Raise STM32F1 UART IRQ Priority, add error handling (#19301)
(Error handling for Overrun, Framing and Parity.)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <HardwareSerial.h>
|
||||
#include <libmaple/usart.h>
|
||||
#include <WString.h>
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
@@ -29,6 +30,8 @@
|
||||
#include "../../feature/e_parser.h"
|
||||
#endif
|
||||
|
||||
#define UART_IRQ_PRIO 1
|
||||
|
||||
class MarlinSerial : public HardwareSerial {
|
||||
public:
|
||||
MarlinSerial(struct usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) :
|
||||
@@ -38,6 +41,18 @@ public:
|
||||
#endif
|
||||
{ }
|
||||
|
||||
#ifdef UART_IRQ_PRIO
|
||||
// shadow the parent methods to set irq priority after the begin
|
||||
void begin(uint32 baud) {
|
||||
MarlinSerial::begin(baud, SERIAL_8N1);
|
||||
}
|
||||
|
||||
void begin(uint32 baud, uint8_t config) {
|
||||
HardwareSerial::begin(baud, config);
|
||||
nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
EmergencyParser::State emergency_state;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user