Midnight Sun Firmware
Loading...
Searching...
No Matches
adc.h
1#pragma once
2
3/************************************************************************************************
4 * @file adc.h
5 *
6 * @brief ADC Library Header file
7 *
8 * @date 2024-11-02
9 * @author Midnight Sun Team #24 - MSXVI
10 ************************************************************************************************/
11
12/* Standard library Headers */
13#include <stdbool.h>
14#include <stdint.h>
15
16/* Inter-component Headers */
17
18/* Intra-component Headers */
19#include "gpio.h"
20#include "notify.h"
21#include "status.h"
22#include "tasks.h"
23
31#define NUM_ADC_CHANNELS 19U
33#define ADC_TIMEOUT_MS 100U
34
38typedef enum {
42} AdcMode;
43
53
65
74
83StatusCode adc_read_raw(GpioAddress *address, uint16_t *reading);
84
93StatusCode adc_read_converted(GpioAddress *address, uint16_t *reading);
94
98void adc_deinit(void);
99
100#ifdef MS_PLATFORM_X86
101
109StatusCode adc_set_reading(GpioAddress *address, uint16_t reading);
110#endif
111
StatusCode adc_read_raw(GpioAddress *address, uint16_t *reading)
Read the most recent raw value for a Gpio address.
Definition: adc.c:219
StatusCode adc_run(void)
Runs ADC conversions for all added channels.
Definition: adc.c:202
StatusCode adc_init(void)
Initialize the ADC instance.
Definition: adc.c:99
StatusCode adc_add_channel(GpioAddress *address)
Adds an ADC channel for a given Gpio.
Definition: adc.c:177
StatusCode adc_read_converted(GpioAddress *address, uint16_t *reading)
Read the most recent converted value for a Gpio address in mV.
Definition: adc.c:235
AdcMode
Available ADC modes.
Definition: adc.h:38
void adc_deinit(void)
Clears the ADC state.
Definition: adc.c:248
@ ADC_MODE_SINGLE
Definition: adc.h:39
@ ADC_MODE_CONTINUOUS
Definition: adc.h:40
@ NUM_ADC_MODES
Definition: adc.h:41
StatusCode
StatusCodes for various errors.
Definition: status.h:27
Port and pin data.
Definition: gpio.h:112