Initial Commit of Existing code
This commit is contained in:
		
							parent
							
								
									0e16acc125
								
							
						
					
					
						commit
						d22813ad3e
					
				
					 85 changed files with 12908 additions and 2 deletions
				
			
		
							
								
								
									
										76
									
								
								CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
cmake_minimum_required(VERSION 3.20)
 | 
			
		||||
 | 
			
		||||
# Use the fancy version substitution
 | 
			
		||||
project(main
 | 
			
		||||
    VERSION 1.0
 | 
			
		||||
    DESCRIPTION "template for cmake + cpputest"
 | 
			
		||||
    LANGUAGES   C CXX
 | 
			
		||||
)
 | 
			
		||||
enable_testing()
 | 
			
		||||
 | 
			
		||||
set(TARGET_GROUP production CACHE STRING "Group to build")
 | 
			
		||||
 | 
			
		||||
if(MSVC OR MSYS OR MINGW)
 | 
			
		||||
    message("### SETUP FOR WINDOWS ###")
 | 
			
		||||
    add_definitions(-DWINDOWS)
 | 
			
		||||
else()
 | 
			
		||||
    message("### SETUP FOR UNIX ###")
 | 
			
		||||
    add_definitions(-DUNIX)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# For being able to used LSP
 | 
			
		||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
 | 
			
		||||
 | 
			
		||||
# Request C 17 standard features
 | 
			
		||||
set(CMAKE_C_STANDARD 11)
 | 
			
		||||
set(CMAKE_C_STANDARD_REQUIRED True)
 | 
			
		||||
# set(CMAKE_C_FLAGS "-Wall -Werror -Wpedantic")
 | 
			
		||||
 | 
			
		||||
# SETUP THE CXX flags for .cpp
 | 
			
		||||
set(CMAKE_CXX_STANDARD 11)
 | 
			
		||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
 | 
			
		||||
set(CMAKE_CXX_FLAGS "-Wall -Werror -Wpedantic")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# #######################################
 | 
			
		||||
# TESTING STUFF 
 | 
			
		||||
# #######################################
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if (UNIT_TESTING)
 | 
			
		||||
    add_definitions(-DUNIT_TESTING)
 | 
			
		||||
    if(DEFINED ENV{CPPUTEST_HOME})
 | 
			
		||||
        message(STATUS "Using CppUTest home: $ENV{CPPUTEST_HOME}")
 | 
			
		||||
        set(CPPUTEST_INCLUDE_DIRS $ENV{CPPUTEST_HOME}/include)
 | 
			
		||||
        set(CPPUTEST_LIBRARIES $ENV{CPPUTEST_HOME}/lib)
 | 
			
		||||
        set(CPPUTEST_LDFLAGS CppUTest CppUTestExt)
 | 
			
		||||
    else()
 | 
			
		||||
        find_package(PkgConfig REQUIRED)
 | 
			
		||||
        pkg_search_module(CPPUTEST REQUIRED cpputest>=3.8)
 | 
			
		||||
        message(STATUS "Found CppUTest version ${CPPUTEST_VERSION}")
 | 
			
		||||
    endif()
 | 
			
		||||
    
 | 
			
		||||
    include_directories(
 | 
			
		||||
        ${CPPUTEST_INCLUDE_DIRS}
 | 
			
		||||
        /usr/include/c++/11/
 | 
			
		||||
        ./inc
 | 
			
		||||
        ./mocks
 | 
			
		||||
        )
 | 
			
		||||
    link_directories(${CPPUTEST_LIBRARIES})
 | 
			
		||||
    
 | 
			
		||||
    add_subdirectory(mocks)
 | 
			
		||||
    add_subdirectory(tests)
 | 
			
		||||
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
# #######################################
 | 
			
		||||
# PROJECT SPECIFIC 
 | 
			
		||||
# #######################################
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include_directories(
 | 
			
		||||
    /usr/local/avr/avr/include
 | 
			
		||||
    ./inc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
add_subdirectory(src)
 | 
			
		||||
							
								
								
									
										115
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										115
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,114 @@
 | 
			
		|||
# thermostat
 | 
			
		||||
# Themostat Firmware 
 | 
			
		||||
 | 
			
		||||
## Description
 | 
			
		||||
 | 
			
		||||
This embedded firmware is the thermostat mode.
 | 
			
		||||
 | 
			
		||||
### Micro Controller Pins
 | 
			
		||||
 | 
			
		||||
**ATtiny404**
 | 
			
		||||
 | 
			
		||||
1. VDD(+5v)
 | 
			
		||||
2. PA4(ADC_LOAD1)
 | 
			
		||||
3. PA5(ADC_LOAD2)
 | 
			
		||||
4. PA6(ADC_LOAD3)
 | 
			
		||||
5. PA7(zerocrossing)
 | 
			
		||||
6. PB3(EN2)
 | 
			
		||||
7. PB2(EN3)
 | 
			
		||||
8. PB1(SDA)
 | 
			
		||||
9. PB0(SCL)
 | 
			
		||||
10. RST(NC)
 | 
			
		||||
11. PA1(G1)
 | 
			
		||||
12. PA2(EN1)
 | 
			
		||||
13. PA3(NC)
 | 
			
		||||
14. VSS(GND)
 | 
			
		||||
 | 
			
		||||
*key*
 | 
			
		||||
NC:: Not Connected
 | 
			
		||||
PBX:: Port B pin X
 | 
			
		||||
PAX:: Port A pin X
 | 
			
		||||
RST:: Reset pin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Project Layout
 | 
			
		||||
 | 
			
		||||
**Tree -L 1, output**
 | 
			
		||||
```
 | 
			
		||||
.
 | 
			
		||||
├── avr-gcc-toolchain.cmake
 | 
			
		||||
├── build
 | 
			
		||||
├── CMakeLists.txt
 | 
			
		||||
├── compile_commands.json -> ./build/compile_commands.json
 | 
			
		||||
├── docs
 | 
			
		||||
├── Doxyfile
 | 
			
		||||
├── inc
 | 
			
		||||
├── mocks
 | 
			
		||||
├── otto.sh
 | 
			
		||||
├── README.md
 | 
			
		||||
├── setup.sh
 | 
			
		||||
├── src
 | 
			
		||||
└── tests
 | 
			
		||||
 | 
			
		||||
6 directories, 7 files
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The source code required to run/build the project is in the `/src` directory, 
 | 
			
		||||
with the headers residing inside the `/inc` directory for most public modules.
 | 
			
		||||
 | 
			
		||||
All other directories are for supporting the development cycle and are used for
 | 
			
		||||
testitng the code base to ensure accuracy and quality. These are contained in
 | 
			
		||||
the `tests` and `mocks` directories.
 | 
			
		||||
 | 
			
		||||
Documentation that has been generated is inside the docs folder which contains
 | 
			
		||||
the html output that can be browswed via your regular web browser.
 | 
			
		||||
 | 
			
		||||
PDF genreation from the doumentaiton is also possible if enabled through the
 | 
			
		||||
`Doxyfile` inside the projects root directory.
 | 
			
		||||
 | 
			
		||||
The build directory contains the output and makefiles genrerated automatically
 | 
			
		||||
when using CMake.
 | 
			
		||||
 | 
			
		||||
This build directory also holds the bin files genreated along with the hex and
 | 
			
		||||
elf files.
 | 
			
		||||
 | 
			
		||||
## Build Requirements
 | 
			
		||||
 | 
			
		||||
- AVR-GCC toolchain OR XC8 from microchip.
 | 
			
		||||
- Make OR CMAKE
 | 
			
		||||
- avrdude
 | 
			
		||||
- A AVR programmer, usbasp for older chips and UPDI for newer ones.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Dev Requirements
 | 
			
		||||
 | 
			
		||||
- ATtiny404 series micro-controller
 | 
			
		||||
- AVR-GCC toolchain.
 | 
			
		||||
- Cmake
 | 
			
		||||
- cpputest(Unit testing harness.)
 | 
			
		||||
- Doxygen(For documentation) 
 | 
			
		||||
- Git(For version control)
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
## Running Unit Tests
 | 
			
		||||
 | 
			
		||||
To run the cppunit tests you can use the included shell script inside a bash
 | 
			
		||||
shell.
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
echo "1" | ./otto.sh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The command runs the otto script which automates parts of the development cycle
 | 
			
		||||
such as running and building tests, compiling hex files and flashing the code
 | 
			
		||||
to a micro-controller using arvdude.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Roadmap
 | 
			
		||||
 | 
			
		||||
Some stuff that still needs done.
 | 
			
		||||
 | 
			
		||||
- [X] Add ADC Mocked interface.
 | 
			
		||||
- [X] Write tests for ADC Mock
 | 
			
		||||
- [X] Write ZCD using ADC Mock.
 | 
			
		||||
- [X] Write ADC version for ATtiny404
 | 
			
		||||
 | 
			
		||||
Attiny404 firmware for thermostat usage
 | 
			
		||||
							
								
								
									
										57
									
								
								avr-gcc-toolchain.cmake
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								avr-gcc-toolchain.cmake
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
# ###############################
 | 
			
		||||
# AVR-GCC toolchain file 
 | 
			
		||||
# ###############################
 | 
			
		||||
 | 
			
		||||
# Specify the cross-compiler
 | 
			
		||||
set(CMAKE_SYSTEM_NAME Generic)
 | 
			
		||||
set(CMAKE_SYSTEM_VERSION 1)
 | 
			
		||||
set(CMAKE_SYSTEM_PROCESSOR avr)
 | 
			
		||||
 | 
			
		||||
# Without this flag, CMake is unable to pass the test compilation check
 | 
			
		||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
 | 
			
		||||
 | 
			
		||||
# Specify the compiler and linker
 | 
			
		||||
#set(AVR_MCU atmega328p) # The old Classic
 | 
			
		||||
#set(AVR_MCU attiny85) # The older ATtiny series, avr25
 | 
			
		||||
set(AVR_MCU attiny404) # this is the avrxmega3 series
 | 
			
		||||
#set(AVR_MCU avr64dd28) # Newer DX series, avrxmega2
 | 
			
		||||
 | 
			
		||||
# The default frequency of an 328p devboard using the external crystal.
 | 
			
		||||
#set(F_CPU 16000000UL)
 | 
			
		||||
set(F_CPU 20000000UL)
 | 
			
		||||
#set(F_CPU 8000000)
 | 
			
		||||
#set(F_PER 3333333)
 | 
			
		||||
add_compile_definitions(F_CPU=${F_CPU})
 | 
			
		||||
# add_compile_definitions(MCU=atmega328p)
 | 
			
		||||
#add_compile_definitions(__AVR_ATmega328P__)
 | 
			
		||||
add_compile_definitions(__AVR_ATtiny404__)
 | 
			
		||||
 | 
			
		||||
# Set up the programmer for it
 | 
			
		||||
#set(PROGRAMMER usbasp-clone)
 | 
			
		||||
#set(PROGRAMMER arduino)
 | 
			
		||||
set(PROGRAMMER serialupdi)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Set the Port for the programmer
 | 
			
		||||
set(PORT /dev/ttyUSB0)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define the toolchain executables
 | 
			
		||||
set(CMAKE_C_COMPILER avr-gcc)
 | 
			
		||||
set(CMAKE_CXX_COMPILER avr-g++)
 | 
			
		||||
set(CMAKE_ASM_COMPILER avr-gcc)
 | 
			
		||||
set(CMAKE_LINKER avr-ld)
 | 
			
		||||
set(CMAKE_OBJCOPY avr-objcopy)
 | 
			
		||||
set(CMAKE_SIZE avr-size)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define compile options
 | 
			
		||||
set(CMAKE_C_FLAGS " -Os -mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
 | 
			
		||||
set(CMAKE_CXX_FLAGS "-mmcu=${AVR_MCU} -DF_CPU=${F_CPU}")
 | 
			
		||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mmcu=${AVR_MCU}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Define the archiver and other tools
 | 
			
		||||
set(CMAKE_AR avr-ar)
 | 
			
		||||
set(CMAKE_RANLIB avr-ranlib)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								debug/attiny404/queuelogs/debugtool.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								debug/attiny404/queuelogs/debugtool.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
466 1722140650289 GEN4_CONNECT_DIAGNOSTICS:MPLABCommTool is null
 | 
			
		||||
 | 
			
		||||
466 1722140650289 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Pre:GetFirmwareInfo
 | 
			
		||||
466 1722140650289 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Payload
 | 
			
		||||
466 1722140650289 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 null
 | 
			
		||||
466 1722140650289 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Payload End
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Post:GetFirmwareInfo
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Return Value
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 FirmwareInfo: Values:
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 FirmwareInfo: boot = false, bootVer = 00.00.10, apVer = 02.01.83, fpgaVer = ff.ff.ff, scriptVer = 00.07.47, macAddress = 0504983776751805049485148484956, devID = a1020e01, devID1 = 2, devSN0 = ffffffff, devSN1 = ffffffff, serialNumber = 020026702RYN031742, appCommitID = null, scriptCommitID = 974b928e70, PCB_ID = 2
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Return End
 | 
			
		||||
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Pre:SetPowerInfo
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Payload
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 PowerInfo: Values:
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 PowerInfo: shotDownSystem = true, isToolPower = false, voltage = 0.000000, useVppFirst = false, useLowVoltageProgramming = true, useMaintainActivePower = false
 | 
			
		||||
466 1722140650295 GEN4_TO_CONTROLLER_LOG:GEN4_CONNECT_INT_LOG_ATtiny404 Payload End
 | 
			
		||||
466 1722140650295 XXXX 1722140650295, Thread 466: XXXX 1722140650295, Entering Thread 466: Commands::runScriptBasic with script contents. contents[0] = 0x39, ...  
 | 
			
		||||
466 1722140650301 XXXX 1722140650301, Thread 466: ToolCommUsb::writeHeaderAndGetResponse, response does not meach. got = 0x200afe1, expected 0xd 
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: transfer: exception after writeHeaderAndGetResult Protocol failure: In writeHeaderAndGetResponse expected 0xd received 0x200afe1 
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: XXXX 1722140650302, Entering Thread 466: ToolCommUsb::recoverFromProtocolError, type = NO_SCRIPT  
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: Send Abort Script Engine Command 
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: XXXX 1722140650302, Entering Thread 466: ToolCommUsb::killScriptEngine  
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: XXXX 1722140650302, Exiting Thread 466: ToolCommUsb::killScriptEngine  
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: Successfully Sent Abort Script EngineCommand 
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: Exiting recoverFromProtocolError 
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: XXXX 1722140650302, Exiting Thread 466: ToolCommUsb::recoverFromProtocolError,  
 | 
			
		||||
466 1722140650302 XXXX 1722140650302, Thread 466: transfer: after recoverFromProtocolError 
 | 
			
		||||
							
								
								
									
										0
									
								
								defmplabxtrace.log
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								defmplabxtrace.log
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										
											BIN
										
									
								
								defmplabxtrace.log.inx
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								defmplabxtrace.log.inx
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										17
									
								
								dist/attiny404/production/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								dist/attiny404/production/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?> 
 | 
			
		||||
<project>                                  
 | 
			
		||||
  <executable name="dist/attiny404/production/High.production.elf">                 
 | 
			
		||||
    <memory name="program">              
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>4096</length>                 
 | 
			
		||||
      <used>2088</used>                     
 | 
			
		||||
      <free>2008</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
    <memory name="data">                 
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>256</length>                 
 | 
			
		||||
      <used>20</used>                     
 | 
			
		||||
      <free>236</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
  </executable>                            
 | 
			
		||||
</project>                                 
 | 
			
		||||
							
								
								
									
										17
									
								
								dist/default/debug/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								dist/default/debug/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?> 
 | 
			
		||||
<project>                                  
 | 
			
		||||
  <executable name="dist/default/debug/fg004a.X.debug.elf">                 
 | 
			
		||||
    <memory name="program">              
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>4096</length>                 
 | 
			
		||||
      <used>424</used>                     
 | 
			
		||||
      <free>3672</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
    <memory name="data">                 
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>256</length>                 
 | 
			
		||||
      <used>2</used>                     
 | 
			
		||||
      <free>254</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
  </executable>                            
 | 
			
		||||
</project>                                 
 | 
			
		||||
							
								
								
									
										17
									
								
								dist/default/production/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								dist/default/production/memoryfile.xml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?> 
 | 
			
		||||
<project>                                  
 | 
			
		||||
  <executable name="dist/default/production/fg004a.X.production.elf">                 
 | 
			
		||||
    <memory name="program">              
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>4096</length>                 
 | 
			
		||||
      <used>1778</used>                     
 | 
			
		||||
      <free>2318</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
    <memory name="data">                 
 | 
			
		||||
      <units>bytes</units>                 
 | 
			
		||||
      <length>256</length>                 
 | 
			
		||||
      <used>4</used>                     
 | 
			
		||||
      <free>252</free>                     
 | 
			
		||||
    </memory>                              
 | 
			
		||||
  </executable>                            
 | 
			
		||||
</project>                                 
 | 
			
		||||
							
								
								
									
										0
									
								
								inc/.git_dir
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								inc/.git_dir
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										71
									
								
								inc/RegEdit.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								inc/RegEdit.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief Module/Interface for editing AVR registers 
 | 
			
		||||
 * @details This file is an interface to AVR registers or the avr/io.h
 | 
			
		||||
 * @author Jake G 
 | 
			
		||||
 * @date 2024 
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file RegEdit.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef REGEDIT_H
 | 
			
		||||
#define REGEDIT_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets the value of the register to 0xFF.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetRegister(void *reg);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets the value of the register to 0x00. 
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_ClearRegister(void *reg);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets a single bit in the register.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetBit(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Clears a single bit in the register.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Checks if a single bit is set in the register.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Preforms logical OR Equals with the passed num.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_OR_Num(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Preforms logical AND Equals with the passed num.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_AND_Num(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets the register to the passed number value.
 | 
			
		||||
 * @param reg A pointer to a register 
 | 
			
		||||
 * @param The bit's index or number in the register
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetNum(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
#endif //REGEDIT_H
 | 
			
		||||
							
								
								
									
										60
									
								
								inc/config.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								inc/config.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,60 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @file config.h 
 | 
			
		||||
 * @author Jake G
 | 
			
		||||
 * @date 15 June 2024
 | 
			
		||||
 * @brief File contains the project configuration values 
 | 
			
		||||
 *
 | 
			
		||||
 * This file contains the user changable parameters. Most the values are 
 | 
			
		||||
 * constants that will change the behavior of the system.
 | 
			
		||||
 *
 | 
			
		||||
 * For these changes to take affect you must recompile/rebuild the project 
 | 
			
		||||
 * after you have changed the values.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef CONFIG_H
 | 
			
		||||
#define CONFIG_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#define ADC_LOAD1 4
 | 
			
		||||
#define ADC_LOAD2 5
 | 
			
		||||
#define ADC_LOAD3 6
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Positive Zero Crossing Trigger Value
 | 
			
		||||
 * The 10 bit value at which the program triggers the ISR to handle 
 | 
			
		||||
 * the zero crossing event.
 | 
			
		||||
 *
 | 
			
		||||
 * You can adjust this to change when the program will start the timer.
 | 
			
		||||
 */
 | 
			
		||||
const uint16_t TriggerValue = 512; 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Triac Gate Pulse Quantity
 | 
			
		||||
 *
 | 
			
		||||
 * Contains the number of pulses that the micro-controller will send to the 
 | 
			
		||||
 * gates of the triac.
 | 
			
		||||
 *
 | 
			
		||||
 * This number should match the quantity of timings inside the pulse/duration
 | 
			
		||||
 * array.
 | 
			
		||||
 */
 | 
			
		||||
const int GatePulsesQty = 5;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Gate Pulses Array
 | 
			
		||||
 *
 | 
			
		||||
 * The gate pulses array holds the duration of pulses in microseconds for the
 | 
			
		||||
 * triacs gates. The length of the array must be matched with the 
 | 
			
		||||
 * GatePulsesQuantity parameter.
 | 
			
		||||
 */
 | 
			
		||||
const uint16_t GatePulses[5] = {250, 500, 750, 1000, 1250};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief The time constant.
 | 
			
		||||
 */
 | 
			
		||||
const double Tau = 8250;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //CONFIG_H
 | 
			
		||||
							
								
								
									
										4713
									
								
								inc/iotn404.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4713
									
								
								inc/iotn404.h
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										49
									
								
								inc/zero_cross_detection.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								inc/zero_cross_detection.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @file zero_cross_detection.h
 | 
			
		||||
 * @author Jake G
 | 
			
		||||
 * @date 16 June 2024
 | 
			
		||||
 * @brief File contains the zero cross detection functions 
 | 
			
		||||
 *
 | 
			
		||||
 * This file holds all the code/functions needed to read the value of the AC
 | 
			
		||||
 * waveform. It uses the trigger value from the `config.h` file to evaluate the
 | 
			
		||||
 * state.
 | 
			
		||||
 *
 | 
			
		||||
 * This module depends on the ADC.h module to get readings from the ADC 
 | 
			
		||||
 * hardware.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ZERO_CROSS_DETECTION
 | 
			
		||||
#define ZERO_CROSS_DETECTION
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Zero Cross Detection Setup
 | 
			
		||||
 *
 | 
			
		||||
 * Sets up the hardware to read the values coming from the AC input waveform.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void ZCD_Setup(void);
 | 
			
		||||
//int ZCD_Setup(volatile uint8_t *ddrx, uint8_t *port, uint8_t pin);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Checks if ZCD should trigger on value
 | 
			
		||||
 *
 | 
			
		||||
 * The function checks for a positive edge first using the ZCD_IsPositiveEdge
 | 
			
		||||
 * function. If a positive edge was found, then it takes an addition set of 
 | 
			
		||||
 * samples and averages them; only triggering(returning true) in the case 
 | 
			
		||||
 * that the average is higher than the previous sample. 
 | 
			
		||||
 */
 | 
			
		||||
bool ZCD_IsTriggered(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function blocks execution until ZCD is triggered. 
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void ZCD_Poll(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //ZERO_CROSS_DETECTION   
 | 
			
		||||
							
								
								
									
										0
									
								
								mocks/.mocks_git_dir
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								mocks/.mocks_git_dir
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										5
									
								
								mocks/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								mocks/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
add_subdirectory(MockRegEdit)
 | 
			
		||||
add_subdirectory(MockADC)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7
									
								
								mocks/MockADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								mocks/MockADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
add_library(MockADC STATIC
 | 
			
		||||
    MockADC.c
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_include_directories(MockADC PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										84
									
								
								mocks/MockADC/MockADC.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								mocks/MockADC/MockADC.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: MockADC.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "MockADC.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport_c.h"
 | 
			
		||||
 | 
			
		||||
#define FAKESIZE 256
 | 
			
		||||
 | 
			
		||||
uint16_t fake_data[FAKESIZE];
 | 
			
		||||
int fake_index = 0;
 | 
			
		||||
 | 
			
		||||
static bool is_setup = false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_SetPin(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ADC_Setup(void)
 | 
			
		||||
{
 | 
			
		||||
    is_setup = true;
 | 
			
		||||
    return;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ADC_Init(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("ADC_Init")
 | 
			
		||||
        ->withUnsignedIntParameters("pin_num", pin_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ADC_Enable(void)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("ADC_Enable");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ADC_Disable()
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("ADC_Disable"); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t ADC_ReadValue_Impl(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("ADC_ReadValue_Impl")
 | 
			
		||||
        ->withUnsignedIntParameters("pin_num", pin_num);
 | 
			
		||||
 | 
			
		||||
    if(fake_index == 0){
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    return fake_data[--fake_index];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint16_t (*ADC_ReadValue)(uint8_t pin_num) = ADC_ReadValue_Impl;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MockADC_PushValue(uint16_t value){
 | 
			
		||||
    if(fake_index >= FAKESIZE - 1){
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    fake_data[fake_index++] = value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MockADC_ZeroIndex(void)
 | 
			
		||||
{
 | 
			
		||||
    fake_index = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int MockADC_GetIndex(void)
 | 
			
		||||
{
 | 
			
		||||
    return fake_index;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool MockADC_IsSetup(void)
 | 
			
		||||
{
 | 
			
		||||
    return is_setup;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								mocks/MockADC/MockADC.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								mocks/MockADC/MockADC.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief PUT_TEXT_HERE
 | 
			
		||||
 * @details This file is...
 | 
			
		||||
 * @author username
 | 
			
		||||
 * @date todays_date
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file MOCKADC.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef MOCKADC_H
 | 
			
		||||
#define MOCKADC_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_Setup(void);
 | 
			
		||||
void ADC_SetPin(uint8_t pin_num);
 | 
			
		||||
void ADC_Init(uint8_t pin_num);
 | 
			
		||||
void ADC_Enable(void);
 | 
			
		||||
void ADC_Disable(void);
 | 
			
		||||
 | 
			
		||||
extern uint16_t (*ADC_ReadValue)(uint8_t pin_num);
 | 
			
		||||
 | 
			
		||||
void MockADC_PushValue(uint16_t value);
 | 
			
		||||
void MockADC_ZeroIndex(void);
 | 
			
		||||
int MockADC_GetIndex(void);
 | 
			
		||||
bool MockADC_IsSetup(void);
 | 
			
		||||
 | 
			
		||||
#endif //MOCKADC_H
 | 
			
		||||
							
								
								
									
										12
									
								
								mocks/MockRegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								mocks/MockRegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
add_library(MockRegEdit STATIC
 | 
			
		||||
    MockRegEdit.c
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_include_directories(MockRegEdit PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(MockRegEdit
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a   
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										82
									
								
								mocks/MockRegEdit/MockRegEdit.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								mocks/MockRegEdit/MockRegEdit.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,82 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: MockRegEdit.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "MockRegEdit.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport_c.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetRegister(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_SetRegister")
 | 
			
		||||
        ->withPointerParameters("reg", reg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_ClearRegister(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_ClearRegister")
 | 
			
		||||
        ->withPointerParameters("reg", reg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetBit(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_SetBit")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("bit_num", bit_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_ClearBit(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_ClearBit")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("bit_num", bit_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    return mock_c()->actualCall("RegEdit_IsBitSet")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("bit_num", bit_num)
 | 
			
		||||
        ->returnBoolValueOrDefault(true);
 | 
			
		||||
    //return mock_c()->returnBoolValueOrDefault(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_OR_Num(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_OR_Num")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("num", num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_AND_Num(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_AND_Num")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("num", num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetNum(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_SetNum")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->withUnsignedIntParameters("num", num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint8_t RegEdit_ReadReg(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    mock_c()->actualCall("RegEdit_ReadReg")
 | 
			
		||||
        ->withPointerParameters("reg", reg)
 | 
			
		||||
        ->returnUnsignedIntValueOrDefault(0);
 | 
			
		||||
    //Return value is mock controlled. So it does actually return a uint8_t
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								mocks/MockRegEdit/MockRegEdit.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								mocks/MockRegEdit/MockRegEdit.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief PUT_TEXT_HERE
 | 
			
		||||
 * @details This file is...
 | 
			
		||||
 * @author username
 | 
			
		||||
 * @date todays_date
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file MockRegEdit.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef MOCKREGEDIT_H
 | 
			
		||||
#define MOCKREGEDIT_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetRegister(void *reg);
 | 
			
		||||
void RegEdit_ClearRegister(void *reg);
 | 
			
		||||
void RegEdit_SetBit(void *reg, uint8_t bit_num);
 | 
			
		||||
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
 | 
			
		||||
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
void RegEdit_OR_Num(void *reg, uint8_t num);
 | 
			
		||||
void RegEdit_AND_Num(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetNum(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
uint8_t RegEdit_ReadReg(void *reg);
 | 
			
		||||
 | 
			
		||||
#endif //MOCKREGEDIT_H
 | 
			
		||||
							
								
								
									
										51
									
								
								mocks/MockRegEdit/u8_comparator.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								mocks/MockRegEdit/u8_comparator.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
#include "u8_comparator.hpp"
 | 
			
		||||
#include "CppUTest/SimpleString.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
class MyTypeComparator : public MockNamedValueComparator
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    virtual bool isEqual(const void* object1, const void* object2)
 | 
			
		||||
    {
 | 
			
		||||
        return object1 == object2;
 | 
			
		||||
    }
 | 
			
		||||
    virtual SimpleString valueToString(const void* object)
 | 
			
		||||
    {
 | 
			
		||||
        return StringFrom(object);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
bool UInt8PointerComparator::isEqual(const void* object1, const void* object2) {
 | 
			
		||||
    const uint8_t* ptr1 = reinterpret_cast<const uint8_t*>(object1);
 | 
			
		||||
    const uint8_t* ptr2 = reinterpret_cast<const uint8_t*>(object2);
 | 
			
		||||
    return std::memcmp(ptr1, ptr2, sizeof(uint8_t)) == 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SimpleString UInt8PointerComparator::valueToString(const void* object) {
 | 
			
		||||
    const uint8_t* ptr = reinterpret_cast<const uint8_t*>(object);
 | 
			
		||||
    return StringFromFormat("0x%02x", *ptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
bool UInt8PointerComparator::isEqual(const void* object1, const void* object2) const {
 | 
			
		||||
    const uint8_t* ptr1 = static_cast<const uint8_t*>(object1);
 | 
			
		||||
    const uint8_t* ptr2 = static_cast<const uint8_t*>(object2);
 | 
			
		||||
    return std::memcmp(ptr1, ptr2, sizeof(uint8_t)) == 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SimpleString UInt8PointerComparator::valueToString(const void* object) const {
 | 
			
		||||
    const uint8_t* ptr = static_cast<const uint8_t*>(object);
 | 
			
		||||
    return StringFromFormat("0x%02x", *ptr);
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
bool UInt8Comparator::isEqual(const void* object1, const void* object2) {
 | 
			
		||||
    return (uint8_t*)object1 == (uint8_t *)object2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SimpleString UInt8Comparator::valueToString(const void* object) {
 | 
			
		||||
    //uint8_t value = reinterpret_cast<uint8_t>(object);
 | 
			
		||||
    const uint8_t *ptr = reinterpret_cast<const uint8_t*>(object);
 | 
			
		||||
    return StringFromFormat("0x%02x", *ptr);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								mocks/MockRegEdit/u8_comparator.hpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								mocks/MockRegEdit/u8_comparator.hpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
#ifndef U8_COMPARATOR_H
 | 
			
		||||
#define U8_COMPARATOR_H
 | 
			
		||||
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <cstring>
 | 
			
		||||
#include <CppUTestExt/MockSupport.h>
 | 
			
		||||
 | 
			
		||||
class UInt8PointerComparator : public MockNamedValueComparator {
 | 
			
		||||
public:
 | 
			
		||||
    virtual bool isEqual(const void* object1, const void* object2) override;
 | 
			
		||||
    SimpleString valueToString(const void* object) override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class UInt8Comparator : public MockNamedValueComparator {
 | 
			
		||||
    public:
 | 
			
		||||
        virtual bool isEqual(const void* object1, const void* object2) override;
 | 
			
		||||
        SimpleString valueToString(const void* object) override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif //U8_COMPARATOR_H
 | 
			
		||||
							
								
								
									
										238
									
								
								nbproject/Makefile-attiny404.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								nbproject/Makefile-attiny404.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,238 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated Makefile - do not edit!
 | 
			
		||||
#
 | 
			
		||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
 | 
			
		||||
# has a -pre and a -post target defined where you can add customized code.
 | 
			
		||||
#
 | 
			
		||||
# This makefile implements configuration specific macros and targets.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Include project Makefile
 | 
			
		||||
ifeq "${IGNORE_LOCAL}" "TRUE"
 | 
			
		||||
# do not include local makefile. User is passing all local related variables already
 | 
			
		||||
else
 | 
			
		||||
include Makefile
 | 
			
		||||
# Include makefile containing local settings
 | 
			
		||||
ifeq "$(wildcard nbproject/Makefile-local-attiny404.mk)" "nbproject/Makefile-local-attiny404.mk"
 | 
			
		||||
include nbproject/Makefile-local-attiny404.mk
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Environment
 | 
			
		||||
MKDIR=mkdir -p
 | 
			
		||||
RM=rm -f 
 | 
			
		||||
MV=mv 
 | 
			
		||||
CP=cp 
 | 
			
		||||
 | 
			
		||||
# Macros
 | 
			
		||||
CND_CONF=attiny404
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
IMAGE_TYPE=debug
 | 
			
		||||
OUTPUT_SUFFIX=elf
 | 
			
		||||
DEBUGGABLE_SUFFIX=elf
 | 
			
		||||
FINAL_IMAGE=${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
else
 | 
			
		||||
IMAGE_TYPE=production
 | 
			
		||||
OUTPUT_SUFFIX=hex
 | 
			
		||||
DEBUGGABLE_SUFFIX=elf
 | 
			
		||||
FINAL_IMAGE=${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(COMPARE_BUILD), true)
 | 
			
		||||
COMPARISON_BUILD=-mafrlcsj
 | 
			
		||||
else
 | 
			
		||||
COMPARISON_BUILD=
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Object Directory
 | 
			
		||||
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
 | 
			
		||||
 | 
			
		||||
# Distribution Directory
 | 
			
		||||
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
 | 
			
		||||
 | 
			
		||||
# Source Files Quoted if spaced
 | 
			
		||||
SOURCEFILES_QUOTED_IF_SPACED=src/main.c src/ADC/ADC.c src/load/load.c src/RegEdit/RegEdit.c src/usart/usart.c src/zero_cross_detection/zero_cross_detection.c src/Enable/Enable.c src/EnOut/EnOut.c
 | 
			
		||||
 | 
			
		||||
# Object Files Quoted if spaced
 | 
			
		||||
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/src/main.o ${OBJECTDIR}/src/ADC/ADC.o ${OBJECTDIR}/src/load/load.o ${OBJECTDIR}/src/RegEdit/RegEdit.o ${OBJECTDIR}/src/usart/usart.o ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o ${OBJECTDIR}/src/Enable/Enable.o ${OBJECTDIR}/src/EnOut/EnOut.o
 | 
			
		||||
POSSIBLE_DEPFILES=${OBJECTDIR}/src/main.o.d ${OBJECTDIR}/src/ADC/ADC.o.d ${OBJECTDIR}/src/load/load.o.d ${OBJECTDIR}/src/RegEdit/RegEdit.o.d ${OBJECTDIR}/src/usart/usart.o.d ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d ${OBJECTDIR}/src/Enable/Enable.o.d ${OBJECTDIR}/src/EnOut/EnOut.o.d
 | 
			
		||||
 | 
			
		||||
# Object Files
 | 
			
		||||
OBJECTFILES=${OBJECTDIR}/src/main.o ${OBJECTDIR}/src/ADC/ADC.o ${OBJECTDIR}/src/load/load.o ${OBJECTDIR}/src/RegEdit/RegEdit.o ${OBJECTDIR}/src/usart/usart.o ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o ${OBJECTDIR}/src/Enable/Enable.o ${OBJECTDIR}/src/EnOut/EnOut.o
 | 
			
		||||
 | 
			
		||||
# Source Files
 | 
			
		||||
SOURCEFILES=src/main.c src/ADC/ADC.c src/load/load.c src/RegEdit/RegEdit.c src/usart/usart.c src/zero_cross_detection/zero_cross_detection.c src/Enable/Enable.c src/EnOut/EnOut.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CFLAGS=
 | 
			
		||||
ASFLAGS=
 | 
			
		||||
LDLIBSOPTIONS=
 | 
			
		||||
 | 
			
		||||
############# Tool locations ##########################################
 | 
			
		||||
# If you copy a project from one host to another, the path where the  #
 | 
			
		||||
# compiler is installed may be different.                             #
 | 
			
		||||
# If you open this project with MPLAB X in the new host, this         #
 | 
			
		||||
# makefile will be regenerated and the paths will be corrected.       #
 | 
			
		||||
#######################################################################
 | 
			
		||||
# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build
 | 
			
		||||
FIXDEPS=fixDeps
 | 
			
		||||
 | 
			
		||||
.build-conf:  ${BUILD_SUBPROJECTS}
 | 
			
		||||
ifneq ($(INFORMATION_MESSAGE), )
 | 
			
		||||
	@echo $(INFORMATION_MESSAGE)
 | 
			
		||||
endif
 | 
			
		||||
	${MAKE}  -f nbproject/Makefile-attiny404.mk ${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
 | 
			
		||||
MP_PROCESSOR_OPTION=ATtiny404
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: compile
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
${OBJECTDIR}/src/main.o: src/main.c  .generated_files/flags/attiny404/4a18d695a6a542a9d305d69379cc82da780a11b5 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/main.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/main.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/main.o.d" -MT "${OBJECTDIR}/src/main.o.d" -MT ${OBJECTDIR}/src/main.o -o ${OBJECTDIR}/src/main.o src/main.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/ADC/ADC.o: src/ADC/ADC.c  .generated_files/flags/attiny404/3d8773449273b085d8c9895efb51aa8448aeb455 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/ADC" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/ADC/ADC.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/ADC/ADC.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/ADC/ADC.o.d" -MT "${OBJECTDIR}/src/ADC/ADC.o.d" -MT ${OBJECTDIR}/src/ADC/ADC.o -o ${OBJECTDIR}/src/ADC/ADC.o src/ADC/ADC.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/load/load.o: src/load/load.c  .generated_files/flags/attiny404/d8655bd13f1d067e11d0f4925135b7be028a5b05 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/load" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/load/load.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/load/load.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/load/load.o.d" -MT "${OBJECTDIR}/src/load/load.o.d" -MT ${OBJECTDIR}/src/load/load.o -o ${OBJECTDIR}/src/load/load.o src/load/load.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/RegEdit/RegEdit.o: src/RegEdit/RegEdit.c  .generated_files/flags/attiny404/8277c62e6eb27d324fcb47eadb55ecca38508940 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/RegEdit" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/RegEdit/RegEdit.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/RegEdit/RegEdit.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/RegEdit/RegEdit.o.d" -MT "${OBJECTDIR}/src/RegEdit/RegEdit.o.d" -MT ${OBJECTDIR}/src/RegEdit/RegEdit.o -o ${OBJECTDIR}/src/RegEdit/RegEdit.o src/RegEdit/RegEdit.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/usart/usart.o: src/usart/usart.c  .generated_files/flags/attiny404/7e35114acd779af68f90c57218e2f5fc0d70b230 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/usart" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/usart/usart.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/usart/usart.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/usart/usart.o.d" -MT "${OBJECTDIR}/src/usart/usart.o.d" -MT ${OBJECTDIR}/src/usart/usart.o -o ${OBJECTDIR}/src/usart/usart.o src/usart/usart.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o: src/zero_cross_detection/zero_cross_detection.c  .generated_files/flags/attiny404/a574ec10cb6dd0c1c60c2b0c579a60fbb2e44ddc .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/zero_cross_detection" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d" -MT "${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d" -MT ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o -o ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o src/zero_cross_detection/zero_cross_detection.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/Enable/Enable.o: src/Enable/Enable.c  .generated_files/flags/attiny404/853c45c88340e56756ea55b91ce01ec66ae5b3f4 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/Enable" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/Enable/Enable.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/Enable/Enable.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/Enable/Enable.o.d" -MT "${OBJECTDIR}/src/Enable/Enable.o.d" -MT ${OBJECTDIR}/src/Enable/Enable.o -o ${OBJECTDIR}/src/Enable/Enable.o src/Enable/Enable.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/EnOut/EnOut.o: src/EnOut/EnOut.c  .generated_files/flags/attiny404/47b193ae7e75c2ae6c3aaf9472e1f3177fcf59d9 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/EnOut" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/EnOut/EnOut.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/EnOut/EnOut.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -D__DEBUG=1 -g -DDEBUG  -gdwarf-2  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/EnOut/EnOut.o.d" -MT "${OBJECTDIR}/src/EnOut/EnOut.o.d" -MT ${OBJECTDIR}/src/EnOut/EnOut.o -o ${OBJECTDIR}/src/EnOut/EnOut.o src/EnOut/EnOut.c 
 | 
			
		||||
	
 | 
			
		||||
else
 | 
			
		||||
${OBJECTDIR}/src/main.o: src/main.c  .generated_files/flags/attiny404/4428bc9166a87775d410e311c31ef68ca65b2ffb .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/main.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/main.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/main.o.d" -MT "${OBJECTDIR}/src/main.o.d" -MT ${OBJECTDIR}/src/main.o -o ${OBJECTDIR}/src/main.o src/main.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/ADC/ADC.o: src/ADC/ADC.c  .generated_files/flags/attiny404/5296cecaa739eeefd0ebf421da823004c2d4c31c .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/ADC" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/ADC/ADC.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/ADC/ADC.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/ADC/ADC.o.d" -MT "${OBJECTDIR}/src/ADC/ADC.o.d" -MT ${OBJECTDIR}/src/ADC/ADC.o -o ${OBJECTDIR}/src/ADC/ADC.o src/ADC/ADC.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/load/load.o: src/load/load.c  .generated_files/flags/attiny404/f57940e2c9a1d09b4d1b0cbe60748a7a23cf1bfd .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/load" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/load/load.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/load/load.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/load/load.o.d" -MT "${OBJECTDIR}/src/load/load.o.d" -MT ${OBJECTDIR}/src/load/load.o -o ${OBJECTDIR}/src/load/load.o src/load/load.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/RegEdit/RegEdit.o: src/RegEdit/RegEdit.c  .generated_files/flags/attiny404/cbcdee9e52a972564c97845e7d8131e7889df7d1 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/RegEdit" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/RegEdit/RegEdit.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/RegEdit/RegEdit.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/RegEdit/RegEdit.o.d" -MT "${OBJECTDIR}/src/RegEdit/RegEdit.o.d" -MT ${OBJECTDIR}/src/RegEdit/RegEdit.o -o ${OBJECTDIR}/src/RegEdit/RegEdit.o src/RegEdit/RegEdit.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/usart/usart.o: src/usart/usart.c  .generated_files/flags/attiny404/eeb93cdee4d5a99d437668c6cc3a0c37e2a22bca .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/usart" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/usart/usart.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/usart/usart.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/usart/usart.o.d" -MT "${OBJECTDIR}/src/usart/usart.o.d" -MT ${OBJECTDIR}/src/usart/usart.o -o ${OBJECTDIR}/src/usart/usart.o src/usart/usart.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o: src/zero_cross_detection/zero_cross_detection.c  .generated_files/flags/attiny404/8720e109db3abe691f56ab4657549cc0502b678a .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/zero_cross_detection" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d" -MT "${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o.d" -MT ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o -o ${OBJECTDIR}/src/zero_cross_detection/zero_cross_detection.o src/zero_cross_detection/zero_cross_detection.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/Enable/Enable.o: src/Enable/Enable.c  .generated_files/flags/attiny404/9900b476323d492363d00093aa125b84669cf8e5 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/Enable" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/Enable/Enable.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/Enable/Enable.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/Enable/Enable.o.d" -MT "${OBJECTDIR}/src/Enable/Enable.o.d" -MT ${OBJECTDIR}/src/Enable/Enable.o -o ${OBJECTDIR}/src/Enable/Enable.o src/Enable/Enable.c 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/src/EnOut/EnOut.o: src/EnOut/EnOut.c  .generated_files/flags/attiny404/8efc6a6c1c80c107efc794123e4f46092e9183f2 .generated_files/flags/attiny404/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}/src/EnOut" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/EnOut/EnOut.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/src/EnOut/EnOut.o 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_CC_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -c  -x c -D__$(MP_PROCESSOR_OPTION)__   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -DXPRJ_attiny404=$(CND_CONF)  $(COMPARISON_BUILD)  -gdwarf-3 -mno-const-data-in-progmem     -MD -MP -MF "${OBJECTDIR}/src/EnOut/EnOut.o.d" -MT "${OBJECTDIR}/src/EnOut/EnOut.o.d" -MT ${OBJECTDIR}/src/EnOut/EnOut.o -o ${OBJECTDIR}/src/EnOut/EnOut.o src/EnOut/EnOut.c 
 | 
			
		||||
	
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: assemble
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: assembleWithPreprocess
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: link
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk    
 | 
			
		||||
	@${MKDIR} ${DISTDIR} 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/High.${IMAGE_TYPE}.map  -D__DEBUG=1  -DXPRJ_attiny404=$(CND_CONF)  -Wl,--defsym=__MPLAB_BUILD=1   -mdfp="${DFP_DIR}/xc8"   -gdwarf-2 -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -gdwarf-3 -mno-const-data-in-progmem     $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/High.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX}  -o ${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}  ${OBJECTFILES_QUOTED_IF_SPACED}      -Wl,--start-group  -Wl,-lm -Wl,--end-group  -Wl,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1
 | 
			
		||||
	@${RM} ${DISTDIR}/High.${IMAGE_TYPE}.hex 
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
else
 | 
			
		||||
${DISTDIR}/High.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk   
 | 
			
		||||
	@${MKDIR} ${DISTDIR} 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_LD_PRE) -mcpu=$(MP_PROCESSOR_OPTION) -Wl,-Map=${DISTDIR}/High.${IMAGE_TYPE}.map  -DXPRJ_attiny404=$(CND_CONF)  -Wl,--defsym=__MPLAB_BUILD=1   -mdfp="${DFP_DIR}/xc8"  -Wl,--gc-sections -O1 -ffunction-sections -fdata-sections -fshort-enums -fno-common -funsigned-char -funsigned-bitfields -I"src/ADC" -I"src/load" -I"src/RegEdit" -I"src/EnOut" -I"src/zero_cross_detection" -I"src/usart" -I"inc" -I"src/Enable" -Wall -gdwarf-3 -mno-const-data-in-progmem     $(COMPARISON_BUILD) -Wl,--memorysummary,${DISTDIR}/memoryfile.xml -o ${DISTDIR}/High.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX}  -o ${DISTDIR}/High.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX}  ${OBJECTFILES_QUOTED_IF_SPACED}      -Wl,--start-group  -Wl,-lm -Wl,--end-group 
 | 
			
		||||
	${MP_CC_DIR}/avr-objcopy -O ihex "${DISTDIR}/High.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX}" "${DISTDIR}/High.${IMAGE_TYPE}.hex"
 | 
			
		||||
	
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Subprojects
 | 
			
		||||
.build-subprojects:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Subprojects
 | 
			
		||||
.clean-subprojects:
 | 
			
		||||
 | 
			
		||||
# Clean Targets
 | 
			
		||||
.clean-conf: ${CLEAN_SUBPROJECTS}
 | 
			
		||||
	${RM} -r ${OBJECTDIR}
 | 
			
		||||
	${RM} -r ${DISTDIR}
 | 
			
		||||
 | 
			
		||||
# Enable dependency checking
 | 
			
		||||
.dep.inc: .depcheck-impl
 | 
			
		||||
 | 
			
		||||
DEPFILES=$(wildcard ${POSSIBLE_DEPFILES})
 | 
			
		||||
ifneq (${DEPFILES},)
 | 
			
		||||
include ${DEPFILES}
 | 
			
		||||
endif
 | 
			
		||||
							
								
								
									
										219
									
								
								nbproject/Makefile-default.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										219
									
								
								nbproject/Makefile-default.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,219 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated Makefile - do not edit!
 | 
			
		||||
#
 | 
			
		||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
 | 
			
		||||
# has a -pre and a -post target defined where you can add customized code.
 | 
			
		||||
#
 | 
			
		||||
# This makefile implements configuration specific macros and targets.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Include project Makefile
 | 
			
		||||
ifeq "${IGNORE_LOCAL}" "TRUE"
 | 
			
		||||
# do not include local makefile. User is passing all local related variables already
 | 
			
		||||
else
 | 
			
		||||
include Makefile
 | 
			
		||||
# Include makefile containing local settings
 | 
			
		||||
ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk"
 | 
			
		||||
include nbproject/Makefile-local-default.mk
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Environment
 | 
			
		||||
MKDIR=gnumkdir -p
 | 
			
		||||
RM=rm -f 
 | 
			
		||||
MV=mv 
 | 
			
		||||
CP=cp 
 | 
			
		||||
 | 
			
		||||
# Macros
 | 
			
		||||
CND_CONF=default
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
IMAGE_TYPE=debug
 | 
			
		||||
OUTPUT_SUFFIX=elf
 | 
			
		||||
DEBUGGABLE_SUFFIX=elf
 | 
			
		||||
FINAL_IMAGE=${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
else
 | 
			
		||||
IMAGE_TYPE=production
 | 
			
		||||
OUTPUT_SUFFIX=hex
 | 
			
		||||
DEBUGGABLE_SUFFIX=elf
 | 
			
		||||
FINAL_IMAGE=${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(COMPARE_BUILD), true)
 | 
			
		||||
COMPARISON_BUILD=
 | 
			
		||||
else
 | 
			
		||||
COMPARISON_BUILD=
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# Object Directory
 | 
			
		||||
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
 | 
			
		||||
 | 
			
		||||
# Distribution Directory
 | 
			
		||||
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
 | 
			
		||||
 | 
			
		||||
# Source Files Quoted if spaced
 | 
			
		||||
SOURCEFILES_QUOTED_IF_SPACED=main.c ADC.c RegEdit.c TriacOut.c zero_cross_detection.c
 | 
			
		||||
 | 
			
		||||
# Object Files Quoted if spaced
 | 
			
		||||
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.o ${OBJECTDIR}/ADC.o ${OBJECTDIR}/RegEdit.o ${OBJECTDIR}/TriacOut.o ${OBJECTDIR}/zero_cross_detection.o
 | 
			
		||||
POSSIBLE_DEPFILES=${OBJECTDIR}/main.o.d ${OBJECTDIR}/ADC.o.d ${OBJECTDIR}/RegEdit.o.d ${OBJECTDIR}/TriacOut.o.d ${OBJECTDIR}/zero_cross_detection.o.d
 | 
			
		||||
 | 
			
		||||
# Object Files
 | 
			
		||||
OBJECTFILES=${OBJECTDIR}/main.o ${OBJECTDIR}/ADC.o ${OBJECTDIR}/RegEdit.o ${OBJECTDIR}/TriacOut.o ${OBJECTDIR}/zero_cross_detection.o
 | 
			
		||||
 | 
			
		||||
# Source Files
 | 
			
		||||
SOURCEFILES=main.c ADC.c RegEdit.c TriacOut.c zero_cross_detection.c
 | 
			
		||||
 | 
			
		||||
# Pack Options 
 | 
			
		||||
PACK_COMPILER_OPTIONS=-I "${DFP_DIR}/include"
 | 
			
		||||
PACK_COMMON_OPTIONS=-B "${DFP_DIR}/gcc/dev/attiny404"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CFLAGS=
 | 
			
		||||
ASFLAGS=
 | 
			
		||||
LDLIBSOPTIONS=
 | 
			
		||||
 | 
			
		||||
############# Tool locations ##########################################
 | 
			
		||||
# If you copy a project from one host to another, the path where the  #
 | 
			
		||||
# compiler is installed may be different.                             #
 | 
			
		||||
# If you open this project with MPLAB X in the new host, this         #
 | 
			
		||||
# makefile will be regenerated and the paths will be corrected.       #
 | 
			
		||||
#######################################################################
 | 
			
		||||
# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build
 | 
			
		||||
FIXDEPS=fixDeps
 | 
			
		||||
 | 
			
		||||
.build-conf:  ${BUILD_SUBPROJECTS}
 | 
			
		||||
ifneq ($(INFORMATION_MESSAGE), )
 | 
			
		||||
	@echo $(INFORMATION_MESSAGE)
 | 
			
		||||
endif
 | 
			
		||||
	${MAKE}  -f nbproject/Makefile-default.mk ${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 | 
			
		||||
 | 
			
		||||
MP_PROCESSOR_OPTION=ATtiny404
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: assemble
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: assembleWithPreprocess
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: compile
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
${OBJECTDIR}/main.o: main.c  .generated_files/flags/default/fb9268029ec6f74151f2e86d3e38c724cee37776 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/main.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/main.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS} -g -DDEBUG  -gdwarf-2  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/main.o.d" -MT "${OBJECTDIR}/main.o.d" -MT ${OBJECTDIR}/main.o  -o ${OBJECTDIR}/main.o main.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/ADC.o: ADC.c  .generated_files/flags/default/f122489a524e88058eea280a192135d1b3c7dcf5 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/ADC.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/ADC.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS} -g -DDEBUG  -gdwarf-2  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/ADC.o.d" -MT "${OBJECTDIR}/ADC.o.d" -MT ${OBJECTDIR}/ADC.o  -o ${OBJECTDIR}/ADC.o ADC.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/RegEdit.o: RegEdit.c  .generated_files/flags/default/9bc268bbb52bbf2ec17312e438cb88b01c311165 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/RegEdit.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/RegEdit.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS} -g -DDEBUG  -gdwarf-2  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/RegEdit.o.d" -MT "${OBJECTDIR}/RegEdit.o.d" -MT ${OBJECTDIR}/RegEdit.o  -o ${OBJECTDIR}/RegEdit.o RegEdit.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/TriacOut.o: TriacOut.c  .generated_files/flags/default/d135b3bd18c20024d8f416e13555456030bd7791 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/TriacOut.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/TriacOut.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS} -g -DDEBUG  -gdwarf-2  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/TriacOut.o.d" -MT "${OBJECTDIR}/TriacOut.o.d" -MT ${OBJECTDIR}/TriacOut.o  -o ${OBJECTDIR}/TriacOut.o TriacOut.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/zero_cross_detection.o: zero_cross_detection.c  .generated_files/flags/default/6a5cfe4cc94a56569160676e4f8ae7e101d86a5e .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/zero_cross_detection.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/zero_cross_detection.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS} -g -DDEBUG  -gdwarf-2  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/zero_cross_detection.o.d" -MT "${OBJECTDIR}/zero_cross_detection.o.d" -MT ${OBJECTDIR}/zero_cross_detection.o  -o ${OBJECTDIR}/zero_cross_detection.o zero_cross_detection.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
else
 | 
			
		||||
${OBJECTDIR}/main.o: main.c  .generated_files/flags/default/52eaeaa7d07ae90b9ebbffbef306cbbce3aa5f10 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/main.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/main.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS}  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/main.o.d" -MT "${OBJECTDIR}/main.o.d" -MT ${OBJECTDIR}/main.o  -o ${OBJECTDIR}/main.o main.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/ADC.o: ADC.c  .generated_files/flags/default/eede8fb82cddf13164026cbfcbdc2161dc5d1027 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/ADC.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/ADC.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS}  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/ADC.o.d" -MT "${OBJECTDIR}/ADC.o.d" -MT ${OBJECTDIR}/ADC.o  -o ${OBJECTDIR}/ADC.o ADC.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/RegEdit.o: RegEdit.c  .generated_files/flags/default/d5ee38712223313b7ee32ed8ef5a076d2a609128 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/RegEdit.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/RegEdit.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS}  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/RegEdit.o.d" -MT "${OBJECTDIR}/RegEdit.o.d" -MT ${OBJECTDIR}/RegEdit.o  -o ${OBJECTDIR}/RegEdit.o RegEdit.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/TriacOut.o: TriacOut.c  .generated_files/flags/default/f05fe06cd9004fe425620b9796b5f29c464a514d .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/TriacOut.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/TriacOut.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS}  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/TriacOut.o.d" -MT "${OBJECTDIR}/TriacOut.o.d" -MT ${OBJECTDIR}/TriacOut.o  -o ${OBJECTDIR}/TriacOut.o TriacOut.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
${OBJECTDIR}/zero_cross_detection.o: zero_cross_detection.c  .generated_files/flags/default/ce134025f38c83d75f9f46ccf18023b6ee51cd4 .generated_files/flags/default/da39a3ee5e6b4b0d3255bfef95601890afd80709
 | 
			
		||||
	@${MKDIR} "${OBJECTDIR}" 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/zero_cross_detection.o.d 
 | 
			
		||||
	@${RM} ${OBJECTDIR}/zero_cross_detection.o 
 | 
			
		||||
	 ${MP_CC}  $(MP_EXTRA_CC_PRE) -mmcu=attiny404 ${PACK_COMPILER_OPTIONS} ${PACK_COMMON_OPTIONS}  -x c -c -D__$(MP_PROCESSOR_OPTION)__  -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "${OBJECTDIR}/zero_cross_detection.o.d" -MT "${OBJECTDIR}/zero_cross_detection.o.d" -MT ${OBJECTDIR}/zero_cross_detection.o  -o ${OBJECTDIR}/zero_cross_detection.o zero_cross_detection.c  -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD) 
 | 
			
		||||
	
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: compileCPP
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
else
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
# ------------------------------------------------------------------------------------
 | 
			
		||||
# Rules for buildStep: link
 | 
			
		||||
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
 | 
			
		||||
${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk    
 | 
			
		||||
	@${MKDIR} ${DISTDIR} 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_LD_PRE) -mmcu=attiny404 ${PACK_COMMON_OPTIONS}   -gdwarf-2 -D__$(MP_PROCESSOR_OPTION)__  -Wl,-Map="${DISTDIR}\fg004a.X.${IMAGE_TYPE}.map"    -o ${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}      -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD)  -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION),--defsym=__ICD2RAM=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1 -Wl,--gc-sections -Wl,--start-group  -Wl,-lm -Wl,--end-group 
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
else
 | 
			
		||||
${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES}  nbproject/Makefile-${CND_CONF}.mk   
 | 
			
		||||
	@${MKDIR} ${DISTDIR} 
 | 
			
		||||
	${MP_CC} $(MP_EXTRA_LD_PRE) -mmcu=attiny404 ${PACK_COMMON_OPTIONS}  -D__$(MP_PROCESSOR_OPTION)__  -Wl,-Map="${DISTDIR}\fg004a.X.${IMAGE_TYPE}.map"    -o ${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}      -DXPRJ_default=$(CND_CONF)  $(COMPARISON_BUILD)  -Wl,--defsym=__MPLAB_BUILD=1$(MP_EXTRA_LD_POST)$(MP_LINKER_FILE_OPTION) -Wl,--gc-sections -Wl,--start-group  -Wl,-lm -Wl,--end-group 
 | 
			
		||||
	${MP_CC_DIR}\\avr-objcopy -O ihex "${DISTDIR}/fg004a.X.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX}" "${DISTDIR}/fg004a.X.${IMAGE_TYPE}.hex"
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Subprojects
 | 
			
		||||
.build-subprojects:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Subprojects
 | 
			
		||||
.clean-subprojects:
 | 
			
		||||
 | 
			
		||||
# Clean Targets
 | 
			
		||||
.clean-conf: ${CLEAN_SUBPROJECTS}
 | 
			
		||||
	${RM} -r ${OBJECTDIR}
 | 
			
		||||
	${RM} -r ${DISTDIR}
 | 
			
		||||
 | 
			
		||||
# Enable dependency checking
 | 
			
		||||
.dep.inc: .depcheck-impl
 | 
			
		||||
 | 
			
		||||
DEPFILES=$(wildcard ${POSSIBLE_DEPFILES})
 | 
			
		||||
ifneq (${DEPFILES},)
 | 
			
		||||
include ${DEPFILES}
 | 
			
		||||
endif
 | 
			
		||||
							
								
								
									
										13
									
								
								nbproject/Makefile-genesis.properties
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								nbproject/Makefile-genesis.properties
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,13 @@
 | 
			
		|||
#
 | 
			
		||||
#Sat Sep 14 13:09:18 PDT 2024
 | 
			
		||||
attiny404.languagetoolchain.version=2.46
 | 
			
		||||
attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
 | 
			
		||||
conf.ids=,attiny404
 | 
			
		||||
host.id=2ov5-ff4p-rv
 | 
			
		||||
configurations-xml=e362e05ffa553999bac071152ffccd3b
 | 
			
		||||
attiny404.platformTool.md5=null
 | 
			
		||||
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
 | 
			
		||||
attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin
 | 
			
		||||
proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/High
 | 
			
		||||
attiny404.Pack.dfplocation=/opt/microchip/mplabx/v6.20/packs/Microchip/ATtiny_DFP/3.1.260
 | 
			
		||||
host.platform=linux
 | 
			
		||||
							
								
								
									
										71
									
								
								nbproject/Makefile-impl.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								nbproject/Makefile-impl.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated Makefile - do not edit!
 | 
			
		||||
#
 | 
			
		||||
# Edit the Makefile in the project folder instead (../Makefile). Each target
 | 
			
		||||
# has a pre- and a post- target defined where you can add customization code.
 | 
			
		||||
#
 | 
			
		||||
# This makefile implements macros and targets common to all configurations.
 | 
			
		||||
#
 | 
			
		||||
# NOCDDL
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
 | 
			
		||||
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
 | 
			
		||||
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
 | 
			
		||||
# and .clean-reqprojects-conf unless SUB has the value 'no'
 | 
			
		||||
SUB_no=NO
 | 
			
		||||
SUBPROJECTS=${SUB_${SUB}}
 | 
			
		||||
BUILD_SUBPROJECTS_=.build-subprojects
 | 
			
		||||
BUILD_SUBPROJECTS_NO=
 | 
			
		||||
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
 | 
			
		||||
CLEAN_SUBPROJECTS_=.clean-subprojects
 | 
			
		||||
CLEAN_SUBPROJECTS_NO=
 | 
			
		||||
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Project Name
 | 
			
		||||
PROJECTNAME=High
 | 
			
		||||
 | 
			
		||||
# Active Configuration
 | 
			
		||||
DEFAULTCONF=attiny404
 | 
			
		||||
CONF=${DEFAULTCONF}
 | 
			
		||||
 | 
			
		||||
# All Configurations
 | 
			
		||||
ALLCONFS=default attiny404 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# build
 | 
			
		||||
.build-impl: .build-pre
 | 
			
		||||
	${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# clean
 | 
			
		||||
.clean-impl: .clean-pre
 | 
			
		||||
	${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
 | 
			
		||||
 | 
			
		||||
# clobber
 | 
			
		||||
.clobber-impl: .clobber-pre .depcheck-impl
 | 
			
		||||
	    ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean
 | 
			
		||||
	    ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=attiny404 clean
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# all
 | 
			
		||||
.all-impl: .all-pre .depcheck-impl
 | 
			
		||||
	    ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build
 | 
			
		||||
	    ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=attiny404 build
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# dependency checking support
 | 
			
		||||
.depcheck-impl:
 | 
			
		||||
#	@echo "# This code depends on make tool being used" >.dep.inc
 | 
			
		||||
#	@if [ -n "${MAKE_VERSION}" ]; then \
 | 
			
		||||
#	    echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
 | 
			
		||||
#	    echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
 | 
			
		||||
#	    echo "include \$${DEPFILES}" >>.dep.inc; \
 | 
			
		||||
#	    echo "endif" >>.dep.inc; \
 | 
			
		||||
#	else \
 | 
			
		||||
#	    echo ".KEEP_STATE:" >>.dep.inc; \
 | 
			
		||||
#	    echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
 | 
			
		||||
#	fi
 | 
			
		||||
							
								
								
									
										36
									
								
								nbproject/Makefile-local-attiny404.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								nbproject/Makefile-local-attiny404.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated Makefile - do not edit!
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# This file contains information about the location of compilers and other tools.
 | 
			
		||||
# If you commmit this file into your revision control server, you will be able to 
 | 
			
		||||
# to checkout the project and build it from the command line with make. However,
 | 
			
		||||
# if more than one person works on the same project, then this file might show
 | 
			
		||||
# conflicts since different users are bound to have compilers in different places.
 | 
			
		||||
# In that case you might choose to not commit this file and let MPLAB X recreate this file
 | 
			
		||||
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
 | 
			
		||||
# least once so the file gets created and the project can be built. Finally, you can also
 | 
			
		||||
# avoid using this file at all if you are only building from the command line with make.
 | 
			
		||||
# You can invoke make with the values of the macros:
 | 
			
		||||
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...  
 | 
			
		||||
#
 | 
			
		||||
PATH_TO_IDE_BIN=/opt/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/
 | 
			
		||||
# Adding MPLAB X bin directory to path.
 | 
			
		||||
PATH:=/opt/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
 | 
			
		||||
# Path to java used to run MPLAB X when this makefile was created
 | 
			
		||||
MP_JAVA_PATH="/opt/microchip/mplabx/v6.20/sys/java/zulu8.64.0.19-ca-fx-jre8.0.345-linux_x64/bin/"
 | 
			
		||||
OS_CURRENT="$(shell uname -s)"
 | 
			
		||||
MP_CC="/opt/microchip/xc8/v2.46/bin/xc8-cc"
 | 
			
		||||
# MP_CPPC is not defined
 | 
			
		||||
# MP_BC is not defined
 | 
			
		||||
MP_AS="/opt/microchip/xc8/v2.46/bin/xc8-cc"
 | 
			
		||||
MP_LD="/opt/microchip/xc8/v2.46/bin/xc8-cc"
 | 
			
		||||
MP_AR="/opt/microchip/xc8/v2.46/bin/xc8-ar"
 | 
			
		||||
DEP_GEN=${MP_JAVA_PATH}java -jar "/opt/microchip/mplabx/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
 | 
			
		||||
MP_CC_DIR="/opt/microchip/xc8/v2.46/bin"
 | 
			
		||||
# MP_CPPC_DIR is not defined
 | 
			
		||||
# MP_BC_DIR is not defined
 | 
			
		||||
MP_AS_DIR="/opt/microchip/xc8/v2.46/bin"
 | 
			
		||||
MP_LD_DIR="/opt/microchip/xc8/v2.46/bin"
 | 
			
		||||
MP_AR_DIR="/opt/microchip/xc8/v2.46/bin"
 | 
			
		||||
DFP_DIR=/opt/microchip/mplabx/v6.20/packs/Microchip/ATtiny_DFP/3.1.260
 | 
			
		||||
							
								
								
									
										37
									
								
								nbproject/Makefile-local-default.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								nbproject/Makefile-local-default.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated Makefile - do not edit!
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# This file contains information about the location of compilers and other tools.
 | 
			
		||||
# If you commmit this file into your revision control server, you will be able to 
 | 
			
		||||
# to checkout the project and build it from the command line with make. However,
 | 
			
		||||
# if more than one person works on the same project, then this file might show
 | 
			
		||||
# conflicts since different users are bound to have compilers in different places.
 | 
			
		||||
# In that case you might choose to not commit this file and let MPLAB X recreate this file
 | 
			
		||||
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
 | 
			
		||||
# least once so the file gets created and the project can be built. Finally, you can also
 | 
			
		||||
# avoid using this file at all if you are only building from the command line with make.
 | 
			
		||||
# You can invoke make with the values of the macros:
 | 
			
		||||
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...  
 | 
			
		||||
#
 | 
			
		||||
SHELL=cmd.exe
 | 
			
		||||
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/
 | 
			
		||||
# Adding MPLAB X bin directory to path.
 | 
			
		||||
PATH:=C:/Program Files/Microchip/MPLABX/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
 | 
			
		||||
# Path to java used to run MPLAB X when this makefile was created
 | 
			
		||||
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v6.20\sys\java\zulu8.64.0.19-ca-fx-jre8.0.345-win_x64/bin/"
 | 
			
		||||
OS_CURRENT="$(shell uname -s)"
 | 
			
		||||
MP_CC="C:\Program Files\avr-gcc\bin\avr-gcc.exe"
 | 
			
		||||
MP_CPPC="C:\Program Files\avr-gcc\bin\avr-g++.exe"
 | 
			
		||||
# MP_BC is not defined
 | 
			
		||||
MP_AS="C:\Program Files\avr-gcc\bin\avr-as.exe"
 | 
			
		||||
MP_LD="C:\Program Files\avr-gcc\bin\avr-ld.exe"
 | 
			
		||||
MP_AR="C:\Program Files\avr-gcc\bin\avr-gcc-ar.exe"
 | 
			
		||||
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v6.20/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
 | 
			
		||||
MP_CC_DIR="C:\Program Files\avr-gcc\bin"
 | 
			
		||||
MP_CPPC_DIR="C:\Program Files\avr-gcc\bin"
 | 
			
		||||
# MP_BC_DIR is not defined
 | 
			
		||||
MP_AS_DIR="C:\Program Files\avr-gcc\bin"
 | 
			
		||||
MP_LD_DIR="C:\Program Files\avr-gcc\bin"
 | 
			
		||||
MP_AR_DIR="C:\Program Files\avr-gcc\bin"
 | 
			
		||||
DFP_DIR=C:/Program Files/Microchip/MPLABX/v6.20/packs/Microchip/ATtiny_DFP/3.1.260
 | 
			
		||||
							
								
								
									
										14
									
								
								nbproject/Makefile-variables.mk
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								nbproject/Makefile-variables.mk
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#
 | 
			
		||||
# Generated - do not edit!
 | 
			
		||||
#
 | 
			
		||||
# NOCDDL
 | 
			
		||||
#
 | 
			
		||||
CND_BASEDIR=`pwd`
 | 
			
		||||
# default configuration
 | 
			
		||||
CND_ARTIFACT_DIR_default=dist/default/production
 | 
			
		||||
CND_ARTIFACT_NAME_default=High.production.hex
 | 
			
		||||
CND_ARTIFACT_PATH_default=dist/default/production/High.production.hex
 | 
			
		||||
# attiny404 configuration
 | 
			
		||||
CND_ARTIFACT_DIR_attiny404=dist/attiny404/production
 | 
			
		||||
CND_ARTIFACT_NAME_attiny404=High.production.hex
 | 
			
		||||
CND_ARTIFACT_PATH_attiny404=dist/attiny404/production/High.production.hex
 | 
			
		||||
							
								
								
									
										592
									
								
								nbproject/configurations.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										592
									
								
								nbproject/configurations.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,592 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<configurationDescriptor version="65">
 | 
			
		||||
  <logicalFolder name="root" displayName="root" projectFiles="true">
 | 
			
		||||
    <logicalFolder name="HeaderFiles"
 | 
			
		||||
                   displayName="Header Files"
 | 
			
		||||
                   projectFiles="true">
 | 
			
		||||
      <itemPath>src/ADC/ADC.h</itemPath>
 | 
			
		||||
      <itemPath>src/load/load.h</itemPath>
 | 
			
		||||
      <itemPath>src/RegEdit/RegEdit.h</itemPath>
 | 
			
		||||
      <itemPath>src/usart/usart.h</itemPath>
 | 
			
		||||
      <itemPath>src/zero_cross_detection/zero_cross_detection.h</itemPath>
 | 
			
		||||
      <itemPath>inc/config.h</itemPath>
 | 
			
		||||
      <itemPath>src/Enable/Enable.h</itemPath>
 | 
			
		||||
      <itemPath>src/EnOut/EnOut.h</itemPath>
 | 
			
		||||
    </logicalFolder>
 | 
			
		||||
    <logicalFolder name="ExternalFiles"
 | 
			
		||||
                   displayName="Important Files"
 | 
			
		||||
                   projectFiles="true">
 | 
			
		||||
      <itemPath>Makefile</itemPath>
 | 
			
		||||
    </logicalFolder>
 | 
			
		||||
    <logicalFolder name="LinkerScript"
 | 
			
		||||
                   displayName="Linker Files"
 | 
			
		||||
                   projectFiles="true">
 | 
			
		||||
    </logicalFolder>
 | 
			
		||||
    <logicalFolder name="SourceFiles"
 | 
			
		||||
                   displayName="Source Files"
 | 
			
		||||
                   projectFiles="true">
 | 
			
		||||
      <itemPath>src/main.c</itemPath>
 | 
			
		||||
      <itemPath>src/ADC/ADC.c</itemPath>
 | 
			
		||||
      <itemPath>src/load/load.c</itemPath>
 | 
			
		||||
      <itemPath>src/RegEdit/RegEdit.c</itemPath>
 | 
			
		||||
      <itemPath>src/usart/usart.c</itemPath>
 | 
			
		||||
      <itemPath>src/zero_cross_detection/zero_cross_detection.c</itemPath>
 | 
			
		||||
      <itemPath>src/Enable/Enable.c</itemPath>
 | 
			
		||||
      <itemPath>src/EnOut/EnOut.c</itemPath>
 | 
			
		||||
    </logicalFolder>
 | 
			
		||||
  </logicalFolder>
 | 
			
		||||
  <sourceRootList>
 | 
			
		||||
    <Elem>.</Elem>
 | 
			
		||||
  </sourceRootList>
 | 
			
		||||
  <projectmakefile>Makefile</projectmakefile>
 | 
			
		||||
  <confs>
 | 
			
		||||
    <conf name="default" type="2">
 | 
			
		||||
      <toolsSet>
 | 
			
		||||
        <developmentServer>localhost</developmentServer>
 | 
			
		||||
        <targetDevice>ATtiny404</targetDevice>
 | 
			
		||||
        <targetHeader></targetHeader>
 | 
			
		||||
        <targetPluginBoard></targetPluginBoard>
 | 
			
		||||
        <platformTool>PK5Tool</platformTool>
 | 
			
		||||
        <languageToolchain>AVR</languageToolchain>
 | 
			
		||||
        <languageToolchainVersion>1.00</languageToolchainVersion>
 | 
			
		||||
        <platform>2</platform>
 | 
			
		||||
      </toolsSet>
 | 
			
		||||
      <packs>
 | 
			
		||||
        <pack name="ATtiny_DFP" vendor="Microchip" version="3.1.260"/>
 | 
			
		||||
      </packs>
 | 
			
		||||
      <ScriptingSettings>
 | 
			
		||||
      </ScriptingSettings>
 | 
			
		||||
      <compileType>
 | 
			
		||||
        <linkerTool>
 | 
			
		||||
          <linkerLibItems>
 | 
			
		||||
          </linkerLibItems>
 | 
			
		||||
        </linkerTool>
 | 
			
		||||
        <archiverTool>
 | 
			
		||||
        </archiverTool>
 | 
			
		||||
        <loading>
 | 
			
		||||
          <useAlternateLoadableFile>false</useAlternateLoadableFile>
 | 
			
		||||
          <parseOnProdLoad>false</parseOnProdLoad>
 | 
			
		||||
          <alternateLoadableFile></alternateLoadableFile>
 | 
			
		||||
        </loading>
 | 
			
		||||
        <subordinates>
 | 
			
		||||
        </subordinates>
 | 
			
		||||
      </compileType>
 | 
			
		||||
      <makeCustomizationType>
 | 
			
		||||
        <makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
 | 
			
		||||
        <makeUseCleanTarget>false</makeUseCleanTarget>
 | 
			
		||||
        <makeCustomizationPreStep></makeCustomizationPreStep>
 | 
			
		||||
        <makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
 | 
			
		||||
        <makeCustomizationPostStep></makeCustomizationPostStep>
 | 
			
		||||
        <makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
 | 
			
		||||
        <makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
 | 
			
		||||
        <makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
 | 
			
		||||
      </makeCustomizationType>
 | 
			
		||||
      <AVR-AR>
 | 
			
		||||
        <property key="archiver-flags" value="-r"/>
 | 
			
		||||
      </AVR-AR>
 | 
			
		||||
      <AVR-AS>
 | 
			
		||||
        <property key="announce-version" value="false"/>
 | 
			
		||||
        <property key="include-paths" value=""/>
 | 
			
		||||
        <property key="suppress-warnings" value="false"/>
 | 
			
		||||
      </AVR-AS>
 | 
			
		||||
      <AVR-AS-PRE>
 | 
			
		||||
        <property key="announce-version" value="false"/>
 | 
			
		||||
        <property key="include-paths" value=""/>
 | 
			
		||||
        <property key="preprocessor-macros" value=""/>
 | 
			
		||||
        <property key="preprocessor-macros-undefined" value=""/>
 | 
			
		||||
        <property key="suppress-warnings" value="false"/>
 | 
			
		||||
      </AVR-AS-PRE>
 | 
			
		||||
      <AVR-CPP>
 | 
			
		||||
        <property key="additional-warnings" value="true"/>
 | 
			
		||||
        <property key="call-prologues" value="false"/>
 | 
			
		||||
        <property key="default-bitfield-type" value="true"/>
 | 
			
		||||
        <property key="default-char-type" value="true"/>
 | 
			
		||||
        <property key="extra-include-directories" value=""/>
 | 
			
		||||
        <property key="garbage-collect-data" value="true"/>
 | 
			
		||||
        <property key="garbage-collect-functions" value="true"/>
 | 
			
		||||
        <property key="inhibit-all" value="false"/>
 | 
			
		||||
        <property key="make-warnings-into-errors" value="false"/>
 | 
			
		||||
        <property key="no-interrupts" value="false"/>
 | 
			
		||||
        <property key="no-system-directories" value="false"/>
 | 
			
		||||
        <property key="optimization-level" value="-O1"/>
 | 
			
		||||
        <property key="pack-struct" value="true"/>
 | 
			
		||||
        <property key="preprocess-only" value="false"/>
 | 
			
		||||
        <property key="preprocessor-macros" value=""/>
 | 
			
		||||
        <property key="preprocessor-macros-undefined" value=""/>
 | 
			
		||||
        <property key="save-temps" value="false"/>
 | 
			
		||||
        <property key="short-calls" value="false"/>
 | 
			
		||||
        <property key="short-enums" value="true"/>
 | 
			
		||||
        <property key="strict-ansi" value="false"/>
 | 
			
		||||
        <property key="strict-ansi-errors" value="false"/>
 | 
			
		||||
        <property key="support-ansi" value="false"/>
 | 
			
		||||
        <property key="syntax-only" value="false"/>
 | 
			
		||||
        <property key="undefined-identifier" value="false"/>
 | 
			
		||||
        <property key="verbose" value="false"/>
 | 
			
		||||
      </AVR-CPP>
 | 
			
		||||
      <AVR-GCC>
 | 
			
		||||
        <property key="additional-warnings" value="true"/>
 | 
			
		||||
        <property key="call-prologues" value="false"/>
 | 
			
		||||
        <property key="default-bitfield-type" value="true"/>
 | 
			
		||||
        <property key="default-char-type" value="true"/>
 | 
			
		||||
        <property key="extra-include-directories" value=""/>
 | 
			
		||||
        <property key="extra-warnings" value="false"/>
 | 
			
		||||
        <property key="garbage-collect-data" value="true"/>
 | 
			
		||||
        <property key="garbage-collect-functions" value="true"/>
 | 
			
		||||
        <property key="inhibit-all" value="false"/>
 | 
			
		||||
        <property key="make-warnings-into-errors" value="false"/>
 | 
			
		||||
        <property key="no-interrupts" value="false"/>
 | 
			
		||||
        <property key="no-system-directories" value="false"/>
 | 
			
		||||
        <property key="optimization-level" value="-O1"/>
 | 
			
		||||
        <property key="pack-struct" value="true"/>
 | 
			
		||||
        <property key="preprocessor-macros" value=""/>
 | 
			
		||||
        <property key="preprocessor-macros-undefined" value=""/>
 | 
			
		||||
        <property key="save-temps" value="false"/>
 | 
			
		||||
        <property key="short-calls" value="false"/>
 | 
			
		||||
        <property key="short-enums" value="true"/>
 | 
			
		||||
        <property key="strict-ansi" value="false"/>
 | 
			
		||||
        <property key="strict-ansi-errors" value="false"/>
 | 
			
		||||
        <property key="support-ansi" value="false"/>
 | 
			
		||||
        <property key="syntax-only" value="false"/>
 | 
			
		||||
        <property key="undefined-identifier" value="false"/>
 | 
			
		||||
        <property key="verbose" value="false"/>
 | 
			
		||||
      </AVR-GCC>
 | 
			
		||||
      <AVR-Global>
 | 
			
		||||
        <property key="common-include-directories" value=""/>
 | 
			
		||||
        <property key="eep" value="false"/>
 | 
			
		||||
        <property key="external-ram-check" value="false"/>
 | 
			
		||||
        <property key="hex" value="true"/>
 | 
			
		||||
        <property key="lss" value="false"/>
 | 
			
		||||
        <property key="omit-pack-options" value="false"/>
 | 
			
		||||
        <property key="relax-branches" value="false"/>
 | 
			
		||||
        <property key="srec" value="false"/>
 | 
			
		||||
        <property key="user-pack-device-support" value=""/>
 | 
			
		||||
        <property key="user-pack-include" value=""/>
 | 
			
		||||
        <property key="usersig" value="false"/>
 | 
			
		||||
      </AVR-Global>
 | 
			
		||||
      <AVR-LD>
 | 
			
		||||
        <property key="eeprom-segment" value=""/>
 | 
			
		||||
        <property key="exclude-standard-libraries" value="false"/>
 | 
			
		||||
        <property key="extra-lib-directories" value=""/>
 | 
			
		||||
        <property key="flash-segment" value=""/>
 | 
			
		||||
        <property key="generate-map-file" value="true"/>
 | 
			
		||||
        <property key="initial-stack-address" value=""/>
 | 
			
		||||
        <property key="input-libraries" value="libm"/>
 | 
			
		||||
        <property key="no-default-libs" value="false"/>
 | 
			
		||||
        <property key="no-shared-libraries" value="false"/>
 | 
			
		||||
        <property key="no-startup-files" value="false"/>
 | 
			
		||||
        <property key="omit-symbol-information" value="false"/>
 | 
			
		||||
        <property key="other-options" value=""/>
 | 
			
		||||
        <property key="remove-unused-sections" value="true"/>
 | 
			
		||||
        <property key="rodata-writable" value="false"/>
 | 
			
		||||
        <property key="sram-segment" value=""/>
 | 
			
		||||
        <property key="v-printf" value="false"/>
 | 
			
		||||
      </AVR-LD>
 | 
			
		||||
      <PK5Tool>
 | 
			
		||||
        <property key="AutoSelectMemRanges" value="auto"/>
 | 
			
		||||
        <property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
 | 
			
		||||
        <property key="ToolFirmwareFilePath"
 | 
			
		||||
                  value="Press to browse for a specific firmware version"/>
 | 
			
		||||
        <property key="ToolFirmwareOption.UpdateOptions"
 | 
			
		||||
                  value="ToolFirmwareOption.UseLatest"/>
 | 
			
		||||
        <property key="ToolFirmwareToolPack"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="communication.activationmode" value="nohv"/>
 | 
			
		||||
        <property key="communication.interface" value="updi"/>
 | 
			
		||||
        <property key="communication.interface.jtag" value="2wire"/>
 | 
			
		||||
        <property key="communication.speed" value="0.500"/>
 | 
			
		||||
        <property key="debugoptions.debug-startup" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.reset-behaviour" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.useswbreakpoints" value="false"/>
 | 
			
		||||
        <property key="event.recorder.debugger.behavior" value="Running"/>
 | 
			
		||||
        <property key="event.recorder.enabled" value="false"/>
 | 
			
		||||
        <property key="event.recorder.scvd.files" value=""/>
 | 
			
		||||
        <property key="hwtoolclock.frcindebug" value="false"/>
 | 
			
		||||
        <property key="lastid" value=""/>
 | 
			
		||||
        <property key="memories.aux" value="false"/>
 | 
			
		||||
        <property key="memories.bootflash" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory2" value="true"/>
 | 
			
		||||
        <property key="memories.dataflash" value="true"/>
 | 
			
		||||
        <property key="memories.eeprom" value="true"/>
 | 
			
		||||
        <property key="memories.exclude.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.flashdata" value="true"/>
 | 
			
		||||
        <property key="memories.id" value="true"/>
 | 
			
		||||
        <property key="memories.instruction.ram.ranges"
 | 
			
		||||
                  value="${memories.instruction.ram.ranges}"/>
 | 
			
		||||
        <property key="memories.programmemory" value="true"/>
 | 
			
		||||
        <property key="memories.programmemory.ranges" value="0-7ff"/>
 | 
			
		||||
        <property key="poweroptions.powerenable" value="true"/>
 | 
			
		||||
        <property key="programmerToGoImageName" value="fg004a_ptg"/>
 | 
			
		||||
        <property key="programoptions.donoteraseauxmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.eraseb4program" value="true"/>
 | 
			
		||||
        <property key="programoptions.ledbrightness" value="5"/>
 | 
			
		||||
        <property key="programoptions.pgcconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgcresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgdconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgdresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgmentry.voltage" value="low"/>
 | 
			
		||||
        <property key="programoptions.pgmspeed" value="Med"/>
 | 
			
		||||
        <property key="programoptions.preservedataflash" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom.ranges" value="1400-147f"/>
 | 
			
		||||
        <property key="programoptions.preserveprogram.ranges" value=""/>
 | 
			
		||||
        <property key="programoptions.preserveprogramrange" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveuserid" value="false"/>
 | 
			
		||||
        <property key="programoptions.program.otpconfig" value="false"/>
 | 
			
		||||
        <property key="programoptions.programcalmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.programuserotp" value="false"/>
 | 
			
		||||
        <property key="programoptions.smart.program" value="When debugging only"/>
 | 
			
		||||
        <property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
 | 
			
		||||
        <property key="ptgProgramImage" value="true"/>
 | 
			
		||||
        <property key="ptgSendImage" value="true"/>
 | 
			
		||||
        <property key="toolpack.updateoptions"
 | 
			
		||||
                  value="toolpack.updateoptions.uselatestoolpack"/>
 | 
			
		||||
        <property key="toolpack.updateoptions.packversion"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="voltagevalue" value="5.0"/>
 | 
			
		||||
      </PK5Tool>
 | 
			
		||||
      <Tool>
 | 
			
		||||
        <property key="AutoSelectMemRanges" value="auto"/>
 | 
			
		||||
        <property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
 | 
			
		||||
        <property key="ToolFirmwareFilePath"
 | 
			
		||||
                  value="Press to browse for a specific firmware version"/>
 | 
			
		||||
        <property key="ToolFirmwareOption.UpdateOptions"
 | 
			
		||||
                  value="ToolFirmwareOption.UseLatest"/>
 | 
			
		||||
        <property key="ToolFirmwareToolPack"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="communication.activationmode" value="nohv"/>
 | 
			
		||||
        <property key="communication.interface" value="updi"/>
 | 
			
		||||
        <property key="communication.interface.jtag" value="2wire"/>
 | 
			
		||||
        <property key="communication.speed" value="0.500"/>
 | 
			
		||||
        <property key="debugoptions.debug-startup" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.reset-behaviour" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.useswbreakpoints" value="false"/>
 | 
			
		||||
        <property key="event.recorder.debugger.behavior" value="Running"/>
 | 
			
		||||
        <property key="event.recorder.enabled" value="false"/>
 | 
			
		||||
        <property key="event.recorder.scvd.files" value=""/>
 | 
			
		||||
        <property key="hwtoolclock.frcindebug" value="false"/>
 | 
			
		||||
        <property key="lastid" value=""/>
 | 
			
		||||
        <property key="memories.aux" value="false"/>
 | 
			
		||||
        <property key="memories.bootflash" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory2" value="true"/>
 | 
			
		||||
        <property key="memories.dataflash" value="true"/>
 | 
			
		||||
        <property key="memories.eeprom" value="true"/>
 | 
			
		||||
        <property key="memories.exclude.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.flashdata" value="true"/>
 | 
			
		||||
        <property key="memories.id" value="true"/>
 | 
			
		||||
        <property key="memories.instruction.ram.ranges"
 | 
			
		||||
                  value="${memories.instruction.ram.ranges}"/>
 | 
			
		||||
        <property key="memories.programmemory" value="true"/>
 | 
			
		||||
        <property key="memories.programmemory.ranges" value="0-7ff"/>
 | 
			
		||||
        <property key="poweroptions.powerenable" value="true"/>
 | 
			
		||||
        <property key="programmerToGoFilePath"
 | 
			
		||||
                  value="C:/Users/Lenovo/MPLABXProjects/fg004a.X/debug/default/fg004a_ptg"/>
 | 
			
		||||
        <property key="programmerToGoImageName" value="fg004a_ptg"/>
 | 
			
		||||
        <property key="programoptions.donoteraseauxmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.eraseb4program" value="true"/>
 | 
			
		||||
        <property key="programoptions.ledbrightness" value="5"/>
 | 
			
		||||
        <property key="programoptions.pgcconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgcresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgdconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgdresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgmentry.voltage" value="low"/>
 | 
			
		||||
        <property key="programoptions.pgmspeed" value="Med"/>
 | 
			
		||||
        <property key="programoptions.preservedataflash" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom.ranges" value="1400-147f"/>
 | 
			
		||||
        <property key="programoptions.preserveprogram.ranges" value=""/>
 | 
			
		||||
        <property key="programoptions.preserveprogramrange" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveuserid" value="false"/>
 | 
			
		||||
        <property key="programoptions.program.otpconfig" value="false"/>
 | 
			
		||||
        <property key="programoptions.programcalmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.programuserotp" value="false"/>
 | 
			
		||||
        <property key="programoptions.smart.program" value="When debugging only"/>
 | 
			
		||||
        <property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
 | 
			
		||||
        <property key="ptgProgramImage" value="true"/>
 | 
			
		||||
        <property key="ptgSendImage" value="true"/>
 | 
			
		||||
        <property key="toolpack.updateoptions"
 | 
			
		||||
                  value="toolpack.updateoptions.uselatestoolpack"/>
 | 
			
		||||
        <property key="toolpack.updateoptions.packversion"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="voltagevalue" value="5.0"/>
 | 
			
		||||
      </Tool>
 | 
			
		||||
    </conf>
 | 
			
		||||
    <conf name="attiny404" type="2">
 | 
			
		||||
      <toolsSet>
 | 
			
		||||
        <developmentServer>localhost</developmentServer>
 | 
			
		||||
        <targetDevice>ATtiny404</targetDevice>
 | 
			
		||||
        <targetHeader></targetHeader>
 | 
			
		||||
        <targetPluginBoard></targetPluginBoard>
 | 
			
		||||
        <platformTool>noID</platformTool>
 | 
			
		||||
        <languageToolchain>XC8</languageToolchain>
 | 
			
		||||
        <languageToolchainVersion>2.46</languageToolchainVersion>
 | 
			
		||||
        <platform>2</platform>
 | 
			
		||||
      </toolsSet>
 | 
			
		||||
      <packs>
 | 
			
		||||
        <pack name="ATtiny_DFP" vendor="Microchip" version="3.1.260"/>
 | 
			
		||||
      </packs>
 | 
			
		||||
      <ScriptingSettings>
 | 
			
		||||
      </ScriptingSettings>
 | 
			
		||||
      <compileType>
 | 
			
		||||
        <linkerTool>
 | 
			
		||||
          <linkerLibItems>
 | 
			
		||||
          </linkerLibItems>
 | 
			
		||||
        </linkerTool>
 | 
			
		||||
        <archiverTool>
 | 
			
		||||
        </archiverTool>
 | 
			
		||||
        <loading>
 | 
			
		||||
          <useAlternateLoadableFile>false</useAlternateLoadableFile>
 | 
			
		||||
          <parseOnProdLoad>false</parseOnProdLoad>
 | 
			
		||||
          <alternateLoadableFile></alternateLoadableFile>
 | 
			
		||||
        </loading>
 | 
			
		||||
        <subordinates>
 | 
			
		||||
        </subordinates>
 | 
			
		||||
      </compileType>
 | 
			
		||||
      <makeCustomizationType>
 | 
			
		||||
        <makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
 | 
			
		||||
        <makeUseCleanTarget>false</makeUseCleanTarget>
 | 
			
		||||
        <makeCustomizationPreStep></makeCustomizationPreStep>
 | 
			
		||||
        <makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
 | 
			
		||||
        <makeCustomizationPostStep></makeCustomizationPostStep>
 | 
			
		||||
        <makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
 | 
			
		||||
        <makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
 | 
			
		||||
        <makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
 | 
			
		||||
      </makeCustomizationType>
 | 
			
		||||
      <HI-TECH-COMP>
 | 
			
		||||
        <property key="additional-warnings" value="true"/>
 | 
			
		||||
        <property key="asmlist" value="true"/>
 | 
			
		||||
        <property key="call-prologues" value="false"/>
 | 
			
		||||
        <property key="default-bitfield-type" value="true"/>
 | 
			
		||||
        <property key="default-char-type" value="true"/>
 | 
			
		||||
        <property key="define-macros" value=""/>
 | 
			
		||||
        <property key="disable-optimizations" value="false"/>
 | 
			
		||||
        <property key="extra-include-directories"
 | 
			
		||||
                  value="src/ADC;src/load;src/RegEdit;src/EnOut;src/zero_cross_detection;src/usart;inc;src/Enable"/>
 | 
			
		||||
        <property key="favor-optimization-for" value="-speed,+space"/>
 | 
			
		||||
        <property key="garbage-collect-data" value="true"/>
 | 
			
		||||
        <property key="garbage-collect-functions" value="true"/>
 | 
			
		||||
        <property key="identifier-length" value="255"/>
 | 
			
		||||
        <property key="local-generation" value="false"/>
 | 
			
		||||
        <property key="operation-mode" value="free"/>
 | 
			
		||||
        <property key="opt-xc8-compiler-strict_ansi" value="false"/>
 | 
			
		||||
        <property key="optimization-assembler" value="true"/>
 | 
			
		||||
        <property key="optimization-assembler-files" value="true"/>
 | 
			
		||||
        <property key="optimization-debug" value="false"/>
 | 
			
		||||
        <property key="optimization-invariant-enable" value="false"/>
 | 
			
		||||
        <property key="optimization-invariant-value" value="16"/>
 | 
			
		||||
        <property key="optimization-level" value="-O1"/>
 | 
			
		||||
        <property key="optimization-speed" value="false"/>
 | 
			
		||||
        <property key="optimization-stable-enable" value="false"/>
 | 
			
		||||
        <property key="preprocess-assembler" value="true"/>
 | 
			
		||||
        <property key="short-enums" value="true"/>
 | 
			
		||||
        <property key="tentative-definitions" value="-fno-common"/>
 | 
			
		||||
        <property key="undefine-macros" value=""/>
 | 
			
		||||
        <property key="use-cci" value="false"/>
 | 
			
		||||
        <property key="use-iar" value="false"/>
 | 
			
		||||
        <property key="verbose" value="false"/>
 | 
			
		||||
        <property key="warning-level" value="-3"/>
 | 
			
		||||
        <property key="what-to-do" value="ignore"/>
 | 
			
		||||
      </HI-TECH-COMP>
 | 
			
		||||
      <HI-TECH-LINK>
 | 
			
		||||
        <property key="additional-options-checksum" value=""/>
 | 
			
		||||
        <property key="additional-options-checksumAVR" value=""/>
 | 
			
		||||
        <property key="additional-options-code-offset" value=""/>
 | 
			
		||||
        <property key="additional-options-command-line" value=""/>
 | 
			
		||||
        <property key="additional-options-errata" value=""/>
 | 
			
		||||
        <property key="additional-options-extend-address" value="false"/>
 | 
			
		||||
        <property key="additional-options-trace-type" value=""/>
 | 
			
		||||
        <property key="additional-options-use-response-files" value="false"/>
 | 
			
		||||
        <property key="backup-reset-condition-flags" value="false"/>
 | 
			
		||||
        <property key="calibrate-oscillator" value="false"/>
 | 
			
		||||
        <property key="calibrate-oscillator-value" value="0x3400"/>
 | 
			
		||||
        <property key="clear-bss" value="true"/>
 | 
			
		||||
        <property key="code-model-external" value="wordwrite"/>
 | 
			
		||||
        <property key="code-model-rom" value=""/>
 | 
			
		||||
        <property key="create-html-files" value="false"/>
 | 
			
		||||
        <property key="data-model-ram" value=""/>
 | 
			
		||||
        <property key="data-model-size-of-double" value="24"/>
 | 
			
		||||
        <property key="data-model-size-of-double-gcc" value="no-short-double"/>
 | 
			
		||||
        <property key="data-model-size-of-float" value="24"/>
 | 
			
		||||
        <property key="data-model-size-of-float-gcc" value="no-short-float"/>
 | 
			
		||||
        <property key="display-class-usage" value="false"/>
 | 
			
		||||
        <property key="display-hex-usage" value="false"/>
 | 
			
		||||
        <property key="display-overall-usage" value="true"/>
 | 
			
		||||
        <property key="display-psect-usage" value="false"/>
 | 
			
		||||
        <property key="extra-lib-directories" value=""/>
 | 
			
		||||
        <property key="fill-flash-options-addr" value=""/>
 | 
			
		||||
        <property key="fill-flash-options-const" value=""/>
 | 
			
		||||
        <property key="fill-flash-options-how" value="0"/>
 | 
			
		||||
        <property key="fill-flash-options-inc-const" value="1"/>
 | 
			
		||||
        <property key="fill-flash-options-increment" value=""/>
 | 
			
		||||
        <property key="fill-flash-options-seq" value=""/>
 | 
			
		||||
        <property key="fill-flash-options-what" value="0"/>
 | 
			
		||||
        <property key="format-hex-file-for-download" value="false"/>
 | 
			
		||||
        <property key="initialize-data" value="true"/>
 | 
			
		||||
        <property key="input-libraries" value="libm"/>
 | 
			
		||||
        <property key="keep-generated-startup.as" value="false"/>
 | 
			
		||||
        <property key="link-in-c-library" value="true"/>
 | 
			
		||||
        <property key="link-in-c-library-gcc" value=""/>
 | 
			
		||||
        <property key="link-in-peripheral-library" value="false"/>
 | 
			
		||||
        <property key="managed-stack" value="false"/>
 | 
			
		||||
        <property key="opt-xc8-linker-file" value="false"/>
 | 
			
		||||
        <property key="opt-xc8-linker-link_startup" value="false"/>
 | 
			
		||||
        <property key="opt-xc8-linker-serial" value=""/>
 | 
			
		||||
        <property key="program-the-device-with-default-config-words" value="false"/>
 | 
			
		||||
        <property key="remove-unused-sections" value="true"/>
 | 
			
		||||
      </HI-TECH-LINK>
 | 
			
		||||
      <PK5Tool>
 | 
			
		||||
        <property key="AutoSelectMemRanges" value="auto"/>
 | 
			
		||||
        <property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
 | 
			
		||||
        <property key="ToolFirmwareFilePath"
 | 
			
		||||
                  value="Press to browse for a specific firmware version"/>
 | 
			
		||||
        <property key="ToolFirmwareOption.UpdateOptions"
 | 
			
		||||
                  value="ToolFirmwareOption.UseLatest"/>
 | 
			
		||||
        <property key="ToolFirmwareToolPack"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="communication.activationmode" value="nohv"/>
 | 
			
		||||
        <property key="communication.interface" value="updi"/>
 | 
			
		||||
        <property key="communication.interface.jtag" value="2wire"/>
 | 
			
		||||
        <property key="communication.speed" value="0.250"/>
 | 
			
		||||
        <property key="debugoptions.debug-startup" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.reset-behaviour" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.useswbreakpoints" value="false"/>
 | 
			
		||||
        <property key="event.recorder.debugger.behavior" value="Running"/>
 | 
			
		||||
        <property key="event.recorder.enabled" value="false"/>
 | 
			
		||||
        <property key="event.recorder.scvd.files" value=""/>
 | 
			
		||||
        <property key="hwtoolclock.frcindebug" value="false"/>
 | 
			
		||||
        <property key="lastid" value=""/>
 | 
			
		||||
        <property key="memories.aux" value="false"/>
 | 
			
		||||
        <property key="memories.bootflash" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory2" value="true"/>
 | 
			
		||||
        <property key="memories.dataflash" value="true"/>
 | 
			
		||||
        <property key="memories.eeprom" value="true"/>
 | 
			
		||||
        <property key="memories.exclude.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.flashdata" value="true"/>
 | 
			
		||||
        <property key="memories.id" value="true"/>
 | 
			
		||||
        <property key="memories.instruction.ram.ranges"
 | 
			
		||||
                  value="${memories.instruction.ram.ranges}"/>
 | 
			
		||||
        <property key="memories.programmemory" value="true"/>
 | 
			
		||||
        <property key="memories.programmemory.ranges" value="0-7ff"/>
 | 
			
		||||
        <property key="poweroptions.powerenable" value="true"/>
 | 
			
		||||
        <property key="programmerToGoImageName" value="fg004a_ptg"/>
 | 
			
		||||
        <property key="programoptions.donoteraseauxmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.eraseb4program" value="true"/>
 | 
			
		||||
        <property key="programoptions.ledbrightness" value="5"/>
 | 
			
		||||
        <property key="programoptions.pgcconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgcresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgdconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgdresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgmentry.voltage" value="low"/>
 | 
			
		||||
        <property key="programoptions.pgmspeed" value="Med"/>
 | 
			
		||||
        <property key="programoptions.preservedataflash" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom.ranges" value="1400-147f"/>
 | 
			
		||||
        <property key="programoptions.preserveprogram.ranges" value=""/>
 | 
			
		||||
        <property key="programoptions.preserveprogramrange" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveuserid" value="false"/>
 | 
			
		||||
        <property key="programoptions.program.otpconfig" value="false"/>
 | 
			
		||||
        <property key="programoptions.programcalmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.programuserotp" value="false"/>
 | 
			
		||||
        <property key="programoptions.smart.program" value="When debugging only"/>
 | 
			
		||||
        <property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
 | 
			
		||||
        <property key="ptgProgramImage" value="true"/>
 | 
			
		||||
        <property key="ptgSendImage" value="true"/>
 | 
			
		||||
        <property key="toolpack.updateoptions"
 | 
			
		||||
                  value="toolpack.updateoptions.uselatestoolpack"/>
 | 
			
		||||
        <property key="toolpack.updateoptions.packversion"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="voltagevalue" value="5.0"/>
 | 
			
		||||
      </PK5Tool>
 | 
			
		||||
      <Tool>
 | 
			
		||||
        <property key="AutoSelectMemRanges" value="auto"/>
 | 
			
		||||
        <property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
 | 
			
		||||
        <property key="ToolFirmwareFilePath"
 | 
			
		||||
                  value="Press to browse for a specific firmware version"/>
 | 
			
		||||
        <property key="ToolFirmwareOption.UpdateOptions"
 | 
			
		||||
                  value="ToolFirmwareOption.UseLatest"/>
 | 
			
		||||
        <property key="ToolFirmwareToolPack"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="communication.activationmode" value="nohv"/>
 | 
			
		||||
        <property key="communication.interface" value="updi"/>
 | 
			
		||||
        <property key="communication.interface.jtag" value="2wire"/>
 | 
			
		||||
        <property key="communication.speed" value="0.250"/>
 | 
			
		||||
        <property key="debugoptions.debug-startup" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.reset-behaviour" value="Use system settings"/>
 | 
			
		||||
        <property key="debugoptions.useswbreakpoints" value="false"/>
 | 
			
		||||
        <property key="event.recorder.debugger.behavior" value="Running"/>
 | 
			
		||||
        <property key="event.recorder.enabled" value="false"/>
 | 
			
		||||
        <property key="event.recorder.scvd.files" value=""/>
 | 
			
		||||
        <property key="hwtoolclock.frcindebug" value="false"/>
 | 
			
		||||
        <property key="lastid" value=""/>
 | 
			
		||||
        <property key="memories.aux" value="false"/>
 | 
			
		||||
        <property key="memories.bootflash" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.configurationmemory2" value="true"/>
 | 
			
		||||
        <property key="memories.dataflash" value="true"/>
 | 
			
		||||
        <property key="memories.eeprom" value="true"/>
 | 
			
		||||
        <property key="memories.exclude.configurationmemory" value="true"/>
 | 
			
		||||
        <property key="memories.flashdata" value="true"/>
 | 
			
		||||
        <property key="memories.id" value="true"/>
 | 
			
		||||
        <property key="memories.instruction.ram.ranges"
 | 
			
		||||
                  value="${memories.instruction.ram.ranges}"/>
 | 
			
		||||
        <property key="memories.programmemory" value="true"/>
 | 
			
		||||
        <property key="memories.programmemory.ranges" value="0-7ff"/>
 | 
			
		||||
        <property key="poweroptions.powerenable" value="true"/>
 | 
			
		||||
        <property key="programmerToGoFilePath"
 | 
			
		||||
                  value="C:/Users/Lenovo/MPLABXProjects/fg004a.X/debug/default/fg004a_ptg"/>
 | 
			
		||||
        <property key="programmerToGoImageName" value="fg004a_ptg"/>
 | 
			
		||||
        <property key="programoptions.donoteraseauxmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.eraseb4program" value="true"/>
 | 
			
		||||
        <property key="programoptions.ledbrightness" value="5"/>
 | 
			
		||||
        <property key="programoptions.pgcconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgcresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgdconfig" value="pull down"/>
 | 
			
		||||
        <property key="programoptions.pgdresistor.value" value="4.7"/>
 | 
			
		||||
        <property key="programoptions.pgmentry.voltage" value="low"/>
 | 
			
		||||
        <property key="programoptions.pgmspeed" value="Med"/>
 | 
			
		||||
        <property key="programoptions.preservedataflash" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveeeprom.ranges" value="1400-147f"/>
 | 
			
		||||
        <property key="programoptions.preserveprogram.ranges" value=""/>
 | 
			
		||||
        <property key="programoptions.preserveprogramrange" value="false"/>
 | 
			
		||||
        <property key="programoptions.preserveuserid" value="false"/>
 | 
			
		||||
        <property key="programoptions.program.otpconfig" value="false"/>
 | 
			
		||||
        <property key="programoptions.programcalmem" value="false"/>
 | 
			
		||||
        <property key="programoptions.programuserotp" value="false"/>
 | 
			
		||||
        <property key="programoptions.smart.program" value="When debugging only"/>
 | 
			
		||||
        <property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
 | 
			
		||||
        <property key="ptgProgramImage" value="true"/>
 | 
			
		||||
        <property key="ptgSendImage" value="true"/>
 | 
			
		||||
        <property key="toolpack.updateoptions"
 | 
			
		||||
                  value="toolpack.updateoptions.uselatestoolpack"/>
 | 
			
		||||
        <property key="toolpack.updateoptions.packversion"
 | 
			
		||||
                  value="Press to select which tool pack to use"/>
 | 
			
		||||
        <property key="voltagevalue" value="5.0"/>
 | 
			
		||||
      </Tool>
 | 
			
		||||
      <XC8-CO>
 | 
			
		||||
        <property key="coverage-enable" value=""/>
 | 
			
		||||
        <property key="stack-guidance" value="false"/>
 | 
			
		||||
      </XC8-CO>
 | 
			
		||||
      <XC8-config-global>
 | 
			
		||||
        <property key="advanced-elf" value="true"/>
 | 
			
		||||
        <property key="constdata-progmem" value="false"/>
 | 
			
		||||
        <property key="gcc-opt-driver-new" value="true"/>
 | 
			
		||||
        <property key="gcc-opt-std" value="-std=c99"/>
 | 
			
		||||
        <property key="gcc-output-file-format" value="dwarf-3"/>
 | 
			
		||||
        <property key="mapped-progmem" value="false"/>
 | 
			
		||||
        <property key="omit-pack-options" value="false"/>
 | 
			
		||||
        <property key="omit-pack-options-new" value="1"/>
 | 
			
		||||
        <property key="output-file-format" value="-mcof,+elf"/>
 | 
			
		||||
        <property key="smart-io-format" value=""/>
 | 
			
		||||
        <property key="stack-size-high" value="auto"/>
 | 
			
		||||
        <property key="stack-size-low" value="auto"/>
 | 
			
		||||
        <property key="stack-size-main" value="auto"/>
 | 
			
		||||
        <property key="stack-type" value="compiled"/>
 | 
			
		||||
        <property key="user-pack-device-support" value=""/>
 | 
			
		||||
        <property key="wpo-lto" value="false"/>
 | 
			
		||||
      </XC8-config-global>
 | 
			
		||||
    </conf>
 | 
			
		||||
  </confs>
 | 
			
		||||
</configurationDescriptor>
 | 
			
		||||
							
								
								
									
										53
									
								
								nbproject/private/SuppressibleMessageMemo.properties
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								nbproject/private/SuppressibleMessageMemo.properties
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
#
 | 
			
		||||
#Tue Jul 02 11:57:01 PDT 2024
 | 
			
		||||
pk4hybrid/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
realice/CAL_WARNING=false
 | 
			
		||||
icd5/CAL_WARNING=false
 | 
			
		||||
pk4hybrid/DEVID_MISMATCH=false
 | 
			
		||||
pkobskde/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
icd4/SIMULTANEOUS_DEBUG_WARNING=false
 | 
			
		||||
EmbeddedAssemblySyntax/MULTIPLE_PROJECT_OWNERSHIP=false
 | 
			
		||||
icd3/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
mdbDebugger/MEMORY_VIEW_NO_HW_BP_RESOURCES_WARN=false
 | 
			
		||||
pk3/DEVID_MISMATCH=false
 | 
			
		||||
pk4hybrid/EESAVE_DONT_DO_NUTHIN=false
 | 
			
		||||
pk4hybrid/CANT_HALT_IN_MMD_MODE=false
 | 
			
		||||
mdbDebugger/NO_HW_COMBINER_RESOURCES_WARNING=false
 | 
			
		||||
mdbDebugger/MEMORY_VIEW_LAST_HW_BP_RESOURCE_WARN=false
 | 
			
		||||
pkobskde/CHECK_CLOCK=false
 | 
			
		||||
pk4hybrid/MCLR_HOLD_RESET_NO_MAINTAIN_POWER=false
 | 
			
		||||
realice/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
mdbDebugger/LAST_HW_BP_RESOURCE_WARN=false
 | 
			
		||||
realice/DEVID_MISMATCH=false
 | 
			
		||||
icd4/CAL_WARNING=false
 | 
			
		||||
icd4/PROGRAM_CFG_WARNING=false
 | 
			
		||||
icd3/VPP_FIRST_WARNING=false
 | 
			
		||||
mdbDebugger/SOFTWARE_BREAK_POINT_PREFERENCE=false
 | 
			
		||||
pkoblicdbgr/DEVID_MISMATCH=false
 | 
			
		||||
icd5/SIMULTANEOUS_DEBUG_WARNING=false
 | 
			
		||||
icd5/DEVID_MISMATCH=false
 | 
			
		||||
icd4/DEVID_MISMATCH=false
 | 
			
		||||
icd3/CHECK_CLOCK=false
 | 
			
		||||
icd3/DEVID_MISMATCH=false
 | 
			
		||||
pk4hybrid/SIMULTANEOUS_DEBUG_WARNING=false
 | 
			
		||||
pkoblicdbgr/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
icd5/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
icd4/MCLR_HOLD_RESET_NO_MAINTAIN_POWER=false
 | 
			
		||||
icd3/CAL_WARNING=false
 | 
			
		||||
pk3/CHECK_CLOCK=false
 | 
			
		||||
mdbDebugger/NO_HW_BP_RESOURCES_WARN=false
 | 
			
		||||
pk4hybrid/CAL_WARNING=false
 | 
			
		||||
pkoblicdbgr/CHECK_CLOCK=false
 | 
			
		||||
icd5/MCLR_HOLD_RESET_NO_MAINTAIN_POWER=false
 | 
			
		||||
pk3/CAL_WARNING=false
 | 
			
		||||
pkobskde/VPP_FIRST_WARNING=false
 | 
			
		||||
icd4/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
icd4/EESAVE_DONT_DO_NUTHIN=false
 | 
			
		||||
pk4hybrid/PROGRAM_CFG_WARNING=false
 | 
			
		||||
icd5/EESAVE_DONT_DO_NUTHIN=false
 | 
			
		||||
pkobskde/DEVID_MISMATCH=false
 | 
			
		||||
icd4/CANT_HALT_IN_MMD_MODE=false
 | 
			
		||||
realice/CHECK_CLOCK=false
 | 
			
		||||
pk3/CHECK_4_HIGH_VOLTAGE_VPP=false
 | 
			
		||||
icd5/PROGRAM_CFG_WARNING=false
 | 
			
		||||
pk3/VPP_FIRST_WARNING=false
 | 
			
		||||
							
								
								
									
										43
									
								
								nbproject/private/configurations.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								nbproject/private/configurations.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<configurationDescriptor version="65">
 | 
			
		||||
  <projectmakefile>Makefile</projectmakefile>
 | 
			
		||||
  <defaultConf>1</defaultConf>
 | 
			
		||||
  <confs>
 | 
			
		||||
    <conf name="default" type="2">
 | 
			
		||||
      <platformToolSN>:=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>9036:=<rev>0100:=<man>Microchip Technology Incorporated:=<prod>MPLAB PICkit 5:=<sn>020026702RYN031742:=<drv>x:=<xpt>b:=end</platformToolSN>
 | 
			
		||||
      <languageToolchainDir>C:\Program Files\avr-gcc\bin</languageToolchainDir>
 | 
			
		||||
      <mdbdebugger version="1">
 | 
			
		||||
        <placeholder1>place holder 1</placeholder1>
 | 
			
		||||
        <placeholder2>place holder 2</placeholder2>
 | 
			
		||||
      </mdbdebugger>
 | 
			
		||||
      <runprofile version="6">
 | 
			
		||||
        <args></args>
 | 
			
		||||
        <rundir></rundir>
 | 
			
		||||
        <buildfirst>true</buildfirst>
 | 
			
		||||
        <console-type>0</console-type>
 | 
			
		||||
        <terminal-type>0</terminal-type>
 | 
			
		||||
        <remove-instrumentation>0</remove-instrumentation>
 | 
			
		||||
        <environment>
 | 
			
		||||
        </environment>
 | 
			
		||||
      </runprofile>
 | 
			
		||||
    </conf>
 | 
			
		||||
    <conf name="attiny404" type="2">
 | 
			
		||||
      <platformToolSN>noToolString</platformToolSN>
 | 
			
		||||
      <languageToolchainDir>/opt/microchip/xc8/v2.46/bin</languageToolchainDir>
 | 
			
		||||
      <mdbdebugger version="1">
 | 
			
		||||
        <placeholder1>place holder 1</placeholder1>
 | 
			
		||||
        <placeholder2>place holder 2</placeholder2>
 | 
			
		||||
      </mdbdebugger>
 | 
			
		||||
      <runprofile version="6">
 | 
			
		||||
        <args></args>
 | 
			
		||||
        <rundir></rundir>
 | 
			
		||||
        <buildfirst>true</buildfirst>
 | 
			
		||||
        <console-type>0</console-type>
 | 
			
		||||
        <terminal-type>0</terminal-type>
 | 
			
		||||
        <remove-instrumentation>0</remove-instrumentation>
 | 
			
		||||
        <environment>
 | 
			
		||||
        </environment>
 | 
			
		||||
      </runprofile>
 | 
			
		||||
    </conf>
 | 
			
		||||
  </confs>
 | 
			
		||||
</configurationDescriptor>
 | 
			
		||||
							
								
								
									
										7
									
								
								nbproject/private/private.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								nbproject/private/private.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
 | 
			
		||||
    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
 | 
			
		||||
    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
 | 
			
		||||
        <group/>
 | 
			
		||||
    </open-files>
 | 
			
		||||
</project-private>
 | 
			
		||||
							
								
								
									
										29
									
								
								nbproject/project.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								nbproject/project.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<project xmlns="http://www.netbeans.org/ns/project/1">
 | 
			
		||||
    <type>com.microchip.mplab.nbide.embedded.makeproject</type>
 | 
			
		||||
    <configuration>
 | 
			
		||||
        <data xmlns="http://www.netbeans.org/ns/make-project/1">
 | 
			
		||||
            <name>High</name>
 | 
			
		||||
            <creation-uuid>428c0aa9-0d58-40bd-97a0-d26a5305fcb1</creation-uuid>
 | 
			
		||||
            <make-project-type>0</make-project-type>
 | 
			
		||||
            <sourceEncoding>UTF-8</sourceEncoding>
 | 
			
		||||
            <make-dep-projects/>
 | 
			
		||||
            <sourceRootList>
 | 
			
		||||
                <sourceRootElem>.</sourceRootElem>
 | 
			
		||||
            </sourceRootList>
 | 
			
		||||
            <confList>
 | 
			
		||||
                <confElem>
 | 
			
		||||
                    <name>default</name>
 | 
			
		||||
                    <type>2</type>
 | 
			
		||||
                </confElem>
 | 
			
		||||
                <confElem>
 | 
			
		||||
                    <name>attiny404</name>
 | 
			
		||||
                    <type>2</type>
 | 
			
		||||
                </confElem>
 | 
			
		||||
            </confList>
 | 
			
		||||
            <formatting>
 | 
			
		||||
                <project-formatting-style>false</project-formatting-style>
 | 
			
		||||
            </formatting>
 | 
			
		||||
        </data>
 | 
			
		||||
    </configuration>
 | 
			
		||||
</project>
 | 
			
		||||
							
								
								
									
										1064
									
								
								queuelogs/debugtool.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1064
									
								
								queuelogs/debugtool.txt
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										112
									
								
								src/ADC/ADC.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								src/ADC/ADC.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,112 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: ADC.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __AVR_ATtiny404__
 | 
			
		||||
#define __AVR_ATtiny404__
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "ADC.h"
 | 
			
		||||
#include "RegEdit.h"
 | 
			
		||||
#include "avr/io.h"
 | 
			
		||||
 | 
			
		||||
#define MAX_PIN_NUM 7
 | 
			
		||||
 | 
			
		||||
static bool IsInvalidPin(uint8_t pin_num){
 | 
			
		||||
    if(pin_num > MAX_PIN_NUM){
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_Setup(void)
 | 
			
		||||
{
 | 
			
		||||
    //Clears control register A for ADC0
 | 
			
		||||
    RegEdit_SetNum((void *) &ADC0.CTRLA, 0x00);
 | 
			
		||||
 | 
			
		||||
    //Sets The sample accumulation number to 32.
 | 
			
		||||
    RegEdit_SetNum((void *) &ADC0.CTRLB, 0x5);
 | 
			
		||||
 | 
			
		||||
    //Sets the voltage reference to VDD or VCC.
 | 
			
		||||
    RegEdit_SetBit((void *) &ADC0.CTRLC, 4);
 | 
			
		||||
 | 
			
		||||
    //Sets the pre-scalar for the adc sample rate.
 | 
			
		||||
    RegEdit_SetBit((void *) &ADC0.CTRLC, 2);
 | 
			
		||||
 | 
			
		||||
    //Setup an Initalization delay.
 | 
			
		||||
    RegEdit_OR_Num((void *) &ADC0.CTRLD, (2<<5));
 | 
			
		||||
 | 
			
		||||
    //Set the bit for ADC variation during readings.
 | 
			
		||||
    RegEdit_SetBit((void *) &ADC0.CTRLD, 4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ADC_Init(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
    if(IsInvalidPin(pin_num)){return;}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //set the direction to input 
 | 
			
		||||
    RegEdit_ClearBit((void *) &PORTA.DIR, pin_num);
 | 
			
		||||
 | 
			
		||||
    //Disable the pull-up resistor
 | 
			
		||||
    RegEdit_ClearBit((void *) &PORTA.OUT, pin_num); 
 | 
			
		||||
 
 | 
			
		||||
    //Disable input buffer
 | 
			
		||||
    //We do some kinda nasty address addition but it saves
 | 
			
		||||
    //memory and means we don't need a switch statment.
 | 
			
		||||
    RegEdit_SetBit(
 | 
			
		||||
            (void *) (&PORTA.PIN0CTRL)+pin_num,
 | 
			
		||||
            PORT_ISC_INPUT_DISABLE_gc
 | 
			
		||||
            );
 | 
			
		||||
 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_Enable(void)
 | 
			
		||||
{
 | 
			
		||||
    //Set the enable bit in the CTRLA register
 | 
			
		||||
    RegEdit_SetBit((void *) &ADC0.CTRLA, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_Disable()
 | 
			
		||||
{
 | 
			
		||||
    //Clear the enable ADC flag
 | 
			
		||||
    RegEdit_ClearBit((void *) &ADC0.CTRLA, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ADC_SetPin(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    if(IsInvalidPin(pin_num)){return;}
 | 
			
		||||
    RegEdit_ClearRegister((void *) &ADC0.MUXPOS);
 | 
			
		||||
    RegEdit_SetNum((void *) &ADC0.MUXPOS, pin_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint16_t ADC_ReadValue_Impl(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    RegEdit_SetNum((void *) &ADC0.COMMAND, ADC_STCONV_bm);
 | 
			
		||||
 | 
			
		||||
    /* Wait until ADC conversion done */
 | 
			
		||||
    while ( !(ADC0.INTFLAGS & ADC_RESRDY_bm) )
 | 
			
		||||
    {
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
   
 | 
			
		||||
    /* Clear the interrupt flag by writing 1: */
 | 
			
		||||
    ADC0.INTFLAGS = ADC_RESRDY_bm;
 | 
			
		||||
    
 | 
			
		||||
    uint16_t adc_val = (uint16_t) ADC0.RES;
 | 
			
		||||
    adc_val = adc_val >> 5;
 | 
			
		||||
    return adc_val; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//Set the default for the function pointer.
 | 
			
		||||
uint16_t (*ADC_ReadValue)(uint8_t pin_num) = ADC_ReadValue_Impl;
 | 
			
		||||
							
								
								
									
										74
									
								
								src/ADC/ADC.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								src/ADC/ADC.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief Interface to the AVR ADC hardware. 
 | 
			
		||||
 * @details This file is...
 | 
			
		||||
 * @author Jake G 
 | 
			
		||||
 * @date 2024 
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file ADC.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ADC_H
 | 
			
		||||
#define ADC_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Initializes the AVR hardware in order to accept
 | 
			
		||||
 * Input for ADC usage.
 | 
			
		||||
 * @param pin_num The number of the pin 0-7 you are initializing.
 | 
			
		||||
 *
 | 
			
		||||
 * This function only makes use of PORTA by default. It sets the direction
 | 
			
		||||
 * register to input, disables the pull-up resistor and also diables interrupts
 | 
			
		||||
 * alongside the input buffer(digital).
 | 
			
		||||
 *
 | 
			
		||||
 * This in turn helps reduce noise when using the ADC.
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
void ADC_Init(uint8_t pin_num);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Enables the ADC 
 | 
			
		||||
 */
 | 
			
		||||
void ADC_Enable(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Disables the ADC
 | 
			
		||||
 */
 | 
			
		||||
void ADC_Disable();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Reads ADC value into variable
 | 
			
		||||
 *
 | 
			
		||||
 * @param pin_num The bin number of the ADC pin being read.
 | 
			
		||||
 *
 | 
			
		||||
 * This function depends on the ADC already being initialized and enabled 
 | 
			
		||||
 * before being called.
 | 
			
		||||
 */
 | 
			
		||||
extern uint16_t (*ADC_ReadValue)(uint8_t pin_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets up the ADC
 | 
			
		||||
 *
 | 
			
		||||
 * This function sets up the ADC to take and accumulate 32 samples. It also
 | 
			
		||||
 * sets the inital delay to 32 ADC clock cycles, and sets the VREF to VDD or
 | 
			
		||||
 * VCC.
 | 
			
		||||
 *
 | 
			
		||||
 * This function should only need to be called once.
 | 
			
		||||
 */
 | 
			
		||||
void ADC_Setup(void);     
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sets the pin used in the MUX for ADC0.
 | 
			
		||||
 *
 | 
			
		||||
 * @param pin_num The number of the pin in Port A.
 | 
			
		||||
 */
 | 
			
		||||
void ADC_SetPin(uint8_t pin_num);
 | 
			
		||||
 | 
			
		||||
#endif //ADC_H   
 | 
			
		||||
							
								
								
									
										17
									
								
								src/ADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/ADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
add_library(ADC STATIC
 | 
			
		||||
    ADC.c
 | 
			
		||||
)
 | 
			
		||||
target_include_directories(ADC PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if(UNIT_TESTING)
 | 
			
		||||
    target_link_libraries(ADC
 | 
			
		||||
        MockRegEdit
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
else()
 | 
			
		||||
    target_link_libraries(ADC
 | 
			
		||||
        RegEdit 
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										58
									
								
								src/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								src/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
add_executable(${PROJECT_NAME}
 | 
			
		||||
    main.c    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(${PROJECT_NAME}
 | 
			
		||||
    RegEdit
 | 
			
		||||
    ADC
 | 
			
		||||
    EnOut
 | 
			
		||||
    zero_cross_detection 
 | 
			
		||||
    load
 | 
			
		||||
    Enable
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# Ensure the build rules are defined
 | 
			
		||||
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".elf")
 | 
			
		||||
 | 
			
		||||
if(NOT TARGET size)
 | 
			
		||||
# Set the size utility to display the size of the final binary
 | 
			
		||||
add_custom_target(size ALL
 | 
			
		||||
    COMMAND ${CMAKE_SIZE} --format=avr --mcu=${AVR_MCU} ${CMAKE_PROJECT_NAME}.elf
 | 
			
		||||
    DEPENDS ${CMAKE_PROJECT_NAME}.elf
 | 
			
		||||
)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(NOT TARGET hex)
 | 
			
		||||
# Define how to convert ELF to HEX
 | 
			
		||||
add_custom_target(hex ALL
 | 
			
		||||
    COMMAND ${CMAKE_OBJCOPY} -O ihex -R .eeprom ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.hex
 | 
			
		||||
    DEPENDS ${CMAKE_PROJECT_NAME}.elf
 | 
			
		||||
)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(NOT TARGET bin)
 | 
			
		||||
# Define how to convert ELF to BIN
 | 
			
		||||
add_custom_target(bin ALL
 | 
			
		||||
    COMMAND ${CMAKE_OBJCOPY} -O binary -R .eeprom ${CMAKE_PROJECT_NAME}.elf ${CMAKE_PROJECT_NAME}.bin
 | 
			
		||||
    DEPENDS ${CMAKE_PROJECT_NAME}.elf
 | 
			
		||||
)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(NOT TARGET upload)
 | 
			
		||||
# Upload command (adjust according to your programmer)
 | 
			
		||||
add_custom_target(upload ALL
 | 
			
		||||
    COMMAND avrdude -c ${PROGRAMMER} -P ${PORT} -p ${AVR_MCU} -U flash:w:${CMAKE_PROJECT_NAME}.hex
 | 
			
		||||
    DEPENDS hex
 | 
			
		||||
)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
add_subdirectory(load)
 | 
			
		||||
add_subdirectory(zero_cross_detection)
 | 
			
		||||
add_subdirectory(ADC)
 | 
			
		||||
add_subdirectory(RegEdit)
 | 
			
		||||
add_subdirectory(usart)
 | 
			
		||||
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()
 | 
			
		||||
							
								
								
									
										40
									
								
								src/EnOut/EnOut.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/EnOut/EnOut.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: EnOut.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
#ifndef __AVR_ATtiny404__
 | 
			
		||||
#define __AVR_ATtiny404__
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
#include "EnOut.h"
 | 
			
		||||
#include "RegEdit.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void EnOut_InitTimerA(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EnOut_SetupPins(void)
 | 
			
		||||
{
 | 
			
		||||
    RegEdit_SetBit((void *) &PORTA.DIR, G1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void EnOut_SetAllHigh(void)
 | 
			
		||||
{
 | 
			
		||||
    RegEdit_SetBit((void *) &PORTA.OUT, G1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void EnOut_PulsePins(uint16_t pulse_time)
 | 
			
		||||
{
 | 
			
		||||
    Delay_MicroSeconds(pulse_time);
 | 
			
		||||
 | 
			
		||||
    RegEdit_ClearBit((void *) &PORTA.OUT, G1);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										48
									
								
								src/EnOut/EnOut.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/EnOut/EnOut.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief PUT_TEXT_HERE
 | 
			
		||||
 * @details This file is...
 | 
			
		||||
 * @author username
 | 
			
		||||
 * @date todays_date
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file EnOut.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ENOUT_H 
 | 
			
		||||
#define ENOUT_H 
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define G1 1
 | 
			
		||||
#define G2 3 
 | 
			
		||||
#define G3 2
 | 
			
		||||
 | 
			
		||||
#define G1_BM (1<<1)
 | 
			
		||||
#define G2_BM (1<<3) 
 | 
			
		||||
#define G3_BM (1<<2)
 | 
			
		||||
 | 
			
		||||
extern void (*Delay_MicroSeconds)(double us);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A function that adds two to a number
 | 
			
		||||
 * @param pulse_time The time in micro seconds.
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 EnOut_PulsePins(uint16_t pulse_time);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This sets up the G1, G2 and the G3 pins for output.
 | 
			
		||||
 */
 | 
			
		||||
void EnOut_SetupPins(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This sets G1, G2 and G3 to high on the output.
 | 
			
		||||
 */
 | 
			
		||||
void EnOut_SetAllHigh(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //ENOUT_H
 | 
			
		||||
							
								
								
									
										17
									
								
								src/Enable/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/Enable/CMakeLists.txt
									
										
									
									
									
										Normal 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()
 | 
			
		||||
							
								
								
									
										36
									
								
								src/Enable/Enable.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								src/Enable/Enable.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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); 
 | 
			
		||||
    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;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								src/Enable/Enable.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/Enable/Enable.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @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   
 | 
			
		||||
							
								
								
									
										7
									
								
								src/RegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/RegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
add_library(RegEdit STATIC
 | 
			
		||||
    RegEdit.c
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_include_directories(RegEdit PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										65
									
								
								src/RegEdit/RegEdit.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								src/RegEdit/RegEdit.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: RegEdit.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "RegEdit.h"
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetRegister(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr = 0xFF;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void RegEdit_ClearRegister(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr = 0x00;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetBit(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr |= (uint8_t)(1<<bit_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_ClearBit(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr &= ~(1<<bit_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    return *reg_ptr & (1<<bit_num);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_OR_Num(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr |= num; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_AND_Num(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr &= num; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RegEdit_SetNum(void *reg, uint8_t num)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    *reg_ptr = num; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
uint8_t RegEdit_ReadReg(void *reg)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t *reg_ptr = (uint8_t *)reg;
 | 
			
		||||
    return *reg_ptr;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										78
									
								
								src/RegEdit/RegEdit.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								src/RegEdit/RegEdit.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,78 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief Register Editing Interface 
 | 
			
		||||
 * @details This file is an abstraction to all the bitwise operations 
 | 
			
		||||
 * @author Jake G 
 | 
			
		||||
 * @date 2024 
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file MockRegEdit.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef REGEDIT_H
 | 
			
		||||
#define REGEDIT_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetRegister(void *reg);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_ClearRegister(void *reg);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param bit_num The bit location.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetBit(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param bit_num The bit location.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_ClearBit(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param bit_num The bit location.
 | 
			
		||||
 * @return 
 | 
			
		||||
 */
 | 
			
		||||
bool RegEdit_IsBitSet(void *reg, uint8_t bit_num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param num The bit location.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_OR_Num(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param num The bit location.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_AND_Num(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 * @param num The bit location.
 | 
			
		||||
 */
 | 
			
		||||
void RegEdit_SetNum(void *reg, uint8_t num);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * @param reg The register address.
 | 
			
		||||
 */
 | 
			
		||||
uint8_t RegEdit_ReadReg(void *reg);
 | 
			
		||||
 | 
			
		||||
#endif //REGEDIT_H
 | 
			
		||||
							
								
								
									
										18
									
								
								src/load/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/load/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,18 @@
 | 
			
		|||
add_library(load STATIC
 | 
			
		||||
    load.c
 | 
			
		||||
)
 | 
			
		||||
target_include_directories(load PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
if(UNIT_TESTING)
 | 
			
		||||
    target_link_libraries(load
 | 
			
		||||
        MockRegEdit
 | 
			
		||||
        MockADC
 | 
			
		||||
    )
 | 
			
		||||
else()
 | 
			
		||||
    target_link_libraries(load
 | 
			
		||||
        RegEdit
 | 
			
		||||
        ADC
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										75
									
								
								src/load/load.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								src/load/load.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,75 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: Jake G 
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: load.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __AVR_ATtiny404__
 | 
			
		||||
#define __AVR_ATtiny404__
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
#include "load.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef UNIT_TESTING
 | 
			
		||||
    #include "ADC.h"
 | 
			
		||||
    #include "RegEdit.h"
 | 
			
		||||
#else
 | 
			
		||||
    #include "MockADC/MockADC.h"
 | 
			
		||||
    #include "MockRegEdit.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//These two arrays allow us to track the A and B ports to know when
 | 
			
		||||
//one has been disabled before.
 | 
			
		||||
static bool porta_disabled[8] = {0};
 | 
			
		||||
static bool portb_disabled[8] = {0};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static bool valid_load(uint16_t val)
 | 
			
		||||
{
 | 
			
		||||
    if(val > 527 && val < 1000) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
 | 
			
		||||
{
 | 
			
		||||
    ADC_Init(adc_pin);
 | 
			
		||||
    ADC_Enable();
 | 
			
		||||
    ADC_SetPin(adc_pin);
 | 
			
		||||
    uint16_t val = ADC_ReadValue(adc_pin);
 | 
			
		||||
    
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
    if(valid_load(val) && !porta_disabled[adc_pin]){
 | 
			
		||||
        RegEdit_SetBit((void *) &PORTA.DIR, out_pin);
 | 
			
		||||
        RegEdit_SetBit((void *) &PORTA.OUT, out_pin);
 | 
			
		||||
    }
 | 
			
		||||
    else{
 | 
			
		||||
        RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);
 | 
			
		||||
        porta_disabled[adc_pin] = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Load_HandleLoadPortB(uint8_t adc_pin, uint8_t out_pin)
 | 
			
		||||
{
 | 
			
		||||
    ADC_Init(adc_pin);
 | 
			
		||||
    ADC_Enable();
 | 
			
		||||
    ADC_SetPin(adc_pin);
 | 
			
		||||
    uint16_t val = ADC_ReadValue(adc_pin);
 | 
			
		||||
        
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
    if(valid_load(val) && !portb_disabled[adc_pin]){
 | 
			
		||||
        RegEdit_SetBit((void *) &PORTB.DIR, out_pin);
 | 
			
		||||
        RegEdit_SetBit((void *) &PORTB.OUT, out_pin);
 | 
			
		||||
    }
 | 
			
		||||
    else{
 | 
			
		||||
        RegEdit_ClearBit((void *) &PORTB.OUT, out_pin);
 | 
			
		||||
        portb_disabled[adc_pin] = true;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								src/load/load.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/load/load.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief Module for handling the ADC input from the load pins.
 | 
			
		||||
 * @details This file holds the functions for reading the ADC values.
 | 
			
		||||
 * @author Jake G
 | 
			
		||||
 * @date 2024
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file load.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef LOAD_H
 | 
			
		||||
#define	LOAD_H
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Low Threshold
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
#define LOWTHRESH 527
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief High Threshold
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
#define HIGHTHRESH 1000
 | 
			
		||||
 | 
			
		||||
void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin);
 | 
			
		||||
void Load_HandleLoadPortB(uint8_t adc_pin, uint8_t out_pin);
 | 
			
		||||
 | 
			
		||||
void Load_HandlePinLoads(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif	/* LOAD_H */
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										61
									
								
								src/main.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								src/main.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @file main.c
 | 
			
		||||
 * @author Jake G
 | 
			
		||||
 * @date 18 September 2024
 | 
			
		||||
 * @brief File contains the main function.
 | 
			
		||||
 *
 | 
			
		||||
 * This file contains the main logic loop and exists to setup the values 
 | 
			
		||||
 * specific to the micro-controller. All other functions and configuration are
 | 
			
		||||
 * extracted into separate source files and headers for configuration.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define F_CPU 3333333UL
 | 
			
		||||
 | 
			
		||||
//This can prevent issues with utils/delay.h library with the gcc toolchain
 | 
			
		||||
#define __DELAY_BACKWARD_COMPATIBLE__
 | 
			
		||||
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#include "RegEdit.h"
 | 
			
		||||
#include "zero_cross_detection.h"
 | 
			
		||||
#include "ADC.h"
 | 
			
		||||
#include "EnOut.h"
 | 
			
		||||
#include "load.h"
 | 
			
		||||
#include "Enable.h"
 | 
			
		||||
#include <avr/cpufunc.h> /* Required header file */
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
#include <util/delay.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//Set the function pointer for the delay func
 | 
			
		||||
void (*Delay_MicroSeconds)(double us) = _delay_us;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main(int argc, char **argv)
 | 
			
		||||
{ 
 | 
			
		||||
 | 
			
		||||
    Enable_SetPinsLow();
 | 
			
		||||
    EnOut_SetupPins();
 | 
			
		||||
    ADC_Setup();
 | 
			
		||||
 | 
			
		||||
    while(true){
 | 
			
		||||
        for(int i = 0; i < GatePulsesQty; i++){
 | 
			
		||||
            ZCD_Poll();
 | 
			
		||||
            _delay_us(Tau);
 | 
			
		||||
            EnOut_SetAllHigh();  //Only G1 exists in High power mode
 | 
			
		||||
            EnOut_PulsePins(GatePulses[i]);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        //The G1 pin is low at this point.
 | 
			
		||||
        _delay_ms(2500);
 | 
			
		||||
        ZCD_Poll();
 | 
			
		||||
        
 | 
			
		||||
        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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								src/usart/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/usart/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
add_library(usart STATIC
 | 
			
		||||
    usart.c
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_include_directories(usart PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										64
									
								
								src/usart/usart.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/usart/usart.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: usart.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "usart.h"
 | 
			
		||||
#include <avr/io.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#define F_CPU 3333333UL
 | 
			
		||||
#define F_PER F_CPU / 6
 | 
			
		||||
#define USART0_BAUD_RATE(BAUD_RATE) ((float)(F_PER * 64 / (16 * (float)BAUD_RATE)) + 0.5)
 | 
			
		||||
 | 
			
		||||
//RX PIN6, TX PIN7
 | 
			
		||||
//ALT: RX PIN12 TX PIN11
 | 
			
		||||
void USART0_init(void)
 | 
			
		||||
{
 | 
			
		||||
    //Config TxD as output, and rx as input?
 | 
			
		||||
    PORTB.DIR &= ~(1<<3);
 | 
			
		||||
    PORTB.DIR |= (1<<2);
 | 
			
		||||
    
 | 
			
		||||
    //setup Alternate pints on PA1 and PA2
 | 
			
		||||
    /*
 | 
			
		||||
    PORTMUX.CTRLB |= PORTMUX_USART0_ALTERNATE_gc;
 | 
			
		||||
    PORTA.DIRSET |= (1<<1);
 | 
			
		||||
    PORTA.DIRSET &= ~(1<<2);
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
    //It says to set the TX pin high?
 | 
			
		||||
    //PORTB.OUT |= (1<<2);
 | 
			
		||||
    //PORTA.OUT |= (1<<11);
 | 
			
		||||
 | 
			
		||||
    //set buad rate.
 | 
			
		||||
    USART0.BAUD = (uint16_t)USART0_BAUD_RATE(9600);
 | 
			
		||||
 | 
			
		||||
    //set the frame format.
 | 
			
		||||
    USART0.CTRLC = 0x3;   //setting 8-bit mode.
 | 
			
		||||
 | 
			
		||||
    //Enable transmitter and receiver (USARTn.CTRLB)
 | 
			
		||||
    //USART0.CTRLB |= (1<<7)|(1<<6);
 | 
			
		||||
    USART0.CTRLB |= USART_TXEN_bm; 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void USART0_sendChar(char c)
 | 
			
		||||
{
 | 
			
		||||
    while (!(USART0.STATUS & USART_DREIF_bm)){
 | 
			
		||||
        ;
 | 
			
		||||
    }
 | 
			
		||||
    USART0.TXDATAL = c;
 | 
			
		||||
    USART0.TXDATAH = c;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void USART0_sendString(char *str)
 | 
			
		||||
{
 | 
			
		||||
    for(size_t i = 0; i < strlen(str); i++)
 | 
			
		||||
    {
 | 
			
		||||
        USART0_sendChar(str[i]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										33
									
								
								src/usart/usart.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/usart/usart.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @brief Universal Asynchronout Serial library. 
 | 
			
		||||
 * @details This file contains the functions for using the avr usart0 periph. 
 | 
			
		||||
 * @author Jake G 
 | 
			
		||||
 * @date 2024
 | 
			
		||||
 * @copyright None
 | 
			
		||||
 * @file USART.h
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef USART_H
 | 
			
		||||
#define USART_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Initializes the USART0 peripheral. 
 | 
			
		||||
 */
 | 
			
		||||
void USART0_init(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sends a single char type variable over usart0.
 | 
			
		||||
 * @param c The charecter to be sent over usart0. 
 | 
			
		||||
 */
 | 
			
		||||
void USART0_sendChar(char c);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Sends string over usart0
 | 
			
		||||
 * @param str A C-style string.
 | 
			
		||||
 */
 | 
			
		||||
void USART0_sendString(char *str);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //USART_H
 | 
			
		||||
							
								
								
									
										17
									
								
								src/zero_cross_detection/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/zero_cross_detection/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
add_library(zero_cross_detection STATIC
 | 
			
		||||
    zero_cross_detection.c
 | 
			
		||||
)
 | 
			
		||||
target_include_directories(zero_cross_detection PUBLIC
 | 
			
		||||
    ${CMAKE_CURRENT_LIST_DIR}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if(UNIT_TESTING)
 | 
			
		||||
    target_link_libraries(zero_cross_detection 
 | 
			
		||||
        MockADC 
 | 
			
		||||
    )
 | 
			
		||||
else()
 | 
			
		||||
    target_link_libraries(zero_cross_detection 
 | 
			
		||||
        ADC 
 | 
			
		||||
    )
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										54
									
								
								src/zero_cross_detection/zero_cross_detection.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/zero_cross_detection/zero_cross_detection.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: Jake G 
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: zero_cross_detection.c
 | 
			
		||||
 * description: 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "zero_cross_detection.h"
 | 
			
		||||
 | 
			
		||||
#define TRIGGERVAL 512 
 | 
			
		||||
 | 
			
		||||
#ifndef UNIT_TESTING
 | 
			
		||||
#include "ADC.h"
 | 
			
		||||
#else
 | 
			
		||||
#include "MockADC/MockADC.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define ZCD_PIN 0x07
 | 
			
		||||
 | 
			
		||||
void ZCD_Setup(void)
 | 
			
		||||
{
 | 
			
		||||
    ADC_Init(ZCD_PIN);
 | 
			
		||||
    ADC_SetPin(ZCD_PIN);
 | 
			
		||||
    ADC_Enable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ZCD_IsTriggered()
 | 
			
		||||
{
 | 
			
		||||
    uint16_t first, second;
 | 
			
		||||
    ZCD_Setup();
 | 
			
		||||
    first = ADC_ReadValue(ZCD_PIN);
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
    
 | 
			
		||||
    ZCD_Setup();
 | 
			
		||||
    second = ADC_ReadValue(ZCD_PIN);
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
 | 
			
		||||
    if(second < TRIGGERVAL){
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    if(second < first){
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ZCD_Poll(void)
 | 
			
		||||
{
 | 
			
		||||
    while(true){
 | 
			
		||||
        if(ZCD_IsTriggered()){
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										49
									
								
								src/zero_cross_detection/zero_cross_detection.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/zero_cross_detection/zero_cross_detection.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
/**
 | 
			
		||||
 * @file zero_cross_detection.h
 | 
			
		||||
 * @author Jake G
 | 
			
		||||
 * @date 16 June 2024
 | 
			
		||||
 * @brief File contains the zero cross detection functions 
 | 
			
		||||
 *
 | 
			
		||||
 * This file holds all the code/functions needed to read the value of the AC
 | 
			
		||||
 * waveform. It uses the trigger value from the `config.h` file to evaluate the
 | 
			
		||||
 * state.
 | 
			
		||||
 *
 | 
			
		||||
 * This module depends on the ADC.h module to get readings from the ADC 
 | 
			
		||||
 * hardware.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ZERO_CROSS_DETECTION
 | 
			
		||||
#define ZERO_CROSS_DETECTION
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Zero Cross Detection Setup
 | 
			
		||||
 *
 | 
			
		||||
 * Sets up the hardware to read the values coming from the AC input waveform.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void ZCD_Setup(void);
 | 
			
		||||
//int ZCD_Setup(volatile uint8_t *ddrx, uint8_t *port, uint8_t pin);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Checks if ZCD should trigger on value
 | 
			
		||||
 *
 | 
			
		||||
 * The function checks for a positive edge first using the ZCD_IsPositiveEdge
 | 
			
		||||
 * function. If a positive edge was found, then it takes an addition set of 
 | 
			
		||||
 * samples and averages them; only triggering(returning true) in the case 
 | 
			
		||||
 * that the average is higher than the previous sample. 
 | 
			
		||||
 */
 | 
			
		||||
bool ZCD_IsTriggered(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Function blocks execution until ZCD is triggered. 
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void ZCD_Poll(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif //ZERO_CROSS_DETECTION   
 | 
			
		||||
							
								
								
									
										17
									
								
								tests/ADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tests/ADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_ADC
 | 
			
		||||
    test_ADC.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_ADC
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    ADC
 | 
			
		||||
    MockRegEdit
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
#Needed for the tests to function
 | 
			
		||||
include_directories(
 | 
			
		||||
    /usr/local/avr/include/avr
 | 
			
		||||
    #/usr/lib/avr/include/avr
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										192
									
								
								tests/ADC/test_ADC.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										192
									
								
								tests/ADC/test_ADC.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,192 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: Jake G 
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: test_ADC.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport.h"
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
//This define allows us to dircetly include the device header without error.
 | 
			
		||||
#define _AVR_IO_H_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include <iotn404.h> //ATtiny404 header fille.
 | 
			
		||||
#include "ADC.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_ADC)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().checkExpectations();
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, FirstTest)
 | 
			
		||||
{
 | 
			
		||||
   CHECK(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_SetupSetsRegisters)
 | 
			
		||||
{
 | 
			
		||||
    //Clears control register A for ADC0
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetNum")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLA)
 | 
			
		||||
        .withUnsignedIntParameter("num", 0x00);
 | 
			
		||||
 | 
			
		||||
    //Sets The sample accumulation number to 32.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetNum")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLB)
 | 
			
		||||
        .withUnsignedIntParameter("num", 0x5);
 | 
			
		||||
 | 
			
		||||
    //Sets the voltage reference to VDD or VCC.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLC)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 4);
 | 
			
		||||
 | 
			
		||||
    //Sets the pre-scalar for the adc sample rate.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLC)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 2);
 | 
			
		||||
 | 
			
		||||
    //Setup an Initalization delay.
 | 
			
		||||
    mock().expectOneCall("RegEdit_OR_Num")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLD)
 | 
			
		||||
        .withUnsignedIntParameter("num", (2<<5));
 | 
			
		||||
 | 
			
		||||
    //Set the bit for ADC variation during readings.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLD)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 4);
 | 
			
		||||
 | 
			
		||||
    ADC_Setup();     
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters)
 | 
			
		||||
{
 | 
			
		||||
    //Check for setting the direction to input.
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.DIR)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 7);
 | 
			
		||||
 
 | 
			
		||||
    //Check that the pullup is off 
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 7);
 | 
			
		||||
 | 
			
		||||
    //Set the ISC(input sense config) to disable digital input
 | 
			
		||||
    //buffering and reduce the noise on ADC usage.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.PIN7CTRL)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    ADC_Init(7);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    //Check for setting the direction to input.
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.DIR)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 0);
 | 
			
		||||
 
 | 
			
		||||
    //Check that the pullup is off 
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 0);
 | 
			
		||||
 | 
			
		||||
    //Set the ISC(input sense config) to disable digital input
 | 
			
		||||
    //buffering and reduce the noise on ADC usage.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.PIN0CTRL)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    ADC_Init(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_InitDoesNothingOnHighPinNumbers)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectNoCall("RegEdit_SetBit");
 | 
			
		||||
    ADC_Init(8);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_EnablePasses)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLA)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 0);
 | 
			
		||||
 | 
			
		||||
    ADC_Enable();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_DisablePasses)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.CTRLA)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 0);
 | 
			
		||||
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
 | 
			
		||||
{
 | 
			
		||||
    //It clears existing MUXPOS register values.
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearRegister")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.MUXPOS);
 | 
			
		||||
 | 
			
		||||
    //It Correctly sets the pin number.
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetNum")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &ADC0.MUXPOS)
 | 
			
		||||
        .withUnsignedIntParameter("num", 4);
 | 
			
		||||
 | 
			
		||||
    ADC_SetPin(4);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_ADC, ADC_SetPinFailsOnInvalidPin)
 | 
			
		||||
{
 | 
			
		||||
    ADC_SetPin(8);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static uint16_t ADC_ReadValueFake(uint8_t pin_num)
 | 
			
		||||
{
 | 
			
		||||
    return 512;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_ADCRead)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
        UT_PTR_SET(ADC_ReadValue, ADC_ReadValueFake);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_ADCRead, FunctionPointerSwapWorks)
 | 
			
		||||
{
 | 
			
		||||
    uint16_t value = ADC_ReadValue(0);
 | 
			
		||||
    
 | 
			
		||||
    LONGS_EQUAL(512, value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								tests/AllTests.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								tests/AllTests.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,16 @@
 | 
			
		|||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//ImportTestGroups
 | 
			
		||||
IMPORT_TEST_GROUP(simple_test);
 | 
			
		||||
IMPORT_TEST_GROUP(test_ADC);
 | 
			
		||||
IMPORT_TEST_GROUP(test_RegEdit);
 | 
			
		||||
IMPORT_TEST_GROUP(test_Enable);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//START: main
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
    return RUN_ALL_TESTS(argc, argv);
 | 
			
		||||
}
 | 
			
		||||
//END: main
 | 
			
		||||
							
								
								
									
										54
									
								
								tests/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								tests/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
project(Tests)
 | 
			
		||||
 | 
			
		||||
# TEST_DIRS
 | 
			
		||||
add_subdirectory(Enable)
 | 
			
		||||
#add_subdirectory(usart)
 | 
			
		||||
add_subdirectory(MockADC)
 | 
			
		||||
add_subdirectory(ADC)
 | 
			
		||||
add_subdirectory(MockRegEdit)
 | 
			
		||||
add_subdirectory(RegEdit)
 | 
			
		||||
add_subdirectory(simple_test)
 | 
			
		||||
add_subdirectory(zero_cross_detection)
 | 
			
		||||
add_subdirectory(EnOut)
 | 
			
		||||
add_subdirectory(load)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# TEST_RUNNER
 | 
			
		||||
add_executable(AllTests
 | 
			
		||||
    AllTests.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(AllTests
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    # TEST_LINKS
 | 
			
		||||
	test_Enable
 | 
			
		||||
    test_ADC
 | 
			
		||||
    test_RegEdit
 | 
			
		||||
    simple_test
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
add_executable(Mock_Tests
 | 
			
		||||
    MockTests.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(Mock_Tests
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
	test_MockRegEdit
 | 
			
		||||
	test_MockADC
 | 
			
		||||
	test_zero_cross_detection
 | 
			
		||||
    test_load
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
add_executable(EnTests
 | 
			
		||||
    EnTests.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(EnTests
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    test_EnOut
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										12
									
								
								tests/EnOut/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/EnOut/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_EnOut
 | 
			
		||||
    test_EnOut.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_EnOut
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    MockRegEdit
 | 
			
		||||
    EnOut
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										80
									
								
								tests/EnOut/test_EnOut.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								tests/EnOut/test_EnOut.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,80 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: test_EnOut.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 "EnOut.h"
 | 
			
		||||
#include "MockRegEdit.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void FakeDelay(double us)
 | 
			
		||||
{
 | 
			
		||||
    //do Nothing.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void (*Delay_MicroSeconds)(double us) = FakeDelay;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_EnOut)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
        //UT_PTR_SET(Delay_MicroSeconds, FakeDelay);
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().checkExpectations();
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_EnOut, FirstTest)
 | 
			
		||||
{
 | 
			
		||||
   //FAIL("Fail me!");
 | 
			
		||||
   CHECK(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_EnOut, EnOut_SetupPins)
 | 
			
		||||
{
 | 
			
		||||
    //Expect that pin PA1 is set to output
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.DIR)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", G1);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    EnOut_SetupPins();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
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);
 | 
			
		||||
 | 
			
		||||
    EnOut_SetAllHigh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_EnOut, EnOut_PulsePins)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    //Expect that pin PA1 is set to output
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", G1);
 | 
			
		||||
 | 
			
		||||
    EnOut_PulsePins(1000);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/EnTests.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/EnTests.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
 | 
			
		||||
IMPORT_TEST_GROUP(test_EnOut);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//START: main
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
    return RUN_ALL_TESTS(argc, argv);
 | 
			
		||||
}
 | 
			
		||||
//END: main
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/Enable/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/Enable/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_Enable
 | 
			
		||||
    test_Enable.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_Enable
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    MockRegEdit
 | 
			
		||||
    Enable
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										84
									
								
								tests/Enable/test_Enable.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								tests/Enable/test_Enable.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
/*
 | 
			
		||||
 * 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);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.DIR)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN2);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.DIR)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN3);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN1);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN2);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN3);
 | 
			
		||||
 | 
			
		||||
    Enable_SetPinsHigh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_Enable, SetEnablePinsLow)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN1);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN2);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTB.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", EN3);
 | 
			
		||||
 | 
			
		||||
    Enable_SetPinsLow();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								tests/MockADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/MockADC/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_MockADC
 | 
			
		||||
    test_MockADC.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_MockADC
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    MockADC
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										94
									
								
								tests/MockADC/test_MockADC.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								tests/MockADC/test_MockADC.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,94 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: Jake G 
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: test_MockADC.c
 | 
			
		||||
 * description: 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport.h"
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include "MockADC.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_MockADC)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().checkExpectations();
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, ADC_InitExpects)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("ADC_Init")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 7);
 | 
			
		||||
 | 
			
		||||
    ADC_Init(7);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, ADC_EnableExpects)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("ADC_Enable");
 | 
			
		||||
 | 
			
		||||
    ADC_Enable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, ADC_DisableExpect)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("ADC_Disable");
 | 
			
		||||
 | 
			
		||||
    ADC_Disable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, ADC_ReadValue)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
    MockADC_PushValue(512);
 | 
			
		||||
 
 | 
			
		||||
    mock().expectOneCall("ADC_ReadValue_Impl")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 0x2);
 | 
			
		||||
 | 
			
		||||
    uint16_t val = ADC_ReadValue(0x2);
 | 
			
		||||
    LONGS_EQUAL(512, val);
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, ADC_ReadValueReturnsZeroOnEmptyBuffer)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
    
 | 
			
		||||
    mock().expectOneCall("ADC_ReadValue_Impl")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 0x2)
 | 
			
		||||
        .andReturnValue(0x0000);
 | 
			
		||||
 | 
			
		||||
    uint16_t val = ADC_ReadValue(0x2);
 | 
			
		||||
    LONGS_EQUAL(0, val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, MockADC_PushValueDoesntOverflowArray)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
    for(int i = 0; i < 257; i++){
 | 
			
		||||
        MockADC_PushValue(512+i); 
 | 
			
		||||
        CHECK_TRUE(MockADC_GetIndex() <= 255);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockADC, MockADC_SetupSetsGlobal)
 | 
			
		||||
{
 | 
			
		||||
    CHECK_FALSE(MockADC_IsSetup());
 | 
			
		||||
    
 | 
			
		||||
    ADC_Setup();
 | 
			
		||||
 | 
			
		||||
    CHECK_TRUE(MockADC_IsSetup());
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/MockRegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/MockRegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_MockRegEdit
 | 
			
		||||
    test_MockRegEdit.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_MockRegEdit
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    MockRegEdit
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										168
									
								
								tests/MockRegEdit/test_MockRegEdit.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										168
									
								
								tests/MockRegEdit/test_MockRegEdit.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,168 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: test_MockRegEdit.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport.h"
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include "MockRegEdit.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_MockRegEdit)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_ClearRegisterExpectedCallPasses)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearRegister")
 | 
			
		||||
        .withPointerParameter("reg", b);
 | 
			
		||||
 | 
			
		||||
    RegEdit_ClearRegister(b);
 | 
			
		||||
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_SetRegisterExpectedCallPasses)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    uint8_t a;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetRegister")
 | 
			
		||||
        .withPointerParameter("reg", b);
 | 
			
		||||
    
 | 
			
		||||
    RegEdit_SetRegister(b);
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_SetBitExpectedCallPasses)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    uint8_t a;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetBit")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 5);
 | 
			
		||||
    
 | 
			
		||||
    RegEdit_SetBit(b, 5);
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_ClearBitExpectedCallPasses)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    uint8_t a;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 5);
 | 
			
		||||
    
 | 
			
		||||
    RegEdit_ClearBit(b, 5);
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_IsBitSetExpectedCallPasses)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a = 0xFF;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_IsBitSet")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 5)
 | 
			
		||||
        .andReturnValue(true);
 | 
			
		||||
    
 | 
			
		||||
    CHECK_TRUE(RegEdit_IsBitSet(b, 5));
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_IsBitSetExpectedCallPassesWithFalse)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a = 0xFF;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_IsBitSet")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 5)
 | 
			
		||||
        .andReturnValue(false);
 | 
			
		||||
    
 | 
			
		||||
    CHECK_FALSE(RegEdit_IsBitSet(b, 5));
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_OR_NumExpectedWorks)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a = 0xFF;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_OR_Num")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("num", 0x4)
 | 
			
		||||
        .andReturnValue(false);
 | 
			
		||||
    
 | 
			
		||||
    RegEdit_OR_Num(b, 0x4);
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_SetNumPasses)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a = 0xFF;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_SetNum")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .withUnsignedIntParameter("num", 0x4)
 | 
			
		||||
        .andReturnValue(false);
 | 
			
		||||
    
 | 
			
		||||
    RegEdit_SetNum(b, 0x4);
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_MockRegEdit, RegEdit_ReadRegPasses)
 | 
			
		||||
{
 | 
			
		||||
    uint8_t a = 0xFF;
 | 
			
		||||
    uint8_t *b = &a;
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("RegEdit_ReadReg")
 | 
			
		||||
        .withPointerParameter("reg", b)
 | 
			
		||||
        .andReturnValue(0xFF);
 | 
			
		||||
   
 | 
			
		||||
    uint8_t reg_val = RegEdit_ReadReg(b);
 | 
			
		||||
    LONGS_EQUAL(0xFF, reg_val); 
 | 
			
		||||
    
 | 
			
		||||
    mock().checkExpectations();
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								tests/MockTests.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/MockTests.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//ImportTestGroups
 | 
			
		||||
IMPORT_TEST_GROUP(test_MockRegEdit);
 | 
			
		||||
IMPORT_TEST_GROUP(test_MockADC);
 | 
			
		||||
IMPORT_TEST_GROUP(test_zero_cross_detection);
 | 
			
		||||
IMPORT_TEST_GROUP(test_load);
 | 
			
		||||
 | 
			
		||||
//START: main
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
    return RUN_ALL_TESTS(argc, argv);
 | 
			
		||||
}
 | 
			
		||||
//END: main
 | 
			
		||||
							
								
								
									
										10
									
								
								tests/RegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/RegEdit/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_RegEdit
 | 
			
		||||
    test_RegEdit.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_RegEdit
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    RegEdit
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										32
									
								
								tests/RegEdit/test_RegEdit.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								tests/RegEdit/test_RegEdit.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: test_RegEdit.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include "RegEdit.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_RegEdit)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_RegEdit, FirstTest)
 | 
			
		||||
{
 | 
			
		||||
   //FAIL("Fail me!");
 | 
			
		||||
   CHECK(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										12
									
								
								tests/load/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/load/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_load
 | 
			
		||||
    test_load.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_load
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    load
 | 
			
		||||
    MockADC
 | 
			
		||||
    MockRegEdit
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										56
									
								
								tests/load/test_load.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								tests/load/test_load.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: Jake G 
 | 
			
		||||
 * Date: 2024 
 | 
			
		||||
 * filename: test_load.cpp
 | 
			
		||||
 * description: 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport.h"
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//This define allows us to dircetly include the device header without error.
 | 
			
		||||
#define _AVR_IO_H_
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include <iotn404.h> //ATtiny404 header fille.
 | 
			
		||||
#include "load.h"
 | 
			
		||||
#include "MockADC.h"
 | 
			
		||||
#include "MockADC.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_load)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().checkExpectations();
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_load, LoadPass)
 | 
			
		||||
{
 | 
			
		||||
    CHECK_TRUE(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_load, PortAHandlerSuccess)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("ADC_Init")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 4);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_Enable");
 | 
			
		||||
    mock().expectOneCall("ADC_ReadValue_Impl")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 4);
 | 
			
		||||
    mock().expectOneCall("ADC_Disable");
 | 
			
		||||
    mock().expectOneCall("RegEdit_ClearBit")
 | 
			
		||||
        .withPointerParameter("reg", (void *) &PORTA.OUT)
 | 
			
		||||
        .withUnsignedIntParameter("bit_num", 7);
 | 
			
		||||
    
 | 
			
		||||
    Load_HandleLoadPortA(4, 7);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/simple_test/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/simple_test/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
 | 
			
		||||
# TEST_RUNNER
 | 
			
		||||
add_library(simple_test 
 | 
			
		||||
    simple_test.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(simple_test
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										26
									
								
								tests/simple_test/simple_test.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								tests/simple_test/simple_test.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,26 @@
 | 
			
		|||
#include "CppUTest/TestHarness.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
extern C 
 | 
			
		||||
{
 | 
			
		||||
#include "simple.h"
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(simple_test)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(simple_test, passing_test)
 | 
			
		||||
{
 | 
			
		||||
    CHECK_TRUE(1);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								tests/usart/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tests/usart/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_usart
 | 
			
		||||
    test_usart.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_usart
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    usart
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										38
									
								
								tests/usart/test_usart.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								tests/usart/test_usart.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: test_usart.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include "usart.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_usart)
 | 
			
		||||
{
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TEST(test_usart, FirstTest)
 | 
			
		||||
{
 | 
			
		||||
   FAIL("Fail me!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(test_usart, SecondTest)
 | 
			
		||||
{
 | 
			
		||||
   STRCMP_EQUAL("hello", "world");
 | 
			
		||||
   LONGS_EQUAL(1, 2);
 | 
			
		||||
   CHECK(false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/zero_cross_detection/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/zero_cross_detection/CMakeLists.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
# TEST_RUNNER
 | 
			
		||||
add_library(test_zero_cross_detection
 | 
			
		||||
    test_zero_cross_detection.cpp    
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_link_libraries(test_zero_cross_detection
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTest.a
 | 
			
		||||
    ${CPPUTEST_LIBRARIES}/libCppUTestExt.a
 | 
			
		||||
    zero_cross_detection
 | 
			
		||||
    MockADC
 | 
			
		||||
)
 | 
			
		||||
							
								
								
									
										111
									
								
								tests/zero_cross_detection/test_zero_cross_detection.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								tests/zero_cross_detection/test_zero_cross_detection.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,111 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Author: username
 | 
			
		||||
 * Date: todays_date 
 | 
			
		||||
 * filename: test_zero_cross_detection.c
 | 
			
		||||
 * description: module_purpose
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "CppUTest/CommandLineTestRunner.h"
 | 
			
		||||
#include "CppUTest/TestFailure.h"
 | 
			
		||||
#include "CppUTest/TestPlugin.h"
 | 
			
		||||
#include "CppUTest/UtestMacros.h"
 | 
			
		||||
#include "CppUTestExt/MockSupport.h"
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
 | 
			
		||||
extern "C" 
 | 
			
		||||
{
 | 
			
		||||
#include "MockADC.h"
 | 
			
		||||
#include "zero_cross_detection.h"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_GROUP(test_zero_cross_detection)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    void setup()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    void teardown()
 | 
			
		||||
    {
 | 
			
		||||
        mock().checkExpectations();
 | 
			
		||||
        mock().clear();
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void ZCDSetupExpectations(void)
 | 
			
		||||
{
 | 
			
		||||
    mock().expectOneCall("ADC_Init")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 7);
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_Enable");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void PollIterationExpectations(void)
 | 
			
		||||
{
 | 
			
		||||
    ZCDSetupExpectations();
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_ReadValue_Impl")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 7)
 | 
			
		||||
        .ignoreOtherParameters();
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_Disable");
 | 
			
		||||
 | 
			
		||||
    ZCDSetupExpectations();
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_ReadValue_Impl")
 | 
			
		||||
        .withUnsignedIntParameter("pin_num", 7)
 | 
			
		||||
        .ignoreOtherParameters();
 | 
			
		||||
 | 
			
		||||
    mock().expectOneCall("ADC_Disable");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_zero_cross_detection, ZCD_SetupCallsCorrectFuncs)
 | 
			
		||||
{
 | 
			
		||||
    ZCDSetupExpectations();
 | 
			
		||||
 | 
			
		||||
    ZCD_Setup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_zero_cross_detection, ZCD_IsTriggeredCallsCorrectFunctions)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
    
 | 
			
		||||
    PollIterationExpectations();
 | 
			
		||||
 | 
			
		||||
    CHECK_FALSE(ZCD_IsTriggered());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_zero_cross_detection, ZCD_IsTriggerdTrueWhenRising)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
 | 
			
		||||
    MockADC_PushValue(512);
 | 
			
		||||
    MockADC_PushValue(450);
 | 
			
		||||
 | 
			
		||||
    PollIterationExpectations();
 | 
			
		||||
 | 
			
		||||
    CHECK_TRUE(ZCD_IsTriggered()); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
TEST(test_zero_cross_detection, ZCD_PollWorksAfterCalls)
 | 
			
		||||
{
 | 
			
		||||
    MockADC_ZeroIndex();
 | 
			
		||||
 | 
			
		||||
    MockADC_PushValue(512);
 | 
			
		||||
    MockADC_PushValue(450);
 | 
			
		||||
    MockADC_PushValue(50);
 | 
			
		||||
    MockADC_PushValue(50);
 | 
			
		||||
 | 
			
		||||
    PollIterationExpectations();
 | 
			
		||||
    PollIterationExpectations();
 | 
			
		||||
 | 
			
		||||
    ZCD_Poll();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue