Updated with function signitures

This commit is contained in:
jakeg00dwin 2024-09-01 12:49:24 -07:00
parent 2e7a4ffa38
commit f43a1cb662
2 changed files with 60 additions and 18 deletions

View File

@ -1,16 +1,8 @@
/*
* Author: username
* Date: 2024
* Author: Jake G
* Date: 2024-09-01
* filename: Relays.c
* description: module_purpose
*/
#include "Relays.h"
// dumb test function
int add_two(int a)
{
int b = a;
b += 2;
return b;
}

View File

@ -1,8 +1,8 @@
/**
* @brief PUT_TEXT_HERE
* @details This file is...
* @author username
* @date todays_date
* @brief Relay control module.
* @details This file is for controlling electromechanical relays.
* @author Jake G
* @date 2024-09-01
* @copyright None
* @file RELAYS.h
*/
@ -10,11 +10,61 @@
#ifndef RELAYS
#define RELAYS
#include <stdint.h>
/**
* A function that adds two to a number
* @param a The first argument
* Represents an individual relay.
*/
int add_two(int a);
typedef struct Relay {
uint8_t output_port;
uint8_t output_pin;
uint8_t input_port;
uint8_t input_pin;
uint16_t make_time;
uint16_t break_time;
} Relay;
#endif //RELAYS
/**
* Uses the AVR timer/counter to get the time it takes the relay to fully
* activate. The value is then saved into the passed structure. To get the
* time in ms divide the value by 10.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_MeasureMakeTime(Relay *relay);
/**
* Uses the AVR timer/counter to get the time it takes the relay to
* deactivate. The value is then saved into the passed structure. To get the
* time in ms divide the value by 10.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_MeasureBreakTime(Relay *relay);
/**
* Changes the current state to the opposite one.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_ToggleState(Relay *relay);
/**
* Enables or activates the relay. If the relay has been disabled
* for this power cycle it will do nothing.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_Enable(Relay *relay);
/**
* Disables or activates the relay. If the relay has been disabled
* for this power cycle it will do nothing.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_Disable(Relay *relay);
/**
* Disables the relay, other Relay function calls will not enable the relay
* or change it's state. This takes affect until restart of the system.
* @param relay A pointer to an Relay stucture instance.
*/
void Relay_DisableForPowerCycle(Relay *relay);
#endif // RELAYS