39 lines
620 B
C++
39 lines
620 B
C++
#ifndef KEY_H
|
|
#define KEY_H
|
|
|
|
#include "ti_msp_dl_config.h"
|
|
|
|
#define KEY1 0
|
|
#define KEY2 1
|
|
#define KEY3 2
|
|
#define KEY4 3
|
|
|
|
#define KEY_LEFT KEY1
|
|
#define KEY_RIGHT KEY2
|
|
#define KEY_ACCESS KEY3
|
|
#define KEY_CANCEL KEY4
|
|
|
|
#define KEY1_PIN_ID 7
|
|
#define KEY2_PIN_ID 10
|
|
#define KEY3_PIN_ID 11
|
|
#define KEY4_PIN_ID 14
|
|
|
|
class Key {
|
|
public:
|
|
struct KeyData {
|
|
uint8_t id;
|
|
GPIO_Regs *port;
|
|
uint32_t pin;
|
|
uint8_t state;
|
|
};
|
|
|
|
static KeyData keys[];
|
|
static void init();
|
|
static uint8_t getState(uint8_t id);
|
|
static void setState(uint8_t id, uint8_t state);
|
|
|
|
private:
|
|
};
|
|
|
|
#endif //KEY_H
|