58 lines
1.1 KiB
C
58 lines
1.1 KiB
C
/**
|
|
* @brief Interface to the AVR ADC hardware.
|
|
* @details This file is...
|
|
* @author Jake G
|
|
* @date 2024
|
|
* @copyright None
|
|
* @file ADC.h
|
|
*/
|
|
|
|
#ifndef ADC_H
|
|
#define ADC_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
/**
|
|
* @brief Initializes the AVR hardware in order to accept
|
|
* Input for ADC usage.
|
|
* @param pin_num The number of the pin 0-7 you are initializing.
|
|
*
|
|
* This function only makes use of PORTA by default. It sets the direction
|
|
* register to input, disables the pull-up resistor and also diables interrupts
|
|
* alongside the input buffer(digital).
|
|
*
|
|
* This in turn helps reduce noise when using the ADC.
|
|
*
|
|
*/
|
|
void ADC_Init(uint8_t pin_num);
|
|
|
|
|
|
/**
|
|
* @brief Enables the ADC
|
|
* @param pin_num The number of the pin 0-7 you are enabling
|
|
*/
|
|
void ADC_Enable(uint8_t pin_num);
|
|
|
|
|
|
/**
|
|
* @brief Disables the ADC
|
|
*/
|
|
void ADC_Disable();
|
|
|
|
|
|
/**
|
|
* @brief Reads ADC value into variable
|
|
*
|
|
* @param pin_num The bin number of the ADC pin being read.
|
|
*
|
|
* This function depends on the ADC already being initialized and enabled
|
|
* before being called.
|
|
*/
|
|
extern uint16_t (*ADC_ReadValue)(uint8_t pin_num);
|
|
|
|
|
|
#endif //ADC_H
|