From: Peter Henn Date: Wed, 29 Dec 2021 21:04:06 +0000 (+0000) Subject: Disable yellow LED driver for Pro-Micro X-Git-Tag: DFU-Bootloader-ProMicro~1 X-Git-Url: http://git.linex4red.de/pub/lufa.git/commitdiff_plain/03d7fb03bd07d75f0f2d6a9e4b731d09b44cfb37 Disable yellow LED driver for Pro-Micro - Use only the green LED to signal bootloader functionality and let the yellow LED untouched disabled. So this signal can be used by the application code also for SPI slave select as input signal. --- diff --git a/LUFA/Drivers/Board/AVR8/PROMICRO/LEDs.h b/LUFA/Drivers/Board/AVR8/PROMICRO/LEDs.h index fba64651b..8fb2058bf 100644 --- a/LUFA/Drivers/Board/AVR8/PROMICRO/LEDs.h +++ b/LUFA/Drivers/Board/AVR8/PROMICRO/LEDs.h @@ -42,12 +42,15 @@ * * Board specific LED driver header for the Arduino Micro board (https://www.sparkfun.com/products/12640). * - * + *
* - * - * + * + * *
NameColorInfoActive LevelPort Pin
LEDS_LED1YellowRXHighPORTB.0
LEDS_LED2GreenTXHighPORTD.5
LEDS_LED1GreenTXHighPORTD.5
LEDS_LED2YellowRXHighPORTB.0
* + * LEDS_LED2 is not used, and just programmed to be an input. So the application can use this MCU pin as + * a SPI slave select signal without the risk that two ouputs be drive the same pin. + * * @{ */ @@ -70,20 +73,20 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define LEDS_PORTB_LEDS (LEDS_LED1) - #define LEDS_PORTD_LEDS (LEDS_LED2) + #define LEDS_PORTD_LEDS (LEDS_LED1) + #define LEDS_PORTB_LEDS (LEDS_LED2) #endif /* Public Interface - May be used in end-application: */ /* Macros: */ /** LED mask for the first LED on the board. */ - #define LEDS_LED1 (1 << 0) + #define LEDS_LED1 (1 << 5) /** LED mask for the second LED on the board. */ - #define LEDS_LED2 (1 << 5) + #define LEDS_LED2 (1 << 0) /** LED mask for all the LEDs on the board. */ - #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) + #define LEDS_ALL_LEDS (LEDS_LED1) /** LED mask for none of the board LEDs. */ #define LEDS_NO_LEDS 0 @@ -92,8 +95,6 @@ #if !defined(__DOXYGEN__) static inline void LEDs_Init(void) { - DDRB |= LEDS_PORTB_LEDS; - PORTB &= ~LEDS_PORTB_LEDS; DDRD |= LEDS_PORTD_LEDS; PORTD &= ~LEDS_PORTD_LEDS; } @@ -108,39 +109,34 @@ static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) { - PORTB |= (LEDMask & LEDS_PORTB_LEDS); PORTD |= (LEDMask & LEDS_PORTD_LEDS); } static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) { - PORTB &= ~(LEDMask & LEDS_PORTB_LEDS); PORTD &= ~(LEDMask & LEDS_PORTD_LEDS); } static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) { - PORTB = ((PORTB & ~LEDS_PORTB_LEDS) | (LEDMask & LEDS_PORTB_LEDS)); PORTD = ((PORTD & ~LEDS_PORTD_LEDS) | (LEDMask & LEDS_PORTD_LEDS)); } static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) { - PORTB = ((PORTB & ~(LEDMask & LEDS_PORTB_LEDS)) | (ActiveMask & LEDS_PORTB_LEDS)); PORTD = ((PORTD & ~(LEDMask & LEDS_PORTD_LEDS)) | (ActiveMask & LEDS_PORTD_LEDS)); } static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) { - PORTB ^= (LEDMask & LEDS_PORTB_LEDS); PORTD ^= (LEDMask & LEDS_PORTD_LEDS); } static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t LEDs_GetLEDs(void) { - return ((PORTB & LEDS_PORTB_LEDS) | (PORTD & LEDS_PORTD_LEDS)); + return (PORTD & LEDS_PORTD_LEDS); } #endif