mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Merge pull request #5820 from jflyper/OMNIBUSF4FW-and-OMNINXT-Use-config-helper
OMNIBUSF4FW and OMNINXT Use config helper function
This commit is contained in:
commit
5460f8775e
2 changed files with 11 additions and 13 deletions
|
@ -29,23 +29,15 @@
|
||||||
#include "drivers/max7456.h"
|
#include "drivers/max7456.h"
|
||||||
#include "io/serial.h"
|
#include "io/serial.h"
|
||||||
|
|
||||||
typedef struct targetSerialConfig_s {
|
#include "config_helper.h"
|
||||||
serialPortIdentifier_e identifier;
|
|
||||||
serialPortFunction_e function;
|
|
||||||
} targetSerialConfig_t;
|
|
||||||
|
|
||||||
targetSerialConfig_t targetSerialConfig[] = {
|
static targetSerialPortFunction_t targetSerialPortFunction[] = {
|
||||||
{ SERIAL_PORT_USART1, FUNCTION_RX_SERIAL },
|
{ SERIAL_PORT_USART1, FUNCTION_RX_SERIAL },
|
||||||
{ SERIAL_PORT_UART4, FUNCTION_ESC_SENSOR },
|
{ SERIAL_PORT_UART4, FUNCTION_ESC_SENSOR },
|
||||||
};
|
};
|
||||||
|
|
||||||
void targetConfiguration(void)
|
void targetConfiguration(void)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0 ; i < ARRAYLEN(targetSerialConfig) ; i++) {
|
targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction));
|
||||||
int index = findSerialPortIndexByIdentifier(targetSerialConfig[i].identifier);
|
|
||||||
if (index >= 0) {
|
|
||||||
serialConfigMutable()->portConfigs[index].functionMask = targetSerialConfig[i].function;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,9 +26,15 @@
|
||||||
|
|
||||||
#include "pg/pg.h"
|
#include "pg/pg.h"
|
||||||
|
|
||||||
|
#include "config_helper.h"
|
||||||
|
|
||||||
|
static targetSerialPortFunction_t targetSerialPortFunction[] = {
|
||||||
|
{ SERIAL_PORT_USART1, FUNCTION_RX_SERIAL },
|
||||||
|
{ SERIAL_PORT_UART5, FUNCTION_ESC_SENSOR },
|
||||||
|
};
|
||||||
|
|
||||||
void targetConfiguration(void)
|
void targetConfiguration(void)
|
||||||
{
|
{
|
||||||
serialConfigMutable()->portConfigs[SERIAL_PORT_USART1].functionMask = FUNCTION_RX_SERIAL;
|
targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction));
|
||||||
serialConfigMutable()->portConfigs[SERIAL_PORT_UART5].functionMask = FUNCTION_ESC_SENSOR;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue