made the bootloader's LED control macro names less offensive

TX_LED_OFF() instead of TXLED0, etc.
This commit is contained in:
Zach Eveland 2012-01-10 15:38:26 -05:00
parent 4b05c3fc75
commit f403b001a2
3 changed files with 19 additions and 19 deletions

View File

@ -114,9 +114,9 @@ int main()
uint8_t MCUSR_state = MCUSR; // store the reason for the reset
MCUSR &= ~(1 << WDRF); // must clear the watchdog reset flag before disabling and reenabling WDT
wdt_disable();
TXLED0;
RXLED0;
LED0;
TX_LED_OFF();
RX_LED_OFF();
L_LED_OFF();
if (MCUSR_state & (1<<WDRF) && (pgm_read_word(0) != -1)) {
StartSketch(); // if the reset was caused by WDT and if a sketch is already present then run the sketch instead of the bootloader
}
@ -225,15 +225,15 @@ void LEDPulse()
p = 127-p;
p += p;
if (((u8)_pulse) > p)
LED0;
L_LED_OFF();
else
LED1;
L_LED_ON();
}
void StartSketch()
{
TXLED0; // switch off the RX and TX LEDs before starting the user sketch
RXLED0;
TX_LED_OFF(); // switch off the RX and TX LEDs before starting the user sketch
RX_LED_OFF();
UDCON = 1; // Detatch USB
UDIEN = 0;
asm volatile ( // Reset vector to run firmware

View File

@ -28,12 +28,12 @@ typedef unsigned long u32;
#define OEM_NAME 'l','e','o','n','a','r','d','o' // 8 chars
#define BOARD_INIT() DDRC |= (1<<7); DDRB |= (1<<0); DDRD |= (1<<5); CPU_PRESCALE(0); DISABLE_JTAG();
#define LED0 PORTC &= ~(1<<7)
#define LED1 PORTC |= (1<<7)
#define TXLED0 PORTD |= (1<<5)
#define TXLED1 PORTD &= ~(1<<5)
#define RXLED0 PORTB |= (1<<0)
#define RXLED1 PORTB &= ~(1<<0)
#define L_LED_OFF() PORTC &= ~(1<<7)
#define L_LED_ON() PORTC |= (1<<7)
#define TX_LED_OFF() PORTD |= (1<<5)
#define TX_LED_ON() PORTD &= ~(1<<5)
#define RX_LED_OFF() PORTB |= (1<<0)
#define RX_LED_ON() PORTB &= ~(1<<0)
#define TRANSFER_PGM 0x80
#define TRANSFER_RELEASE 0x40

View File

@ -89,7 +89,7 @@ static inline void ClearOUT(void)
static
void Send(volatile const u8* data, u8 count)
{
TXLED1; // light the TX LED
TX_LED_ON(); // light the TX LED
TxLEDPulse = TX_RX_LED_PULSE_MS;
while (count--)
UEDATX = *data++;
@ -97,7 +97,7 @@ void Send(volatile const u8* data, u8 count)
void Recv(volatile u8* data, u8 count)
{
RXLED1; // light the RX LED
RX_LED_ON(); // light the RX LED
RxLEDPulse = TX_RX_LED_PULSE_MS;
while (count--)
*data++ = UEDATX;
@ -105,14 +105,14 @@ void Recv(volatile u8* data, u8 count)
static inline u8 Recv8()
{
RXLED1; // light the RX LED
RX_LED_ON(); // light the RX LED
RxLEDPulse = TX_RX_LED_PULSE_MS;
return UEDATX;
}
static inline void Send8(u8 d)
{
TXLED1; // light the TX LED
TX_LED_ON(); // light the TX LED
TxLEDPulse = TX_RX_LED_PULSE_MS;
UEDATX = d;
}
@ -473,9 +473,9 @@ void USBGeneralInterrupt()
{
// check whether the one-shot period has elapsed. if so, turn off the LED
if (TxLEDPulse && !(--TxLEDPulse))
TXLED0;
TX_LED_OFF();
if (RxLEDPulse && !(--RxLEDPulse))
RXLED0;
RX_LED_OFF();
if (!_ejected)
_timeout = 0;