Compare commits

..

No commits in common. "bd85f08a2a2a30b252d2f593345b074e07d6682d" and "0c083dede1bad6e9ad285bb9e0cdfcbd6263a591" have entirely different histories.

6 changed files with 23 additions and 57 deletions

View file

@ -1,11 +1,11 @@
#
#Mon Aug 26 09:45:40 PDT 2024
#Thu Aug 22 12:59:17 PDT 2024
attiny404.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7
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=d7d18985d0458f138e05bddaa7c94a76
configurations-xml=0048f11b5d154940aa328734e33d107d
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/Relay_Tester

View file

@ -183,7 +183,7 @@
value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/>
<property key="communication.activationmode" value="simplepulse"/>
<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"/>
@ -209,6 +209,8 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="/home/ronin/Documents/projects/freelance/laith_naaman/Relay_Tester/debug/default/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
@ -247,7 +249,7 @@
value="ToolFirmwareOption.UseLatest"/>
<property key="ToolFirmwareToolPack"
value="Press to select which tool pack to use"/>
<property key="communication.activationmode" value="simplepulse"/>
<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"/>
@ -463,6 +465,8 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="/home/ronin/Documents/projects/freelance/laith_naaman/Relay_Tester/debug/attiny404/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>

View file

@ -2,6 +2,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/>
<group>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/Relay_Tester/src/main.c</file>
</group>
</open-files>
</project-private>

View file

@ -12,9 +12,14 @@
#include "LedController.h"
#include "avr/io.h"
#define LED_BM_PORTA (1 << 6)|(1 << 1)|(1 << 2)|(1 << 3)
#define LED_BM_PORTB (1 << 3)|(1 << 2)|(1 << 0)|(1 << 1)
#define PA_B1 (1 << 2)
#define PA_B2 (1 << 3)
#define PA_B3 (1 << 6)
#define PA_B4 (1 << 7)
#define BITS_IN_BYTE (1 << 2) | (1 << 3) | (1 << 6) | (1 << 7)
#define HALF_BYTE_BM
LedByte LedController_New(uint8_t *port)
{

View file

@ -18,7 +18,7 @@
*/
typedef struct Led
{
volatile uint8_t *port;
uint8_t *port;
uint8_t pin_num;
bool state;
} Led;
@ -28,7 +28,6 @@ typedef struct LedByte
Led leds[8];
} LedByte;
/**
* Returns a instance of the LedByte structure.
*/

View file

@ -25,11 +25,8 @@
#define SW1PIN (1 << 5)
#define SW2PIN (1 << 4)
#define RELAYPIN (1 << 7)
#define RELAYREADINGPIN (1 << 0) // It would be better to use PA7 so USART worked
#define LED_BM_PORTA (1 << 6)|(1 << 1)|(1 << 2)|(1 << 3)
#define LED_BM_PORTB (1 << 3)|(1 << 2)|(1 << 0)|(1 << 1)
#define RELAYPIN (1 << 1)
#define RELAYREADINGPIN (1 << 2) // It would be better to use PA7 so USART worked
// Set the function pointer for the delay func
void (*Delay_MicroSeconds)(double us) = _delay_us;
@ -72,44 +69,6 @@ void WaitForRelayDisconnect(void)
}
}
void LedSetup(LedByte *led_byte)
{
PORTA.DIR |= LED_BM_PORTA;
PORTB.DIR |= LED_BM_PORTB;
//pin 13, bit 0, PA3
led_byte->leds[0].port = (void *) &PORTA.OUT;
led_byte->leds[0].pin_num = 3;
//pin 12, bit 1, PA2
led_byte->leds[1].port = &PORTA.OUT;
led_byte->leds[1].pin_num = 2;
//pin 11, bit 2, PA1
led_byte->leds[2].port = &PORTA.OUT;
led_byte->leds[2].pin_num = 1;
//pin 9, bit 3, PB0
led_byte->leds[3].port = &PORTB.OUT;
led_byte->leds[3].pin_num = 0;
//pin 8, bit 4, PB1
led_byte->leds[4].port = &PORTB.OUT;
led_byte->leds[4].pin_num = 1;
//pin 2, bit 5, PB2
led_byte->leds[5].port = &PORTB.OUT;
led_byte->leds[5].pin_num = 2;
//pin 3, bit 6, PB3
led_byte->leds[6].port = &PORTB.OUT;
led_byte->leds[6].pin_num = 3;
//pin 3, bit 7, PA6
led_byte->leds[7].port = &PORTA.OUT;
led_byte->leds[7].pin_num = 6;
}
int main(int argc, char **argv)
{
PORTA.DIR |= RELAYPIN;
@ -122,9 +81,6 @@ int main(int argc, char **argv)
uint8_t temp = 0;
LedByte led_byte = LedController_New(&PORTA.OUT);
LedSetup(&led_byte);
//wait for a second then disable UPDI
while (true)
{
@ -138,7 +94,7 @@ int main(int argc, char **argv)
make_time = Timer_GetOverflowCount();
// Output the Make time via LEDS
temp = (uint8_t)(make_time & 0xFF);
temp = (uint8_t)(make_time & 0x0F);
LedController_ShowByte(&led_byte, temp);
SW2_Wait();
@ -151,7 +107,7 @@ int main(int argc, char **argv)
break_time = Timer_GetOverflowCount();
// Output the Break time via LEDS
temp = (uint8_t)(break_time & 0xFF);
temp = (uint8_t)(break_time & 0x0F);
LedController_ShowByte(&led_byte, temp);