renesas-ra/machine_uart: Add the UART.IRQ_RX class constant.
The renesas-ra port supports calling a handler to be called on every byte received by UART. For consistency with other ports, the symbol IRQ_RX is added as the trigger name. Side change: Add the received UART data to the REPL input buffer only if it is the REPL UART. Otherwise, every UART would act as REPL input. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
#define MICROPY_PY_MACHINE_UART_CLASS_CONSTANTS \
|
#define MICROPY_PY_MACHINE_UART_CLASS_CONSTANTS \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HWCONTROL_RTS) }, \
|
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_INT(UART_HWCONTROL_RTS) }, \
|
||||||
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
|
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_INT(UART_HWCONTROL_CTS) }, \
|
||||||
|
{ MP_ROM_QSTR(MP_QSTR_IRQ_RX), MP_ROM_INT(0x10) }, \
|
||||||
|
|
||||||
static const char *_parity_name[] = {"None", "ODD", "EVEN"};
|
static const char *_parity_name[] = {"None", "ODD", "EVEN"};
|
||||||
|
|
||||||
|
|||||||
@@ -71,14 +71,18 @@ static void uart_rx_cb(uint32_t ch, int d) {
|
|||||||
// even disable the IRQ. This should never happen.
|
// even disable the IRQ. This should never happen.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if MICROPY_KBD_EXCEPTION
|
#if defined(MICROPY_HW_UART_REPL)
|
||||||
if (keyex_cb[ch]) {
|
if (ch == MICROPY_HW_UART_REPL) {
|
||||||
(*keyex_cb[ch])(d);
|
#if MICROPY_KBD_EXCEPTION
|
||||||
}
|
if (keyex_cb[ch]) {
|
||||||
#endif
|
(*keyex_cb[ch])(d);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MICROPY_HW_ENABLE_UART_REPL
|
#if MICROPY_HW_ENABLE_UART_REPL
|
||||||
ringbuf_put(&stdin_ringbuf, d);
|
ringbuf_put(&stdin_ringbuf, d);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check the flags to see if the user handler should be called
|
// Check the flags to see if the user handler should be called
|
||||||
|
|||||||
Reference in New Issue
Block a user