Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freek van Tienen <freek.v.tienen@gmail.com>
3  * Copyright (C) 2017 Gautier Hattenberger <gautier.hattenberger@enac.fr>
4  *
5  * This file is part of paparazzi.
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
30 #ifndef ACTUATORS_DISCO_H_
31 #define ACTUATORS_DISCO_H_
32 
33 #include "std.h"
34 #include "mcu_periph/i2c.h"
35 #include "mcu_periph/pwm_sysfs.h"
36 
37 // full 8-bit address
38 #define ACTUATORS_DISCO_ADDR 0x10
39 
40 // I2C Commands
41 #define ACTUATORS_DISCO_SET_REF_SPEED 0x02
42 #define ACTUATORS_DISCO_GET_OBS_DATA 0x20
43 #define ACTUATORS_DISCO_START_PROP 0x40
44 #define ACTUATORS_DISCO_TOGGLE_GPIO 0x4D
45 #define ACTUATORS_DISCO_STOP_PROP 0x60
46 #define ACTUATORS_DISCO_CLEAR_ERROR 0x80
47 #define ACTUATORS_DISCO_PLAY_SOUND 0x82
48 #define ACTUATORS_DISCO_GET_INFO 0xA0
49 
50 // PWM setup
51 #define ACTUATORS_DISCO_PWM_NB 6
52 #define ACTUATORS_DISCO_MOTOR_IDX 0
53 
61 };
62 
63 #define ActuatorsDiscoSet(_i, _v) actuators_disco_set(_i, _v)
64 #define ActuatorsDiscoCommit() actuators_disco_commit()
65 #define ActuatorsDiscoInit() actuators_disco_init()
66 
67 extern struct ActuatorsDisco actuators_disco;
69 extern void actuators_disco_commit(void);
70 extern void actuators_disco_init(void);
71 
72 #endif /* ACTUATORS_DISCO_H_ */
unsigned short uint16_t
Definition: types.h:16
static uint32_t idx
void actuators_disco_init(void)
Definition: actuators.c:84
struct i2c_transaction i2c_trans
I2C transaction for communicating with the Disco BLDC driver.
Definition: actuators.h:55
PWM servos handling using Linux sysfs.
uint8_t status
Status flag.
Definition: actuators.h:59
bool rpm_saturated
RPM saturation flag (bit 15 in obs data)
Definition: actuators.h:60
void actuators_disco_commit(void)
Definition: actuators.c:108
uint16_t val[TCOUPLE_NB]
uint16_t motor_rpm
Motor RPM setpoint.
Definition: actuators.h:56
struct ActuatorsDisco actuators_disco
Definition: actuators.c:81
I2C transaction structure.
Definition: i2c.h:93
PWM structure.
Definition: pwm_sysfs.h:36
unsigned char uint8_t
Definition: types.h:14
#define ACTUATORS_DISCO_PWM_NB
Max number of PWM channels.
Definition: actuators.h:51
uint16_t rpm_obs
Measured RPM.
Definition: actuators.h:57
void actuators_disco_set(uint8_t idx, uint16_t val)
Definition: actuators.c:96
struct PWM_Sysfs pwm[ACTUATORS_DISCO_PWM_NB]
Array of PWM outputs.
Definition: actuators.h:58
Architecture independent I2C (Inter-Integrated Circuit Bus) API.