671 lines
27 KiB
C++
671 lines
27 KiB
C++
//Arduino 1.8.3
|
||
//STM32F103C, 64k flash
|
||
//upload method: serial (A9 to RX, A10 to TX)
|
||
//To upload set Boot0 jumper to 1 (the one further away from reset btn) and press reset (stm will boot from flash wich contains uart to flash uploader)
|
||
//upload via arduino IDE
|
||
//To boot program after restart set Boot0 jumper to 0
|
||
|
||
//#define DEBUG
|
||
|
||
//pins die nicht gehn als output:
|
||
/* PA15
|
||
* PB3
|
||
* PB4
|
||
* PA12
|
||
*/
|
||
|
||
#define SCAN_0 PA1
|
||
#define SCAN_1 PA2
|
||
#define SCAN_2 PA3
|
||
#define SCAN_3 PA4
|
||
#define SCAN_4 PA5
|
||
#define SCAN_5 PA6
|
||
#define SCAN_6 PA7
|
||
#define SCAN_7 PB0
|
||
#define SCAN_8 PB1
|
||
#define IN_A PB13 //geht
|
||
#define IN_B PB14 //geht
|
||
#define IN_C PB15 //geht
|
||
#define IN_D PB5 //geht
|
||
#define IN_E PB6 //geht
|
||
#define IN_F PB7 //geht
|
||
#define IN_G PB8 //geht
|
||
#define IN_H PB9 //geht
|
||
|
||
#define PIN_LED PC13
|
||
|
||
#define PIN_COIL_SENSE PB11
|
||
|
||
#define LEDON LOW
|
||
#define LEDOFF HIGH
|
||
|
||
|
||
#define NUM_SCANPINS 9
|
||
|
||
|
||
int scanaddress[]={SCAN_0,SCAN_1,SCAN_2,SCAN_3,SCAN_4,SCAN_5,SCAN_6,SCAN_7,SCAN_8};
|
||
int inaddress[]={IN_A,IN_B,IN_C,IN_D,IN_E,IN_F,IN_G,IN_H};
|
||
|
||
byte keymatrix[128][NUM_SCANPINS]={
|
||
//0 1 2 3 4 5 6 7 8
|
||
{255,255,255,255,255,255,255,255,255}, //0 = |