mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
machine: improve UARTParity slightly
There are only 3 possible values, so a uint8 seems more appropriate. Also, there is no reason to use specific numbers over a simple enumeration.
This commit is contained in:
committed by
Ron Evans
parent
a5aa777c7b
commit
9720ccacbb
+4
-4
@@ -8,20 +8,20 @@ import "errors"
|
|||||||
var errUARTBufferEmpty = errors.New("UART buffer empty")
|
var errUARTBufferEmpty = errors.New("UART buffer empty")
|
||||||
|
|
||||||
// UARTParity is the parity setting to be used for UART communication.
|
// UARTParity is the parity setting to be used for UART communication.
|
||||||
type UARTParity int
|
type UARTParity uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ParityNone means to not use any parity checking. This is
|
// ParityNone means to not use any parity checking. This is
|
||||||
// the most common setting.
|
// the most common setting.
|
||||||
ParityNone UARTParity = 0
|
ParityNone UARTParity = iota
|
||||||
|
|
||||||
// ParityEven means to expect that the total number of 1 bits sent
|
// ParityEven means to expect that the total number of 1 bits sent
|
||||||
// should be an even number.
|
// should be an even number.
|
||||||
ParityEven UARTParity = 1
|
ParityEven
|
||||||
|
|
||||||
// ParityOdd means to expect that the total number of 1 bits sent
|
// ParityOdd means to expect that the total number of 1 bits sent
|
||||||
// should be an odd number.
|
// should be an odd number.
|
||||||
ParityOdd UARTParity = 2
|
ParityOdd
|
||||||
)
|
)
|
||||||
|
|
||||||
// To implement the UART interface for a board, you must declare a concrete type as follows:
|
// To implement the UART interface for a board, you must declare a concrete type as follows:
|
||||||
|
|||||||
Reference in New Issue
Block a user