mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-09 14:28:37 +00:00
[feat][examples/adc] update adc case
This commit is contained in:
parent
1e4265ffa3
commit
1f492d6a38
6 changed files with 40 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue