Trident IoT SDK
Loading...
Searching...
No Matches
tr_hal_adc.h
Go to the documentation of this file.
1
10
11#ifndef TR_HAL_ADC_H_
12#define TR_HAL_ADC_H_
13
14#include "tr_hal_platform.h"
15
19
20// note: when using more than one ADC channel, it is required to use interrupts
21// in order to get readings from all initialized ADC channels. This is because
22// a START command starts ALL the ADCs and an interrupt fires for each one as
23// they are ready and there is only one RESULT register so it needs to be read
24// when the interrupt fires. The READ APIs below return the LAST value read
25// at the last START command. When using a single ADC channel interrupts are
26// not required because the RESULT register only has results for the one
27// channel
28
29
30// ADC register values are cleared with a power cycle but not on a software reset
31// this clears the ADC registers. Safe to call this when the HAL comes up before
32// any other peripherals are configured
34
35// error check and then load the settings into the registers
37 tr_hal_adc_settings_t* adc_settings);
38
39// sets GPIO back to general GPIO and turns off interrupts, etc
41
42// starts the ADC reading. This starts ALL ADCs that are initialized to take
43// a measurement. The value read can be received either in the interrupt
44// handler or by calling the adc_read API
46
47// returns the value last read by the ADC for the channel selected
49 uint32_t* result);
50
51// returns the value last read by the ADC for the channel selected in
52// microvolts if this channel is setup to convert
54 uint32_t* microVolts);
55
56
57#endif //TR_HAL_ADC_H_
tr_hal_adc_channel_id_t
Definition T32CM11_adc.h:33
tr_hal_status_t
Definition tr_hal_common.h:25
Definition T32CM11_adc.h:538
tr_hal_status_t tr_hal_adc_uninit(tr_hal_adc_channel_id_t adc_channel_id)
tr_hal_status_t tr_hal_adc_read_voltage(tr_hal_adc_channel_id_t adc_channel_id, uint32_t *microVolts)
tr_hal_status_t tr_hal_adc_read(tr_hal_adc_channel_id_t adc_channel_id, uint32_t *result)
tr_hal_status_t tr_hal_adc_set_for_initial_state_all_disabled(void)
tr_hal_status_t tr_hal_adc_start(void)
tr_hal_status_t tr_hal_adc_init(tr_hal_adc_channel_id_t adc_channel_id, tr_hal_adc_settings_t *adc_settings)