-
Notifications
You must be signed in to change notification settings - Fork 7
UART234_RXF_ISR
gicking edited this page Feb 10, 2018
·
1 revision
back to Command Reference / Interrupt
Implementation of the shared UART2/3/4 receive buffer full (RXF) interrupt service routine for background reception
(see Serial).
If UART234 receive interrupt is enabled via UARTx_enable_receive_interrupt(), interrupt
service routine UART234_RXF_ISR()
is automatically called when a byte is received via UART2, UART3 or UART4.
Notes:
- global interrupts must also be enabled, see interrupts()
- defined in
stm8_interrupt_vector.h
- auto-loaded in
main_general.h
- in
config.h
set#define USE_UART234_RXF_ISR
, and implement the interrupt routineUART234_RXF_ISR
ISR_HANDLER(UART234_RXF_ISR, UART234_RXF_VECTOR)
-
input:
- none
-
output:
- none
- Nothing
The below code echoes bytes received via UART2 in interrupts. After byte is sent, an LED toggles.
#include "main_general.h"
#include "uart2.h"
ISR_HANDLER(UART234_RXF_ISR, __UART234_RXF_VECTOR__) {
UART2_write(UART2_read());
UART2_enable_send_interrupt();
}
ISR_HANDLER(UART234_TXE_ISR, __UART234_TXE_VECTOR__) {
pinToggle(&PORT_H, 3);
UART2_disable_send_interrupt(); // important!
}
void setup() {
UART2_begin(115200);
UART2_enable_receive_interrupt();
pinMode(&PORT_H, 3, OUTPUT);
}
void loop() {
// do something else
}
-
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