Hello,
I'm using S7G2-SK and tried ADC example and its working fine, the problem is while trying to read adc values with basic r_adc driver.
I took a blinky project > added new thread > from new stack driver added r_adc driver > configured channel 0 and 1
I'm trying to read ADC channel 0 and 1 values but i'm unable to read, please help me if i'm missing something.
Please post me if there are any examples where i can read adc values using r_adc driver instead framework.
////////////// my code /////////////////////
err = g_adc0.p_api->open (g_adc0.p_ctrl, g_adc0.p_cfg);
err = g_adc0.p_api->scanCfg (g_adc0.p_ctrl, g_adc0.p_channel_cfg);
err = g_adc0.p_api->scanStart (g_adc0.p_ctrl);
while (1)
{
err = g_adc0.p_api->read (g_adc0.p_ctrl, ADC_REG_CHANNEL_0, &adc_val0);
err = g_adc0.p_api->read (g_adc0.p_ctrl, ADC_REG_CHANNEL_1, &adc_val1);
#ifdef SEMI_HOSTING
if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
{
printf ("ADC0: %d, ADC1: %d\n\n", adc_val0, adc_val1);
}
#endif
tx_thread_sleep (100);
}
/////////////////////////////////
(Please visit the site to view this file)
Thanks in advance,
Sreeman.