aboutsummaryrefslogtreecommitdiff
path: root/bootloaders
diff options
context:
space:
mode:
authorZach Eveland <zeveland@blacklabel-development.com>2012-01-10 15:38:26 -0500
committerZach Eveland <zeveland@blacklabel-development.com>2012-01-10 15:38:26 -0500
commitdbec0f0058fdf33ef95b57f130c5ff8986f5c359 (patch)
treedf5523573c00fed59c26cf36c5c17c9accc02a92 /bootloaders
parent648dd85e945a7e0a2db284987377a97936ee77e4 (diff)
made the bootloader's LED control macro names less offensive
TX_LED_OFF() instead of TXLED0, etc.
Diffstat (limited to 'bootloaders')
-rw-r--r--bootloaders/diskloader/src/DiskLoader.cpp14
-rw-r--r--bootloaders/diskloader/src/Platform.h12
-rw-r--r--bootloaders/diskloader/src/USBCore.cpp12
3 files changed, 19 insertions, 19 deletions
diff --git a/bootloaders/diskloader/src/DiskLoader.cpp b/bootloaders/diskloader/src/DiskLoader.cpp
index 09f59a7..f5df8a4 100644
--- a/bootloaders/diskloader/src/DiskLoader.cpp
+++ b/bootloaders/diskloader/src/DiskLoader.cpp
@@ -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
diff --git a/bootloaders/diskloader/src/Platform.h b/bootloaders/diskloader/src/Platform.h
index fcce0a1..2e90334 100644
--- a/bootloaders/diskloader/src/Platform.h
+++ b/bootloaders/diskloader/src/Platform.h
@@ -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
diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp
index 64f5852..160e6cf 100644
--- a/bootloaders/diskloader/src/USBCore.cpp
+++ b/bootloaders/diskloader/src/USBCore.cpp
@@ -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;