-
Notifications
You must be signed in to change notification settings - Fork 7
UARTx_read
gicking edited this page Feb 10, 2018
·
1 revision
back to Command Reference / Serial
blocking read of byte received via UARTx (x=1..4). Prior to receiving via UART, communication must be configured via UARTx_begin().
Notes:
- formatted input e.g. via
gets()
is supported by using getcharAttach() with argumentUARTx_read
-
UARTx_read()
halts code execution until a byte has been received. To avoid stalling, first check receive buffer via UARTx_available(), or receive via interrupt UART1_RXF_ISR or UART234_RXF_ISR, respectively
- defined in
uartx.h
(x=1..4) -
not loaded by
main_general.h
- for UART1 receive interrupt set
#define USE_UART1_RXF_ISR
inconfig.h
. The corresponding interrupt function name isUART1_RXF_ISR
- for UART2,3,4 receive interrupt set
#define USE_UART234_RXF_ISR
inconfig.h
. The corresponding interrupt function name isUART234_RXF_ISR
c = UART1_read()
-
input:
- none
-
output:
- none
- read byte (char)
The below function echoes bytes received via UART1
#include "main_general.h"
#include "uart1.h"
void setup() {
UART1_begin(115200);
}
void loop() {
if (UART1_available())
UART1_write(UART1_read());
}
-
Getting Started
-
- General Commands
- Libraries
- LCD BTHQ21605V
- poti AD5280
- poti AD5282
- freemodbus
- PetitFS SD-card (min)
- FatFS: SD card (full)
- Board Specific
-
- Universal
- Board Specific