Skip to content
Snippets Groups Projects
Commit c64690b5 authored by Paulus Kruger's avatar Paulus Kruger
Browse files

Frontpant LEDs fixed

parent 84ad1032
No related branches found
No related tags found
No related merge requests found
......@@ -81,6 +81,9 @@ void GoToSleep(){
// IC3CON1 = 0x02;
LED_on();
}
#define HBA1_LED _LATA3
#define HBA2_LED _LATB4
#define HBA3_LED _LATA4
#define HBA_(name) HBA1_ ## name
#define SPI_(name) SPI1 ## name
......@@ -132,7 +135,9 @@ int main(void)
_LATB10=1;
_LATB15=1; //SPI pins high = 0V output
//SPI1BUFL=~0x00;
HBA1_LED=1; //LED off
HBA2_LED=1; //LED off
HBA3_LED=1; //LED off
HBA1_state=HBA_STATE_IDLE;
while (1)
{
......
......@@ -7,6 +7,7 @@ inline void HBA_(Handle_IC_Capture)()
else {
HBA_(IC_previous)=TMR3;
HBA_(state)=HBA_STATE_RX;
HBA_(LED)=0; //LED on
HBA_(decode_start)();
}
}
......@@ -14,7 +15,10 @@ inline void HBA_(mainloop)()
{
switch (HBA_(state)) {
case HBA_STATE_IDLE:
if (HBA_(TX_waiting)()) HBA_(state)=HBA_STATE_TX;
if (HBA_(TX_waiting)()) {
HBA_(state)=HBA_STATE_TX;
HBA_(LED)=0; //LED on
}
break;
case HBA_STATE_TX:
if (SPI_(STATLbits).SPITBF) break; //Do nothing until finished transmitting character
......@@ -44,6 +48,7 @@ inline void HBA_(mainloop)()
if (HBA_RX_Mode()==2) if (HBA_(I2CReg_waiting)()) HBA_(start_TX)();
//IC1_Stop();
HBA_(state)=HBA_STATE_IDLE;
HBA_(LED)=1; //LED off
}
break;
case HBA_STATE_RX: //Process edges until we have a time-out
......@@ -58,6 +63,7 @@ inline void HBA_(mainloop)()
HBA_(RX_finished)();
if (HBA_RX_Mode()==2) {HBA_(I2CReg_decode_responce)();if (HBA_(I2CReg_waiting)()) HBA_(start_TX)();}
HBA_(state)=HBA_STATE_IDLE;
HBA_(LED)=1; //LED off
//IC1_Stop();
}
break;
......
//This is the git commit SHA and is updated after the commit...
#ifndef SOFTWARE_VERSION
#define SOFTWARE_VERSION 0x5bef0727
#define SOFTWARE_VERSION 0x84ad1032
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment