mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-13 03:19:58 +03:00
Increase max number of pwm outputs by 1, if a LED pin is defined
This commit is contained in:
parent
3f52a55540
commit
5a50f95f08
3 changed files with 10 additions and 4 deletions
|
@ -53,8 +53,8 @@ enum {
|
|||
typedef struct {
|
||||
int maxTimMotorCount;
|
||||
int maxTimServoCount;
|
||||
const timerHardware_t * timMotors[MAX_PWM_OUTPUT_PORTS];
|
||||
const timerHardware_t * timServos[MAX_PWM_OUTPUT_PORTS];
|
||||
const timerHardware_t * timMotors[MAX_PWM_OUTPUTS];
|
||||
const timerHardware_t * timServos[MAX_PWM_OUTPUTS];
|
||||
} timMotorServoHardware_t;
|
||||
|
||||
static pwmInitError_e pwmInitError = PWM_INIT_ERROR_NONE;
|
||||
|
|
|
@ -98,7 +98,7 @@ typedef struct {
|
|||
bool requestTelemetry;
|
||||
} pwmOutputMotor_t;
|
||||
|
||||
static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUT_PORTS];
|
||||
static DMA_RAM pwmOutputPort_t pwmOutputPorts[MAX_PWM_OUTPUTS];
|
||||
|
||||
static pwmOutputMotor_t motors[MAX_MOTORS];
|
||||
static motorPwmProtocolTypes_e initMotorProtocol;
|
||||
|
@ -142,7 +142,7 @@ static void pwmOutConfigTimer(pwmOutputPort_t * p, TCH_t * tch, uint32_t hz, uin
|
|||
|
||||
static pwmOutputPort_t *pwmOutAllocatePort(void)
|
||||
{
|
||||
if (allocatedOutputPortCount >= MAX_PWM_OUTPUT_PORTS) {
|
||||
if (allocatedOutputPortCount >= MAX_PWM_OUTPUTS) {
|
||||
LOG_ERROR(PWM, "Attempt to allocate PWM output beyond MAX_PWM_OUTPUT_PORTS");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
#include "drivers/io_types.h"
|
||||
#include "drivers/time.h"
|
||||
|
||||
|
||||
#if defined(WS2811_PIN)
|
||||
#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS + 1)
|
||||
#else
|
||||
#define MAX_PWM_OUTPUTS (MAX_PWM_OUTPUT_PORTS)
|
||||
#endif
|
||||
typedef enum {
|
||||
DSHOT_CMD_SPIN_DIRECTION_NORMAL = 20,
|
||||
DSHOT_CMD_SPIN_DIRECTION_REVERSED = 21,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue