diff --git a/Makefile b/Makefile
index 1a8ea3a565..8598c43e6f 100644
--- a/Makefile
+++ b/Makefile
@@ -496,6 +496,7 @@ COMMON_SRC = \
drivers/gyro_sync.c \
drivers/io.c \
drivers/light_led.c \
+ drivers/resource.c \
drivers/rx_nrf24l01.c \
drivers/rx_spi.c \
drivers/rx_xn297.c \
diff --git a/src/main/drivers/accgyro_l3gd20.c b/src/main/drivers/accgyro_l3gd20.c
index a9323004fa..3cb7bc1704 100644
--- a/src/main/drivers/accgyro_l3gd20.c
+++ b/src/main/drivers/accgyro_l3gd20.c
@@ -76,7 +76,7 @@ static void l3gd20SpiInit(SPI_TypeDef *SPIx)
UNUSED(SPIx); // FIXME
mpul3gd20CsPin = IOGetByTag(IO_TAG(L3GD20_CS_PIN));
- IOInit(mpul3gd20CsPin, OWNER_MPU, RESOURCE_SPI_CS, 0);
+ IOInit(mpul3gd20CsPin, OWNER_MPU_CS, 0);
IOConfigGPIO(mpul3gd20CsPin, SPI_IO_CS_CFG);
DISABLE_L3GD20;
diff --git a/src/main/drivers/accgyro_mma845x.c b/src/main/drivers/accgyro_mma845x.c
index 69a82a0adb..128e6cfc1c 100644
--- a/src/main/drivers/accgyro_mma845x.c
+++ b/src/main/drivers/accgyro_mma845x.c
@@ -105,7 +105,7 @@ static inline void mma8451ConfigureInterrupt(void)
// PA5 - ACC_INT2 output on NAZE rev3/4 hardware
// NAZE rev.5 hardware has PA5 (ADC1_IN5) on breakout pad on bottom of board
// OLIMEXINO - The PA5 pin is wired up to LED1, if you need to use an mma8452 on an Olimexino use a different pin and provide support in code.
- IOInit(IOGetByTag(IO_TAG(PA5)), OWNER_MPU, RESOURCE_EXTI, 0);
+ IOInit(IOGetByTag(IO_TAG(PA5)), OWNER_MPU_EXTI, 0);
IOConfigGPIO(IOGetByTag(IO_TAG(PA5)), IOCFG_IN_FLOATING); // TODO - maybe pullup / pulldown ?
#endif
diff --git a/src/main/drivers/accgyro_mpu.c b/src/main/drivers/accgyro_mpu.c
index f5cd4a2d0f..505501d397 100644
--- a/src/main/drivers/accgyro_mpu.c
+++ b/src/main/drivers/accgyro_mpu.c
@@ -257,12 +257,12 @@ void mpuIntExtiInit(void)
#endif
#if defined (STM32F7)
- IOInit(mpuIntIO, OWNER_MPU, RESOURCE_EXTI, 0);
+ IOInit(mpuIntIO, OWNER_MPU_EXTI, 0);
EXTIHandlerInit(&mpuIntCallbackRec, mpuIntExtiHandler);
EXTIConfig(mpuIntIO, &mpuIntCallbackRec, NVIC_PRIO_MPU_INT_EXTI, IO_CONFIG(GPIO_MODE_INPUT,0,GPIO_NOPULL)); // TODO - maybe pullup / pulldown ?
#else
- IOInit(mpuIntIO, OWNER_MPU, RESOURCE_EXTI, 0);
+ IOInit(mpuIntIO, OWNER_MPU_EXTI, 0);
IOConfigGPIO(mpuIntIO, IOCFG_IN_FLOATING); // TODO - maybe pullup / pulldown ?
EXTIHandlerInit(&mpuIntCallbackRec, mpuIntExtiHandler);
diff --git a/src/main/drivers/accgyro_spi_icm20689.c b/src/main/drivers/accgyro_spi_icm20689.c
index 6458d2f510..97451efefd 100644
--- a/src/main/drivers/accgyro_spi_icm20689.c
+++ b/src/main/drivers/accgyro_spi_icm20689.c
@@ -70,7 +70,7 @@ static void icm20689SpiInit(void)
}
icmSpi20689CsPin = IOGetByTag(IO_TAG(ICM20689_CS_PIN));
- IOInit(icmSpi20689CsPin, OWNER_MPU, RESOURCE_SPI_CS, 0);
+ IOInit(icmSpi20689CsPin, OWNER_MPU_CS, 0);
IOConfigGPIO(icmSpi20689CsPin, SPI_IO_CS_CFG);
spiSetDivisor(ICM20689_SPI_INSTANCE, SPI_CLOCK_STANDARD);
diff --git a/src/main/drivers/accgyro_spi_mpu6000.c b/src/main/drivers/accgyro_spi_mpu6000.c
index faf6fba1a7..e95afc3215 100644
--- a/src/main/drivers/accgyro_spi_mpu6000.c
+++ b/src/main/drivers/accgyro_spi_mpu6000.c
@@ -161,7 +161,7 @@ bool mpu6000SpiDetect(void)
#ifdef MPU6000_CS_PIN
mpuSpi6000CsPin = IOGetByTag(IO_TAG(MPU6000_CS_PIN));
#endif
- IOInit(mpuSpi6000CsPin, OWNER_MPU, RESOURCE_SPI_CS, 0);
+ IOInit(mpuSpi6000CsPin, OWNER_MPU_CS, 0);
IOConfigGPIO(mpuSpi6000CsPin, SPI_IO_CS_CFG);
spiSetDivisor(MPU6000_SPI_INSTANCE, SPI_CLOCK_INITIALIZATON);
diff --git a/src/main/drivers/accgyro_spi_mpu6500.c b/src/main/drivers/accgyro_spi_mpu6500.c
index bfbba6dce5..07311ac738 100755
--- a/src/main/drivers/accgyro_spi_mpu6500.c
+++ b/src/main/drivers/accgyro_spi_mpu6500.c
@@ -68,7 +68,7 @@ static void mpu6500SpiInit(void)
}
mpuSpi6500CsPin = IOGetByTag(IO_TAG(MPU6500_CS_PIN));
- IOInit(mpuSpi6500CsPin, OWNER_MPU, RESOURCE_SPI_CS, 0);
+ IOInit(mpuSpi6500CsPin, OWNER_MPU_CS, 0);
IOConfigGPIO(mpuSpi6500CsPin, SPI_IO_CS_CFG);
spiSetDivisor(MPU6500_SPI_INSTANCE, SPI_CLOCK_FAST);
diff --git a/src/main/drivers/accgyro_spi_mpu9250.c b/src/main/drivers/accgyro_spi_mpu9250.c
index c1c1169ae9..4ef2fc72d1 100644
--- a/src/main/drivers/accgyro_spi_mpu9250.c
+++ b/src/main/drivers/accgyro_spi_mpu9250.c
@@ -191,7 +191,7 @@ bool mpu9250SpiDetect(void)
#ifdef MPU9250_CS_PIN
mpuSpi9250CsPin = IOGetByTag(IO_TAG(MPU9250_CS_PIN));
#endif
- IOInit(mpuSpi9250CsPin, OWNER_MPU, RESOURCE_SPI_CS, 0);
+ IOInit(mpuSpi9250CsPin, OWNER_MPU_CS, 0);
IOConfigGPIO(mpuSpi9250CsPin, SPI_IO_CS_CFG);
spiSetDivisor(MPU9250_SPI_INSTANCE, SPI_CLOCK_INITIALIZATON); //low speed
diff --git a/src/main/drivers/adc_stm32f10x.c b/src/main/drivers/adc_stm32f10x.c
index 00fd32bcb0..7838ca8acb 100644
--- a/src/main/drivers/adc_stm32f10x.c
+++ b/src/main/drivers/adc_stm32f10x.c
@@ -118,11 +118,11 @@ void adcInit(drv_adc_config_t *init)
const adcDevice_t adc = adcHardware[device];
- for (int i = 0; i < ADC_CHANNEL_COUNT; i++) {
+ for (int i = 0; i < ADC_CHANNEL_COUNT; i++) {
if (!adcConfig[i].tag)
continue;
- IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC, RESOURCE_ADC_BATTERY+i, 0);
+ IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC_BATT + i, 0);
IOConfigGPIO(IOGetByTag(adcConfig[i].tag), IO_CONFIG(GPIO_Mode_AIN, 0));
adcConfig[i].adcChannel = adcChannelByTag(adcConfig[i].tag);
adcConfig[i].dmaIndex = configuredAdcChannels++;
@@ -133,7 +133,7 @@ void adcInit(drv_adc_config_t *init)
RCC_ADCCLKConfig(RCC_PCLK2_Div8); // 9MHz from 72MHz APB2 clock(HSE), 8MHz from 64MHz (HSI)
RCC_ClockCmd(adc.rccADC, ENABLE);
- dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, 0);
DMA_DeInit(adc.DMAy_Channelx);
DMA_InitTypeDef DMA_InitStructure;
diff --git a/src/main/drivers/adc_stm32f30x.c b/src/main/drivers/adc_stm32f30x.c
index f17fb892f1..4a17a3ab9d 100644
--- a/src/main/drivers/adc_stm32f30x.c
+++ b/src/main/drivers/adc_stm32f30x.c
@@ -147,7 +147,7 @@ void adcInit(drv_adc_config_t *init)
if (!adcConfig[i].tag)
continue;
- IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC, RESOURCE_ADC_BATTERY+i,0);
+ IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC_BATT + i,0);
IOConfigGPIO(IOGetByTag(adcConfig[i].tag), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
adcConfig[i].adcChannel = adcChannelByTag(adcConfig[i].tag);
adcConfig[i].dmaIndex = adcChannelCount++;
@@ -158,7 +158,7 @@ void adcInit(drv_adc_config_t *init)
RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div256); // 72 MHz divided by 256 = 281.25 kHz
RCC_ClockCmd(adc.rccADC, ENABLE);
- dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(adc.DMAy_Channelx), OWNER_ADC, 0);
DMA_DeInit(adc.DMAy_Channelx);
diff --git a/src/main/drivers/adc_stm32f4xx.c b/src/main/drivers/adc_stm32f4xx.c
index 9655381977..92b66648b1 100644
--- a/src/main/drivers/adc_stm32f4xx.c
+++ b/src/main/drivers/adc_stm32f4xx.c
@@ -133,7 +133,7 @@ void adcInit(drv_adc_config_t *init)
if (!adcConfig[i].tag)
continue;
- IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC, RESOURCE_ADC_BATTERY + i, 0);
+ IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC_BATT + i, 0);
IOConfigGPIO(IOGetByTag(adcConfig[i].tag), IO_CONFIG(GPIO_Mode_AN, 0, GPIO_OType_OD, GPIO_PuPd_NOPULL));
adcConfig[i].adcChannel = adcChannelByTag(adcConfig[i].tag);
adcConfig[i].dmaIndex = configuredAdcChannels++;
@@ -143,7 +143,7 @@ void adcInit(drv_adc_config_t *init)
RCC_ClockCmd(adc.rccADC, ENABLE);
- dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, 0);
DMA_DeInit(adc.DMAy_Streamx);
diff --git a/src/main/drivers/adc_stm32f7xx.c b/src/main/drivers/adc_stm32f7xx.c
index b6c84fbaad..4bfa1435b4 100644
--- a/src/main/drivers/adc_stm32f7xx.c
+++ b/src/main/drivers/adc_stm32f7xx.c
@@ -131,7 +131,7 @@ void adcInit(drv_adc_config_t *init)
if (!adcConfig[i].tag)
continue;
- IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC, RESOURCE_ADC_BATTERY + i, 0);
+ IOInit(IOGetByTag(adcConfig[i].tag), OWNER_ADC_BATT + i, 0);
IOConfigGPIO(IOGetByTag(adcConfig[i].tag), IO_CONFIG(GPIO_MODE_ANALOG, 0, GPIO_NOPULL));
adcConfig[i].adcChannel = adcChannelByTag(adcConfig[i].tag);
adcConfig[i].dmaIndex = configuredAdcChannels++;
@@ -141,7 +141,7 @@ void adcInit(drv_adc_config_t *init)
RCC_ClockCmd(adc.rccADC, ENABLE);
- dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(adc.DMAy_Streamx), OWNER_ADC, 0);
ADCHandle.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV8;
ADCHandle.Init.ContinuousConvMode = ENABLE;
diff --git a/src/main/drivers/barometer_bmp085.c b/src/main/drivers/barometer_bmp085.c
index 9f022f6fe4..534d4b424c 100644
--- a/src/main/drivers/barometer_bmp085.c
+++ b/src/main/drivers/barometer_bmp085.c
@@ -143,7 +143,7 @@ void bmp085InitXclrIO(const bmp085Config_t *config)
{
if (!xclrIO && config && config->xclrIO) {
xclrIO = IOGetByTag(config->xclrIO);
- IOInit(xclrIO, OWNER_BARO, RESOURCE_OUTPUT, 0);
+ IOInit(xclrIO, OWNER_BARO_CS, 0);
IOConfigGPIO(xclrIO, IOCFG_OUT_PP);
}
}
@@ -172,7 +172,7 @@ bool bmp085Detect(const bmp085Config_t *config, baro_t *baro)
if (config && config->eocIO) {
eocIO = IOGetByTag(config->eocIO);
// EXTI interrupt for barometer EOC
- IOInit(eocIO, OWNER_SYSTEM, RESOURCE_INPUT | RESOURCE_EXTI);
+ IOInit(eocIO, OWNER_BARO_EXTI, 0);
IOConfigGPIO(eocIO, Mode_IN_FLOATING);
EXTIHandlerInit(&bmp085_extiCallbackRec, bmp085_extiHandler);
EXTIConfig(eocIO, &bmp085_extiCallbackRec, NVIC_PRIO_BARO_EXTI, EXTI_Trigger_Rising);
diff --git a/src/main/drivers/barometer_spi_bmp280.c b/src/main/drivers/barometer_spi_bmp280.c
index 0c97684972..7d6b1af90e 100644
--- a/src/main/drivers/barometer_spi_bmp280.c
+++ b/src/main/drivers/barometer_spi_bmp280.c
@@ -65,7 +65,7 @@ void bmp280SpiInit(void)
}
bmp280CsPin = IOGetByTag(IO_TAG(BMP280_CS_PIN));
- IOInit(bmp280CsPin, OWNER_BARO, RESOURCE_SPI_CS, 0);
+ IOInit(bmp280CsPin, OWNER_BARO_CS, 0);
IOConfigGPIO(bmp280CsPin, IOCFG_OUT_PP);
DISABLE_BMP280;
diff --git a/src/main/drivers/bus_i2c_hal.c b/src/main/drivers/bus_i2c_hal.c
index 88238ed077..0e91134de5 100644
--- a/src/main/drivers/bus_i2c_hal.c
+++ b/src/main/drivers/bus_i2c_hal.c
@@ -209,8 +209,8 @@ void i2cInit(I2CDevice device)
IO_t scl = IOGetByTag(i2c->scl);
IO_t sda = IOGetByTag(i2c->sda);
- IOInit(scl, OWNER_I2C, RESOURCE_I2C_SCL, RESOURCE_INDEX(device));
- IOInit(sda, OWNER_I2C, RESOURCE_I2C_SDA, RESOURCE_INDEX(device));
+ IOInit(scl, OWNER_I2C_SCL, RESOURCE_INDEX(device));
+ IOInit(sda, OWNER_I2C_SDA, RESOURCE_INDEX(device));
// Enable RCC
RCC_ClockCmd(i2c->rcc, ENABLE);
diff --git a/src/main/drivers/bus_i2c_stm32f10x.c b/src/main/drivers/bus_i2c_stm32f10x.c
index be298d3cf9..0849a03561 100644
--- a/src/main/drivers/bus_i2c_stm32f10x.c
+++ b/src/main/drivers/bus_i2c_stm32f10x.c
@@ -387,8 +387,8 @@ void i2cInit(I2CDevice device)
IO_t scl = IOGetByTag(i2c->scl);
IO_t sda = IOGetByTag(i2c->sda);
- IOInit(scl, OWNER_I2C, RESOURCE_I2C_SCL, RESOURCE_INDEX(device));
- IOInit(sda, OWNER_I2C, RESOURCE_I2C_SDA, RESOURCE_INDEX(device));
+ IOInit(scl, OWNER_I2C_SCL, RESOURCE_INDEX(device));
+ IOInit(sda, OWNER_I2C_SDA, RESOURCE_INDEX(device));
// Enable RCC
RCC_ClockCmd(i2c->rcc, ENABLE);
diff --git a/src/main/drivers/bus_i2c_stm32f30x.c b/src/main/drivers/bus_i2c_stm32f30x.c
index 524148fe9c..ba362f3897 100644
--- a/src/main/drivers/bus_i2c_stm32f30x.c
+++ b/src/main/drivers/bus_i2c_stm32f30x.c
@@ -90,10 +90,10 @@ void i2cInit(I2CDevice device)
RCC_ClockCmd(i2c->rcc, ENABLE);
RCC_I2CCLKConfig(I2Cx == I2C2 ? RCC_I2C2CLK_SYSCLK : RCC_I2C1CLK_SYSCLK);
- IOInit(scl, OWNER_I2C, RESOURCE_I2C_SCL, RESOURCE_INDEX(device));
+ IOInit(scl, OWNER_I2C_SCL, RESOURCE_INDEX(device));
IOConfigGPIOAF(scl, IOCFG_I2C, GPIO_AF_4);
- IOInit(sda, OWNER_I2C, RESOURCE_I2C_SDA, RESOURCE_INDEX(device));
+ IOInit(sda, OWNER_I2C_SDA, RESOURCE_INDEX(device));
IOConfigGPIOAF(sda, IOCFG_I2C, GPIO_AF_4);
I2C_InitTypeDef i2cInit = {
diff --git a/src/main/drivers/bus_spi.c b/src/main/drivers/bus_spi.c
index 8e62e09957..ce33d7b0eb 100644
--- a/src/main/drivers/bus_spi.c
+++ b/src/main/drivers/bus_spi.c
@@ -116,9 +116,9 @@ void spiInitDevice(SPIDevice device)
RCC_ClockCmd(spi->rcc, ENABLE);
RCC_ResetCmd(spi->rcc, ENABLE);
- IOInit(IOGetByTag(spi->sck), OWNER_SPI, RESOURCE_SPI_SCK, device + 1);
- IOInit(IOGetByTag(spi->miso), OWNER_SPI, RESOURCE_SPI_MISO, device + 1);
- IOInit(IOGetByTag(spi->mosi), OWNER_SPI, RESOURCE_SPI_MOSI, device + 1);
+ IOInit(IOGetByTag(spi->sck), OWNER_SPI_SCK, RESOURCE_INDEX(device));
+ IOInit(IOGetByTag(spi->miso), OWNER_SPI_MISO, RESOURCE_INDEX(device));
+ IOInit(IOGetByTag(spi->mosi), OWNER_SPI_MOSI, RESOURCE_INDEX(device));
#if defined(STM32F3) || defined(STM32F4)
IOConfigGPIOAF(IOGetByTag(spi->sck), SPI_IO_AF_CFG, spi->af);
diff --git a/src/main/drivers/bus_spi_hal.c b/src/main/drivers/bus_spi_hal.c
index 4da26ffb6a..7f3cdf3883 100644
--- a/src/main/drivers/bus_spi_hal.c
+++ b/src/main/drivers/bus_spi_hal.c
@@ -155,9 +155,9 @@ void spiInitDevice(SPIDevice device)
RCC_ClockCmd(spi->rcc, ENABLE);
RCC_ResetCmd(spi->rcc, ENABLE);
- IOInit(IOGetByTag(spi->sck), OWNER_SPI, RESOURCE_SPI_SCK, device + 1);
- IOInit(IOGetByTag(spi->miso), OWNER_SPI, RESOURCE_SPI_MISO, device + 1);
- IOInit(IOGetByTag(spi->mosi), OWNER_SPI, RESOURCE_SPI_MOSI, device + 1);
+ IOInit(IOGetByTag(spi->sck), OWNER_SPI_SCK, RESOURCE_INDEX(device));
+ IOInit(IOGetByTag(spi->miso), OWNER_SPI_MISO, RESOURCE_INDEX(device));
+ IOInit(IOGetByTag(spi->mosi), OWNER_SPI_MOSI, RESOURCE_INDEX(device));
#if defined(STM32F3) || defined(STM32F4) || defined(STM32F7)
IOConfigGPIOAF(IOGetByTag(spi->sck), SPI_IO_AF_CFG, spi->af);
diff --git a/src/main/drivers/bus_spi_soft.c b/src/main/drivers/bus_spi_soft.c
index 6207f6591e..85d7d2454a 100644
--- a/src/main/drivers/bus_spi_soft.c
+++ b/src/main/drivers/bus_spi_soft.c
@@ -34,7 +34,7 @@
void softSpiInit(const softSPIDevice_t *dev)
{
// SCK as output
- IOInit(IOGetByTag(dev->sckTag), OWNER_SOFTSPI, RESOURCE_SPI_SCK, SOFT_SPIDEV_1 + 1);
+ IOInit(IOGetByTag(dev->sckTag), OWNER_SPI_SCK, RESOURCE_INDEX(SOFT_SPIDEV_1) + 10);
#if defined(STM32F10X)
IOConfigGPIO(IOGetByTag(dev->sckTag), IO_CONFIG(GPIO_Mode_Out_PP, GPIO_Speed_50MHz));
#elif defined(STM32F3) || defined(STM32F4)
@@ -42,7 +42,7 @@ void softSpiInit(const softSPIDevice_t *dev)
#endif
// MOSI as output
- IOInit(IOGetByTag(dev->mosiTag), OWNER_SOFTSPI, RESOURCE_SPI_MOSI, SOFT_SPIDEV_1 + 1);
+ IOInit(IOGetByTag(dev->mosiTag), OWNER_SPI_MOSI, RESOURCE_INDEX(SOFT_SPIDEV_1) + 10);
#if defined(STM32F10X)
IOConfigGPIO(IOGetByTag(dev->mosiTag), IO_CONFIG(GPIO_Mode_Out_PP, GPIO_Speed_50MHz));
#elif defined(STM32F3) || defined(STM32F4)
@@ -50,7 +50,7 @@ void softSpiInit(const softSPIDevice_t *dev)
#endif
// MISO as input
- IOInit(IOGetByTag(dev->misoTag), OWNER_SOFTSPI, RESOURCE_SPI_MISO, SOFT_SPIDEV_1 + 1);
+ IOInit(IOGetByTag(dev->misoTag), OWNER_SPI_MISO, RESOURCE_INDEX(SOFT_SPIDEV_1) + 10);
#if defined(STM32F10X)
IOConfigGPIO(IOGetByTag(dev->misoTag), IO_CONFIG(GPIO_Mode_IN_FLOATING, GPIO_Speed_50MHz));
#elif defined(STM32F3) || defined(STM32F4)
@@ -59,7 +59,7 @@ void softSpiInit(const softSPIDevice_t *dev)
// NSS as output
if (dev->nssTag != IOTAG_NONE) {
- IOInit(IOGetByTag(dev->nssTag), OWNER_SOFTSPI, RESOURCE_SPI_CS, SOFT_SPIDEV_1 + 1);
+ IOInit(IOGetByTag(dev->nssTag), OWNER_SPI_CS, RESOURCE_INDEX(SOFT_SPIDEV_1) + 10);
#if defined(STM32F10X)
IOConfigGPIO(IOGetByTag(dev->nssTag), IO_CONFIG(GPIO_Mode_Out_PP, GPIO_Speed_50MHz));
#elif defined(STM32F3) || defined(STM32F4)
diff --git a/src/main/drivers/flash_m25p16.c b/src/main/drivers/flash_m25p16.c
index d0df78c4b1..0f8e8a496e 100644
--- a/src/main/drivers/flash_m25p16.c
+++ b/src/main/drivers/flash_m25p16.c
@@ -224,7 +224,7 @@ bool m25p16_init(ioTag_t csTag)
return false;
#endif
}
- IOInit(m25p16CsPin, OWNER_FLASH, RESOURCE_SPI_CS, 0);
+ IOInit(m25p16CsPin, OWNER_FLASH_CS, 0);
IOConfigGPIO(m25p16CsPin, SPI_IO_CS_CFG);
DISABLE_M25P16;
diff --git a/src/main/drivers/inverter.c b/src/main/drivers/inverter.c
index 336f850865..dfcfe116a5 100644
--- a/src/main/drivers/inverter.c
+++ b/src/main/drivers/inverter.c
@@ -36,7 +36,7 @@ static IO_t pin = IO_NONE;
void initInverter(void)
{
pin = IOGetByTag(IO_TAG(INVERTER));
- IOInit(pin, OWNER_INVERTER, RESOURCE_OUTPUT, 1);
+ IOInit(pin, OWNER_INVERTER, 1);
IOConfigGPIO(pin, IOCFG_OUT_PP);
inverterSet(false);
diff --git a/src/main/drivers/io.c b/src/main/drivers/io.c
index de5be5f68d..d60e3af649 100644
--- a/src/main/drivers/io.c
+++ b/src/main/drivers/io.c
@@ -77,19 +77,7 @@ const struct ioPortDef_s ioPortDefs[] = {
{ RCC_AHB1(GPIOE) },
{ RCC_AHB1(GPIOF) },
};
-# endif
-
-const char * const ownerNames[OWNER_TOTAL_COUNT] = {
- "FREE", "PWM", "PPM", "MOTOR", "SERVO", "SOFTSERIAL", "ADC", "SERIAL", "DEBUG", "TIMER",
- "SONAR_TRIGGER", "SONAR_ECHO", "SYSTEM", "SPI", "I2C", "SDCARD", "FLASH", "USB", "BEEPER", "OSD",
- "BARO", "MPU", "INVERTER", "LED_STRIP", "LED", "RX", "TX", "SOFT_SPI", "RX_SPI", "MAX7456"
-};
-
-const char * const resourceNames[RESOURCE_TOTAL_COUNT] = {
- "", // NONE
- "IN", "OUT", "IN / OUT", "TIMER","UART TX","UART RX","UART TX/RX","EXTI","SCL",
- "SDA", "SCK","MOSI","MISO","CS","BATTERY","RSSI","EXT","CURRENT"
-};
+#endif
ioRec_t* IO_Rec(IO_t io)
{
@@ -248,11 +236,10 @@ void IOToggle(IO_t io)
}
// claim IO pin, set owner and resources
-void IOInit(IO_t io, resourceOwner_e owner, resourceType_e resource, uint8_t index)
+void IOInit(IO_t io, resourceOwner_e owner, uint8_t index)
{
ioRec_t *ioRec = IO_Rec(io);
ioRec->owner = owner;
- ioRec->resource = resource;
ioRec->index = index;
}
@@ -268,12 +255,6 @@ resourceOwner_e IOGetOwner(IO_t io)
return ioRec->owner;
}
-resourceType_e IOGetResource(IO_t io)
-{
- ioRec_t *ioRec = IO_Rec(io);
- return ioRec->resource;
-}
-
#if defined(STM32F1)
void IOConfigGPIO(IO_t io, ioConfig_t cfg)
diff --git a/src/main/drivers/io.h b/src/main/drivers/io.h
index 5d3766ec39..4d17b9d2a2 100644
--- a/src/main/drivers/io.h
+++ b/src/main/drivers/io.h
@@ -15,7 +15,7 @@
* along with Cleanflight. If not, see .
*/
- #pragma once
+#pragma once
#include
#include
@@ -101,10 +101,9 @@ void IOHi(IO_t io);
void IOLo(IO_t io);
void IOToggle(IO_t io);
-void IOInit(IO_t io, resourceOwner_e owner, resourceType_e resource, uint8_t index);
+void IOInit(IO_t io, resourceOwner_e owner, uint8_t index);
void IORelease(IO_t io); // unimplemented
resourceOwner_e IOGetOwner(IO_t io);
-resourceType_e IOGetResources(IO_t io);
IO_t IOGetByTag(ioTag_t tag);
void IOConfigGPIO(IO_t io, ioConfig_t cfg);
diff --git a/src/main/drivers/io_impl.h b/src/main/drivers/io_impl.h
index 9f7a8f01c3..470cf8163d 100644
--- a/src/main/drivers/io_impl.h
+++ b/src/main/drivers/io_impl.h
@@ -29,7 +29,6 @@ typedef struct ioRec_s {
GPIO_TypeDef *gpio;
uint16_t pin;
resourceOwner_e owner;
- resourceType_e resource;
uint8_t index;
} ioRec_t;
diff --git a/src/main/drivers/light_led.c b/src/main/drivers/light_led.c
index a6b2a6892e..1c92718832 100644
--- a/src/main/drivers/light_led.c
+++ b/src/main/drivers/light_led.c
@@ -96,7 +96,7 @@ void ledInit(bool alternative_led)
for (int i = 0; i < LED_NUMBER; i++) {
if (leds[i + ledOffset]) {
- IOInit(leds[i + ledOffset], OWNER_LED, RESOURCE_OUTPUT, RESOURCE_INDEX(i));
+ IOInit(leds[i + ledOffset], OWNER_LED, RESOURCE_INDEX(i));
IOConfigGPIO(leds[i + ledOffset], IOCFG_OUT_PP);
}
}
diff --git a/src/main/drivers/light_ws2811strip_hal.c b/src/main/drivers/light_ws2811strip_hal.c
index 8de162c280..838f67522b 100644
--- a/src/main/drivers/light_ws2811strip_hal.c
+++ b/src/main/drivers/light_ws2811strip_hal.c
@@ -79,7 +79,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
static DMA_HandleTypeDef hdma_tim;
ws2811IO = IOGetByTag(ioTag);
- IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0);
+ IOInit(ws2811IO, OWNER_LED_STRIP, 0);
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLUP), timerHardware->alternateFunction);
__DMA1_CLK_ENABLE();
diff --git a/src/main/drivers/light_ws2811strip_stm32f10x.c b/src/main/drivers/light_ws2811strip_stm32f10x.c
index 3f52896fdd..e458b866b3 100644
--- a/src/main/drivers/light_ws2811strip_stm32f10x.c
+++ b/src/main/drivers/light_ws2811strip_stm32f10x.c
@@ -62,7 +62,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
}
ws2811IO = IOGetByTag(ioTag);
- IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0);
+ IOInit(ws2811IO, OWNER_LED_STRIP, 0);
IOConfigGPIO(ws2811IO, IO_CONFIG(GPIO_Speed_50MHz, GPIO_Mode_AF_PP));
RCC_ClockCmd(timerRCC(timer), ENABLE);
diff --git a/src/main/drivers/light_ws2811strip_stm32f30x.c b/src/main/drivers/light_ws2811strip_stm32f30x.c
index 0db3d239eb..4474c9d6ad 100644
--- a/src/main/drivers/light_ws2811strip_stm32f30x.c
+++ b/src/main/drivers/light_ws2811strip_stm32f30x.c
@@ -63,7 +63,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
}
ws2811IO = IOGetByTag(ioTag);
- IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0);
+ IOInit(ws2811IO, OWNER_LED_STRIP, 0);
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_UP), timerHardware->alternateFunction);
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
diff --git a/src/main/drivers/light_ws2811strip_stm32f4xx.c b/src/main/drivers/light_ws2811strip_stm32f4xx.c
index 378e83cbfd..c2ab867971 100644
--- a/src/main/drivers/light_ws2811strip_stm32f4xx.c
+++ b/src/main/drivers/light_ws2811strip_stm32f4xx.c
@@ -68,7 +68,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
ws2811IO = IOGetByTag(ioTag);
/* GPIOA Configuration: TIM5 Channel 1 as alternate function push-pull */
- IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0);
+ IOInit(ws2811IO, OWNER_LED_STRIP, 0);
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_UP), timerHardware->alternateFunction);
// Stop timer
diff --git a/src/main/drivers/max7456.c b/src/main/drivers/max7456.c
index 1c9edcbd2e..765c7f5ea4 100755
--- a/src/main/drivers/max7456.c
+++ b/src/main/drivers/max7456.c
@@ -260,7 +260,7 @@ void max7456Init(uint8_t video_system)
#ifdef MAX7456_SPI_CS_PIN
max7456CsPin = IOGetByTag(IO_TAG(MAX7456_SPI_CS_PIN));
#endif
- IOInit(max7456CsPin, OWNER_OSD, RESOURCE_SPI_CS, 0);
+ IOInit(max7456CsPin, OWNER_OSD_CS, 0);
IOConfigGPIO(max7456CsPin, SPI_IO_CS_CFG);
spiSetDivisor(MAX7456_SPI_INSTANCE, SPI_CLOCK_STANDARD);
diff --git a/src/main/drivers/pwm_output.c b/src/main/drivers/pwm_output.c
index e57c27f2e4..4102a8655e 100644
--- a/src/main/drivers/pwm_output.c
+++ b/src/main/drivers/pwm_output.c
@@ -228,7 +228,7 @@ void motorInit(const motorConfig_t *motorConfig, uint16_t idlePulse, uint8_t mot
}
#endif
- IOInit(motors[motorIndex].io, OWNER_MOTOR, RESOURCE_OUTPUT, RESOURCE_INDEX(motorIndex));
+ IOInit(motors[motorIndex].io, OWNER_MOTOR, RESOURCE_INDEX(motorIndex));
IOConfigGPIO(motors[motorIndex].io, IOCFG_AF_PP);
motors[motorIndex].pwmWritePtr = pwmWritePtr;
@@ -271,7 +271,7 @@ void servoInit(const servoConfig_t *servoConfig)
servos[servoIndex].io = IOGetByTag(tag);
- IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_OUTPUT, RESOURCE_INDEX(servoIndex));
+ IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_INDEX(servoIndex));
IOConfigGPIO(servos[servoIndex].io, IOCFG_AF_PP);
const timerHardware_t *timer = timerGetByTag(tag, TIM_USE_ANY);
diff --git a/src/main/drivers/pwm_output_hal.c b/src/main/drivers/pwm_output_hal.c
index d81d027422..7ea4853f59 100644
--- a/src/main/drivers/pwm_output_hal.c
+++ b/src/main/drivers/pwm_output_hal.c
@@ -238,7 +238,7 @@ void motorInit(const motorConfig_t *motorConfig, uint16_t idlePulse, uint8_t mot
#endif
motors[motorIndex].io = IOGetByTag(tag);
- IOInit(motors[motorIndex].io, OWNER_MOTOR, RESOURCE_OUTPUT, RESOURCE_INDEX(motorIndex));
+ IOInit(motors[motorIndex].io, OWNER_MOTOR, RESOURCE_INDEX(motorIndex));
//IOConfigGPIO(motors[motorIndex].io, IOCFG_AF_PP);
IOConfigGPIOAF(motors[motorIndex].io, IOCFG_AF_PP, timerHardware->alternateFunction);
@@ -282,7 +282,7 @@ void servoInit(const servoConfig_t *servoConfig)
servos[servoIndex].io = IOGetByTag(tag);
- IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_OUTPUT, RESOURCE_INDEX(servoIndex));
+ IOInit(servos[servoIndex].io, OWNER_SERVO, RESOURCE_INDEX(servoIndex));
//IOConfigGPIO(servos[servoIndex].io, IOCFG_AF_PP);
const timerHardware_t *timer = timerGetByTag(tag, TIMER_OUTPUT_ENABLED);
diff --git a/src/main/drivers/pwm_output_stm32f3xx.c b/src/main/drivers/pwm_output_stm32f3xx.c
index 18c57facdf..d9b35803dc 100644
--- a/src/main/drivers/pwm_output_stm32f3xx.c
+++ b/src/main/drivers/pwm_output_stm32f3xx.c
@@ -125,7 +125,7 @@ void pwmDigitalMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t
const uint8_t timerIndex = getTimerIndex(timer);
const bool configureTimer = (timerIndex == dmaMotorTimerCount-1);
- IOInit(motorIO, OWNER_MOTOR, RESOURCE_OUTPUT, 0);
+ IOInit(motorIO, OWNER_MOTOR, 0);
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_UP), timerHardware->alternateFunction);
if (configureTimer) {
diff --git a/src/main/drivers/pwm_output_stm32f4xx.c b/src/main/drivers/pwm_output_stm32f4xx.c
index 62693d80db..1168875ad7 100644
--- a/src/main/drivers/pwm_output_stm32f4xx.c
+++ b/src/main/drivers/pwm_output_stm32f4xx.c
@@ -123,7 +123,7 @@ void pwmDigitalMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t
const uint8_t timerIndex = getTimerIndex(timer);
const bool configureTimer = (timerIndex == dmaMotorTimerCount-1);
- IOInit(motorIO, OWNER_MOTOR, RESOURCE_OUTPUT, 0);
+ IOInit(motorIO, OWNER_MOTOR, 0);
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_UP), timerHardware->alternateFunction);
if (configureTimer) {
diff --git a/src/main/drivers/pwm_output_stm32f7xx.c b/src/main/drivers/pwm_output_stm32f7xx.c
index 8ecf46e119..b8c3f9bb91 100644
--- a/src/main/drivers/pwm_output_stm32f7xx.c
+++ b/src/main/drivers/pwm_output_stm32f7xx.c
@@ -130,7 +130,7 @@ void pwmDigitalMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t
const uint8_t timerIndex = getTimerIndex(timer);
const bool configureTimer = (timerIndex == dmaMotorTimerCount-1);
- IOInit(motorIO, OWNER_MOTOR, RESOURCE_OUTPUT, 0);
+ IOInit(motorIO, OWNER_MOTOR, 0);
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLUP), timerHardware->alternateFunction);
__DMA1_CLK_ENABLE();
diff --git a/src/main/drivers/pwm_rx.c b/src/main/drivers/pwm_rx.c
index 13f074fad1..c85d0e1425 100644
--- a/src/main/drivers/pwm_rx.c
+++ b/src/main/drivers/pwm_rx.c
@@ -407,7 +407,7 @@ void pwmRxInit(const pwmConfig_t *pwmConfig)
port->timerHardware = timer;
IO_t io = IOGetByTag(pwmConfig->ioTags[channel]);
- IOInit(io, OWNER_PWMINPUT, RESOURCE_INPUT, RESOURCE_INDEX(channel));
+ IOInit(io, OWNER_PWMINPUT, RESOURCE_INDEX(channel));
IOConfigGPIO(io, IOCFG_IPD);
#if defined(USE_HAL_DRIVER)
@@ -471,7 +471,7 @@ void ppmRxInit(const ppmConfig_t *ppmConfig, uint8_t pwmProtocol)
port->timerHardware = timer;
IO_t io = IOGetByTag(ppmConfig->ioTag);
- IOInit(io, OWNER_PPMINPUT, RESOURCE_INPUT, 0);
+ IOInit(io, OWNER_PPMINPUT, 0);
IOConfigGPIO(io, IOCFG_IPD);
#if defined(USE_HAL_DRIVER)
diff --git a/src/main/drivers/resource.c b/src/main/drivers/resource.c
new file mode 100644
index 0000000000..1b5eb25cb0
--- /dev/null
+++ b/src/main/drivers/resource.c
@@ -0,0 +1,62 @@
+/*
+ * This file is part of Cleanflight.
+ *
+ * Cleanflight is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation,either version 3 of the License,or
+ * (at your option) any later version.
+ *
+ * Cleanflight is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cleanflight. If not,see .
+ */
+
+#include "resource.h"
+
+const char * const ownerNames[OWNER_TOTAL_COUNT] = {
+ "FREE",
+ "PWM",
+ "PPM",
+ "MOTOR",
+ "SERVO",
+ "LED",
+ "ADC",
+ "ADC_BATT",
+ "ADC_CURR",
+ "ADC_EXT",
+ "ADC_RSSI",
+ "SERIAL_TX",
+ "SERIAL_RX",
+ "DEBUG",
+ "TIMER",
+ "SONAR_TRIGGER",
+ "SONAR_ECHO",
+ "SYSTEM",
+ "SPI_SCK",
+ "SPI_MISO",
+ "SPI_MOSI",
+ "I2C_SDA",
+ "I2C_SCL",
+ "SDCARD_CS",
+ "FLASH_CS",
+ "BARO_CS",
+ "MPU_CS",
+ "OSD_CS",
+ "RX_SPI_CS",
+ "SPI_CS",
+ "MPU_EXTI",
+ "BARO_EXTI",
+ "USB",
+ "USB_DETECT",
+ "BEEPER",
+ "OSD",
+ "SDCARD_DETECT",
+ "RX_BIND",
+ "INVERTER",
+ "LED_STRIP",
+};
+
diff --git a/src/main/drivers/resource.h b/src/main/drivers/resource.h
index 7eb040e7d7..e554f98459 100644
--- a/src/main/drivers/resource.h
+++ b/src/main/drivers/resource.h
@@ -1,57 +1,67 @@
+/*
+ * This file is part of Cleanflight.
+ *
+ * Cleanflight is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Cleanflight is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cleanflight. If not, see .
+ */
#pragma once
-#define RESOURCE_INDEX(x) (x + 1)
-
typedef enum {
OWNER_FREE = 0,
OWNER_PWMINPUT,
OWNER_PPMINPUT,
OWNER_MOTOR,
OWNER_SERVO,
- OWNER_SOFTSERIAL,
+ OWNER_LED,
OWNER_ADC,
- OWNER_SERIAL,
+ OWNER_ADC_BATT,
+ OWNER_ADC_CURR,
+ OWNER_ADC_EXT,
+ OWNER_ADC_RSSI,
+ OWNER_SERIAL_TX,
+ OWNER_SERIAL_RX,
OWNER_PINDEBUG,
OWNER_TIMER,
OWNER_SONAR_TRIGGER,
OWNER_SONAR_ECHO,
OWNER_SYSTEM,
- OWNER_SPI,
- OWNER_I2C,
- OWNER_SDCARD,
- OWNER_FLASH,
+ OWNER_SPI_SCK,
+ OWNER_SPI_MISO,
+ OWNER_SPI_MOSI,
+ OWNER_I2C_SCL,
+ OWNER_I2C_SDA,
+ OWNER_SDCARD_CS,
+ OWNER_FLASH_CS,
+ OWNER_BARO_CS,
+ OWNER_MPU_CS,
+ OWNER_OSD_CS,
+ OWNER_RX_SPI_CS,
+ OWNER_SPI_CS,
+ OWNER_MPU_EXTI,
+ OWNER_BARO_EXTI,
OWNER_USB,
+ OWNER_USB_DETECT,
OWNER_BEEPER,
OWNER_OSD,
- OWNER_BARO,
- OWNER_MPU,
+ OWNER_SDCARD_DETECT,
+ OWNER_RX_BIND,
OWNER_INVERTER,
OWNER_LED_STRIP,
- OWNER_LED,
- OWNER_RX,
- OWNER_TX,
- OWNER_SOFTSPI,
- OWNER_RX_SPI,
- OWNER_MAX7456,
OWNER_TOTAL_COUNT
} resourceOwner_e;
extern const char * const ownerNames[OWNER_TOTAL_COUNT];
-// Currently TIMER should be shared resource (softserial dualtimer and timerqueue needs to allocate timer channel, but pin can be used for other function)
-// with mode switching (shared serial ports, ...) this will need some improvement
-typedef enum {
- RESOURCE_NONE = 0,
- RESOURCE_INPUT, RESOURCE_OUTPUT, RESOURCE_IO,
- RESOURCE_TIMER,
- RESOURCE_UART_TX, RESOURCE_UART_RX, RESOURCE_UART_TXRX,
- RESOURCE_EXTI,
- RESOURCE_I2C_SCL, RESOURCE_I2C_SDA,
- RESOURCE_SPI_SCK, RESOURCE_SPI_MOSI, RESOURCE_SPI_MISO, RESOURCE_SPI_CS,
- RESOURCE_ADC_BATTERY, RESOURCE_ADC_RSSI, RESOURCE_ADC_EXTERNAL1, RESOURCE_ADC_CURRENT,
- RESOURCE_RX_CE,
- RESOURCE_TOTAL_COUNT
-} resourceType_e;
-
-extern const char * const resourceNames[RESOURCE_TOTAL_COUNT];
+#define RESOURCE_INDEX(x) (x + 1)
+#define RESOURCE_SOFT_OFFSET 10
diff --git a/src/main/drivers/rx_spi.c b/src/main/drivers/rx_spi.c
index e7e8f70d4f..91a11b9d8c 100644
--- a/src/main/drivers/rx_spi.c
+++ b/src/main/drivers/rx_spi.c
@@ -73,7 +73,7 @@ void rxSpiDeviceInit(rx_spi_type_e spiType)
#else
UNUSED(spiType);
const SPIDevice rxSPIDevice = spiDeviceByInstance(RX_SPI_INSTANCE);
- IOInit(IOGetByTag(IO_TAG(RX_NSS_PIN)), OWNER_SPI, RESOURCE_SPI_CS, rxSPIDevice + 1);
+ IOInit(IOGetByTag(IO_TAG(RX_NSS_PIN)), OWNER_SPI_CS, rxSPIDevice + 1);
#endif // USE_RX_SOFTSPI
#if defined(STM32F10X)
@@ -83,7 +83,7 @@ void rxSpiDeviceInit(rx_spi_type_e spiType)
#ifdef RX_CE_PIN
// CE as OUTPUT
- IOInit(IOGetByTag(IO_TAG(RX_CE_PIN)), OWNER_RX_SPI, RESOURCE_RX_CE, rxSPIDevice + 1);
+ IOInit(IOGetByTag(IO_TAG(RX_CE_PIN)), OWNER_RX_SPI_CS, rxSPIDevice + 1);
#if defined(STM32F10X)
IOConfigGPIO(IOGetByTag(IO_TAG(RX_CE_PIN)), SPI_IO_CS_CFG);
#elif defined(STM32F3) || defined(STM32F4)
diff --git a/src/main/drivers/sdcard.c b/src/main/drivers/sdcard.c
index f02df997d8..e74303f179 100644
--- a/src/main/drivers/sdcard.c
+++ b/src/main/drivers/sdcard.c
@@ -128,7 +128,7 @@ void sdcardInsertionDetectDeinit(void)
{
#ifdef SDCARD_DETECT_PIN
sdCardDetectPin = IOGetByTag(IO_TAG(SDCARD_DETECT_PIN));
- IOInit(sdCardDetectPin, OWNER_FREE, RESOURCE_NONE, 0);
+ IOInit(sdCardDetectPin, OWNER_FREE, 0);
IOConfigGPIO(sdCardDetectPin, IOCFG_IN_FLOATING);
#endif
}
@@ -137,7 +137,7 @@ void sdcardInsertionDetectInit(void)
{
#ifdef SDCARD_DETECT_PIN
sdCardDetectPin = IOGetByTag(IO_TAG(SDCARD_DETECT_PIN));
- IOInit(sdCardDetectPin, OWNER_SDCARD, RESOURCE_INPUT, 0);
+ IOInit(sdCardDetectPin, OWNER_SDCARD_DETECT, 0);
IOConfigGPIO(sdCardDetectPin, IOCFG_IPU);
#endif
}
@@ -558,7 +558,7 @@ void sdcard_init(bool useDMA)
#ifdef SDCARD_SPI_CS_PIN
sdCardCsPin = IOGetByTag(IO_TAG(SDCARD_SPI_CS_PIN));
- IOInit(sdCardCsPin, OWNER_SDCARD, RESOURCE_SPI_CS, 0);
+ IOInit(sdCardCsPin, OWNER_SDCARD_CS, 0);
IOConfigGPIO(sdCardCsPin, SPI_IO_CS_CFG);
#endif // SDCARD_SPI_CS_PIN
diff --git a/src/main/drivers/serial_escserial.c b/src/main/drivers/serial_escserial.c
index 1ae53a3659..f2e11a6a7f 100644
--- a/src/main/drivers/serial_escserial.c
+++ b/src/main/drivers/serial_escserial.c
@@ -152,7 +152,7 @@ static void escSerialGPIOConfig(ioTag_t tag, ioConfig_t cfg)
return;
}
- IOInit(IOGetByTag(tag), OWNER_MOTOR, RESOURCE_OUTPUT, 0);
+ IOInit(IOGetByTag(tag), OWNER_MOTOR, 0);
IOConfigGPIO(IOGetByTag(tag), cfg);
}
diff --git a/src/main/drivers/serial_softserial.c b/src/main/drivers/serial_softserial.c
index 0b5be52f51..0b599e09c6 100644
--- a/src/main/drivers/serial_softserial.c
+++ b/src/main/drivers/serial_softserial.c
@@ -101,7 +101,7 @@ void setTxSignal(softSerial_t *softSerial, uint8_t state)
void serialInputPortConfig(ioTag_t pin, uint8_t portIndex)
{
- IOInit(IOGetByTag(pin), OWNER_SOFTSERIAL, RESOURCE_UART_RX, RESOURCE_INDEX(portIndex));
+ IOInit(IOGetByTag(pin), OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex) + RESOURCE_SOFT_OFFSET);
#ifdef STM32F1
IOConfigGPIO(IOGetByTag(pin), IOCFG_IPU);
#else
@@ -111,7 +111,7 @@ void serialInputPortConfig(ioTag_t pin, uint8_t portIndex)
static void serialOutputPortConfig(ioTag_t pin, uint8_t portIndex)
{
- IOInit(IOGetByTag(pin), OWNER_SOFTSERIAL, RESOURCE_UART_TX, RESOURCE_INDEX(portIndex));
+ IOInit(IOGetByTag(pin), OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex) + RESOURCE_SOFT_OFFSET);
IOConfigGPIO(IOGetByTag(pin), IOCFG_OUT_PP);
}
diff --git a/src/main/drivers/serial_uart_stm32f10x.c b/src/main/drivers/serial_uart_stm32f10x.c
index b4602ae020..599087f5d5 100644
--- a/src/main/drivers/serial_uart_stm32f10x.c
+++ b/src/main/drivers/serial_uart_stm32f10x.c
@@ -110,7 +110,7 @@ uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t option
s->USARTx = USART1;
#ifdef USE_UART1_RX_DMA
- dmaInit(DMA1_CH5_HANDLER, OWNER_SERIAL, 1);
+ dmaInit(DMA1_CH5_HANDLER, OWNER_SERIAL_RX, 1);
s->rxDMAChannel = DMA1_Channel5;
s->rxDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->DR;
#endif
@@ -122,22 +122,22 @@ uartPort_t *serialUART1(uint32_t baudRate, portMode_t mode, portOptions_t option
// UART1_TX PA9
// UART1_RX PA10
if (options & SERIAL_BIDIR) {
- IOInit(IOGetByTag(IO_TAG(PA9)), OWNER_SERIAL, RESOURCE_UART_TXRX, 1);
+ IOInit(IOGetByTag(IO_TAG(PA9)), OWNER_SERIAL_TX, 1);
IOConfigGPIO(IOGetByTag(IO_TAG(PA9)), IOCFG_AF_OD);
} else {
if (mode & MODE_TX) {
- IOInit(IOGetByTag(IO_TAG(PA9)), OWNER_SERIAL, RESOURCE_UART_TX, 1);
+ IOInit(IOGetByTag(IO_TAG(PA9)), OWNER_SERIAL_TX, 1);
IOConfigGPIO(IOGetByTag(IO_TAG(PA9)), IOCFG_AF_PP);
}
if (mode & MODE_RX) {
- IOInit(IOGetByTag(IO_TAG(PA10)), OWNER_SERIAL, RESOURCE_UART_RX, 1);
+ IOInit(IOGetByTag(IO_TAG(PA10)), OWNER_SERIAL_RX, 1);
IOConfigGPIO(IOGetByTag(IO_TAG(PA10)), IOCFG_IPU);
}
}
// DMA TX Interrupt
- dmaInit(DMA1_CH4_HANDLER, OWNER_SERIAL, 1);
+ dmaInit(DMA1_CH4_HANDLER, OWNER_SERIAL_TX, 1);
dmaSetHandler(DMA1_CH4_HANDLER, uart_tx_dma_IRQHandler, NVIC_PRIO_SERIALUART1_TXDMA, (uint32_t)&uartPort1);
#ifndef USE_UART1_RX_DMA
@@ -193,16 +193,16 @@ uartPort_t *serialUART2(uint32_t baudRate, portMode_t mode, portOptions_t option
// UART2_TX PA2
// UART2_RX PA3
if (options & SERIAL_BIDIR) {
- IOInit(IOGetByTag(IO_TAG(PA2)), OWNER_SERIAL, RESOURCE_UART_TXRX, 2);
+ IOInit(IOGetByTag(IO_TAG(PA2)), OWNER_SERIAL_TX, 2);
IOConfigGPIO(IOGetByTag(IO_TAG(PA2)), IOCFG_AF_OD);
} else {
if (mode & MODE_TX) {
- IOInit(IOGetByTag(IO_TAG(PA2)), OWNER_SERIAL, RESOURCE_UART_TX, 2);
+ IOInit(IOGetByTag(IO_TAG(PA2)), OWNER_SERIAL_TX, 2);
IOConfigGPIO(IOGetByTag(IO_TAG(PA2)), IOCFG_AF_PP);
}
if (mode & MODE_RX) {
- IOInit(IOGetByTag(IO_TAG(PA3)), OWNER_SERIAL, RESOURCE_UART_RX, 2);
+ IOInit(IOGetByTag(IO_TAG(PA3)), OWNER_SERIAL_RX, 2);
IOConfigGPIO(IOGetByTag(IO_TAG(PA3)), IOCFG_IPU);
}
}
@@ -255,16 +255,16 @@ uartPort_t *serialUART3(uint32_t baudRate, portMode_t mode, portOptions_t option
RCC_ClockCmd(RCC_APB1(USART3), ENABLE);
if (options & SERIAL_BIDIR) {
- IOInit(IOGetByTag(IO_TAG(UART3_TX_PIN)), OWNER_SERIAL, RESOURCE_UART_TXRX, 3);
+ IOInit(IOGetByTag(IO_TAG(UART3_TX_PIN)), OWNER_SERIAL_TX, 3);
IOConfigGPIO(IOGetByTag(IO_TAG(UART3_TX_PIN)), IOCFG_AF_OD);
} else {
if (mode & MODE_TX) {
- IOInit(IOGetByTag(IO_TAG(UART3_TX_PIN)), OWNER_SERIAL, RESOURCE_UART_TX, 3);
+ IOInit(IOGetByTag(IO_TAG(UART3_TX_PIN)), OWNER_SERIAL_TX, 3);
IOConfigGPIO(IOGetByTag(IO_TAG(UART3_TX_PIN)), IOCFG_AF_PP);
}
if (mode & MODE_RX) {
- IOInit(IOGetByTag(IO_TAG(UART3_RX_PIN)), OWNER_SERIAL, RESOURCE_UART_RX, 3);
+ IOInit(IOGetByTag(IO_TAG(UART3_RX_PIN)), OWNER_SERIAL_RX, 3);
IOConfigGPIO(IOGetByTag(IO_TAG(UART3_RX_PIN)), IOCFG_IPU);
}
}
diff --git a/src/main/drivers/serial_uart_stm32f30x.c b/src/main/drivers/serial_uart_stm32f30x.c
index f37f85790c..7b9464990a 100644
--- a/src/main/drivers/serial_uart_stm32f30x.c
+++ b/src/main/drivers/serial_uart_stm32f30x.c
@@ -121,7 +121,7 @@ void serialUARTInit(IO_t tx, IO_t rx, portMode_t mode, portOptions_t options, ui
(options & SERIAL_INVERTED) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP
);
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TXRX, index);
+ IOInit(tx, OWNER_SERIAL_TX, index);
IOConfigGPIOAF(tx, ioCfg, af);
if (!(options & SERIAL_INVERTED))
@@ -129,12 +129,12 @@ void serialUARTInit(IO_t tx, IO_t rx, portMode_t mode, portOptions_t options, ui
} else {
ioConfig_t ioCfg = IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, (options & SERIAL_INVERTED) ? GPIO_PuPd_DOWN : GPIO_PuPd_UP);
if (mode & MODE_TX) {
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TX, index);
+ IOInit(tx, OWNER_SERIAL_TX, index);
IOConfigGPIOAF(tx, ioCfg, af);
}
if (mode & MODE_RX) {
- IOInit(rx, OWNER_SERIAL, RESOURCE_UART_RX, index);
+ IOInit(rx, OWNER_SERIAL_RX, index);
IOConfigGPIOAF(rx, ioCfg, af);
}
}
diff --git a/src/main/drivers/serial_uart_stm32f4xx.c b/src/main/drivers/serial_uart_stm32f4xx.c
index c0aed43f73..076ee91853 100644
--- a/src/main/drivers/serial_uart_stm32f4xx.c
+++ b/src/main/drivers/serial_uart_stm32f4xx.c
@@ -315,12 +315,12 @@ uartPort_t *serialUART(UARTDevice device, uint32_t baudRate, portMode_t mode, po
if (uart->rxDMAStream) {
s->rxDMAChannel = uart->DMAChannel;
s->rxDMAStream = uart->rxDMAStream;
- dmaInit(dmaGetIdentifier(uart->rxDMAStream), OWNER_SERIAL, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(uart->rxDMAStream), OWNER_SERIAL_RX, RESOURCE_INDEX(device));
}
if (uart->txDMAStream) {
s->txDMAChannel = uart->DMAChannel;
s->txDMAStream = uart->txDMAStream;
- dmaInit(dmaGetIdentifier(uart->txDMAStream), OWNER_SERIAL, RESOURCE_INDEX(device));
+ dmaInit(dmaGetIdentifier(uart->txDMAStream), OWNER_SERIAL_TX, RESOURCE_INDEX(device));
}
s->txDMAPeripheralBaseAddr = (uint32_t)&s->USARTx->DR;
@@ -339,17 +339,17 @@ uartPort_t *serialUART(UARTDevice device, uint32_t baudRate, portMode_t mode, po
RCC_AHB1PeriphClockCmd(uart->rcc_ahb1, ENABLE);
if (options & SERIAL_BIDIR) {
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TXRX, RESOURCE_INDEX(device));
+ IOInit(tx, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
IOConfigGPIOAF(tx, IOCFG_AF_OD, uart->af);
}
else {
if (mode & MODE_TX) {
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TX, RESOURCE_INDEX(device));
+ IOInit(tx, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
IOConfigGPIOAF(tx, IOCFG_AF_PP, uart->af);
}
if (mode & MODE_RX) {
- IOInit(rx, OWNER_SERIAL, RESOURCE_UART_RX, RESOURCE_INDEX(device));
+ IOInit(rx, OWNER_SERIAL_RX, RESOURCE_INDEX(device));
IOConfigGPIOAF(rx, IOCFG_AF_PP, uart->af);
}
}
diff --git a/src/main/drivers/serial_uart_stm32f7xx.c b/src/main/drivers/serial_uart_stm32f7xx.c
index b6aeb7c320..facd6ced76 100644
--- a/src/main/drivers/serial_uart_stm32f7xx.c
+++ b/src/main/drivers/serial_uart_stm32f7xx.c
@@ -406,22 +406,23 @@ uartPort_t *serialUART(UARTDevice device, uint32_t baudRate, portMode_t mode, po
IO_t rx = IOGetByTag(uart->rx);
if (options & SERIAL_BIDIR) {
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TXRX, RESOURCE_INDEX(device));
+ IOInit(tx, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
IOConfigGPIOAF(tx, IOCFG_AF_PP, uart->af);
}
else {
if (mode & MODE_TX) {
- IOInit(tx, OWNER_SERIAL, RESOURCE_UART_TX, RESOURCE_INDEX(device));
+ IOInit(tx, OWNER_SERIAL_TX, RESOURCE_INDEX(device));
IOConfigGPIOAF(tx, IOCFG_AF_PP, uart->af);
}
if (mode & MODE_RX) {
- IOInit(rx, OWNER_SERIAL, RESOURCE_UART_RX, RESOURCE_INDEX(device));
+ IOInit(rx, OWNER_SERIAL_RX, RESOURCE_INDEX(device));
IOConfigGPIOAF(rx, IOCFG_AF_PP, uart->af);
}
}
// DMA TX Interrupt
+ dmaInit(uart->txIrq, OWNER_SERIAL_TX, (uint32_t)uart);
dmaSetHandler(uart->txIrq, dmaIRQHandler, uart->txPriority, (uint32_t)uart);
diff --git a/src/main/drivers/serial_usb_vcp.c b/src/main/drivers/serial_usb_vcp.c
index 7c67aca529..5c9cd58acf 100644
--- a/src/main/drivers/serial_usb_vcp.c
+++ b/src/main/drivers/serial_usb_vcp.c
@@ -182,8 +182,8 @@ serialPort_t *usbVcpOpen(void)
vcpPort_t *s;
#ifdef STM32F4
- IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, RESOURCE_INPUT, 0);
- IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, RESOURCE_OUTPUT, 0);
+ IOInit(IOGetByTag(IO_TAG(PA11)), OWNER_USB, 0);
+ IOInit(IOGetByTag(IO_TAG(PA12)), OWNER_USB, 0);
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_CDC_cb, &USR_cb);
#else
Set_System();
diff --git a/src/main/drivers/sonar_hcsr04.c b/src/main/drivers/sonar_hcsr04.c
index 43d662f4a9..e3d851f8de 100644
--- a/src/main/drivers/sonar_hcsr04.c
+++ b/src/main/drivers/sonar_hcsr04.c
@@ -83,12 +83,12 @@ void hcsr04_init(const sonarConfig_t *sonarConfig, sonarRange_t *sonarRange)
// trigger pin
triggerIO = IOGetByTag(sonarConfig->triggerTag);
- IOInit(triggerIO, OWNER_SONAR_TRIGGER, RESOURCE_OUTPUT, 0);
+ IOInit(triggerIO, OWNER_SONAR_TRIGGER, 0);
IOConfigGPIO(triggerIO, IOCFG_OUT_PP);
// echo pin
echoIO = IOGetByTag(sonarConfig->echoTag);
- IOInit(echoIO, OWNER_SONAR_ECHO, RESOURCE_INPUT, 0);
+ IOInit(echoIO, OWNER_SONAR_ECHO, 0);
IOConfigGPIO(echoIO, IOCFG_IN_FLOATING);
#ifdef USE_EXTI
diff --git a/src/main/drivers/sound_beeper.c b/src/main/drivers/sound_beeper.c
index 44d968db0b..dbe3122bdb 100644
--- a/src/main/drivers/sound_beeper.c
+++ b/src/main/drivers/sound_beeper.c
@@ -58,7 +58,7 @@ void beeperInit(const beeperConfig_t *config)
beeperInverted = config->isInverted;
if (beeperIO) {
- IOInit(beeperIO, OWNER_BEEPER, RESOURCE_OUTPUT, 0);
+ IOInit(beeperIO, OWNER_BEEPER, 0);
IOConfigGPIO(beeperIO, config->isOD ? IOCFG_OUT_OD : IOCFG_OUT_PP);
}
systemBeep(false);
diff --git a/src/main/drivers/timer.c b/src/main/drivers/timer.c
index 2ffa962ebc..1d185ccf39 100755
--- a/src/main/drivers/timer.c
+++ b/src/main/drivers/timer.c
@@ -414,7 +414,7 @@ void timerChClearCCFlag(const timerHardware_t *timHw)
// configure timer channel GPIO mode
void timerChConfigGPIO(const timerHardware_t* timHw, ioConfig_t mode)
{
- IOInit(IOGetByTag(timHw->tag), OWNER_TIMER, RESOURCE_TIMER, 0);
+ IOInit(IOGetByTag(timHw->tag), OWNER_TIMER, 0);
IOConfigGPIO(IOGetByTag(timHw->tag), mode);
}
diff --git a/src/main/drivers/timer_hal.c b/src/main/drivers/timer_hal.c
index d643ed1285..8492bfe2e8 100644
--- a/src/main/drivers/timer_hal.c
+++ b/src/main/drivers/timer_hal.c
@@ -486,7 +486,7 @@ void timerChClearCCFlag(const timerHardware_t *timHw)
// configure timer channel GPIO mode
void timerChConfigGPIO(const timerHardware_t* timHw, ioConfig_t mode)
{
- IOInit(IOGetByTag(timHw->tag), OWNER_TIMER, RESOURCE_TIMER, 0);
+ IOInit(IOGetByTag(timHw->tag), OWNER_TIMER, 0);
IOConfigGPIO(IOGetByTag(timHw->tag), mode);
}
diff --git a/src/main/drivers/usb_detection.c b/src/main/drivers/usb_detection.c
index 9279d7dff4..d1c0088c9e 100644
--- a/src/main/drivers/usb_detection.c
+++ b/src/main/drivers/usb_detection.c
@@ -27,7 +27,7 @@ static IO_t usbDetectPin = IO_NONE;
void usbCableDetectDeinit(void)
{
#ifdef USB_DETECT_PIN
- IOInit(usbDetectPin, OWNER_FREE, RESOURCE_NONE);
+ IOInit(usbDetectPin, OWNER_FREE, 0);
IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING);
usbDetectPin = IO_NONE;
#endif
@@ -38,7 +38,7 @@ void usbCableDetectInit(void)
#ifdef USB_DETECT_PIN
usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN));
- IOInit(usbDetectPin, OWNER_USB, RESOURCE_INPUT);
+ IOInit(usbDetectPin, OWNER_USB_DETECT, 0);
IOConfigGPIO(usbDetectPin, IOCFG_OUT_PP);
#endif
}
diff --git a/src/main/drivers/usb_io.c b/src/main/drivers/usb_io.c
index 8520ef8e54..7d2c99fc89 100644
--- a/src/main/drivers/usb_io.c
+++ b/src/main/drivers/usb_io.c
@@ -36,7 +36,7 @@ static IO_t usbDetectPin = IO_NONE;
void usbCableDetectDeinit(void)
{
#ifdef USB_DETECT_PIN
- IOInit(usbDetectPin, OWNER_FREE, RESOURCE_NONE, 0);
+ IOInit(usbDetectPin, OWNER_FREE, 0);
IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING);
usbDetectPin = IO_NONE;
#endif
@@ -47,7 +47,7 @@ void usbCableDetectInit(void)
#ifdef USB_DETECT_PIN
usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN));
- IOInit(usbDetectPin, OWNER_USB, RESOURCE_INPUT, 0);
+ IOInit(usbDetectPin, OWNER_USB_DETECT, 0);
IOConfigGPIO(usbDetectPin, IOCFG_OUT_PP);
#endif
}
diff --git a/src/main/drivers/vtx_soft_spi_rtc6705.c b/src/main/drivers/vtx_soft_spi_rtc6705.c
index e6340680fa..cf480fb072 100644
--- a/src/main/drivers/vtx_soft_spi_rtc6705.c
+++ b/src/main/drivers/vtx_soft_spi_rtc6705.c
@@ -59,13 +59,13 @@ void rtc6705_soft_spi_init(void)
rtc6705LePin = IOGetByTag(IO_TAG(RTC6705_SPILE_PIN));
rtc6705ClkPin = IOGetByTag(IO_TAG(RTC6705_SPICLK_PIN));
- IOInit(rtc6705DataPin, OWNER_TX, RESOURCE_SPI_MOSI, 0);
+ IOInit(rtc6705DataPin, OWNER_SPI_MOSI, RESOURCE_SOFT_OFFSET);
IOConfigGPIO(rtc6705DataPin, IOCFG_OUT_PP);
- IOInit(rtc6705LePin, OWNER_TX, RESOURCE_SPI_CS, 0);
+ IOInit(rtc6705LePin, OWNER_SPI_CS, RESOURCE_SOFT_OFFSET);
IOConfigGPIO(rtc6705LePin, IOCFG_OUT_PP);
- IOInit(rtc6705ClkPin, OWNER_TX, RESOURCE_SPI_SCK, 0);
+ IOInit(rtc6705ClkPin, OWNER_SPI_SCK, RESOURCE_SOFT_OFFSET);
IOConfigGPIO(rtc6705ClkPin, IOCFG_OUT_PP);
}
diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c
index 46c5de156d..c2d3ea39ec 100755
--- a/src/main/io/serial_cli.c
+++ b/src/main/io/serial_cli.c
@@ -3842,13 +3842,10 @@ static void cliResource(char *cmdline)
const char* owner;
owner = ownerNames[ioRecs[i].owner];
- const char* resource;
- resource = resourceNames[ioRecs[i].resource];
-
if (ioRecs[i].index > 0) {
- cliPrintf("%c%02d: %s%d %s\r\n", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner, ioRecs[i].index, resource);
+ cliPrintf("%c%02d: %s %d\r\n", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner, ioRecs[i].index);
} else {
- cliPrintf("%c%02d: %s %s\r\n", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner, resource);
+ cliPrintf("%c%02d: %s \r\n", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner);
}
}
@@ -3860,7 +3857,7 @@ static void cliResource(char *cmdline)
cliPrintf(DMA_OUTPUT_STRING, i / DMA_MOD_VALUE + 1, (i % DMA_MOD_VALUE) + DMA_MOD_OFFSET);
uint8_t resourceIndex = dmaGetResourceIndex(i);
if (resourceIndex > 0) {
- cliPrintf(" %s%d\r\n", owner, resourceIndex);
+ cliPrintf(" %s %d\r\n", owner, resourceIndex);
} else {
cliPrintf(" %s\r\n", owner);
}
diff --git a/src/main/rx/spektrum.c b/src/main/rx/spektrum.c
index 9530450208..6616fbc542 100644
--- a/src/main/rx/spektrum.c
+++ b/src/main/rx/spektrum.c
@@ -171,7 +171,7 @@ bool spekShouldBind(uint8_t spektrum_sat_bind)
{
#ifdef HARDWARE_BIND_PLUG
BindPlug = IOGetByTag(IO_TAG(BINDPLUG_PIN));
- IOInit(BindPlug, OWNER_RX, RESOURCE_INPUT, 0);
+ IOInit(BindPlug, OWNER_RX_BIND, 0);
IOConfigGPIO(BindPlug, IOCFG_IPU);
// Check status of bind plug and exit if not active
@@ -203,7 +203,7 @@ void spektrumBind(rxConfig_t *rxConfig)
LED1_ON;
BindPin = IOGetByTag(IO_TAG(BIND_PIN));
- IOInit(BindPin, OWNER_RX, RESOURCE_OUTPUT, 0);
+ IOInit(BindPin, OWNER_RX_BIND, 0);
IOConfigGPIO(BindPin, IOCFG_OUT_PP);
// RX line, set high
diff --git a/src/main/target/ALIENFLIGHTF3/hardware_revision.c b/src/main/target/ALIENFLIGHTF3/hardware_revision.c
index c535c7d9a2..f8cabdc76e 100644
--- a/src/main/target/ALIENFLIGHTF3/hardware_revision.c
+++ b/src/main/target/ALIENFLIGHTF3/hardware_revision.c
@@ -41,7 +41,7 @@ static IO_t HWDetectPin = IO_NONE;
void detectHardwareRevision(void)
{
HWDetectPin = IOGetByTag(IO_TAG(HW_PIN));
- IOInit(HWDetectPin, OWNER_SYSTEM, RESOURCE_INPUT, 0);
+ IOInit(HWDetectPin, OWNER_SYSTEM, 0);
IOConfigGPIO(HWDetectPin, IOCFG_IPU);
// Check hardware revision
diff --git a/src/main/target/BLUEJAYF4/hardware_revision.c b/src/main/target/BLUEJAYF4/hardware_revision.c
index aa5f311326..4418181941 100644
--- a/src/main/target/BLUEJAYF4/hardware_revision.c
+++ b/src/main/target/BLUEJAYF4/hardware_revision.c
@@ -42,11 +42,11 @@ uint8_t hardwareRevision = UNKNOWN;
void detectHardwareRevision(void)
{
IO_t pin1 = IOGetByTag(IO_TAG(PB12));
- IOInit(pin1, OWNER_SYSTEM, RESOURCE_INPUT, 1);
+ IOInit(pin1, OWNER_SYSTEM, 1);
IOConfigGPIO(pin1, IOCFG_IPU);
IO_t pin2 = IOGetByTag(IO_TAG(PB13));
- IOInit(pin2, OWNER_SYSTEM, RESOURCE_INPUT, 2);
+ IOInit(pin2, OWNER_SYSTEM, 2);
IOConfigGPIO(pin2, IOCFG_IPU);
// Check hardware revision
@@ -76,7 +76,7 @@ void detectHardwareRevision(void)
HI or LO in configuration.
*/
IO_t uart1invert = IOGetByTag(IO_TAG(PC9));
- IOInit(uart1invert, OWNER_INVERTER, RESOURCE_OUTPUT, 2);
+ IOInit(uart1invert, OWNER_INVERTER, 2);
IOConfigGPIO(uart1invert, IOCFG_AF_PP);
IOLo(uart1invert);
}
@@ -93,7 +93,7 @@ void updateHardwareRevision(void)
if (m25p16_init(IO_TAG(PB3))) {
hardwareRevision = BJF4_REV1;
} else {
- IOInit(IOGetByTag(IO_TAG(PB3)), OWNER_FREE, RESOURCE_NONE, 0);
+ IOInit(IOGetByTag(IO_TAG(PB3)), OWNER_FREE, 0);
}
}