Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop PCA9685 support #8032

Merged
merged 2 commits into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| --- | --- | --- |
Expand Down
4 changes: 0 additions & 4 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/main/drivers/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
147 changes: 0 additions & 147 deletions src/main/drivers/io_pca9685.c

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/drivers/io_pca9685.h

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/drivers/lights_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/main/drivers/pwm_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 0 additions & 20 deletions src/main/drivers/pwm_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions src/main/fc/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions src/main/fc/fc_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
10 changes: 3 additions & 7 deletions src/main/fc/fc_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -294,9 +293,6 @@ void taskSyncServoDriver(timeUs_t currentTimeUs)
sbusServoSendUpdate();
#endif

#ifdef USE_PWM_SERVO_DRIVER
pwmDriverSync();
#endif
}

#ifdef USE_OSD
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/main/fc/runtime_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/flight/servos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading