src/def_f446re.h

Mon, 09 Nov 2020 23:05:24 +0100

author
David Douard <david.douard@sdf3.org>
date
Mon, 09 Nov 2020 23:05:24 +0100
changeset 49
c146d19101a3
parent 44
b3c3d54d2c7c
permissions
-rw-r--r--

Refactor HPSerial to get rid of packet collision misbehavior

completely split the key sending code from the irq-based receiveing logic.
When sending keycodes, disable the RxIrq callback and handle send and recv
of bytes synchronously.

The keycode sending routine rus in a dedicated thread.

#if !defined(DEF_F446RE_H)


#define DEF_F446RE_H
/******************************************************/
/*                 F446RE                             */
/******************************************************/
// TODO: use TARGET_NUCLEO_F446RE or similar
// UART
// USBTX PA_2
// USBRX PA_3
// display
#define DSP_MOSI PB_15 // blue
#define DSP_MISO PB_14 // NC
#define DSP_SCLK PB_13 // yellow
#define DSP_CS   PB_12 // green
#define DSP_RST  PB_5 // green
#define DSP_DC   PB_4 // red

// UART for RX (CPU->DP)
#define HP_RX PC_11 // serial3 RX
#define HP_TX PC_10 // serial3 TX

// RST pin (handle this by hand)
#define HP_RST PC_12

// encoder
#define KP_ENC1 PC_4
#define KP_ENC2 PC_5

// keypad
#define KP_R0 PC_0   //  I-6
#define KP_R1 PC_1   // II-5
#define KP_R2 PC_2   //  I-5
#define KP_R3 PC_3   // II-4


#define KP_C0 PB_0   //  I-4
#define KP_C1 PA_6   //  I-2
#define KP_C2 PA_7   //  I-3
#define KP_C3 PA_10   //  I-1
#define KP_C4 PD_2   // II-1

// misc
#define DBGPIN PC_6

#ifdef HAVE_PC
BufferedSerial pc(USBTX, USBRX, 115200);
#endif
DigitalOut led(LED1);
#define HAS_LED
#endif

mercurial