uint16_t i = 0;
while (1) {
(1) {
dac_chan_write(&dac_instance, DAC_CHANNEL_0, i);
if (++i == 0x3FF) { i = 0; }
(++i == 0x3FF) {
i = 0;
}