mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 06:45:16 +03:00
Merge branch 'softserial-enabled' of git://github.com/sherlockflight/cleanflight-dev into sherlockflight-softserial-enabled
This commit is contained in:
commit
8a7edb17ed
3 changed files with 19 additions and 5 deletions
|
@ -247,8 +247,8 @@ serialPort_t *openSerialPort(
|
|||
portOptions_t options)
|
||||
{
|
||||
serialPortUsage_t *serialPortUsage = findSerialPortUsageByIdentifier(identifier);
|
||||
if (serialPortUsage->function != FUNCTION_NONE) {
|
||||
// already in use
|
||||
if (!serialPortUsage || serialPortUsage->function != FUNCTION_NONE) {
|
||||
// not available / already in use
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ void closeSerialPort(serialPort_t *serialPort) {
|
|||
serialPortUsage->serialPort = NULL;
|
||||
}
|
||||
|
||||
void serialInit(serialConfig_t *initialSerialConfig)
|
||||
void serialInit(serialConfig_t *initialSerialConfig, bool softserialEnabled)
|
||||
{
|
||||
uint8_t index;
|
||||
|
||||
|
@ -328,6 +328,19 @@ void serialInit(serialConfig_t *initialSerialConfig)
|
|||
|
||||
for (index = 0; index < SERIAL_PORT_COUNT; index++) {
|
||||
serialPortUsageList[index].identifier = serialPortIdentifiers[index];
|
||||
|
||||
if (!softserialEnabled) {
|
||||
if (0
|
||||
#ifdef USE_SOFTSERIAL1
|
||||
|| serialPortUsageList[index].identifier == SERIAL_PORT_SOFTSERIAL1
|
||||
#endif
|
||||
#ifdef USE_SOFTSERIAL2
|
||||
|| serialPortUsageList[index].identifier == SERIAL_PORT_SOFTSERIAL2
|
||||
#endif
|
||||
) {
|
||||
serialPortUsageList[index].identifier = SERIAL_PORT_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue