mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 12:25:20 +03:00
* trailing space removal Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * deduplicate empty lines --------- Co-authored-by: Petr Ledvina <ledvinap@gmail.com> Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
37 lines
909 B
C
37 lines
909 B
C
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#include "platform.h"
|
|
|
|
#include "io/serial.h"
|
|
|
|
#include "serial.h"
|
|
#include "serial_impl.h"
|
|
|
|
// convert options into pin pull mode (up/down/none)
|
|
serialPullMode_t serialOptions_pull(portOptions_e options)
|
|
{
|
|
// handle SmartAudio first - different SA versions need different values
|
|
// add more cases here if necessary
|
|
if (options & SERIAL_PULL_SMARTAUDIO) {
|
|
#ifdef USE_SMARTAUDIO_NOPULLDOWN
|
|
return serialPullNone;
|
|
#else
|
|
return serialPullDown;
|
|
#endif
|
|
}
|
|
if (options & SERIAL_PULL_NONE) {
|
|
return serialPullNone; // explicit nopull
|
|
} else if (options & SERIAL_INVERTED) {
|
|
return serialPullDown;
|
|
} else {
|
|
return serialPullUp;
|
|
}
|
|
}
|
|
|
|
// is pushPull mode necessary
|
|
bool serialOptions_pushPull(portOptions_e options)
|
|
{
|
|
return options & (SERIAL_INVERTED | SERIAL_BIDIR_PP);
|
|
}
|
|
|