31 #define PERIODIC_C_MAIN
33 #pragma GCC diagnostic push
34 #pragma GCC diagnostic ignored "-Wunused-parameter"
35 #include "generated/periodic_telemetry.h"
36 #pragma GCC diagnostic pop
38 #include "generated/airframe.h"
39 #include "generated/settings.h"
40 #include "generated/modules.h"
80 for (i = 0; i < ACTUATORS_NB; i++) {
101 modules_periodic_task();
108 modules_event_task();
112 #define IdOfMsg(x) (x[1])
114 void dl_parse_msg(
struct link_device *
dev __attribute__((unused)),
struct transport_tx *trans __attribute__((unused)),
uint8_t *buf)
117 if (msg_id == DL_SET_ACTUATOR) {
118 uint8_t actuator_no = DL_SET_ACTUATOR_no(buf);
119 uint16_t actuator_value __attribute__((unused)) = DL_SET_ACTUATOR_value(buf);
126 switch (actuator_no) {
128 case 0: ActuatorSet(0, actuator_value);
break;
131 case 1: ActuatorSet(1, actuator_value);
break;
134 case 2: ActuatorSet(2, actuator_value);
break;
137 case 3: ActuatorSet(3, actuator_value);
break;
140 case 4: ActuatorSet(4, actuator_value);
break;
143 case 5: ActuatorSet(5, actuator_value);
break;
146 case 6: ActuatorSet(6, actuator_value);
break;
149 case 7: ActuatorSet(7, actuator_value);
break;
152 case 8: ActuatorSet(8, actuator_value);
break;
162 else if (msg_id == DL_SETTING && DL_SETTING_ac_id(buf) == AC_ID) {
163 uint8_t i = DL_SETTING_index(buf);
164 float val = DL_SETTING_value(buf);
169 ActuatorSet(0, actuators[SERVO_0_IDX]);
172 ActuatorSet(1, actuators[SERVO_1_IDX]);
175 ActuatorSet(2, actuators[SERVO_2_IDX]);
178 ActuatorSet(3, actuators[SERVO_3_IDX]);
181 ActuatorSet(4, actuators[SERVO_4_IDX]);
184 ActuatorSet(5, actuators[SERVO_5_IDX]);
187 ActuatorSet(6, actuators[SERVO_6_IDX]);
190 ActuatorSet(7, actuators[SERVO_7_IDX]);
193 ActuatorSet(8, actuators[SERVO_8_IDX]);
197 }
else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(buf) == AC_ID) {
198 uint8_t i = DL_GET_SETTING_index(buf);
199 float val = settings_get_value(i);
void mcu_init(void)
Microcontroller peripherals initialization.
void pprz_dl_init(void)
Init function.
Handling of messages coming from ground and other A/Cs.
Datalink using PPRZ protocol.
static void main_event(void)
Hardware independent API for actuators (servos, motor controllers).
Architecture independent timing functions.
void pprz_dl_event(void)
Datalink Event.
void dl_parse_msg(struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
Should be called when chars are available in dl_buffer.
static const struct usb_device_descriptor dev
Arch independent mcu ( Micro Controller Unit ) utilities.
static void main_periodic(void)
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
static void main_init(void)
Common code for AP and FBW telemetry.
arch independent LED (Light Emitting Diodes) API
void mcu_event(void)
MCU event functions.
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.