File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 5757
5858#define SERIAL_RESERVED_CHAR_MATCH (255)
5959
60+ /**
61+ * @defgroup SerialRXErrors Serial RX Errors Macros
62+ *
63+ * @{
64+ */
65+ #define SERIAL_ERROR_RX_OVERRUN (1 << 0)
66+ #define SERIAL_ERROR_RX_FRAMING (1 << 1)
67+ #define SERIAL_ERROR_RX_PARITY (1 << 2)
68+ #define SERIAL_ERROR_RX_OVERFLOW (1 << 3)
69+ /**@}*/
70+
6071typedef enum {
6172 ParityNone = 0 ,
6273 ParityOdd = 1 ,
@@ -175,6 +186,21 @@ void serial_putc(serial_t *obj, int c);
175186 */
176187int serial_readable (serial_t * obj );
177188
189+ /** Returns any errors that were encountered by the serial peripheral:
190+ * RX overrun, parity error, framing error, or FIFO overflow. All the
191+ * error flags are cleared after the function call.
192+ *
193+ * The return value is a bit field where one bit represents one error
194+ * type (in the above mentioned order, the least significant bit first).
195+ *
196+ * @param obj The serial object
197+ * @return Non-zero value if any of the errors have occurred, 0 otherwise
198+ * @retval 0000b No errors have occurred on the serial
199+ * @retval 0101b RX overrrun, framing errors
200+ * @retval 1111b All error types have occurred
201+ */
202+ int serial_error (serial_t * obj );
203+
178204/** Check if the serial peripheral is writable
179205 *
180206 * @param obj The serial object
You can’t perform that action at this time.
0 commit comments