Merge pull request #567 from blckmn/development
Renamed additional io to tag, and fixed issue with timerhardware tag
This commit is contained in:
commit
0d00260ff2
|
@ -236,7 +236,7 @@ void mpuIntExtiInit(void)
|
|||
|
||||
#if defined(USE_MPU_DATA_READY_SIGNAL) && defined(USE_EXTI)
|
||||
|
||||
IO_t mpuIntIO = IOGetByTag(mpuIntExtiConfig->io);
|
||||
IO_t mpuIntIO = IOGetByTag(mpuIntExtiConfig->tag);
|
||||
|
||||
#ifdef ENSURE_MPU_DATA_READY_IS_LOW
|
||||
uint8_t status = IORead(mpuIntIO);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// old EXTI interface, to be replaced
|
||||
typedef struct extiConfig_s {
|
||||
ioTag_t io;
|
||||
ioTag_t tag;
|
||||
} extiConfig_t;
|
||||
|
||||
typedef struct extiCallbackRec_s extiCallbackRec_t;
|
||||
|
|
|
@ -144,7 +144,7 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
|
||||
#if defined(STM32F303xC) && defined(USE_USART3)
|
||||
// skip UART3 ports (PB10/PB11)
|
||||
if (init->useUART3 && (CheckGPIOPin(timerHardwarePtr->pin, UART3_GPIO, UART3_TX_PIN) || CheckGPIOPin(timerHardwarePtr->pin, UART3_GPIO, UART3_RX_PIN)))
|
||||
if (init->useUART3 && (CheckGPIOPin(timerHardwarePtr->tag, UART3_GPIO, UART3_TX_PIN) || CheckGPIOPin(timerHardwarePtr->tag, UART3_GPIO, UART3_RX_PIN)))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
|
@ -163,7 +163,7 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
if (timerHardwarePtr->tim == LED_STRIP_TIMER)
|
||||
continue;
|
||||
#if defined(STM32F303xC) && defined(WS2811_GPIO) && defined(WS2811_PIN_SOURCE)
|
||||
if (CheckGPIOPinSource(timerHardwarePtr->pin, WS2811_GPIO, WS2811_PIN_SOURCE))
|
||||
if (CheckGPIOPinSource(timerHardwarePtr->tag, WS2811_GPIO, WS2811_PIN_SOURCE))
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
|
@ -171,19 +171,19 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
#endif
|
||||
|
||||
#ifdef VBAT_ADC_GPIO
|
||||
if (init->useVbat && CheckGPIOPin(timerHardwarePtr->pin, VBAT_ADC_GPIO, VBAT_ADC_GPIO_PIN)) {
|
||||
if (init->useVbat && CheckGPIOPin(timerHardwarePtr->tag, VBAT_ADC_GPIO, VBAT_ADC_GPIO_PIN)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RSSI_ADC_GPIO
|
||||
if (init->useRSSIADC && CheckGPIOPin(timerHardwarePtr->pin, RSSI_ADC_GPIO, RSSI_ADC_GPIO_PIN)) {
|
||||
if (init->useRSSIADC && CheckGPIOPin(timerHardwarePtr->tag, RSSI_ADC_GPIO, RSSI_ADC_GPIO_PIN)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CURRENT_METER_ADC_GPIO
|
||||
if (init->useCurrentMeterADC && CheckGPIOPin(timerHardwarePtr->pin, CURRENT_METER_ADC_GPIO, CURRENT_METER_ADC_GPIO_PIN)) {
|
||||
if (init->useCurrentMeterADC && CheckGPIOPin(timerHardwarePtr->tag, CURRENT_METER_ADC_GPIO, CURRENT_METER_ADC_GPIO_PIN)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
@ -191,8 +191,8 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
#ifdef SONAR
|
||||
if (init->sonarConfig &&
|
||||
(
|
||||
timerHardwarePtr->pin == init->sonarConfig->triggerPin ||
|
||||
timerHardwarePtr->pin == init->sonarConfig->echoPin
|
||||
timerHardwarePtr->tag == init->sonarConfig->triggerTag ||
|
||||
timerHardwarePtr->tag == init->sonarConfig->echoTag
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@
|
|||
#define ONESHOT125_TIMER_MHZ 8
|
||||
|
||||
typedef struct sonarIOConfig_s {
|
||||
ioTag_t triggerPin;
|
||||
ioTag_t echoPin;
|
||||
ioTag_t triggerTag;
|
||||
ioTag_t echoTag;
|
||||
} sonarIOConfig_t;
|
||||
|
||||
typedef struct drv_pwm_config_s {
|
||||
|
|
|
@ -218,11 +218,11 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
|
|||
|
||||
softSerial->softSerialPortIndex = portIndex;
|
||||
|
||||
softSerial->txIO = IOGetByTag(softSerial->txTimerHardware->pin);
|
||||
serialOutputPortConfig(softSerial->txTimerHardware->pin);
|
||||
softSerial->txIO = IOGetByTag(softSerial->txTimerHardware->tag);
|
||||
serialOutputPortConfig(softSerial->txTimerHardware->tag);
|
||||
|
||||
softSerial->rxIO = IOGetByTag(softSerial->rxTimerHardware->pin);
|
||||
serialInputPortConfig(softSerial->rxTimerHardware->pin);
|
||||
softSerial->rxIO = IOGetByTag(softSerial->rxTimerHardware->tag);
|
||||
serialInputPortConfig(softSerial->rxTimerHardware->tag);
|
||||
|
||||
setTxSignal(softSerial, ENABLE);
|
||||
delay(50);
|
||||
|
|
|
@ -83,12 +83,12 @@ void hcsr04_init(const sonarHardware_t *initialSonarHardware, sonarRange_t *sona
|
|||
#endif
|
||||
|
||||
// trigger pin
|
||||
triggerIO = IOGetByTag(sonarHardware->triggerIO);
|
||||
triggerIO = IOGetByTag(sonarHardware->triggerTag);
|
||||
IOInit(triggerIO, OWNER_SONAR, RESOURCE_INPUT);
|
||||
IOConfigGPIO(triggerIO, IOCFG_OUT_PP);
|
||||
|
||||
// echo pin
|
||||
echoIO = IOGetByTag(sonarHardware->echoIO);
|
||||
echoIO = IOGetByTag(sonarHardware->echoTag);
|
||||
IOInit(echoIO, OWNER_SONAR, RESOURCE_INPUT);
|
||||
IOConfigGPIO(echoIO, IOCFG_IN_FLOATING);
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "io.h"
|
||||
|
||||
typedef struct sonarHardware_s {
|
||||
ioTag_t triggerIO;
|
||||
ioTag_t echoIO;
|
||||
ioTag_t triggerTag;
|
||||
ioTag_t echoTag;
|
||||
} sonarHardware_t;
|
||||
|
||||
typedef struct sonarRange_s {
|
||||
|
|
|
@ -269,8 +269,8 @@ void init(void)
|
|||
if (feature(FEATURE_SONAR)) {
|
||||
sonarHardware = sonarGetHardwareConfiguration(&masterConfig.batteryConfig);
|
||||
sonarIOConfig_t sonarConfig = {
|
||||
.triggerPin = sonarHardware->triggerIO,
|
||||
.echoPin = sonarHardware->echoIO
|
||||
.triggerTag = sonarHardware->triggerTag,
|
||||
.echoTag = sonarHardware->echoTag
|
||||
};
|
||||
pwm_params.sonarConfig = &sonarConfig;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ uint8_t detectedSensors[MAX_SENSORS_TO_DETECT] = { GYRO_NONE, ACC_NONE, BARO_NON
|
|||
const extiConfig_t *selectMPUIntExtiConfig(void)
|
||||
{
|
||||
#if defined(MPU_INT_EXTI)
|
||||
static const extiConfig_t mpuIntExtiConfig = { .io = IO_TAG(MPU_INT_EXTI) };
|
||||
static const extiConfig_t mpuIntExtiConfig = { .tag = IO_TAG(MPU_INT_EXTI) };
|
||||
return &mpuIntExtiConfig;
|
||||
#elif defined(USE_HARDWARE_REVISION_DETECTION)
|
||||
return selectMPUIntExtiConfigByHardwareRevision();
|
||||
|
|
|
@ -57,8 +57,8 @@ const sonarHardware_t *sonarGetHardwareConfiguration(batteryConfig_t *batteryCon
|
|||
#if defined(SONAR_TRIGGER_PIN) && defined(SONAR_ECHO_PIN)
|
||||
UNUSED(batteryConfig);
|
||||
static const sonarHardware_t const sonarHardware = {
|
||||
.triggerIO = IO_TAG(SONAR_TRIGGER_PIN),
|
||||
.echoIO = IO_TAG(SONAR_ECHO_PIN),
|
||||
.triggerTag = IO_TAG(SONAR_TRIGGER_PIN),
|
||||
.echoTag = IO_TAG(SONAR_ECHO_PIN),
|
||||
};
|
||||
return &sonarHardware;
|
||||
#elif defined(SONAR_CUSTOM_CONFIG)
|
||||
|
|
|
@ -61,11 +61,11 @@ const extiConfig_t *selectMPUIntExtiConfigByHardwareRevision(void)
|
|||
{
|
||||
// MPU_INT output on V1 PA15
|
||||
static const extiConfig_t alienFlightF3V1MPUIntExtiConfig = {
|
||||
.io = IO_TAG(PA15)
|
||||
.tag = IO_TAG(PA15)
|
||||
};
|
||||
// MPU_INT output on V2 PB13
|
||||
static const extiConfig_t alienFlightF3V2MPUIntExtiConfig = {
|
||||
.io = IO_TAG(PB13)
|
||||
.tag = IO_TAG(PB13)
|
||||
};
|
||||
|
||||
if (hardwareRevision == AFF3_REV_1) {
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
const sonarHardware_t *sonarGetTargetHardwareConfiguration(batteryConfig_t *batteryConfig)
|
||||
{
|
||||
static const sonarHardware_t const sonarPWM56 = {
|
||||
.triggerIO = IO_TAG(PB8),
|
||||
.echoIO = IO_TAG(PB9),
|
||||
.triggerTag = IO_TAG(PB8),
|
||||
.echoTag = IO_TAG(PB9),
|
||||
};
|
||||
static const sonarHardware_t sonarRC78 = {
|
||||
.triggerIO = IO_TAG(PB0),
|
||||
.echoIO = IO_TAG(PB1),
|
||||
.triggerTag = IO_TAG(PB0),
|
||||
.echoTag = IO_TAG(PB1),
|
||||
};
|
||||
// If we are using softserial, parallel PWM or ADC current sensor, then use motor pins 5 and 6 for sonar, otherwise use rc pins 7 and 8
|
||||
if (feature(FEATURE_SOFTSERIAL)
|
||||
|
|
|
@ -113,18 +113,19 @@ void updateHardwareRevision(void)
|
|||
|
||||
const extiConfig_t *selectMPUIntExtiConfigByHardwareRevision(void)
|
||||
{
|
||||
// MPU_INT output on rev4 PB13
|
||||
static const extiConfig_t nazeRev4MPUIntExtiConfig = {
|
||||
.io = IO_TAG(PB13)
|
||||
};
|
||||
// MPU_INT output on rev5 hardware PC13
|
||||
static const extiConfig_t nazeRev5MPUIntExtiConfig = {
|
||||
.io = IO_TAG(PC13)
|
||||
.tag = IO_TAG(PC13)
|
||||
};
|
||||
|
||||
#ifdef AFROMINI
|
||||
return &nazeRev5MPUIntExtiConfig;
|
||||
#else
|
||||
// MPU_INT output on rev4 PB13
|
||||
static const extiConfig_t nazeRev4MPUIntExtiConfig = {
|
||||
.tag = IO_TAG(PB13)
|
||||
};
|
||||
|
||||
if (hardwareRevision < NAZE32_REV5) {
|
||||
return &nazeRev4MPUIntExtiConfig;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
const sonarHardware_t *sonarGetTargetHardwareConfiguration(batteryConfig_t *batteryConfig)
|
||||
{
|
||||
static const sonarHardware_t const sonarPWM56 = {
|
||||
.triggerIO = IO_TAG(PB8),
|
||||
.echoIO = IO_TAG(PB9),
|
||||
.triggerTag = IO_TAG(PB8),
|
||||
.echoTag = IO_TAG(PB9),
|
||||
};
|
||||
static const sonarHardware_t sonarRC78 = {
|
||||
.triggerIO = IO_TAG(PB0),
|
||||
.echoIO = IO_TAG(PB1),
|
||||
.triggerTag = IO_TAG(PB0),
|
||||
.echoTag = IO_TAG(PB1),
|
||||
};
|
||||
// If we are using softserial, parallel PWM or ADC current sensor, then use motor pins 5 and 6 for sonar, otherwise use rc pins 7 and 8
|
||||
if (feature(FEATURE_SOFTSERIAL)
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
const sonarHardware_t *sonarGetTargetHardwareConfiguration(batteryConfig_t *batteryConfig)
|
||||
{
|
||||
static const sonarHardware_t const sonarPWM56 = {
|
||||
.triggerIO = IO_TAG(PB8),
|
||||
.echoIO = IO_TAG(PB9),
|
||||
.triggerTag = IO_TAG(PB8),
|
||||
.echoTag = IO_TAG(PB9),
|
||||
};
|
||||
static const sonarHardware_t sonarRC78 = {
|
||||
.triggerIO = IO_TAG(PB0),
|
||||
.echoIO = IO_TAG(PB1),
|
||||
.triggerTag = IO_TAG(PB0),
|
||||
.echoTag = IO_TAG(PB1),
|
||||
};
|
||||
// If we are using softserial, parallel PWM or ADC current sensor, then use motor pins 5 and 6 for sonar, otherwise use rc pins 7 and 8
|
||||
if (feature(FEATURE_SOFTSERIAL)
|
||||
|
|
Loading…
Reference in New Issue