Browse Source

Fix SERIAL_8N2 mode on Teensy LC

teensy4-core
PaulStoffregen 7 years ago
parent
commit
717916e64d
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      teensy3/HardwareSerial.h

+ 10
- 4
teensy3/HardwareSerial.h View File

#define SERIAL_7E1 0x02 #define SERIAL_7E1 0x02
#define SERIAL_7O1 0x03 #define SERIAL_7O1 0x03
#define SERIAL_8N1 0x00 #define SERIAL_8N1 0x00
#define SERIAL_8N2 0x04
#define SERIAL_8E1 0x06 #define SERIAL_8E1 0x06
#define SERIAL_8O1 0x07 #define SERIAL_8O1 0x07
#define SERIAL_7E1_RXINV 0x12 #define SERIAL_7E1_RXINV 0x12
#define SERIAL_7O1_RXINV 0x13 #define SERIAL_7O1_RXINV 0x13
#define SERIAL_8N1_RXINV 0x10 #define SERIAL_8N1_RXINV 0x10
#define SERIAL_8N2_RXINV 0x14
#define SERIAL_8E1_RXINV 0x16 #define SERIAL_8E1_RXINV 0x16
#define SERIAL_8O1_RXINV 0x17 #define SERIAL_8O1_RXINV 0x17
#define SERIAL_7E1_TXINV 0x22 #define SERIAL_7E1_TXINV 0x22
#define SERIAL_7O1_TXINV 0x23 #define SERIAL_7O1_TXINV 0x23
#define SERIAL_8N1_TXINV 0x20 #define SERIAL_8N1_TXINV 0x20
#define SERIAL_8N2_TXINV 0x24
#define SERIAL_8E1_TXINV 0x26 #define SERIAL_8E1_TXINV 0x26
#define SERIAL_8O1_TXINV 0x27 #define SERIAL_8O1_TXINV 0x27
#define SERIAL_7E1_RXINV_TXINV 0x32 #define SERIAL_7E1_RXINV_TXINV 0x32
#define SERIAL_7O1_RXINV_TXINV 0x33 #define SERIAL_7O1_RXINV_TXINV 0x33
#define SERIAL_8N1_RXINV_TXINV 0x30 #define SERIAL_8N1_RXINV_TXINV 0x30
#define SERIAL_8N2_RXINV_TXINV 0x34
#define SERIAL_8E1_RXINV_TXINV 0x36 #define SERIAL_8E1_RXINV_TXINV 0x36
#define SERIAL_8O1_RXINV_TXINV 0x37 #define SERIAL_8O1_RXINV_TXINV 0x37
#ifdef SERIAL_9BIT_SUPPORT #ifdef SERIAL_9BIT_SUPPORT
#define SERIAL_8O2_TXINV (SERIAL_8O1_TXINV | SERIAL_2STOP_BITS) #define SERIAL_8O2_TXINV (SERIAL_8O1_TXINV | SERIAL_2STOP_BITS)
#define SERIAL_8E2_RXINV_TXINV (SERIAL_8E1_RXINV_TXINV | SERIAL_2STOP_BITS) #define SERIAL_8E2_RXINV_TXINV (SERIAL_8E1_RXINV_TXINV | SERIAL_2STOP_BITS)
#define SERIAL_8O2_RXINV_TXINV (SERIAL_8O1_RXINV_TXINV | SERIAL_2STOP_BITS) #define SERIAL_8O2_RXINV_TXINV (SERIAL_8O1_RXINV_TXINV | SERIAL_2STOP_BITS)
#define SERIAL_8N2 (SERIAL_8N1 | SERIAL_2STOP_BITS)
#define SERIAL_8N2_RXINV (SERIAL_8N1_RXINV | SERIAL_2STOP_BITS)
#define SERIAL_8N2_TXINV (SERIAL_8N1_TXINV | SERIAL_2STOP_BITS)
#define SERIAL_8N2_RXINV_TXINV (SERIAL_8N1_RXINV_TXINV | SERIAL_2STOP_BITS)
#else
// for Teensy 3.0-3.2 we can fake 2 stop bits by using 9 bit mode
#define SERIAL_8N2 0x04
#define SERIAL_8N2_RXINV 0x14
#define SERIAL_8N2_TXINV 0x24
#define SERIAL_8N2_RXINV_TXINV 0x34
#endif #endif
// bit0: parity, 0=even, 1=odd // bit0: parity, 0=even, 1=odd
// bit1: parity, 0=disable, 1=enable // bit1: parity, 0=disable, 1=enable

Loading…
Cancel
Save