From d35a8b1c760438999dc2d0be43579e71eff642f6 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 12 May 2022 13:02:54 +0200 Subject: [PATCH 1/2] Drop PCA9685 support --- src/main/CMakeLists.txt | 4 - src/main/drivers/bus.h | 1 - src/main/drivers/io_pca9685.c | 147 ----------------------- src/main/drivers/io_pca9685.h | 6 - src/main/drivers/lights_io.c | 3 +- src/main/drivers/pwm_mapping.h | 1 - src/main/drivers/pwm_output.c | 20 --- src/main/fc/config.c | 6 - src/main/fc/fc_init.c | 3 - src/main/fc/fc_tasks.c | 10 +- src/main/fc/runtime_config.h | 1 - src/main/fc/settings.yaml | 4 +- src/main/flight/servos.c | 2 +- src/main/io/pwmdriver_i2c.c | 70 ----------- src/main/io/pwmdriver_i2c.h | 4 - src/main/scheduler/scheduler.h | 2 +- src/main/target/AIKONF4/target.h | 1 - src/main/target/AIRBOTF4/target.h | 2 - src/main/target/ALIENFLIGHTF3/target.h | 2 - src/main/target/ANYFC/target.h | 2 - src/main/target/ANYFCF7/target.h | 2 - src/main/target/ANYFCM7/target.h | 2 - src/main/target/ASGARD32F4/target.h | 1 - src/main/target/ASGARD32F7/target.h | 1 - src/main/target/BETAFLIGHTF4/target.h | 2 - src/main/target/COLIBRI_RACE/target.h | 1 - src/main/target/F4BY/target.h | 2 - src/main/target/FALCORE/target.h | 1 - src/main/target/FIREWORKSV2/target.h | 2 - src/main/target/FURYF4OSD/target.h | 2 - src/main/target/IFLIGHTF4_TWING/target.h | 1 - src/main/target/LUX_RACE/target.h | 2 - src/main/target/MATEKF405/target.h | 2 - src/main/target/MATEKF405CAN/target.h | 1 - src/main/target/MATEKF405SE/target.h | 2 - src/main/target/MATEKF405TE/target.h | 1 - src/main/target/MOTOLAB/target.h | 1 - src/main/target/OMNIBUSF4/target.h | 2 - src/main/target/OMNIBUSF7/target.h | 2 - src/main/target/RCEXPLORERF3/target.h | 2 - src/main/target/REVO/target.h | 2 - src/main/target/SKYSTARSF405HD/target.h | 1 - src/main/target/SPARKY/target.h | 2 - src/main/target/SPARKY2/target.h | 2 - src/main/target/YUPIF4/target.h | 2 - src/main/target/common.h | 2 - src/main/target/common_hardware.c | 9 -- 47 files changed, 8 insertions(+), 335 deletions(-) delete mode 100644 src/main/drivers/io_pca9685.c delete mode 100644 src/main/drivers/io_pca9685.h delete mode 100644 src/main/io/pwmdriver_i2c.c delete mode 100644 src/main/io/pwmdriver_i2c.h diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index b74b0ba3910..1c968c8cf51 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -180,8 +180,6 @@ main_sources(COMMON_SRC drivers/flash_m25p16.h drivers/io.c drivers/io.h - drivers/io_pca9685.c - drivers/io_pca9685.h drivers/io_pcf8574.c drivers/io_pcf8574.h drivers/io_port_expander.c @@ -354,8 +352,6 @@ main_sources(COMMON_SRC io/lights.h io/piniobox.c io/piniobox.h - io/pwmdriver_i2c.c - io/pwmdriver_i2c.h io/serial.c io/serial.h io/serial_4way.c diff --git a/src/main/drivers/bus.h b/src/main/drivers/bus.h index 8b488559052..91d4077bf4c 100755 --- a/src/main/drivers/bus.h +++ b/src/main/drivers/bus.h @@ -139,7 +139,6 @@ typedef enum { /* Other hardware */ DEVHW_MS4525, // Pitot meter - DEVHW_PCA9685, // PWM output device DEVHW_M25P16, // SPI NOR flash DEVHW_UG2864, // I2C OLED display DEVHW_SDCARD, // Generic SD-Card diff --git a/src/main/drivers/io_pca9685.c b/src/main/drivers/io_pca9685.c deleted file mode 100644 index 1038496228e..00000000000 --- a/src/main/drivers/io_pca9685.c +++ /dev/null @@ -1,147 +0,0 @@ -#include -#include - -#include "platform.h" - -#include "build/build_config.h" - -#ifdef USE_PWM_DRIVER_PCA9685 - -#include "common/time.h" -#include "common/maths.h" - -#include "drivers/io.h" -#include "drivers/time.h" -#include "drivers/bus.h" -#include "drivers/bus_i2c.h" - -#define PCA9685_MODE1 0x00 -#define PCA9685_PRESCALE 0xFE - -#define LED0_ON_L 0x06 -#define LED0_ON_H 0x07 -#define LED0_OFF_L 0x08 -#define LED0_OFF_H 0x09 - -#define PCA9685_SERVO_FREQUENCY 60 -#define PCA9685_SERVO_COUNT 16 -#define PCA9685_SYNC_THRESHOLD 5 - -static busDevice_t * busDev; -static uint16_t currentOutputState[PCA9685_SERVO_COUNT] = {0}; -static uint16_t temporaryOutputState[PCA9685_SERVO_COUNT] = {0}; - -void pca9685setPWMOn(uint8_t servoIndex, uint16_t on) { - if (servoIndex < PCA9685_SERVO_COUNT) { - busWrite(busDev, LED0_ON_L + (servoIndex * 4), on); - busWrite(busDev, LED0_ON_H + (servoIndex * 4), on>>8); - } -} - -void pca9685setPWMOff(uint8_t servoIndex, uint16_t off) { - if (servoIndex < PCA9685_SERVO_COUNT) { - busWrite(busDev, LED0_OFF_L + (servoIndex * 4), off); - busWrite(busDev, LED0_OFF_H + (servoIndex * 4), off>>8); - } -} - -/* -Writing new state every cycle for each servo is extremely time consuming -and does not makes sense. -Trying to sync 5 servos every 2000us extends looptime -to 3500us. Very, very bad... -Instead of that, write desired values to temporary -table and write it to PCA9685 only when there a need. -Also, because of resultion of PCA9685 internal counter of about 5us, do not write -small changes, since thwy will only clog the bandwidch and will not -be represented on output -PWM Driver runs at 200Hz, every cycle every 4th servo output is updated: -cycle 0: servo 0, 4, 8, 12 -cycle 1: servo 1, 5, 9, 13 -cycle 2: servo 2, 6, 10, 14 -cycle 3: servo3, 7, 11, 15 -*/ -void pca9685sync(uint8_t cycleIndex) { - uint8_t i; - - for (i = 0; i < PCA9685_SERVO_COUNT; i++) { - if (cycleIndex == i % 4 && ABS(temporaryOutputState[i] - currentOutputState[i]) > PCA9685_SYNC_THRESHOLD) { - pca9685setPWMOff(i, temporaryOutputState[i]); - currentOutputState[i] = temporaryOutputState[i]; - } - } -} - -void pca9685setServoPulse(uint8_t servoIndex, uint16_t pulse) { - - static double pulselength = 0; - - if (pulselength == 0) { - pulselength = 1000000; // 1,000,000 us per second - pulselength /= PCA9685_SERVO_FREQUENCY; - pulselength /= 4096; // 12 bits of resolution - } - pulse /= pulselength; - - temporaryOutputState[servoIndex] = pulse; -} - -void pca9685setPWMFreq(uint16_t freq) { - - uint32_t prescaleval = 25000000; - prescaleval /= 4096; - prescaleval /= freq; - prescaleval -= 1; - - busWrite(busDev, PCA9685_MODE1, 16); - delay(1); - busWrite(busDev, PCA9685_PRESCALE, (uint8_t) prescaleval); - delay(1); - busWrite(busDev, PCA9685_MODE1, 128); -} - -static bool deviceDetect(busDevice_t * busDev) -{ - for (int retry = 0; retry < 5; retry++) { - uint8_t sig; - - delay(150); - - bool ack = busRead(busDev, PCA9685_MODE1, &sig); - if (ack) { - return true; - } - }; - - return false; -} - -bool pca9685Initialize(void) -{ - busDev = busDeviceInit(BUSTYPE_I2C, DEVHW_PCA9685, 0, 0); - if (busDev == NULL) { - return false; - } - - if (!deviceDetect(busDev)) { - busDeviceDeInit(busDev); - return false; - } - - /* Reset device */ - busWrite(busDev, PCA9685_MODE1, 0x00); - - /* Set refresh rate */ - pca9685setPWMFreq(PCA9685_SERVO_FREQUENCY); - - delay(1); - - for (uint8_t i = 0; i < PCA9685_SERVO_COUNT; i++) { - pca9685setPWMOn(i, 0); - pca9685setPWMOff(i, 1500); - } - - return true; -} - -#endif diff --git a/src/main/drivers/io_pca9685.h b/src/main/drivers/io_pca9685.h deleted file mode 100644 index 2ab7b0477eb..00000000000 --- a/src/main/drivers/io_pca9685.h +++ /dev/null @@ -1,6 +0,0 @@ -bool pca9685Initialize(void); -void pca9685setPWMOn(uint8_t servoIndex, uint16_t on); -void pca9685setPWMOff(uint8_t servoIndex, uint16_t off); -void pca9685setPWMFreq(uint16_t freq); -void pca9685setServoPulse(uint8_t servoIndex, uint16_t pulse); -void pca9685sync(uint8_t cycleIndex); diff --git a/src/main/drivers/lights_io.c b/src/main/drivers/lights_io.c index b6f453686eb..a495a324930 100644 --- a/src/main/drivers/lights_io.c +++ b/src/main/drivers/lights_io.c @@ -3,11 +3,10 @@ #ifdef USE_LIGHTS -#if (!defined(LIGHTS_USE_PCA9685_OUTPUT)) && (!defined(LIGHTS_OUTPUT_MODE)) +#ifndef LIGHTS_OUTPUT_MODE #define LIGHTS_OUTPUT_MODE IOCFG_OUT_PP #endif - static IO_t lightsIO = DEFIO_IO(NONE); bool lightsHardwareInit(void) diff --git a/src/main/drivers/pwm_mapping.h b/src/main/drivers/pwm_mapping.h index 51ec456a779..14c3f9293ba 100644 --- a/src/main/drivers/pwm_mapping.h +++ b/src/main/drivers/pwm_mapping.h @@ -48,7 +48,6 @@ typedef enum { typedef enum { SERVO_TYPE_PWM = 0, - SERVO_TYPE_SERVO_DRIVER, SERVO_TYPE_SBUS, SERVO_TYPE_SBUS_PWM } servoProtocolType_e; diff --git a/src/main/drivers/pwm_output.c b/src/main/drivers/pwm_output.c index 1e59f3edf33..e04f90c232a 100644 --- a/src/main/drivers/pwm_output.c +++ b/src/main/drivers/pwm_output.c @@ -34,9 +34,6 @@ FILE_COMPILE_FOR_SPEED #include "drivers/timer.h" #include "drivers/pwm_mapping.h" #include "drivers/pwm_output.h" -#include "drivers/io_pca9685.h" - -#include "io/pwmdriver_i2c.h" #include "io/servo_sbus.h" #include "sensors/esc_sensor.h" @@ -535,16 +532,6 @@ static void sbusPwmWriteStandard(uint8_t index, uint16_t value) } #endif -#ifdef USE_PWM_SERVO_DRIVER -static void pwmServoWriteExternalDriver(uint8_t index, uint16_t value) -{ - // If PCA9685 is not detected, we do not want to write servo output anywhere - if (STATE(PWM_DRIVER_AVAILABLE)) { - pwmDriverSetPulse(index, value); - } -} -#endif - void pwmServoPreconfigure(void) { // Protocol-specific configuration @@ -554,13 +541,6 @@ void pwmServoPreconfigure(void) servoWritePtr = pwmServoWriteStandard; break; -#ifdef USE_PWM_SERVO_DRIVER - case SERVO_TYPE_SERVO_DRIVER: - pwmDriverInitialize(); - servoWritePtr = pwmServoWriteExternalDriver; - break; -#endif - #ifdef USE_SERVO_SBUS case SERVO_TYPE_SBUS: sbusServoInitialize(); diff --git a/src/main/fc/config.c b/src/main/fc/config.c index c916434d09a..205289a3cae 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -217,12 +217,6 @@ void validateAndFixConfig(void) } #endif -#ifndef USE_PWM_SERVO_DRIVER - if (servoConfig()->servo_protocol == SERVO_TYPE_SERVO_DRIVER) { - servoConfigMutable()->servo_protocol = SERVO_TYPE_PWM; - } -#endif - #ifndef USE_SERVO_SBUS if (servoConfig()->servo_protocol == SERVO_TYPE_SBUS || servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM) { servoConfigMutable()->servo_protocol = SERVO_TYPE_PWM; diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index 4bf83d3d050..df55b33d62b 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -53,7 +53,6 @@ #include "drivers/exti.h" #include "drivers/flash_m25p16.h" #include "drivers/io.h" -#include "drivers/io_pca9685.h" #include "drivers/flash.h" #include "drivers/light_led.h" #include "drivers/nvic.h" @@ -75,7 +74,6 @@ #include "drivers/uart_inverter.h" #include "drivers/io.h" #include "drivers/exti.h" -#include "drivers/io_pca9685.h" #include "drivers/vtx_common.h" #ifdef USE_USB_MSC #include "drivers/usb_msc.h" @@ -114,7 +112,6 @@ #include "io/flashfs.h" #include "io/gps.h" #include "io/ledstrip.h" -#include "io/pwmdriver_i2c.h" #include "io/osd.h" #include "io/osd_dji_hd.h" #include "io/rcdevice_cam.h" diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index 262e7fa6e24..1954ab7d127 100755 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -61,7 +61,6 @@ #include "io/gps.h" #include "io/ledstrip.h" #include "io/osd.h" -#include "io/pwmdriver_i2c.h" #include "io/serial.h" #include "io/rcdevice_cam.h" #include "io/smartport_master.h" @@ -294,9 +293,6 @@ void taskSyncServoDriver(timeUs_t currentTimeUs) sbusServoSendUpdate(); #endif -#ifdef USE_PWM_SERVO_DRIVER - pwmDriverSync(); -#endif } #ifdef USE_OSD @@ -368,8 +364,8 @@ void fcTasksInit(void) #ifdef STACK_CHECK setTaskEnabled(TASK_STACK_CHECK, true); #endif -#if defined(USE_PWM_SERVO_DRIVER) || defined(USE_SERVO_SBUS) - setTaskEnabled(TASK_PWMDRIVER, (servoConfig()->servo_protocol == SERVO_TYPE_SERVO_DRIVER) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM)); +#if defined(USE_SERVO_SBUS) + setTaskEnabled(TASK_PWMDRIVER, (servoConfig()->servo_protocol == SERVO_TYPE_SBUS) || (servoConfig()->servo_protocol == SERVO_TYPE_SBUS_PWM)); #endif #ifdef USE_CMS #ifdef USE_MSP_DISPLAYPORT @@ -559,7 +555,7 @@ cfTask_t cfTasks[TASK_COUNT] = { }, #endif -#if defined(USE_PWM_SERVO_DRIVER) || defined(USE_SERVO_SBUS) +#if defined(USE_SERVO_SBUS) [TASK_PWMDRIVER] = { .taskName = "SERVOS", .taskFunc = taskSyncServoDriver, diff --git a/src/main/fc/runtime_config.h b/src/main/fc/runtime_config.h index ab380dc67e9..790f73e9001 100644 --- a/src/main/fc/runtime_config.h +++ b/src/main/fc/runtime_config.h @@ -121,7 +121,6 @@ typedef enum { NAV_MOTOR_STOP_OR_IDLE = (1 << 7), // navigation requests MOTOR_STOP or motor idle regardless of throttle stick, will only activate if MOTOR_STOP feature is available COMPASS_CALIBRATED = (1 << 8), ACCELEROMETER_CALIBRATED = (1 << 9), - PWM_DRIVER_AVAILABLE = (1 << 10), NAV_CRUISE_BRAKING = (1 << 11), NAV_CRUISE_BRAKING_BOOST = (1 << 12), NAV_CRUISE_BRAKING_LOCKED = (1 << 13), diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 92028133266..e7c97d8edbf 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -37,7 +37,7 @@ tables: - name: motor_pwm_protocol values: ["STANDARD", "ONESHOT125", "MULTISHOT", "BRUSHED", "DSHOT150", "DSHOT300", "DSHOT600"] - name: servo_protocol - values: ["PWM", "SERVO_DRIVER", "SBUS", "SBUS_PWM"] + values: ["PWM", "SBUS", "SBUS_PWM"] - name: failsafe_procedure values: ["LAND", "DROP", "RTH", "NONE"] - name: current_sensor @@ -1288,7 +1288,7 @@ groups: headers: ["flight/servos.h"] members: - name: servo_protocol - description: "An option to chose the protocol/option that would be used to output servo data. Possible options `PWM` (FC servo outputs), `SERVO_DRIVER` (I2C PCA9685 peripheral), `SBUS` (S.Bus protocol output via a configured serial port)" + description: "An option to chose the protocol/option that would be used to output servo data. Possible options `PWM` (FC servo outputs), `SBUS` (S.Bus protocol output via a configured serial port)" default_value: "PWM" field: servo_protocol table: servo_protocol diff --git a/src/main/flight/servos.c b/src/main/flight/servos.c index 53d9a4b5215..1d7de59b690 100755 --- a/src/main/flight/servos.c +++ b/src/main/flight/servos.c @@ -58,7 +58,7 @@ #include "sensors/gyro.h" -PG_REGISTER_WITH_RESET_TEMPLATE(servoConfig_t, servoConfig, PG_SERVO_CONFIG, 2); +PG_REGISTER_WITH_RESET_TEMPLATE(servoConfig_t, servoConfig, PG_SERVO_CONFIG, 3); PG_RESET_TEMPLATE(servoConfig_t, servoConfig, .servoCenterPulse = SETTING_SERVO_CENTER_PULSE_DEFAULT, diff --git a/src/main/io/pwmdriver_i2c.c b/src/main/io/pwmdriver_i2c.c deleted file mode 100644 index 0103a291028..00000000000 --- a/src/main/io/pwmdriver_i2c.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include - -#include "drivers/io_pca9685.h" - -#include "fc/config.h" -#include "fc/runtime_config.h" - -#include "config/feature.h" -#include "platform.h" - -#ifdef USE_PWM_SERVO_DRIVER - -#define PWM_DRIVER_IMPLEMENTATION_COUNT 1 -#define PWM_DRIVER_MAX_CYCLE 4 - -static bool driverEnabled = false; -static uint8_t driverImplementationIndex = 0; - -typedef struct { - bool (*initFunction)(void); - void (*writeFunction)(uint8_t servoIndex, uint16_t off); - void (*setFrequencyFunction)(uint16_t freq); - void (*syncFunction)(uint8_t cycleIndex); -} pwmDriverDriver_t; - -pwmDriverDriver_t pwmDrivers[PWM_DRIVER_IMPLEMENTATION_COUNT] = { - [0] = { - .initFunction = pca9685Initialize, - .writeFunction = pca9685setServoPulse, - .setFrequencyFunction = pca9685setPWMFreq, - .syncFunction = pca9685sync - } -}; - -bool isPwmDriverEnabled(void) { - return driverEnabled; -} - -void pwmDriverSetPulse(uint8_t servoIndex, uint16_t length) { - (pwmDrivers[driverImplementationIndex].writeFunction)(servoIndex, length); -} - -void pwmDriverInitialize(void) { - driverEnabled = (pwmDrivers[driverImplementationIndex].initFunction)(); - - if (driverEnabled) { - ENABLE_STATE(PWM_DRIVER_AVAILABLE); - } else { - DISABLE_STATE(PWM_DRIVER_AVAILABLE); - } - -} - -void pwmDriverSync(void) { - if (!STATE(PWM_DRIVER_AVAILABLE)) { - return; - } - - static uint8_t cycle = 0; - - (pwmDrivers[driverImplementationIndex].syncFunction)(cycle); - - cycle++; - if (cycle == PWM_DRIVER_MAX_CYCLE) { - cycle = 0; - } -} - -#endif \ No newline at end of file diff --git a/src/main/io/pwmdriver_i2c.h b/src/main/io/pwmdriver_i2c.h deleted file mode 100644 index 1170c87109c..00000000000 --- a/src/main/io/pwmdriver_i2c.h +++ /dev/null @@ -1,4 +0,0 @@ - -void pwmDriverInitialize(void); -void pwmDriverSync(void); -void pwmDriverSetPulse(uint8_t servoIndex, uint16_t length); diff --git a/src/main/scheduler/scheduler.h b/src/main/scheduler/scheduler.h index 4efa96e17db..98aadbcb44a 100755 --- a/src/main/scheduler/scheduler.h +++ b/src/main/scheduler/scheduler.h @@ -87,7 +87,7 @@ typedef enum { #ifdef USE_LED_STRIP TASK_LEDSTRIP, #endif -#if defined(USE_PWM_SERVO_DRIVER) || defined(USE_SERVO_SBUS) +#if defined(USE_SERVO_SBUS) TASK_PWMDRIVER, #endif #ifdef STACK_CHECK diff --git a/src/main/target/AIKONF4/target.h b/src/main/target/AIKONF4/target.h index 28ee33cf228..33310b3fc69 100644 --- a/src/main/target/AIKONF4/target.h +++ b/src/main/target/AIKONF4/target.h @@ -102,7 +102,6 @@ #define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS #define TEMPERATURE_I2C_BUS DEFAULT_I2C_BUS #define PITOT_I2C_BUS DEFAULT_I2C_BUS -#define PCA9685_I2C_BUS DEFAULT_I2C_BUS #define BNO055_I2C_BUS DEFAULT_I2C_BUS #define DEFAULT_RX_TYPE RX_TYPE_SERIAL diff --git a/src/main/target/AIRBOTF4/target.h b/src/main/target/AIRBOTF4/target.h index 4dbd8476c8b..81c525c82fe 100644 --- a/src/main/target/AIRBOTF4/target.h +++ b/src/main/target/AIRBOTF4/target.h @@ -144,7 +144,5 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff -#define PCA9685_I2C_BUS BUS_I2C2 - #define USE_DSHOT #define USE_ESC_SENSOR \ No newline at end of file diff --git a/src/main/target/ALIENFLIGHTF3/target.h b/src/main/target/ALIENFLIGHTF3/target.h index 7b5349533c9..c5c76a45aa9 100644 --- a/src/main/target/ALIENFLIGHTF3/target.h +++ b/src/main/target/ALIENFLIGHTF3/target.h @@ -131,5 +131,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD (BIT(2)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) - -#define PCA9685_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/ANYFC/target.h b/src/main/target/ANYFC/target.h index dbc23b09d7b..765fcbf0b64 100644 --- a/src/main/target/ANYFC/target.h +++ b/src/main/target/ANYFC/target.h @@ -127,5 +127,3 @@ #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/ANYFCF7/target.h b/src/main/target/ANYFCF7/target.h index 6a75ae56241..4c0a8b25ca0 100644 --- a/src/main/target/ANYFCF7/target.h +++ b/src/main/target/ANYFCF7/target.h @@ -168,5 +168,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/ANYFCM7/target.h b/src/main/target/ANYFCM7/target.h index 2ba94862976..1cbf321885e 100644 --- a/src/main/target/ANYFCM7/target.h +++ b/src/main/target/ANYFCM7/target.h @@ -135,5 +135,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/ASGARD32F4/target.h b/src/main/target/ASGARD32F4/target.h index ad671e8065c..53631c9169c 100644 --- a/src/main/target/ASGARD32F4/target.h +++ b/src/main/target/ASGARD32F4/target.h @@ -161,6 +161,5 @@ #define TARGET_IO_PORTD 0xffff #define PITOT_I2C_BUS BUS_I2C2 -#define PCA9685_I2C_BUS BUS_I2C2 #define TEMPERATURE_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 diff --git a/src/main/target/ASGARD32F7/target.h b/src/main/target/ASGARD32F7/target.h index 0ac92994f9a..7e2841c3e91 100644 --- a/src/main/target/ASGARD32F7/target.h +++ b/src/main/target/ASGARD32F7/target.h @@ -165,6 +165,5 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff -#define PCA9685_I2C_BUS BUS_I2C2 #define PITOT_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 diff --git a/src/main/target/BETAFLIGHTF4/target.h b/src/main/target/BETAFLIGHTF4/target.h index e9b44bb480b..89e6db9d516 100755 --- a/src/main/target/BETAFLIGHTF4/target.h +++ b/src/main/target/BETAFLIGHTF4/target.h @@ -171,7 +171,5 @@ #define MAX_PWM_OUTPUT_PORTS 4 -#define PCA9685_I2C_BUS BUS_I2C2 - #define USE_DSHOT #define USE_ESC_SENSOR diff --git a/src/main/target/COLIBRI_RACE/target.h b/src/main/target/COLIBRI_RACE/target.h index 8347b58cd34..205f68f2e51 100755 --- a/src/main/target/COLIBRI_RACE/target.h +++ b/src/main/target/COLIBRI_RACE/target.h @@ -124,5 +124,4 @@ #define TARGET_IO_PORTD (BIT(2)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) -#define PCA9685_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/F4BY/target.h b/src/main/target/F4BY/target.h index 03fc7c6749f..dff346355ab 100644 --- a/src/main/target/F4BY/target.h +++ b/src/main/target/F4BY/target.h @@ -148,5 +148,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/FALCORE/target.h b/src/main/target/FALCORE/target.h index 094adb76318..fe35c1b85f5 100755 --- a/src/main/target/FALCORE/target.h +++ b/src/main/target/FALCORE/target.h @@ -130,5 +130,4 @@ #define TARGET_IO_PORTD 0xFFFF #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) -#define PCA9685_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/FIREWORKSV2/target.h b/src/main/target/FIREWORKSV2/target.h index ec20e387ec0..faffddf32bc 100644 --- a/src/main/target/FIREWORKSV2/target.h +++ b/src/main/target/FIREWORKSV2/target.h @@ -228,9 +228,7 @@ #define TARGET_IO_PORTD 0xffff #if defined(OMNIBUSF4V6) -#define PCA9685_I2C_BUS BUS_I2C1 #define BNO055_I2C_BUS BUS_I2C1 #else -#define PCA9685_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 #endif diff --git a/src/main/target/FURYF4OSD/target.h b/src/main/target/FURYF4OSD/target.h index 9e8283dfff3..8eeed9c8530 100644 --- a/src/main/target/FURYF4OSD/target.h +++ b/src/main/target/FURYF4OSD/target.h @@ -179,5 +179,3 @@ #define USE_ESC_SENSOR #define MAX_PWM_OUTPUT_PORTS 6 - -#define PCA9685_I2C_BUS DEFAULT_I2C_BUS diff --git a/src/main/target/IFLIGHTF4_TWING/target.h b/src/main/target/IFLIGHTF4_TWING/target.h index 5a3943e11ad..8d52534d361 100644 --- a/src/main/target/IFLIGHTF4_TWING/target.h +++ b/src/main/target/IFLIGHTF4_TWING/target.h @@ -78,7 +78,6 @@ #define USE_RANGEFINDER #define RANGEFINDER_I2C_BUS BUS_I2C1 -#define PCA9685_I2C_BUS BUS_I2C1 #define BNO055_I2C_BUS BUS_I2C1 // *************** OSD ***************************** diff --git a/src/main/target/LUX_RACE/target.h b/src/main/target/LUX_RACE/target.h index 45acda286ac..1eacd65d915 100644 --- a/src/main/target/LUX_RACE/target.h +++ b/src/main/target/LUX_RACE/target.h @@ -106,5 +106,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD (BIT(2)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) - -#define PCA9685_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/MATEKF405/target.h b/src/main/target/MATEKF405/target.h index 4e66c2fb7af..df9bd6087c7 100644 --- a/src/main/target/MATEKF405/target.h +++ b/src/main/target/MATEKF405/target.h @@ -201,5 +201,3 @@ #define USE_ESC_SENSOR #define MAX_PWM_OUTPUT_PORTS 6 - -#define PCA9685_I2C_BUS DEFAULT_I2C_BUS diff --git a/src/main/target/MATEKF405CAN/target.h b/src/main/target/MATEKF405CAN/target.h index 927e8ae3fb7..044781b36f3 100644 --- a/src/main/target/MATEKF405CAN/target.h +++ b/src/main/target/MATEKF405CAN/target.h @@ -73,7 +73,6 @@ #define PITOT_I2C_BUS BUS_I2C2 #define TEMPERATURE_I2C_BUS BUS_I2C2 -#define PCA9685_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 diff --git a/src/main/target/MATEKF405SE/target.h b/src/main/target/MATEKF405SE/target.h index 507279bc47d..17a0be19a4a 100644 --- a/src/main/target/MATEKF405SE/target.h +++ b/src/main/target/MATEKF405SE/target.h @@ -177,5 +177,3 @@ #define TARGET_IO_PORTD (BIT(2)) #define MAX_PWM_OUTPUT_PORTS 9 - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/MATEKF405TE/target.h b/src/main/target/MATEKF405TE/target.h index 96625605b0c..4ceac5ae97d 100644 --- a/src/main/target/MATEKF405TE/target.h +++ b/src/main/target/MATEKF405TE/target.h @@ -107,7 +107,6 @@ #define PITOT_I2C_BUS BUS_I2C1 #define TEMPERATURE_I2C_BUS BUS_I2C1 #define BNO055_I2C_BUS BUS_I2C1 -#define PCA9685_I2C_BUS BUS_I2C1 // *************** UART ***************************** #define USE_VCP diff --git a/src/main/target/MOTOLAB/target.h b/src/main/target/MOTOLAB/target.h index 81d44eb6a20..f2e2289a2c4 100644 --- a/src/main/target/MOTOLAB/target.h +++ b/src/main/target/MOTOLAB/target.h @@ -120,5 +120,4 @@ // !!TODO - check the following line is correct #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(3)|BIT(4)) -#define PCA9685_I2C_BUS BUS_I2C2 #define BNO055_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/OMNIBUSF4/target.h b/src/main/target/OMNIBUSF4/target.h index 96c0de62446..4bb37521a17 100644 --- a/src/main/target/OMNIBUSF4/target.h +++ b/src/main/target/OMNIBUSF4/target.h @@ -281,5 +281,3 @@ #ifdef OMNIBUSF4PRO #define CURRENT_METER_SCALE 265 #endif - -#define PCA9685_I2C_BUS I2C_EXT_BUS diff --git a/src/main/target/OMNIBUSF7/target.h b/src/main/target/OMNIBUSF7/target.h index 65f1fb364d0..ab2f85c9c6c 100644 --- a/src/main/target/OMNIBUSF7/target.h +++ b/src/main/target/OMNIBUSF7/target.h @@ -196,5 +196,3 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/RCEXPLORERF3/target.h b/src/main/target/RCEXPLORERF3/target.h index 18e67194355..04dc53bbfe0 100644 --- a/src/main/target/RCEXPLORERF3/target.h +++ b/src/main/target/RCEXPLORERF3/target.h @@ -110,5 +110,3 @@ #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/REVO/target.h b/src/main/target/REVO/target.h index 4f4befce660..35ae7367b9d 100644 --- a/src/main/target/REVO/target.h +++ b/src/main/target/REVO/target.h @@ -144,5 +144,3 @@ #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/SKYSTARSF405HD/target.h b/src/main/target/SKYSTARSF405HD/target.h index 544a001487a..ec83125d5fa 100644 --- a/src/main/target/SKYSTARSF405HD/target.h +++ b/src/main/target/SKYSTARSF405HD/target.h @@ -135,7 +135,6 @@ #define RANGEFINDER_I2C_BUS DEFAULT_I2C_BUS #define PITOT_I2C_BUS DEFAULT_I2C_BUS -#define PCA9685_I2C_BUS DEFAULT_I2C_BUS // *************** ADC ***************************** #define USE_ADC diff --git a/src/main/target/SPARKY/target.h b/src/main/target/SPARKY/target.h index f119da56b1c..166ba737f28 100644 --- a/src/main/target/SPARKY/target.h +++ b/src/main/target/SPARKY/target.h @@ -105,5 +105,3 @@ #define TARGET_IO_PORTA (BIT(1)|BIT(2)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(10)|BIT(11)|BIT(12)|BIT(13)|BIT(14)|BIT(15)) #define TARGET_IO_PORTB (BIT(0)|BIT(1)|BIT(6)|BIT(10)|BIT(11)|BIT(14)|BIT(15)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(12)|BIT(13)) #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4)) - -#define PCA9685_I2C_BUS BUS_I2C2 \ No newline at end of file diff --git a/src/main/target/SPARKY2/target.h b/src/main/target/SPARKY2/target.h index d5b291b323f..c5526d4afd4 100644 --- a/src/main/target/SPARKY2/target.h +++ b/src/main/target/SPARKY2/target.h @@ -133,5 +133,3 @@ #define TARGET_IO_PORTA 0xffff #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC 0xffff - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/YUPIF4/target.h b/src/main/target/YUPIF4/target.h index 69c5bc3ab1c..b514a1fa3ef 100644 --- a/src/main/target/YUPIF4/target.h +++ b/src/main/target/YUPIF4/target.h @@ -156,5 +156,3 @@ #define TARGET_IO_PORTB 0xffff #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD (BIT(2)) - -#define PCA9685_I2C_BUS BUS_I2C2 diff --git a/src/main/target/common.h b/src/main/target/common.h index 874cdc3a8ec..b299e3f3b1f 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -220,8 +220,6 @@ #define USE_VTX_FFPV #define USE_PITOT_VIRTUAL -#define USE_PWM_DRIVER_PCA9685 -#define USE_PWM_SERVO_DRIVER #define USE_SERIALRX_SUMD #define USE_SERIALRX_SUMH diff --git a/src/main/target/common_hardware.c b/src/main/target/common_hardware.c index 7ff1444177f..0ebbb91df5e 100755 --- a/src/main/target/common_hardware.c +++ b/src/main/target/common_hardware.c @@ -388,15 +388,6 @@ BUSDEV_REGISTER_I2C(busdev_ug2864, DEVHW_UG2864, UG2864_I2C_BUS, 0x3C, NONE, DEVFLAGS_NONE, 0); #endif -#if defined(USE_PWM_SERVO_DRIVER) - #if defined(USE_PWM_DRIVER_PCA9685) && defined(USE_I2C) - #if !defined(PCA9685_I2C_BUS) - #define PCA9685_I2C_BUS BUS_I2C1 - #endif - BUSDEV_REGISTER_I2C(busdev_pca9685, DEVHW_PCA9685, PCA9685_I2C_BUS, 0x40, NONE, DEVFLAGS_NONE, 0); - #endif -#endif - #if defined(USE_IRLOCK) && defined(USE_I2C) #if !defined(IRLOCK_I2C_BUS) && defined(EXTERNAL_I2C_BUS) #define IRLOCK_I2C_BUS EXTERNAL_I2C_BUS From fcc50476fc35ede25751c612900468eeecc297fa Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Thu, 12 May 2022 19:59:38 +0200 Subject: [PATCH 2/2] Docs update --- docs/Settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Settings.md b/docs/Settings.md index 96b9633c84f..4338aeb54a3 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -5374,7 +5374,7 @@ Selects the servo PWM output cutoff frequency. Value is in [Hz] ### servo_protocol -An option to chose the protocol/option that would be used to output servo data. Possible options `PWM` (FC servo outputs), `SERVO_DRIVER` (I2C PCA9685 peripheral), `SBUS` (S.Bus protocol output via a configured serial port) +An option to chose the protocol/option that would be used to output servo data. Possible options `PWM` (FC servo outputs), `SBUS` (S.Bus protocol output via a configured serial port) | Default | Min | Max | | --- | --- | --- |