2019-03-20 08:21:11 +01:00
|
|
|
/*
|
|
|
|
* key.h
|
|
|
|
*
|
|
|
|
* Created on: Mar 20, 2019
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SRC_KEY_H_
|
|
|
|
#define SRC_KEY_H_
|
|
|
|
|
2019-04-04 06:33:42 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-05-02 09:27:01 +02:00
|
|
|
#include "utils.h"
|
|
|
|
|
2019-04-01 01:29:37 +02:00
|
|
|
//#define DEBUG_KEYS
|
|
|
|
|
2019-03-20 08:21:11 +01:00
|
|
|
void KeyInit(void);
|
2019-05-02 09:27:01 +02:00
|
|
|
|
|
|
|
#pragma nooverlay
|
|
|
|
void raw_scan(void) __using(1);
|
|
|
|
|
|
|
|
#pragma nooverlay
|
|
|
|
void debounce(void) __using(1);
|
|
|
|
|
|
|
|
|
|
|
|
#define KeyScan() do { \
|
|
|
|
raw_scan(); \
|
|
|
|
debounce(); \
|
|
|
|
} while(0);
|
2019-03-20 08:21:11 +01:00
|
|
|
|
2019-04-01 01:29:37 +02:00
|
|
|
#ifdef DEBUG_KEYS
|
|
|
|
const uint8_t* DebugGetKeys(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//definition included for determining if multiple keys are pressed
|
|
|
|
//prefer using GetNewKeys();
|
|
|
|
#define TOTAL_ROWS 5
|
2019-05-02 09:27:01 +02:00
|
|
|
extern __idata uint8_t Keys[TOTAL_ROWS]; //only bottom nibbles get set
|
2019-04-01 07:55:47 +02:00
|
|
|
extern int8_t NewKeyPressed;
|
2019-04-01 01:29:37 +02:00
|
|
|
|
2019-03-20 08:21:11 +01:00
|
|
|
|
2019-04-04 06:33:42 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-03-20 08:21:11 +01:00
|
|
|
#endif /* SRC_KEY_H_ */
|