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
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
Generic transmission transport header.
uint16_t output_length
number of data words to write
bool_t spi_slave_wait(struct spi_periph *p)
Initialized and wait for the next transaction.
Periodic telemetry system header (includes downlink utility and generated code).
volatile bool_t inter_mcu_received_ap
volatile bool_t inter_mcu_received_fbw
SPI transaction structure.
struct link_mcu_msg link_mcu_from_ap_msg
struct spi_transaction link_mcu_trans
volatile uint8_t * output_buf
pointer to transmit buffer for DMA
enum SPISlaveSelect select
slave selection behavior
struct fbw_state * fbw_state
void link_mcu_event_task(void)
enum SPIClockPhase cpha
clock phase control
bool_t spi_submit(struct spi_periph *p, struct spi_transaction *t)
Submit a spi transaction.
#define DefaultPeriodic
Set default periodic telemetry.
uint16_t input_length
number of data words to read
static const struct usb_device_descriptor dev
bool_t spi_slave_register(struct spi_periph *p, struct spi_transaction *t)
Register one (and only one) transaction to use spi as slave.
slave is selected before transaction and unselected after
Transport for the communication between FBW and AP via SPI.
#define LINK_MCU_FRAME_LENGTH
struct link_mcu_msg link_mcu_from_fbw_msg
enum SPIDataSizeSelect dss
data transfer word size
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
#define ComputeChecksum(_buf)
volatile uint8_t * input_buf
pointer to receive buffer for DMA
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
enum SPITransactionStatus status