Skip to content

Commit 2a8cf49

Browse files
Merge pull request #4646 from iNavFlight/de_serialshot
Add Matek Serialshot protocol
2 parents 01d26a6 + bf2b97a commit 2a8cf49

File tree

18 files changed

+315
-102
lines changed

18 files changed

+315
-102
lines changed

make/source.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ COMMON_SRC = \
9393
io/beeper.c \
9494
io/lights.c \
9595
io/pwmdriver_i2c.c \
96+
io/esc_serialshot.c \
9697
io/piniobox.c \
9798
io/serial.c \
9899
io/serial_4way.c \

src/main/drivers/pwm_mapping.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,8 @@ pwmIOConfiguration_t *pwmInit(drv_pwm_config_t *init)
205205
continue;
206206
}
207207

208-
if (pwmMotorConfig(timerHardwarePtr, pwmIOConfiguration.motorCount, init->motorPwmRate, init->pwmProtocolType, init->enablePWMOutput)) {
209-
if (init->useFastPwm) {
210-
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_MOTOR | PWM_PF_OUTPUT_PROTOCOL_FASTPWM | PWM_PF_OUTPUT_PROTOCOL_PWM;
211-
} else if (init->pwmProtocolType == PWM_TYPE_BRUSHED) {
212-
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_MOTOR | PWM_PF_MOTOR_MODE_BRUSHED | PWM_PF_OUTPUT_PROTOCOL_PWM;
213-
} else {
214-
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_MOTOR | PWM_PF_OUTPUT_PROTOCOL_PWM ;
215-
}
216-
208+
if (pwmMotorConfig(timerHardwarePtr, pwmIOConfiguration.motorCount, motorConfig()->motorPwmRate, init->enablePWMOutput)) {
209+
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_MOTOR;
217210
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].index = pwmIOConfiguration.motorCount;
218211
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].timerHardware = timerHardwarePtr;
219212

@@ -232,7 +225,7 @@ pwmIOConfiguration_t *pwmInit(drv_pwm_config_t *init)
232225
}
233226

234227
if (pwmServoConfig(timerHardwarePtr, pwmIOConfiguration.servoCount, init->servoPwmRate, init->servoCenterPulse, init->enablePWMOutput)) {
235-
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_SERVO | PWM_PF_OUTPUT_PROTOCOL_PWM;
228+
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].flags = PWM_PF_SERVO;
236229
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].index = pwmIOConfiguration.servoCount;
237230
pwmIOConfiguration.ioConfigurations[pwmIOConfiguration.ioCount].timerHardware = timerHardwarePtr;
238231

src/main/drivers/pwm_mapping.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ typedef struct drv_pwm_config_s {
5757
bool useUART3;
5858
bool useUART6;
5959
bool useVbat;
60-
bool useFastPwm;
6160
bool useSoftSerial;
6261
bool useLEDStrip;
6362
#ifdef USE_RANGEFINDER
@@ -66,18 +65,13 @@ typedef struct drv_pwm_config_s {
6665
bool useServoOutputs;
6766
uint16_t servoPwmRate;
6867
uint16_t servoCenterPulse;
69-
uint8_t pwmProtocolType;
70-
uint16_t motorPwmRate;
7168
rangefinderIOConfig_t rangefinderIOConfig;
7269
} drv_pwm_config_t;
7370

7471
typedef enum {
7572
PWM_PF_NONE = 0,
7673
PWM_PF_MOTOR = (1 << 0),
7774
PWM_PF_SERVO = (1 << 1),
78-
PWM_PF_MOTOR_MODE_BRUSHED = (1 << 2),
79-
PWM_PF_OUTPUT_PROTOCOL_PWM = (1 << 3),
80-
PWM_PF_OUTPUT_PROTOCOL_FASTPWM = (1 << 4),
8175
PWM_PF_PPM = (1 << 5),
8276
PWM_PF_PWM = (1 << 6)
8377
} pwmPortFlags_e;

0 commit comments

Comments
 (0)