This example demonstrates the usage of the nPZero driver to setup the ADC and there threshould's. Booth ADC's (Internal and External) are set in the example code, the ADC_IN pin for this example is connected to VDD.
Code snippet ...
{
}
{
{
printf("Failed to write SYSCFG1 register\r\n");
}
}
static void set_system_config2(
np0_device_s *device, uint8_t adc_ext_on, uint8_t adc_div_en,
{
{
printf("Failed to write SYSCFG2 register\n\r\n");
}
}
{
printf("Executing external ADC example\r\n");
set_global_timeout(device);
set_system_config1(device);
{
printf("Failed to write THROVA01 register\r\n");
return;
}
{
printf("Failed to write THRUNA2 register\r\n");
return;
}
}
{
printf("Executing internal ADC example\r\n");
set_global_timeout(device);
set_system_config1(device);
{
printf("Failed to write THROVA01 register\r\n");
return;
}
{
printf("Failed to write THRUNA1 register\r\n");
return;
}
}
*
np0_status_e np0_write_SYSCFG1(const np0_register_syscfg1_s syscfg1)
Writes the syscfg1 struct to the syscfg1 register.
Definition: np0.c:84
np0_status_e np0_write_THRUNA1(const np0_register_thruna1_s thruna1)
Writes the thruna1 struct to the TRHUNA1 register.
Definition: np0.c:201
np0_status_e np0_write_SYSCFG2(const np0_register_syscfg2_s syscfg2)
Writes the syscfg2 struct to the syscfg2 register.
Definition: np0.c:104
np0_status_e np0_write_THROVA1(const np0_register_throva1_s throva1)
Writes the throva1 struct to the throva1 register.
Definition: np0.c:173
np0_status_e np0_write_THRUNA2(const np0_register_thruna2_s thruna2)
Writes the thruna2 struct to the TRHUNA2 register.
Definition: np0.c:215
np0_status_e np0_write_THROVA2(const np0_register_throva2_s throva2)
Writes the throva2 struct to the throva2 register.
Definition: np0.c:187
@ SCLK_DIV_SEL_2
Definition: np0.h:135
np0_adc_div_sel_e
Definition: np0.h:143
@ ADC_DIV_SEL_2
Definition: np0.h:144
void np0_device_go_sleep(np0_device_s *device)
Put the device into sleep mode.
Definition: np0_device_control.c:298
void np0_device_set_wakeup_timeout(np0_device_s *device, uint8_t tout_l, uint8_t tout_h)
Sets time out until host wakes up.
Definition: np0_device_control.c:325
np0_register_throva1_s throva1
Definition: np0.h:477
np0_register_syscfg2_s syscfg2
Definition: np0.h:474
np0_register_syscfg1_s syscfg1
Definition: np0.h:473
np0_register_throva2_s throva2
Definition: np0.h:478
np0_register_thruna2_s thruna2
Definition: np0.h:480
np0_register_thruna1_s thruna1
Definition: np0.h:479
uint8_t sclk_sel
Definition: np0.h:242
uint8_t wup4
Definition: np0.h:250
uint8_t wup3
Definition: np0.h:248
uint8_t wup2
Definition: np0.h:246
uint8_t wup1
Definition: np0.h:244
uint8_t sclk_div_en
Definition: np0.h:239
np0_sclk_div_sel_e sclk_div_sel
Definition: np0.h:241
np0_adc_div_sel_e adc_div_sel
Definition: np0.h:261
uint8_t adc_ext_on
Definition: np0.h:257
uint8_t ta2_en
Definition: np0.h:264
uint8_t wupmod
Definition: np0.h:266
uint8_t adc_div_en
Definition: np0.h:259
uint8_t ta1_en
Definition: np0.h:262
uint8_t throva
Definition: np0.h:413
uint8_t throva
Definition: np0.h:420
uint8_t thruna
Definition: np0.h:427
uint8_t thruna
Definition: np0.h:434