42_Static_assert((
sizeof(
struct ADCRegs)) == (
sizeof(uint32_t) * 20U),
43 "ADC register struct size mismatch. Is it aligned?");
54_Static_assert((
sizeof(
struct ADCCommonRegs)) == (
sizeof(uint32_t) * 3U),
55 "ADC Common register struct size mismatch. Is it aligned?");
58#define ADC_(NUM) (struct ADCRegs *)(ADC1_BASE + (0x100UL * ((uint8_t)NUM)))
59#define ADC_COMMON (struct ADCCommonRegs *)(ADC123_COMMON_BASE)
61extern struct ADCRegs *ADC_(
const uint8_t number);
69 volatile _Bool DMA : 1;
70 volatile _Bool DDS : 1;
71 volatile _Bool CONT : 1;
72 volatile _Bool DISC : 1;
73 volatile _Bool SCAN : 1;
76_Static_assert((
sizeof(
struct ADCModes)) == (
sizeof(uint8_t) * 1U),
77 "ADC Configuration struct size mismatch. Is it aligned?");
110 ADC_TRIGGER_NONE = 0x00,
111 ADC_TRIGGER_RISE = 0x01,
112 ADC_TRIGGER_FALL = 0x02,
113 ADC_TRIGGER_BOTH = 0x03
120 ADC_SAMPLERATE_C003 = 0x00,
121 ADC_SAMPLERATE_C015 = 0x01,
122 ADC_SAMPLERATE_C028 = 0x02,
123 ADC_SAMPLERATE_C056 = 0x03,
124 ADC_SAMPLERATE_C084 = 0x04,
125 ADC_SAMPLERATE_C112 = 0x05,
126 ADC_SAMPLERATE_C144 = 0x06,
127 ADC_SAMPLERATE_C480 = 0x07
134 ADC_PRESCALER_DIV2 = 0x00,
135 ADC_PRESCALER_DIV4 = 0x01,
136 ADC_PRESCALER_DIV6 = 0x02,
137 ADC_PRESCALER_DIV8 = 0x03,
203 const uint8_t count);
adc_prescaler
Available ADC prescaler dividers.
Definition adc.h:133
enum adc_samplerate adc_samplerate_t
Available ADC samplerates (in cycles)
adc_res
Available ADC resolutions.
Definition adc.h:99
void adc_set_resolution(const adc_peripheral_t adc, const adc_res_t value)
Sets the ADC resolution to the specified value.
Definition adc.c:44
adc_peripheral
Available ADC peripherals.
Definition adc.h:83
enum adc_prescaler adc_prescaler_t
Available ADC prescaler dividers.
enum adc_trigger adc_trigger_t
Available ADC trigger modes.
uint16_t adc_read(const adc_peripheral_t adc)
Reads the last ADC conversion result.
Definition adc.c:183
enum adc_res adc_res_t
Available ADC resolutions.
void adc_set_prescaler(const adc_prescaler_t value)
Sets the ADC Prescaler divider to the specified value.
Definition adc.c:23
void adc_set_seq(const adc_peripheral_t adc, const uint8_t *seq, const uint8_t count)
Sets the ADC conversion sequence to the specified order.
Definition adc.c:126
enum adc_peripheral adc_peripheral_t
Available ADC peripherals.
void adc_off(const adc_peripheral_t adc)
Stops the ADC conversion.
Definition adc.c:172
adc_trigger
Available ADC trigger modes.
Definition adc.h:109
void adc_set_samplerate(const adc_peripheral_t adc, const uint8_t channel, const adc_samplerate_t value)
Sets the ADC sampling rate to the specified value.
Definition adc.c:69
void adc_set_modes(const adc_peripheral_t adc, const struct ADCModes config)
Sets the ADC modes according to the configuration.
Definition adc.c:102
void adc_on(const adc_peripheral_t adc)
Starts the ADC conversion.
Definition adc.c:153
adc_samplerate
Available ADC samplerates (in cycles)
Definition adc.h:119
Defines used commonly in most files.
CMSIS device header stubs.
Contains ADC common registers.
Definition adc.h:48
Contains ADC conversion modes.
Definition adc.h:68
Contains ADC registers.
Definition adc.h:28