Chameleon-Mini
LED.h
1 /*
2  * LED.h
3  *
4  * Created on: 10.02.2013
5  * Author: skuser
6  */
7 
8 #ifndef LED_H
9 #define LED_H
10 
11 #include <avr/io.h>
12 #include "Common.h"
13 
14 #define LED_PORT PORTA
15 #define LED_GREEN PIN4_bm
16 #define LED_RED PIN3_bm
17 #define LED_MASK (LED_GREEN | LED_RED)
18 
19 typedef enum LEDFunctionEnum {
20  LED_NO_FUNC = 0, /* Don't light up the LED */
21  LED_POWERED, /* Light up the LED whenever the Chameleon is powered */
22 
23  LED_TERMINAL_CONN, /* A Terminal/USB connection has been established */
24  LED_TERMINAL_RXTX, /* There is traffic on the terminal */
25 
26  LED_SETTING_CHANGE, /* Outputs a blink code that shows the current setting */
27 
28  LED_MEMORY_STORED, /* Blink once when memory has been stored to flash */
29  LED_MEMORY_CHANGED, /* Switch LED on when card memory has changed compared to flash */
30 
31  LED_FIELD_DETECTED, /* Shows LED while a reader field is being detected or turned on by the chameleon itself */
32 
33  LED_CODEC_RX, /* Blink LED when receiving codec data */
34  LED_CODEC_TX, /* Blink LED when transmitting codec data */
35 
36  LED_LOG_MEM_FULL, /* Light up if log memory is full. */
37 
38  //TODO: LED_APP_SELECTED, /* Show LED while the correct UID has been selected and the application is active */
39  /* Has to be last element */
40  LED_FUNC_COUNT
41 } LEDHookEnum;
42 
43 typedef enum LEDActionEnum {
44  LED_NO_ACTION = 0x00,
45  LED_OFF = 0x10,
46  LED_ON = 0x11,
47  LED_TOGGLE = 0x12,
48  LED_PULSE = 0x13,
49  LED_BLINK = 0x20,
50  LED_BLINK_1X = 0x20,
51  LED_BLINK_2X, /* Have to be sequentially ordered */
52  LED_BLINK_3X,
53  LED_BLINK_4X,
54  LED_BLINK_5X,
55  LED_BLINK_6X,
56  LED_BLINK_7X,
57  LED_BLINK_8X,
58 } LEDActionEnum;
59 
60 
61 
62 void LEDInit(void);
63 void LEDTick(void);
64 
65 void LEDGetFuncList(char *List, uint16_t BufferSize);
66 void LEDSetFuncById(uint8_t Mask, LEDHookEnum Func);
67 void LEDGetFuncByName(uint8_t Mask, char *Function, uint16_t BufferSize);
68 bool LEDSetFuncByName(uint8_t Mask, const char *Function);
69 
70 #endif /* LED_H */