diff --git a/src/Enable/CMakeLists.txt b/src/Enable/CMakeLists.txt new file mode 100644 index 0000000..6da8e33 --- /dev/null +++ b/src/Enable/CMakeLists.txt @@ -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() diff --git a/src/Enable/Enable.c b/src/Enable/Enable.c new file mode 100644 index 0000000..30a90c8 --- /dev/null +++ b/src/Enable/Enable.c @@ -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; +} diff --git a/src/Enable/Enable.h b/src/Enable/Enable.h new file mode 100644 index 0000000..dbb74b6 --- /dev/null +++ b/src/Enable/Enable.h @@ -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