Skip to content

Commit

Permalink
Merge pull request esp8266#1625 from hallard/master
Browse files Browse the repository at this point in the history
Added bit mask and constant for SerialConfig parameter
  • Loading branch information
igrr committed Feb 13, 2016
2 parents 153138e + e3bf9bb commit 4f5f003
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions cores/esp8266/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,49 @@ extern "C" {
#define UART_NO -1

// Options for `config` argument of uart_init
#define UART_NB_BIT_MASK 0B00001100
#define UART_NB_BIT_5 0B00000000
#define UART_NB_BIT_6 0B00000100
#define UART_NB_BIT_7 0B00001000
#define UART_NB_BIT_8 0B00001100

#define UART_PARITY_MASK 0B00000011
#define UART_PARITY_NONE 0B00000000
#define UART_PARITY_EVEN 0B00000010
#define UART_PARITY_ODD 0B00000011

#define UART_NB_STOP_BIT_MASK 0B00110000
#define UART_NB_STOP_BIT_0 0B00000000
#define UART_NB_STOP_BIT_1 0B00010000
#define UART_NB_STOP_BIT_15 0B00100000
#define UART_NB_STOP_BIT_2 0B00110000

#define UART_5N1 ( UART_NB_BIT_5 | UART_PARITY_NONE | UART_NB_STOP_BIT_1 )
#define UART_6N1 ( UART_NB_BIT_6 | UART_PARITY_NONE | UART_NB_STOP_BIT_1 )
#define UART_7N1 ( UART_NB_BIT_7 | UART_PARITY_NONE | UART_NB_STOP_BIT_1 )
#define UART_8N1 ( UART_NB_BIT_8 | UART_PARITY_NONE | UART_NB_STOP_BIT_1 )
#define UART_5N2 ( UART_NB_BIT_5 | UART_PARITY_NONE | UART_NB_STOP_BIT_2 )
#define UART_6N2 ( UART_NB_BIT_6 | UART_PARITY_NONE | UART_NB_STOP_BIT_2 )
#define UART_7N2 ( UART_NB_BIT_7 | UART_PARITY_NONE | UART_NB_STOP_BIT_2 )
#define UART_8N2 ( UART_NB_BIT_8 | UART_PARITY_NONE | UART_NB_STOP_BIT_2 )
#define UART_5E1 ( UART_NB_BIT_5 | UART_PARITY_EVEN | UART_NB_STOP_BIT_1 )
#define UART_6E1 ( UART_NB_BIT_6 | UART_PARITY_EVEN | UART_NB_STOP_BIT_1 )
#define UART_7E1 ( UART_NB_BIT_7 | UART_PARITY_EVEN | UART_NB_STOP_BIT_1 )
#define UART_8E1 ( UART_NB_BIT_8 | UART_PARITY_EVEN | UART_NB_STOP_BIT_1 )
#define UART_5E2 ( UART_NB_BIT_5 | UART_PARITY_EVEN | UART_NB_STOP_BIT_2 )
#define UART_6E2 ( UART_NB_BIT_6 | UART_PARITY_EVEN | UART_NB_STOP_BIT_2 )
#define UART_7E2 ( UART_NB_BIT_7 | UART_PARITY_EVEN | UART_NB_STOP_BIT_2 )
#define UART_8E2 ( UART_NB_BIT_8 | UART_PARITY_EVEN | UART_NB_STOP_BIT_2 )
#define UART_5O1 ( UART_NB_BIT_5 | UART_PARITY_ODD | UART_NB_STOP_BIT_1 )
#define UART_6O1 ( UART_NB_BIT_6 | UART_PARITY_ODD | UART_NB_STOP_BIT_1 )
#define UART_7O1 ( UART_NB_BIT_7 | UART_PARITY_ODD | UART_NB_STOP_BIT_1 )
#define UART_8O1 ( UART_NB_BIT_8 | UART_PARITY_ODD | UART_NB_STOP_BIT_1 )
#define UART_5O2 ( UART_NB_BIT_5 | UART_PARITY_ODD | UART_NB_STOP_BIT_2 )
#define UART_6O2 ( UART_NB_BIT_6 | UART_PARITY_ODD | UART_NB_STOP_BIT_2 )
#define UART_7O2 ( UART_NB_BIT_7 | UART_PARITY_ODD | UART_NB_STOP_BIT_2 )
#define UART_8O2 ( UART_NB_BIT_8 | UART_PARITY_ODD | UART_NB_STOP_BIT_2 )

/*
#define UART_5N1 0x10
#define UART_6N1 0x14
#define UART_7N1 0x18
Expand All @@ -58,6 +101,7 @@ extern "C" {
#define UART_6O2 0x37
#define UART_7O2 0x3b
#define UART_8O2 0x3f
*/

// Options for `mode` argument of uart_init
#define UART_FULL 0
Expand Down

0 comments on commit 4f5f003

Please sign in to comment.