Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
esc32.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) Murat Bronz <murat.bronz@enac.fr>
3
*
4
* This file is part of paparazzi
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, see
18
* <http://www.gnu.org/licenses/>.
19
*/
26
#ifndef ESC32_H
27
#define ESC32_H
28
29
#include "
std.h
"
30
31
extern
void
esc32_init
(
void
);
32
extern
void
esc32_periodic
(
void
);
33
extern
void
esc32_event
(
void
);
34
35
struct
esc32_parameter
{
36
float
amps
;
37
float
volts_bat
;
38
float
volts_motor
;
39
float
rpm
;
40
float
duty
;
41
};
42
43
struct
esc32
{
44
struct
esc32_parameter
params
;
45
float
energy
;
46
float
power
;
47
bool
data_available
;
48
};
49
50
extern
struct
esc32
esc32
;
51
52
enum
binaryCommands
{
53
BINARY_COMMAND_NOP
= 0,
54
BINARY_COMMAND_ARM
,
55
BINARY_COMMAND_CLI
,
56
BINARY_COMMAND_CONFIG
,
57
BINARY_COMMAND_DISARM
,
58
BINARY_COMMAND_DUTY
,
59
BINARY_COMMAND_PWM
,
60
BINARY_COMMAND_RPM
,
61
BINARY_COMMAND_SET
,
62
BINARY_COMMAND_START
,
63
BINARY_COMMAND_STATUS
,
64
BINARY_COMMAND_STOP
,
65
BINARY_COMMAND_TELEM_RATE
,
66
BINARY_COMMAND_VERSION
,
67
BINARY_COMMAND_TELEM_VALUE
,
68
BINARY_COMMAND_GET_PARAM_ID
,
69
BINARY_COMMAND_ACK
= 250,
70
BINARY_COMMAND_NACK
71
};
72
73
enum
binaryValues
{
74
BINARY_VALUE_NONE
= 0,
75
BINARY_VALUE_AMPS
,
76
BINARY_VALUE_VOLTS_BAT
,
77
BINARY_VALUE_VOLTS_MOTOR
,
78
BINARY_VALUE_RPM
,
79
BINARY_VALUE_DUTY
,
80
BINARY_VALUE_COMM_PERIOD
,
81
BINARY_VALUE_BAD_DETECTS
,
82
BINARY_VALUE_ADC_WINDOW
,
83
BINARY_VALUE_IDLE_PERCENT
,
84
BINARY_VALUE_STATE
,
85
BINARY_VALUE_AVGA
,
86
BINARY_VALUE_AVGB
,
87
BINARY_VALUE_AVGC
,
88
BINARY_VALUE_AVGCOMP
,
89
BINARY_VALUE_FETSTEP
,
90
BINARY_VALUE_NUM
91
};
92
93
enum
configParameters
{
94
CONFIG_VERSION
= 0,
95
STARTUP_MODE
,
96
BAUD_RATE
,
97
PTERM
,
98
ITERM
,
99
FF1TERM
,
100
FF2TERM
,
101
CL1TERM
,
102
CL2TERM
,
103
CL3TERM
,
104
CL4TERM
,
105
CL5TERM
,
106
SHUNT_RESISTANCE
,
107
MIN_PERIOD
,
108
MAX_PERIOD
,
109
BLANKING_MICROS
,
110
ADVANCE
,
111
START_VOLTAGE
,
112
GOOD_DETECTS_START
,
113
BAD_DETECTS_DISARM
,
114
MAX_CURRENT
,
115
SWITCH_FREQ
,
116
MOTOR_POLES
,
117
PWM_MIN_PERIOD
,
118
PWM_MAX_PERIOD
,
119
PWM_MIN_VALUE
,
120
PWM_LO_VALUE
,
121
PWM_HI_VALUE
,
122
PWM_MAX_VALUE
,
123
PWM_MIN_START
,
124
PWM_RPM_SCALE
,
125
FET_BRAKING
,
126
PNFAC
,
127
INFAC
,
128
THR1TERM
,
129
THR2TERM
,
130
START_ALIGN_TIME
,
131
START_ALIGN_VOLTAGE
,
132
START_STEPS_NUM
,
133
START_STEPS_PERIOD
,
134
START_STEPS_ACCEL
,
135
PWM_LOWPASS
,
136
RPM_MEAS_LP
,
137
SERVO_DUTY
,
138
SERVO_P
,
139
SERVO_D
,
140
SERVO_MAX_RATE
,
141
SERVO_SCALE
,
142
ESC_ID
,
143
DIRECTION
,
144
CONFIG_NUM_PARAMS
145
};
146
147
#endif
148
BINARY_COMMAND_VERSION
@ BINARY_COMMAND_VERSION
Definition:
esc32.h:66
SWITCH_FREQ
@ SWITCH_FREQ
Definition:
esc32.h:115
START_ALIGN_VOLTAGE
@ START_ALIGN_VOLTAGE
Definition:
esc32.h:131
MAX_PERIOD
@ MAX_PERIOD
Definition:
esc32.h:108
BINARY_COMMAND_STOP
@ BINARY_COMMAND_STOP
Definition:
esc32.h:64
PWM_HI_VALUE
@ PWM_HI_VALUE
Definition:
esc32.h:121
GOOD_DETECTS_START
@ GOOD_DETECTS_START
Definition:
esc32.h:112
BINARY_VALUE_COMM_PERIOD
@ BINARY_VALUE_COMM_PERIOD
Definition:
esc32.h:80
BINARY_VALUE_RPM
@ BINARY_VALUE_RPM
Definition:
esc32.h:78
CL4TERM
@ CL4TERM
Definition:
esc32.h:104
BINARY_VALUE_AVGC
@ BINARY_VALUE_AVGC
Definition:
esc32.h:87
START_STEPS_ACCEL
@ START_STEPS_ACCEL
Definition:
esc32.h:134
PWM_MIN_START
@ PWM_MIN_START
Definition:
esc32.h:123
START_ALIGN_TIME
@ START_ALIGN_TIME
Definition:
esc32.h:130
CL3TERM
@ CL3TERM
Definition:
esc32.h:103
SERVO_D
@ SERVO_D
Definition:
esc32.h:139
binaryCommands
binaryCommands
Definition:
esc32.h:52
CONFIG_NUM_PARAMS
@ CONFIG_NUM_PARAMS
Definition:
esc32.h:144
BINARY_VALUE_VOLTS_BAT
@ BINARY_VALUE_VOLTS_BAT
Definition:
esc32.h:76
SERVO_SCALE
@ SERVO_SCALE
Definition:
esc32.h:141
esc32_parameter::volts_motor
float volts_motor
motor voltage (bat voltage * throttle in % in fact)
Definition:
esc32.h:38
esc32
Definition:
esc32.h:43
esc32::data_available
bool data_available
data updated
Definition:
esc32.h:47
FF1TERM
@ FF1TERM
Definition:
esc32.h:99
esc32_parameter::amps
float amps
current consumption
Definition:
esc32.h:36
DIRECTION
@ DIRECTION
Definition:
esc32.h:143
ADVANCE
@ ADVANCE
Definition:
esc32.h:110
BINARY_COMMAND_CONFIG
@ BINARY_COMMAND_CONFIG
Definition:
esc32.h:56
BINARY_VALUE_ADC_WINDOW
@ BINARY_VALUE_ADC_WINDOW
Definition:
esc32.h:82
CL1TERM
@ CL1TERM
Definition:
esc32.h:101
PNFAC
@ PNFAC
Definition:
esc32.h:126
START_STEPS_PERIOD
@ START_STEPS_PERIOD
Definition:
esc32.h:133
PWM_LO_VALUE
@ PWM_LO_VALUE
Definition:
esc32.h:120
INFAC
@ INFAC
Definition:
esc32.h:127
BINARY_COMMAND_DUTY
@ BINARY_COMMAND_DUTY
Definition:
esc32.h:58
STARTUP_MODE
@ STARTUP_MODE
Definition:
esc32.h:95
BINARY_VALUE_AVGA
@ BINARY_VALUE_AVGA
Definition:
esc32.h:85
ITERM
@ ITERM
Definition:
esc32.h:98
PWM_MIN_VALUE
@ PWM_MIN_VALUE
Definition:
esc32.h:119
BINARY_COMMAND_SET
@ BINARY_COMMAND_SET
Definition:
esc32.h:61
configParameters
configParameters
Definition:
esc32.h:93
BINARY_COMMAND_CLI
@ BINARY_COMMAND_CLI
Definition:
esc32.h:55
BLANKING_MICROS
@ BLANKING_MICROS
Definition:
esc32.h:109
std.h
esc32::power
float power
computed battery power
Definition:
esc32.h:46
BINARY_VALUE_AVGCOMP
@ BINARY_VALUE_AVGCOMP
Definition:
esc32.h:88
PWM_RPM_SCALE
@ PWM_RPM_SCALE
Definition:
esc32.h:124
BINARY_VALUE_IDLE_PERCENT
@ BINARY_VALUE_IDLE_PERCENT
Definition:
esc32.h:83
BINARY_COMMAND_NACK
@ BINARY_COMMAND_NACK
Definition:
esc32.h:70
BINARY_COMMAND_ACK
@ BINARY_COMMAND_ACK
Definition:
esc32.h:69
BINARY_COMMAND_GET_PARAM_ID
@ BINARY_COMMAND_GET_PARAM_ID
Definition:
esc32.h:68
SERVO_P
@ SERVO_P
Definition:
esc32.h:138
PWM_MAX_VALUE
@ PWM_MAX_VALUE
Definition:
esc32.h:122
START_VOLTAGE
@ START_VOLTAGE
Definition:
esc32.h:111
BINARY_COMMAND_NOP
@ BINARY_COMMAND_NOP
Definition:
esc32.h:53
esc32_parameter
Definition:
esc32.h:35
SERVO_MAX_RATE
@ SERVO_MAX_RATE
Definition:
esc32.h:140
BINARY_VALUE_VOLTS_MOTOR
@ BINARY_VALUE_VOLTS_MOTOR
Definition:
esc32.h:77
esc32_parameter::duty
float duty
motor duty cycle (more or less throttle in %)
Definition:
esc32.h:40
MIN_PERIOD
@ MIN_PERIOD
Definition:
esc32.h:107
FF2TERM
@ FF2TERM
Definition:
esc32.h:100
START_STEPS_NUM
@ START_STEPS_NUM
Definition:
esc32.h:132
MOTOR_POLES
@ MOTOR_POLES
Definition:
esc32.h:116
BAUD_RATE
@ BAUD_RATE
Definition:
esc32.h:96
BINARY_VALUE_NONE
@ BINARY_VALUE_NONE
Definition:
esc32.h:74
binaryValues
binaryValues
Definition:
esc32.h:73
FET_BRAKING
@ FET_BRAKING
Definition:
esc32.h:125
BINARY_VALUE_FETSTEP
@ BINARY_VALUE_FETSTEP
Definition:
esc32.h:89
PWM_LOWPASS
@ PWM_LOWPASS
Definition:
esc32.h:135
PWM_MIN_PERIOD
@ PWM_MIN_PERIOD
Definition:
esc32.h:117
BINARY_VALUE_AMPS
@ BINARY_VALUE_AMPS
Definition:
esc32.h:75
BINARY_VALUE_STATE
@ BINARY_VALUE_STATE
Definition:
esc32.h:84
SERVO_DUTY
@ SERVO_DUTY
Definition:
esc32.h:137
BINARY_COMMAND_TELEM_RATE
@ BINARY_COMMAND_TELEM_RATE
Definition:
esc32.h:65
ESC_ID
@ ESC_ID
Definition:
esc32.h:142
esc32_parameter::volts_bat
float volts_bat
input battery voltage
Definition:
esc32.h:37
BINARY_VALUE_NUM
@ BINARY_VALUE_NUM
Definition:
esc32.h:90
BINARY_COMMAND_STATUS
@ BINARY_COMMAND_STATUS
Definition:
esc32.h:63
BAD_DETECTS_DISARM
@ BAD_DETECTS_DISARM
Definition:
esc32.h:113
BINARY_COMMAND_START
@ BINARY_COMMAND_START
Definition:
esc32.h:62
BINARY_COMMAND_ARM
@ BINARY_COMMAND_ARM
Definition:
esc32.h:54
RPM_MEAS_LP
@ RPM_MEAS_LP
Definition:
esc32.h:136
BINARY_VALUE_BAD_DETECTS
@ BINARY_VALUE_BAD_DETECTS
Definition:
esc32.h:81
PTERM
@ PTERM
Definition:
esc32.h:97
esc32_init
void esc32_init(void)
Definition:
esc32.c:235
BINARY_COMMAND_TELEM_VALUE
@ BINARY_COMMAND_TELEM_VALUE
Definition:
esc32.h:67
CONFIG_VERSION
@ CONFIG_VERSION
Definition:
esc32.h:94
esc32_event
void esc32_event(void)
Definition:
esc32.c:345
esc32::params
struct esc32_parameter params
filtered data from the esc
Definition:
esc32.h:44
esc32_parameter::rpm
float rpm
motor rotation speed
Definition:
esc32.h:39
MAX_CURRENT
@ MAX_CURRENT
Definition:
esc32.h:114
esc32::energy
float energy
accumulated energy
Definition:
esc32.h:45
SHUNT_RESISTANCE
@ SHUNT_RESISTANCE
Definition:
esc32.h:106
BINARY_VALUE_DUTY
@ BINARY_VALUE_DUTY
Definition:
esc32.h:79
CL5TERM
@ CL5TERM
Definition:
esc32.h:105
BINARY_COMMAND_RPM
@ BINARY_COMMAND_RPM
Definition:
esc32.h:60
PWM_MAX_PERIOD
@ PWM_MAX_PERIOD
Definition:
esc32.h:118
BINARY_COMMAND_DISARM
@ BINARY_COMMAND_DISARM
Definition:
esc32.h:57
BINARY_COMMAND_PWM
@ BINARY_COMMAND_PWM
Definition:
esc32.h:59
CL2TERM
@ CL2TERM
Definition:
esc32.h:102
esc32_periodic
void esc32_periodic(void)
Definition:
esc32.c:255
THR2TERM
@ THR2TERM
Definition:
esc32.h:129
THR1TERM
@ THR1TERM
Definition:
esc32.h:128
BINARY_VALUE_AVGB
@ BINARY_VALUE_AVGB
Definition:
esc32.h:86
sw
airborne
modules
esc32
esc32.h
Generated on Tue Feb 1 2022 13:51:15 for Paparazzi UAS by
1.8.17