Added `Enable` module.

This commit is contained in:
jakeg00dwin 2024-09-03 16:40:40 -07:00
parent 1396db590f
commit 3cee05065a
3 changed files with 76 additions and 0 deletions

17
src/Enable/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
add_library(Enable STATIC
Enable.c
)
target_include_directories(Enable PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)
if(UNIT_TESTING)
target_link_libraries(Enable
MockRegEdit
)
else()
target_link_libraries(Enable
RegEdit
)
endif()

32
src/Enable/Enable.c Normal file
View File

@ -0,0 +1,32 @@
/*
* Author: username
* Date: 2024
* filename: Enable.c
* description: module_purpose
*/
#ifndef __AVR_ATtiny404__
#define __AVR_ATtiny404__
#endif
#include "Enable.h"
#include "RegEdit.h"
#include "avr/io.h"
void Enable_SetPinsHigh() {
RegEdit_SetBit((void *)&PORTA.DIR, EN1);
RegEdit_SetBit((void *)&PORTB.DIR, EN2);
RegEdit_SetBit((void *)&PORTB.DIR, EN3);
RegEdit_SetBit((void *)&PORTA.OUT, EN1);
RegEdit_SetBit((void *)&PORTB.OUT, EN2);
RegEdit_SetBit((void *)&PORTB.OUT, EN3);
return;
}
void Enable_SetPinsLow() {
RegEdit_ClearBit((void *)&PORTA.OUT, EN1);
RegEdit_ClearBit((void *)&PORTB.OUT, EN2);
RegEdit_ClearBit((void *)&PORTB.OUT, EN3);
return;
}

27
src/Enable/Enable.h Normal file
View File

@ -0,0 +1,27 @@
/**
* @brief PUT_TEXT_HERE
* @details This file is...
* @author username
* @date todays_date
* @copyright None
* @file ENABLE.h
*/
#ifndef ENABLE
#define ENABLE
#define EN1 2
#define EN2 3
#define EN3 2
/**
* Sets all the Enable pins high.
*/
void Enable_SetPinsHigh();
/**
* Sets all the Enable pins low.
*/
void Enable_SetPinsLow();
#endif // ENABLE