I'm working with the SAADC peripheral example and I'm trying to add some code to set the ADC resolution. I've tried doing this several different ways based on what I can find in examples/the API reference, but I keep getting errors. I'm using SDK12.1 and Eclipse Mars.
First method I've tried (I insert this code at the top of my file with the other definitions):
#define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT Gives an error that "SAADC_CONFIG_RESOLUTION" is redefined.
Second method:
void saadc_init(void) { nrf_drv_saadc_config_t saadc_config; saadc_config.resolution = NRF_SAADC_RESOLUTION_10BIT; ...
This second way I tried to define the resolution gives an error that "saadc_config is set, but not used"
I'm new to C/my nordic board so I assume there's something I'm missing about the structure definition, but I can't figure out the error. Any tips would be great. Thanks!