From 3d057cfb918fb7e296cd27d6ced98008ea967753 Mon Sep 17 00:00:00 2001 From: Samson Gama Date: Thu, 14 Mar 2019 23:41:07 -0700 Subject: [PATCH] Added some LED utility functions (#802) --- armsrc/appmain.c | 7 ++----- armsrc/iclass.c | 5 +---- armsrc/util.c | 16 ++++++++++++++++ armsrc/util.h | 2 ++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 2a16f5f0..8824847e 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1490,11 +1490,8 @@ void __attribute__((noreturn)) AppMain(void) } common_area.flags.osimage_present = 1; - LED_D_OFF(); - LED_C_OFF(); - LED_B_OFF(); - LED_A_OFF(); - + LEDsoff(); + // Init USB device usb_enable(); diff --git a/armsrc/iclass.c b/armsrc/iclass.c index be7da703..83c9a75b 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -810,10 +810,7 @@ done: AT91C_BASE_PDC_SSC->PDC_PTCR = AT91C_PDC_RXTDIS; Dbprintf("%x %x %x", maxBehindBy, Uart.state, Uart.byteCnt); Dbprintf("%x %x %x", Uart.byteCntMax, BigBuf_get_traceLen(), (int)Uart.output[0]); - LED_A_OFF(); - LED_B_OFF(); - LED_C_OFF(); - LED_D_OFF(); + LEDsoff(); } void rotateCSN(uint8_t* originalCSN, uint8_t* rotatedCSN) { diff --git a/armsrc/util.c b/armsrc/util.c index fbb6d489..aac68a34 100644 --- a/armsrc/util.c +++ b/armsrc/util.c @@ -89,6 +89,22 @@ void LEDsoff() LED_D_OFF(); } +void LEDson() +{ + LED_A_ON(); + LED_B_ON(); + LED_C_ON(); + LED_D_ON(); +} + +void LEDsinvert() +{ + LED_A_INV(); + LED_B_INV(); + LED_C_INV(); + LED_D_INV(); +} + // LEDs: R(C) O(A) G(B) -- R(D) [1, 2, 4 and 8] void LED(int led, int ms) { diff --git a/armsrc/util.h b/armsrc/util.h index fb50ecc8..da333e01 100644 --- a/armsrc/util.h +++ b/armsrc/util.h @@ -37,6 +37,8 @@ void lsl (uint8_t *data, size_t len); void LED(int led, int ms); void LEDsoff(); +void LEDson(); +void LEDsinvert(); int BUTTON_CLICKED(int ms); int BUTTON_HELD(int ms); void FormatVersionInformation(char *dst, int len, const char *prefix, void *version_information); -- 2.39.5