mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Allow the user to specify their serial port scenarios.
This commit is contained in:
parent
5043370b2f
commit
0fd127bf60
8 changed files with 258 additions and 50 deletions
|
@ -11,18 +11,22 @@ typedef enum {
|
|||
} serialPortFunction_e;
|
||||
|
||||
typedef enum {
|
||||
SCENARIO_MAIN_PORT = FUNCTION_MSP | FUNCTION_CLI | FUNCTION_TELEMETRY | FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_CLI_ONLY = FUNCTION_CLI,
|
||||
SCENARIO_GPS_AND_TELEMETRY = FUNCTION_GPS | FUNCTION_TELEMETRY,
|
||||
SCENARIO_GPS_PASSTHROUGH_ONLY = FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_GPS_ONLY = FUNCTION_GPS,
|
||||
SCENARIO_MSP_ONLY = FUNCTION_MSP,
|
||||
SCENARIO_SERIAL_RX_ONLY = FUNCTION_SERIAL_RX,
|
||||
SCENARIO_TELEMETRY_ONLY = FUNCTION_TELEMETRY,
|
||||
SCENARIO_MSP_CLI_GPS_PASTHROUGH = FUNCTION_CLI | FUNCTION_MSP | FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_UNUSED = FUNCTION_NONE
|
||||
SCENARIO_UNUSED = FUNCTION_NONE,
|
||||
|
||||
SCENARIO_CLI_ONLY = FUNCTION_CLI,
|
||||
SCENARIO_GPS_ONLY = FUNCTION_GPS,
|
||||
SCENARIO_GPS_PASSTHROUGH_ONLY = FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_MSP_ONLY = FUNCTION_MSP,
|
||||
SCENARIO_MSP_CLI_GPS_PASTHROUGH = FUNCTION_CLI | FUNCTION_MSP | FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_MSP_CLI_TELEMETRY_GPS_PASTHROUGH = FUNCTION_MSP | FUNCTION_CLI | FUNCTION_TELEMETRY | FUNCTION_GPS_PASSTHROUGH,
|
||||
SCENARIO_SERIAL_RX_ONLY = FUNCTION_SERIAL_RX,
|
||||
SCENARIO_TELEMETRY_ONLY = FUNCTION_TELEMETRY,
|
||||
} serialPortFunctionScenario_e;
|
||||
|
||||
#define SERIAL_PORT_SCENARIO_COUNT 9
|
||||
#define SERIAL_PORT_SCENARIO_MAX (SERIAL_PORT_SCENARIO_COUNT - 1)
|
||||
extern const serialPortFunctionScenario_e serialPortScenarios[SERIAL_PORT_SCENARIO_COUNT];
|
||||
|
||||
#define SERIAL_PORT_COUNT 4
|
||||
|
||||
typedef enum {
|
||||
|
@ -62,6 +66,11 @@ typedef struct serialPortFunction_s {
|
|||
} serialPortFunction_t;
|
||||
|
||||
typedef struct serialConfig_s {
|
||||
uint8_t serial_port_1_scenario;
|
||||
uint8_t serial_port_2_scenario;
|
||||
uint8_t serial_port_3_scenario;
|
||||
uint8_t serial_port_4_scenario;
|
||||
|
||||
uint32_t msp_baudrate;
|
||||
uint32_t cli_baudrate;
|
||||
uint32_t gps_passthrough_baudrate;
|
||||
|
@ -71,6 +80,8 @@ typedef struct serialConfig_s {
|
|||
uint8_t reboot_character; // which byte is used to reboot. Default 'R', could be changed carefully to something else.
|
||||
} serialConfig_t;
|
||||
|
||||
uint8_t lookupScenarioIndex(serialPortFunctionScenario_e scenario);
|
||||
|
||||
serialPort_t *findOpenSerialPort(uint16_t functionMask);
|
||||
serialPort_t *openSerialPort(serialPortFunction_e functionMask, serialReceiveCallbackPtr callback, uint32_t baudRate, portMode_t mode, serialInversion_e inversion);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue