[feat][examples/adc] update adc case

This commit is contained in:
qqwang 2021-07-06 17:31:23 +08:00
parent 1e4265ffa3
commit 1f492d6a38
6 changed files with 40 additions and 6 deletions

View file

@ -51,7 +51,14 @@ int main(void)
ADC_DEV(adc_test)->differential_mode = ENABLE;
ADC_DEV(adc_test)->continuous_conv_mode = ENABLE;
device_open(adc_test, DEVICE_OFLAG_STREAM_RX);
device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
MSG("adc device find success\r\n");
}
@ -66,5 +73,6 @@ int main(void)
} else {
MSG("PosId = %d NegId = %d V= %d mV \r\n", result_val.posChan, result_val.negChan, (uint32_t)(result_val.volt * 1000));
}
bflb_platform_delay_ms(500);
}
}

View file

@ -48,7 +48,12 @@ int main(void)
if (adc_test) {
ADC_DEV(adc_test)->continuous_conv_mode = ENABLE;
device_open(adc_test, DEVICE_OFLAG_STREAM_RX);
device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
MSG("adc device find success\r\n");
}

View file

@ -181,7 +181,13 @@ int main(void)
if (adc_key) {
ADC_DEV(adc_key)->continuous_conv_mode = ENABLE;
device_open(adc_key, DEVICE_OFLAG_STREAM_RX);
device_control(adc_key, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_key, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
} else {
MSG("device open failed\r\n");

View file

@ -50,7 +50,12 @@ int main(void)
if (adc_test) {
ADC_DEV(adc_test)->differential_mode = ENABLE;
device_open(adc_test, DEVICE_OFLAG_STREAM_RX);
device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
MSG("adc device find success\r\n");
}

View file

@ -49,7 +49,12 @@ int main(void)
if (adc_test) {
device_open(adc_test, DEVICE_OFLAG_STREAM_RX);
device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
MSG("adc device find success\r\n");
}

View file

@ -50,7 +50,12 @@ int main(void)
if (adc_test) {
ADC_DEV(adc_test)->continuous_conv_mode = ENABLE;
device_open(adc_test, DEVICE_OFLAG_STREAM_RX);
device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg);
if (device_control(adc_test, DEVICE_CTRL_ADC_CHANNEL_CONFIG, &adc_channel_cfg) == ERROR) {
MSG("ADC channel config error , Please check the channel corresponding to IO is initial success by board system or Channel is invaild \r\n");
BL_CASE_FAIL;
while (1)
;
}
MSG("adc device find success\r\n");
}