|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
25 #ifndef LINK_MCU_SPI_DEV
26 #define LINK_MCU_SPI_DEV spi1
38 #define PAYLOAD_LENGTH sizeof(link_mcu_from_fbw_msg.payload)
39 #define LINK_MCU_FRAME_LENGTH sizeof(struct link_mcu_msg)
41 #define ComputeChecksum(_buf) { \
44 for(i = 0; i < PAYLOAD_LENGTH; i++) { \
45 uint8_t _byte = ((uint8_t*)&_buf)[i]; \
46 crc = CrcUpdate(crc, _byte); \
65 void link_mcu_restart(
void)
103 #ifndef LINK_MCU_SLAVE_IDX
104 #define LINK_MCU_SLAVE_IDX SPI_SLAVE0
110 #if PERIODIC_TELEMETRY
113 static void send_debug_link(
struct transport_tx *trans,
struct link_device *
dev)
116 pprz_msg_send_DEBUG_MCU_LINK(trans,
dev, AC_ID,
117 &link_mcu_nb_err, &link_mcu_fbw_nb_err, &mcu1_ppm_cpt_foo);
135 #if PERIODIC_TELEMETRY
enum SPIClockPolarity cpol
clock polarity control
struct link_mcu_msg link_mcu_from_ap_msg
struct spi_transaction link_mcu_trans
uint16_t output_length
number of data words to write
volatile bool inter_mcu_received_ap
SPI transaction structure.
struct fbw_state * fbw_state
bool spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
Register one (and only one) transaction to use spi as slave.
#define ComputeChecksum(_buf)
@ SPISelectUnselect
slave is selected before transaction and unselected after
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
@ SPICpolIdleLow
CPOL = 0.
void link_mcu_event_task(void)
enum SPIClockPhase cpha
clock phase control
#define LINK_MCU_FRAME_LENGTH
bool spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit SPI transaction.
volatile bool inter_mcu_received_fbw
static const struct usb_device_descriptor dev
struct link_mcu_msg link_mcu_from_fbw_msg
bool spi_slave_wait(struct spi_periph *p)
Initialized and wait for the next transaction.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
uint16_t input_length
number of data words to read
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
volatile uint8_t * input_buf
pointer to receive buffer for DMA
enum SPITransactionStatus status
#define DefaultPeriodic
Set default periodic telemetry.