updated relays by linking with the timer module.

This commit is contained in:
jakeg00dwin 2024-09-01 16:29:10 -07:00
parent 4118e68268
commit d558b3552c
3 changed files with 19 additions and 12 deletions

View File

@ -5,3 +5,7 @@ add_library(Relays STATIC
target_include_directories(Relays PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)
target_link_libraries(Relays
timer
)

View File

@ -6,24 +6,24 @@
*/
#include "Relays.h"
#include "timer.h"
/*
static void WaitForRelayConnect(void) {
while (!(PORTA.IN & RELAYREADINGPIN)) {
;
void Relay_MeasureMakeTime(Relay *relay) {
Timer_Start();
while (Relay_ReadState(relay)) {
}
Timer_Disable();
relay->make_time = Timer_GetOverflowCount();
}
static void WaitForRelayDisconnect(void) {
while (PORTA.IN & RELAYREADINGPIN) {
;
void Relay_MeasureBreakTime(Relay *relay) {
Timer_Start();
while (Relay_ReadState(relay)) {
}
Timer_Disable();
relay->make_time = Timer_GetOverflowCount();
}
*/
void Relay_MeasureMakeTime(Relay *relay) {}
void Relay_MeasureBreakTime(Relay *relay) {}
void Relay_Enable(Relay *relay) {
if (relay->disabled_fpc) {

View File

@ -26,6 +26,9 @@ typedef struct Relay {
bool disabled_fpc;
} Relay;
// extern void ptr_Timer_Start(void);
// extern void Timer_Disable(void);
/**
* 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