| | |
| | | /* If the external reference voltage driving capability is insufficient */ |
| | | /* It is recommended to enable this configuration */ |
| | | // val |= (9 << 1) | (1 << 4); |
| | | val |= (1 << 9) | (7 << 5) | (1 << 4); |
| | | } |
| | | REG_WRITE(0x4000062C, val); |
| | | |
| | |
| | | adc_close(); |
| | | } |
| | | |
| | | static void adc_continue_callback(void *data, uint32_t number) |
| | | { |
| | | |
| | | LOG_INFO(TRACE_MODULE_APP, "Chip adc callback %d degree\r\n", data); |
| | | } |
| | | int16_t battery_monitor_get(void) |
| | | { |
| | | #define NUM_SAMPLES (3) |
| | | |
| | | uint32_t sample[NUM_SAMPLES]; |
| | | adc_get(&sample[0], NUM_SAMPLES, adc_continue_callback); |
| | | adc_get(&sample[0], NUM_SAMPLES, NULL); |
| | | |
| | | int32_t sum = 0; |
| | | for (int i = 0; i < NUM_SAMPLES; i++) |