2022-02-13 12:37:40 +00:00
# include "Arduino.h"
2022-02-13 14:42:08 +00:00
bool use_rn = false ; //if use_rn=true, CR and LF only do what they say. if use_rn=false \r is ignored and \n does CRLF(=Enter)
2022-01-17 19:28:56 +00:00
//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)
//To boot program after restart set Boot0 jumper to 0
//#define DEBUG
2022-02-13 13:14:49 +00:00
# define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
2022-02-13 12:37:40 +00:00
void checkSerial ( ) ;
bool textAvailable ( ) ;
bool checkTextbuffer ( ) ;
void sendChar ( char c , char c2 ) ;
void coilInterrupt ( ) ;
2022-01-17 19:28:56 +00:00
//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
2022-02-13 12:37:40 +00:00
2022-01-17 19:28:56 +00:00
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 } ;
2022-02-13 14:42:08 +00:00
2022-01-17 19:28:56 +00:00
byte keymatrix [ 128 ] [ NUM_SCANPINS ] = {
2022-02-13 13:14:49 +00:00
//0 1 2 3 4 5 6 7 8 <- see rows (left side) in docs/brotherax240_keyboard.JPG
//content at this array position is pressed keys 2^0 - 2^7=A-H. If Column 0(A) and 7(H) should be used, 2^0+2^7=1+128=129 is entered
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , //0 =