diff options
author | jaseg <git@jaseg.net> | 2018-12-24 19:09:46 +0900 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2018-12-24 19:09:46 +0900 |
commit | f5d7b0428db5257d62c080daa2757199c27ef784 (patch) | |
tree | 0871ee9b9d75b3d3f0c909d2ab64e989b92cc9d7 /fw/adc.h | |
parent | 0029ed768ea0b3626ba8b26c369c409962ff38b6 (diff) | |
download | 8seg-f5d7b0428db5257d62c080daa2757199c27ef784.tar.gz 8seg-f5d7b0428db5257d62c080daa2757199c27ef784.tar.bz2 8seg-f5d7b0428db5257d62c080daa2757199c27ef784.zip |
Add untested ADC mode switching code
Diffstat (limited to 'fw/adc.h')
-rw-r--r-- | fw/adc.h | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -20,8 +20,6 @@ #include "global.h" -#define ADC_OVERSAMPLING 0 - struct adc_measurements { int16_t adc_vcc_mv; int16_t adc_temp_celsius_tenths; @@ -29,8 +27,29 @@ struct adc_measurements { int16_t adc_vmeas_b_mv; }; +enum channel_mask { + MASK_VMEAS_A = ADC_CHSELR_CHSEL0, + MASK_VMEAS_B = ADC_CHSELR_CHSEL1 +}; + +enum adc_mode { + ADC_UNINITIALIZED, + ADC_MONITOR, + ADC_SCOPE +}; + +enum sampling_mode { + SAMPLE_FAST = 0 +}; + + extern volatile struct adc_measurements adc_data; +extern volatile uint16_t adc_buf[ADC_BUFSIZE]; +extern enum adc_mode adc_mode; +extern int adc_oversampling; void adc_init(void); +void adc_configure_scope_mode(uint8_t channel_mask, int sampling_interval_ns); +void adc_configure_monitor_mode(int oversampling); #endif/*__ADC_H__*/ |