Compare commits
5 commits
597441b978
...
c04b35168a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c04b35168a | ||
|
|
fb49abc27b | ||
|
|
c73ce58b0f | ||
|
|
4d077a2ef6 | ||
|
|
e886fbb0c1 |
12 changed files with 57 additions and 58 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Description
|
||||
|
||||
This embedded firmware is the High Power mode for the triac software.
|
||||
This embedded firmware is the High Power mode for the software.
|
||||
|
||||
### Micro Controller Pins
|
||||
|
||||
|
|
@ -111,6 +111,4 @@ Some stuff that still needs done.
|
|||
- [X] Write tests for ADC Mock
|
||||
- [X] Write ZCD using ADC Mock.
|
||||
- [X] Write ADC version for ATtiny404
|
||||
- [X] Add Triac module.
|
||||
- [X] Add Triac tests.
|
||||
|
||||
|
|
|
|||
4
otto.sh
4
otto.sh
|
|
@ -257,10 +257,10 @@ run_c_tests () {
|
|||
cmake -DUNIT_TESTING=ON -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE} ../
|
||||
make AllTests
|
||||
make Mock_Tests
|
||||
make TriacTests
|
||||
make EnTests
|
||||
./tests/AllTests -v -c
|
||||
./tests/Mock_Tests -v -c
|
||||
./tests/TriacTests -v -c
|
||||
./tests/EnTests -v -c
|
||||
}
|
||||
|
||||
print_menu () {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ add_executable(${PROJECT_NAME}
|
|||
target_link_libraries(${PROJECT_NAME}
|
||||
RegEdit
|
||||
ADC
|
||||
TriacOut
|
||||
EnOut
|
||||
zero_cross_detection
|
||||
load
|
||||
Enable
|
||||
|
|
@ -54,5 +54,5 @@ add_subdirectory(zero_cross_detection)
|
|||
add_subdirectory(ADC)
|
||||
add_subdirectory(RegEdit)
|
||||
add_subdirectory(usart)
|
||||
add_subdirectory(TriacOut)
|
||||
add_subdirectory(EnOut)
|
||||
add_subdirectory(Enable)
|
||||
|
|
|
|||
17
src/EnOut/CMakeLists.txt
Normal file
17
src/EnOut/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
add_library(EnOut STATIC
|
||||
EnOut.c
|
||||
)
|
||||
|
||||
target_include_directories(EnOut PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
if(UNIT_TESTING)
|
||||
target_link_libraries(EnOut
|
||||
MockRegEdit
|
||||
)
|
||||
else()
|
||||
target_link_libraries(EnOut
|
||||
RegEdit
|
||||
)
|
||||
endif()
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Author: username
|
||||
* Date: todays_date
|
||||
* filename: TriacOut.c
|
||||
* filename: EnOut.c
|
||||
* description: module_purpose
|
||||
*/
|
||||
#ifndef __AVR_ATtiny404__
|
||||
|
|
@ -10,29 +10,29 @@
|
|||
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "TriacOut.h"
|
||||
#include "EnOut.h"
|
||||
#include "RegEdit.h"
|
||||
|
||||
|
||||
void TriacOut_InitTimerA(void)
|
||||
void EnOut_InitTimerA(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TriacOut_SetupPins(void)
|
||||
void EnOut_SetupPins(void)
|
||||
{
|
||||
RegEdit_SetBit((void *) &PORTA.DIR, G1);
|
||||
}
|
||||
|
||||
|
||||
void TriacOut_SetAllHigh(void)
|
||||
void EnOut_SetAllHigh(void)
|
||||
{
|
||||
RegEdit_SetBit((void *) &PORTA.OUT, G1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TriacOut_PulsePins(uint16_t pulse_time)
|
||||
void EnOut_PulsePins(uint16_t pulse_time)
|
||||
{
|
||||
Delay_MicroSeconds(pulse_time);
|
||||
|
||||
|
|
@ -4,11 +4,11 @@
|
|||
* @author username
|
||||
* @date todays_date
|
||||
* @copyright None
|
||||
* @file TriacOut.h
|
||||
* @file EnOut.h
|
||||
*/
|
||||
|
||||
#ifndef TRIACOUT_H
|
||||
#define TRIACOUT_H
|
||||
#ifndef ENOUT_H
|
||||
#define ENOUT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
@ -31,18 +31,18 @@ extern void (*Delay_MicroSeconds)(double us);
|
|||
* This function turns off G1, G2 and G3, once the passed time in micro seconds
|
||||
* has elapsed the pins are all set to low.
|
||||
*/
|
||||
void TriacOut_PulsePins(uint16_t pulse_time);
|
||||
void EnOut_PulsePins(uint16_t pulse_time);
|
||||
|
||||
/**
|
||||
* This sets up the G1, G2 and the G3 pins for output.
|
||||
*/
|
||||
void TriacOut_SetupPins(void);
|
||||
void EnOut_SetupPins(void);
|
||||
|
||||
/**
|
||||
* This sets G1, G2 and G3 to high on the output.
|
||||
*/
|
||||
void TriacOut_SetAllHigh(void);
|
||||
void EnOut_SetAllHigh(void);
|
||||
|
||||
|
||||
|
||||
#endif //TRIACOUT_H
|
||||
#endif //ENOUT_H
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
add_library(TriacOut STATIC
|
||||
TriacOut.c
|
||||
)
|
||||
|
||||
target_include_directories(TriacOut PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
)
|
||||
|
||||
if(UNIT_TESTING)
|
||||
target_link_libraries(TriacOut
|
||||
MockRegEdit
|
||||
)
|
||||
else()
|
||||
target_link_libraries(TriacOut
|
||||
RegEdit
|
||||
)
|
||||
endif()
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#include "RegEdit.h"
|
||||
#include "zero_cross_detection.h"
|
||||
#include "ADC.h"
|
||||
#include "TriacOut.h"
|
||||
#include "EnOut.h"
|
||||
#include "load.h"
|
||||
#include "Enable.h"
|
||||
#include <avr/cpufunc.h> /* Required header file */
|
||||
|
|
@ -52,6 +52,7 @@ int main(int argc, char **argv)
|
|||
|
||||
while(true){
|
||||
//Enable pins are enabled(set high) if the ADCLOAD value is valid.
|
||||
_delay_us(Tau);
|
||||
Load_HandleLoadPortA(ADC_LOAD1, EN1);
|
||||
Load_HandleLoadPortB(ADC_LOAD2, EN2);
|
||||
Load_HandleLoadPortB(ADC_LOAD3, EN3);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ add_subdirectory(MockRegEdit)
|
|||
add_subdirectory(RegEdit)
|
||||
add_subdirectory(simple_test)
|
||||
add_subdirectory(zero_cross_detection)
|
||||
add_subdirectory(TriacOut)
|
||||
add_subdirectory(EnOut)
|
||||
add_subdirectory(load)
|
||||
|
||||
|
||||
|
|
@ -43,12 +43,12 @@ target_link_libraries(Mock_Tests
|
|||
)
|
||||
|
||||
|
||||
add_executable(TriacTests
|
||||
TriacTests.cpp
|
||||
add_executable(EnTests
|
||||
EnTests.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(TriacTests
|
||||
target_link_libraries(EnTests
|
||||
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||
test_TriacOut
|
||||
test_EnOut
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# TEST_RUNNER
|
||||
add_library(test_TriacOut
|
||||
test_TriacOut.cpp
|
||||
add_library(test_EnOut
|
||||
test_EnOut.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(test_TriacOut
|
||||
target_link_libraries(test_EnOut
|
||||
${CPPUTEST_LIBRARIES}/libCppUTest.a
|
||||
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
|
||||
MockRegEdit
|
||||
TriacOut
|
||||
EnOut
|
||||
)
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Author: username
|
||||
* Date: todays_date
|
||||
* filename: test_TriacOut.c
|
||||
* filename: test_EnOut.c
|
||||
* description: module_purpose
|
||||
*/
|
||||
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
extern "C"
|
||||
{
|
||||
#include <iotn404.h>
|
||||
#include "TriacOut.h"
|
||||
#include "EnOut.h"
|
||||
#include "MockRegEdit.h"
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ void FakeDelay(double us)
|
|||
void (*Delay_MicroSeconds)(double us) = FakeDelay;
|
||||
|
||||
|
||||
TEST_GROUP(test_TriacOut)
|
||||
TEST_GROUP(test_EnOut)
|
||||
{
|
||||
void setup()
|
||||
{
|
||||
|
|
@ -40,13 +40,13 @@ TEST_GROUP(test_TriacOut)
|
|||
}
|
||||
};
|
||||
|
||||
TEST(test_TriacOut, FirstTest)
|
||||
TEST(test_EnOut, FirstTest)
|
||||
{
|
||||
//FAIL("Fail me!");
|
||||
CHECK(true);
|
||||
}
|
||||
|
||||
TEST(test_TriacOut, TriacOut_SetupPins)
|
||||
TEST(test_EnOut, EnOut_SetupPins)
|
||||
{
|
||||
//Expect that pin PA1 is set to output
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
|
|
@ -54,21 +54,21 @@ TEST(test_TriacOut, TriacOut_SetupPins)
|
|||
.withUnsignedIntParameter("bit_num", G1);
|
||||
|
||||
|
||||
TriacOut_SetupPins();
|
||||
EnOut_SetupPins();
|
||||
}
|
||||
|
||||
|
||||
TEST(test_TriacOut, TriacOut_SetAllHigh)
|
||||
TEST(test_EnOut, EnOut_SetAllHigh)
|
||||
{
|
||||
//Expect that pin PA1 is set to output
|
||||
mock().expectOneCall("RegEdit_SetBit")
|
||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", G1);
|
||||
|
||||
TriacOut_SetAllHigh();
|
||||
EnOut_SetAllHigh();
|
||||
}
|
||||
|
||||
TEST(test_TriacOut, TriacOut_PulsePins)
|
||||
TEST(test_EnOut, EnOut_PulsePins)
|
||||
{
|
||||
|
||||
//Expect that pin PA1 is set to output
|
||||
|
|
@ -76,5 +76,5 @@ TEST(test_TriacOut, TriacOut_PulsePins)
|
|||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||
.withUnsignedIntParameter("bit_num", G1);
|
||||
|
||||
TriacOut_PulsePins(1000);
|
||||
EnOut_PulsePins(1000);
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "CppUTest/CommandLineTestRunner.h"
|
||||
|
||||
IMPORT_TEST_GROUP(test_TriacOut);
|
||||
IMPORT_TEST_GROUP(test_EnOut);
|
||||
|
||||
|
||||
//START: main
|
||||
Loading…
Add table
Reference in a new issue