WiP
This commit is contained in:
+37
-4
@@ -22,19 +22,52 @@
|
||||
#ifndef _SERIAL_H_
|
||||
#define _SERIAL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_AUX_SERIAL 2
|
||||
|
||||
void initSerialPorts();
|
||||
uint8_t serialGetMode(int port_nr);
|
||||
uint8_t serialTracesEnabled(int port_nr);
|
||||
void serialInit(int port_nr, int mode);
|
||||
void serialStop(int port_nr);
|
||||
void serialPutc(int port_nr, uint8_t c);
|
||||
|
||||
#if defined(AUX_SERIAL)
|
||||
#define auxSerialSbusInit() serialInit(0, UART_MODE_SBUS_TRAINER)
|
||||
#define auxSerialGetMode() serialGetMode(0)
|
||||
#define auxSerialTracesEnabled() serialTracesEnabled(0)
|
||||
#define auxSerialStop() serialStop(0)
|
||||
#define auxSerialPutc(c) serialPutc(0, (c))
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
#define aux2SerialSbusInit() serialInit(1, UART_MODE_SBUS_TRAINER)
|
||||
#define aux2SerialGetMode() serialGetMode(1)
|
||||
#define aux2SerialTracesEnabled() serialTracesEnabled(1)
|
||||
#define aux2SerialStop() serialStop(1)
|
||||
#define aux2SerialPutc(c) serialPutc(1, (c))
|
||||
#endif
|
||||
|
||||
//
|
||||
// Functions used by debug.h
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void serialPutc(char c);
|
||||
void serialPrintf(const char *format, ...);
|
||||
void serialCrlf();
|
||||
void dbgSerialPutc(char c);
|
||||
void dbgSerialPrintf(const char *format, ...);
|
||||
void dbgSerialCrlf();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define serialPrint(...) do { serialPrintf(__VA_ARGS__); serialCrlf(); } while(0)
|
||||
#define dbgSerialPrint(...) do { dbgSerialPrintf(__VA_ARGS__); dbgSerialCrlf(); } while(0)
|
||||
|
||||
// Debug serial callback
|
||||
void dbgSerialSetSendCb(void* ctx, void (*cb)(void*, uint8_t));
|
||||
|
||||
#endif // _SERIAL_H_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user