set register, aoid magic number

Hi.

I playing with the ADC PDC of the DUE.

I made the code work, but now I want to remove .

The worst place is into ADC_mr register. It is split in field, some of them already defined. but by printing it, those field return the alu of the first bit. example: LOWRES start at bit 4 ( 0b10000 ), it return 16.

how can i use those value to set and reset field?

Thanks.

Nitrof

I think I got the answer...

for that register, value that are define use only one bit, so It is easy to use ^=field to reset |= to set...

Those field that are not set are more than one bit, so they need bit shift to enter the right value...

Unless someone have a etter mothode ??