71 #define DISCO_BLDC_STATUS_STOPPED 1
72 #define DISCO_BLDC_STATUS_RAMPUP 2
73 #define DISCO_BLDC_STATUS_RUNNING 4
74 #define DISCO_BLDC_STATUS_RAMPDOWN 5
79 #define DISCO_BLDC_START_MOTOR_THRESHOLD 1100
119 #pragma GCC diagnostic push
120 #pragma GCC diagnostic ignored "-Wcast-qual"
122 #pragma GCC diagnostic pop
164 #pragma GCC diagnostic push
165 #pragma GCC diagnostic ignored "-Wcast-qual"
167 #pragma GCC diagnostic pop
178 for (
int i = 0; i < size; i++) {
179 checksum = checksum ^ bytes[i];
struct disco_bldc_obs obs_data
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
struct i2c_transaction i2c_trans
I2C transaction for communicating with the Disco BLDC driver.
#define ACTUATORS_DISCO_CLEAR_ERROR
Clear all current erros.
Main include for ABI (AirBorneInterface).
void actuators_disco_set(uint8_t idx, uint16_t val)
#define DISCO_BLDC_START_MOTOR_THRESHOLD
#define ACTUATORS_DISCO_MOTOR_IDX
Index for motor BLDC.
float vsupply
supply voltage in V
void actuators_disco_commit(void)
bool rpm_saturated
RPM saturation flag (bit 15 in obs data)
private observation structure
bool i2c_blocking_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction and wait for it to complete.
Hardware independent API for actuators (servos, motor controllers).
struct ActuatorsDisco actuators_disco
transaction set to done by user level
Interface for electrical status: supply voltage, current, battery status, etc.
#define ACTUATORS_DISCO_GET_OBS_DATA
Get observation data.
#define ACTUATORS_DISCO_STOP_PROP
Stop the propellers.
void autopilot_set_kill_throttle(bool kill)
set kill throttle
uint16_t motor_rpm
Motor RPM setpoint.
#define DISCO_BLDC_STATUS_RAMPUP
#define ACTUATORS_DISCO_SET_REF_SPEED
Set reference speed.
enum I2CTransactionStatus status
Transaction status.
static uint8_t disco_channels[]
Internal mapping of the PWM with output index servo rail 1 <-> linux pwm_4 servo rail 2 <-> linux pwm...
#define ACTUATORS_DISCO_START_PROP
Start the propellers.
static uint8_t actuators_disco_checksum(uint8_t *bytes, uint8_t size)
#define DISCO_BLDC_STATUS_STOPPED
Core autopilot interface common to all firmwares.
uint8_t slave_addr
Slave address.
void actuators_disco_init(void)
int pwm_sysfs_init(struct PWM_Sysfs *pwm, char *base_path, char *_export, char *_enable, char *_duty, char *_period, uint8_t channel)
struct Electrical electrical
#define ACTUATORS_DISCO_PWM_NB
Max number of PWM channels.
uint16_t rpm_obs
Measured RPM.
#define DISCO_BLDC_STATUS_RUNNING
void pwm_sysfs_set_duty(struct PWM_Sysfs *pwm, uint32_t duty)
bool i2c_blocking_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction and wait for it to complete.
#define ACTUATORS_DISCO_ADDR
struct PWM_Sysfs pwm[ACTUATORS_DISCO_PWM_NB]
Array of PWM outputs.
Actuator driver for the disco.