Use config helper function
This commit is contained in:
parent
d93667a48c
commit
51998a6e59
|
@ -29,23 +29,15 @@
|
|||
#include "drivers/max7456.h"
|
||||
#include "io/serial.h"
|
||||
|
||||
typedef struct targetSerialConfig_s {
|
||||
serialPortIdentifier_e identifier;
|
||||
serialPortFunction_e function;
|
||||
} targetSerialConfig_t;
|
||||
#include "config_helper.h"
|
||||
|
||||
targetSerialConfig_t targetSerialConfig[] = {
|
||||
static targetSerialPortFunction_t targetSerialPortFunction[] = {
|
||||
{ SERIAL_PORT_USART1, FUNCTION_RX_SERIAL },
|
||||
{ SERIAL_PORT_UART4, FUNCTION_ESC_SENSOR },
|
||||
};
|
||||
|
||||
void targetConfiguration(void)
|
||||
{
|
||||
for (unsigned i = 0 ; i < ARRAYLEN(targetSerialConfig) ; i++) {
|
||||
int index = findSerialPortIndexByIdentifier(targetSerialConfig[i].identifier);
|
||||
if (index >= 0) {
|
||||
serialConfigMutable()->portConfigs[index].functionMask = targetSerialConfig[i].function;
|
||||
}
|
||||
}
|
||||
targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction));
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,9 +26,15 @@
|
|||
|
||||
#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)
|
||||
{
|
||||
serialConfigMutable()->portConfigs[SERIAL_PORT_USART1].functionMask = FUNCTION_RX_SERIAL;
|
||||
serialConfigMutable()->portConfigs[SERIAL_PORT_UART5].functionMask = FUNCTION_ESC_SENSOR;
|
||||
targetSerialPortFunctionConfig(targetSerialPortFunction, ARRAYLEN(targetSerialPortFunction));
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue