Compare commits

..

No commits in common. "a09d7de1df4657d9db0897859fab863c9712b0b9" and "f551dd582b9cea00f28f69c162274ca6cf1217f3" have entirely different histories.

24 changed files with 15 additions and 311 deletions

1
.gitignore vendored
View file

@ -104,4 +104,3 @@ queuelogs
.generated_files/flags/attiny404
dist/default
dist/attiny404/production
.cache/clangd/index

View file

@ -1,7 +0,0 @@
add_library(module_name STATIC
module_name.c
)
target_include_directories(module_name PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

View file

@ -1,10 +0,0 @@
# TEST_RUNNER
add_library(test_module_name
test_module_name.cpp
)
target_link_libraries(test_module_name
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
module_name
)

View file

@ -1,16 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: module_name.c
* description: module_purpose
*/
#include "module_name.h"
// dumb test function
int add_two(int a)
{
int b = a;
b += 2;
return b;
}

View file

@ -1,14 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: module_name.h
* description: module_purpose
*/
#ifndef module_name
#define module_name
int add_two(int a);
#endif //module_name

View file

@ -1,38 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: test_module_name.c
* description: module_purpose
*/
#include "CppUTest/CommandLineTestRunner.h"
extern "C"
{
#include "module_name.h"
}
TEST_GROUP(FirstTestGroup)
{
void setup()
{
}
void teardown()
{
}
};
TEST(FirstTestGroup, FirstTest)
{
FAIL("Fail me!");
}
TEST(FirstTestGroup, SecondTest)
{
STRCMP_EQUAL("hello", "world");
LONGS_EQUAL(1, 2);
CHECK(false);
}

View file

@ -1,7 +0,0 @@
add_library(module_name STATIC
module_name.c
)
target_include_directories(module_name PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

View file

@ -1,10 +0,0 @@
# TEST_RUNNER
add_library(test_module_name
test_module_name.cpp
)
target_link_libraries(test_module_name
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
module_name
)

View file

@ -1,16 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: module_name.c
* description: module_purpose
*/
#include "module_name.h"
// dumb test function
int add_two(int a)
{
int b = a;
b += 2;
return b;
}

View file

@ -1,20 +0,0 @@
/**
* @brief PUT_TEXT_HERE
* @details This file is...
* @author username
* @date todays_date
* @copyright None
* @file module_name.h
*/
#ifndef module_name
#define module_name
/**
* A function that adds two to a number
* @param a The first argument
*/
int add_two(int a);
#endif //module_name

View file

@ -1,38 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: test_module_name.c
* description: module_purpose
*/
#include "CppUTest/CommandLineTestRunner.h"
extern "C"
{
#include "module_name.h"
}
TEST_GROUP(test_module_name)
{
void setup()
{
}
void teardown()
{
}
};
TEST(test_module_name, FirstTest)
{
FAIL("Fail me!");
}
TEST(test_module_name, SecondTest)
{
STRCMP_EQUAL("hello", "world");
LONGS_EQUAL(1, 2);
CHECK(false);
}

View file

@ -54,4 +54,3 @@ add_subdirectory(RegEdit)
add_subdirectory(usart)
add_subdirectory(TriacOut)
add_subdirectory(load)
add_subdirectory(Enable)

View file

@ -1,17 +0,0 @@
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()

View file

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

View file

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

View file

@ -11,6 +11,12 @@
#define F_CPU 3333333UL
//These defines are mostly useful for when you want you editors LSP server to
//function correctly.
//#ifndef __AVR_ATtiny404__
//#define __AVR_ATtiny404__
//#endif
//This can prevent issues with utils/delay.h library with the gcc toolchain
#define __DELAY_BACKWARD_COMPATIBLE__
@ -29,16 +35,6 @@
//Set the function pointer for the delay func
void (*Delay_MicroSeconds)(double us) = _delay_us;
static void setEnablePinsHigh(void)
{
//Pins 12, 6 and 7 are all set high.
PORTA.DIR |= (1<<2); //PA2= pin 12
PORTB.DIR |= (1<<2)|(1<<3); //PB2 = pin 7, PB3 = pin 6
PORTA.OUT |= (1<<2);
PORTB.OUT |= (1<<2)|(1<<3);
}
int main(int argc, char **argv)
{
while(true){
@ -46,14 +42,20 @@ int main(int argc, char **argv)
ZCD_Poll();
_delay_us(Tau);
TriacOut_SetupPins();
TriacOut_SetAllHigh(); //Only G1 exists in High power mode
TriacOut_SetAllHigh();
TriacOut_PulsePins(GatePulses[i]);
}
//The G1 pin is low at this point.
//The G1-G3 pins are low at this point.
_delay_ms(2500);
ZCD_Poll();
//setEnablePinsHigh();
TriacOut_SetupPins();
TriacOut_SetAllHigh();
Load_HandleLoadPortA(ADC_LOAD1, 1);
Load_HandleLoadPortB(ADC_LOAD2, 3);
Load_HandleLoadPortB(ADC_LOAD3, 2);
while(true){
; //Do nothing until new Power cycle/reset occurs
}

View file

@ -5,7 +5,6 @@
IMPORT_TEST_GROUP(simple_test);
IMPORT_TEST_GROUP(test_ADC);
IMPORT_TEST_GROUP(test_RegEdit);
IMPORT_TEST_GROUP(test_Enable);
//START: main

View file

@ -1,7 +1,6 @@
project(Tests)
# TEST_DIRS
add_subdirectory(Enable)
#add_subdirectory(usart)
add_subdirectory(MockADC)
add_subdirectory(ADC)
@ -21,7 +20,6 @@ target_link_libraries(AllTests
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
# TEST_LINKS
test_Enable
test_ADC
test_RegEdit
simple_test

View file

@ -1,11 +0,0 @@
# TEST_RUNNER
add_library(test_Enable
test_Enable.cpp
)
target_link_libraries(test_Enable
${CPPUTEST_LIBRARIES}/libCppUTest.a
${CPPUTEST_LIBRARIES}/libCppUTestExt.a
MockRegEdit
Enable
)

View file

@ -1,44 +0,0 @@
/*
* Author: username
* Date: todays_date
* filename: test_Enable.c
* description: module_purpose
*/
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTestExt/MockSupport.h"
//This define allows us to dircetly include the device header without error.
#define _AVR_IO_H_
extern "C"
{
#include <iotn404.h>
#include "Enable.h"
#include "MockRegEdit.h"
}
TEST_GROUP(test_Enable)
{
void setup()
{
}
void teardown()
{
mock().checkExpectations();
mock().clear();
}
};
TEST(test_Enable, SetEnablePinsHighCallsCorrectFuncs)
{
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.DIR)
.withUnsignedIntParameter("bit_num", EN1);
Enable_SetPinsHigh();
}