58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
/**
|
|
* @brief Module for handling the ADC input from the load pins.
|
|
* @details This file holds the functions for reading the ADC values.
|
|
* @author Jake G
|
|
* @date 2024
|
|
* @copyright None
|
|
* @file load.h
|
|
*/
|
|
|
|
#ifndef LOAD_H
|
|
#define LOAD_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Low Threshold
|
|
* Anything below or equal to the value will cause the pin to lock into the disabled
|
|
* state.
|
|
*/
|
|
#define LOWTHRESH 0
|
|
|
|
/**
|
|
* @brief High Threshold
|
|
* Anything equal or above the value will cause the pin to lock into the disabled
|
|
* state.
|
|
*/
|
|
#define HIGHTHRESH 1000
|
|
|
|
|
|
#ifndef HYSTERESIS
|
|
#define HYSTERESIS 900
|
|
#endif
|
|
|
|
/**
|
|
* @brief Checks if the adc pin is inbetween LOWTHRESH and HIGHTHRESH and then
|
|
* sets or disables the output pin on PORTA.
|
|
* @param adc_pin the pin number that the load value is read from.
|
|
* @param out_pin The pin that is set high if the adc_pin input is valid.
|
|
*/
|
|
void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin);
|
|
|
|
/**
|
|
* @brief Checks if the adc pin is inbetween LOWTHRESH and HIGHTHRESH and then
|
|
* sets or disables the output pin on PORTB.
|
|
* @param adc_pin the pin number that the load value is read from.
|
|
* @param out_pin The pin that is set high if the adc_pin input is valid.
|
|
*/
|
|
void Load_HandleLoadPortB(uint8_t adc_pin, uint8_t out_pin);
|
|
|
|
|
|
/**
|
|
* @brief Resets the disabled array state.
|
|
*/
|
|
void Load_SoftResetDisabledLoads();
|
|
|
|
#endif /* LOAD_H */
|
|
|