ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
motors.h File Reference

PWM for 4 brushed coreless motors (8520, 1S) - PREPARED, unused in phase 1. More...

#include <stdint.h>
Include dependency graph for motors.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MOTORS_ENABLE   0
 1 only with the power stage connected
 
#define MOTORS_PWM_TOP   1999u
 

Functions

void motors_init (void)
 
void motors_arm (uint8_t armed)
 disarmed: duty forced to 0

 
void motors_set (const float duty[4])
 0..1, saturated

 
void motors_test (uint8_t motor, float duty)
 MOTOR_TEST (props off, disarmed): motor 1..4 at duty, the others off; motor 0 = all off.
 

Detailed Description

PWM for 4 brushed coreless motors (8520, 1S) - PREPARED, unused in phase 1.

TIM1 CH1..CH4, 64 MHz timer clock, ARR = 1999 -> 32 kHz, 2000 levels. The WB55 pins can NOT drive the motors: a power stage is required (low-side logic-level N-MOSFET + freewheeling diode per motor), see 03 - Docs/firmware/architecture.md. Check in CubeMX that the TIM1 pins do not clash with those used by the IKS4A1 on the Arduino connector.

Definition in file motors.h.

Macro Definition Documentation

◆ MOTORS_ENABLE

#define MOTORS_ENABLE   0

1 only with the power stage connected

Definition at line 16 of file motors.h.

◆ MOTORS_PWM_TOP

#define MOTORS_PWM_TOP   1999u

Definition at line 17 of file motors.h.

Function Documentation

◆ motors_init()

void motors_init ( void  )

Definition at line 13 of file motors.c.

References s_armed.

Referenced by app_start().

Here is the caller graph for this function:

◆ motors_arm()

void motors_arm ( uint8_t  armed)

disarmed: duty forced to 0

Definition at line 24 of file motors.c.

References motors_set(), and s_armed.

Referenced by app_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ motors_set()

void motors_set ( const float  duty[4])

0..1, saturated

Definition at line 30 of file motors.c.

References MOTORS_PWM_TOP, and s_armed.

Referenced by motors_arm().

Here is the caller graph for this function:

◆ motors_test()

void motors_test ( uint8_t  motor,
float  duty 
)

MOTOR_TEST (props off, disarmed): motor 1..4 at duty, the others off; motor 0 = all off.

Does nothing with MOTORS_ENABLE = 0.

Definition at line 44 of file motors.c.

References MOTORS_PWM_TOP, and s_armed.

Referenced by motor_test_hook().

Here is the caller graph for this function: