How PPM Works
https://electronicscoach.com/pulse-position-modulation.html
RC Sender Interface
A generic interface for sending RC (Radio Control) signal
/* Set the value of a specific channel (0.0-1.0). Returns 1 if success, 0 if failed. */ virtual uint8_t setChannelValue(uint8_t channel, float value) = 0; /* Initialize the RC output. */ virtual void init() = 0; /* A callback that gets called after each RC value is sent. */ virtual void interrupt_callback(TIM_HandleTypeDef* timer) = 0;
PPM Output Driver
The driver for outputting PPM. Implements the RC sender interface.
/* Constructor */ PPMChannelOut(TIM_HandleTypeDef* timer, uint16_t timer_channel, uint8_t num_channels); /* Implementation of the RcSender Interface. See LOS_D_RcSender.hpp */ uint8_t setChannelValue(uint8_t channel, float value); /* Implementation of the RcSender Interface. See LOS_D_RcSender.hpp * After initialization, we will be constantly sending PPM signals. */ void init(); /* Implementation of the RcSender Interface. See LOS_D_RcSender.hpp */ void interrupt_callback(TIM_HandleTypeDef* timer); /* Set the number of channels. Returns 1 if success, 0 if failed. */ uint8_t setNumChannels(uint8_t num_channels);
0 Comments