/** * \brief Sends and reads protocol packet data byte on SPI * * \param[in] tx_buf Pointer to send the protocol packet data * \param[in] length The length of the send protocol packet data * \param[out] rx_buf Pointer to store the received SPI character */ void adp_interface_transceive_procotol(uint8_t* tx_buf, uint16_t length, uint8_t* rx_buf) { /* Send SPI start condition */ adp_interface_send_start(); adp_interface_transceive(tx_buf, rx_buf, length); /* Send SPI end condition */ adp_interface_send_stop(); }
/** * \brief Read response on SPI from PC * * return Status * \param[in] rx_buf Pointer to receive the data * \param[in] length The length of the read data * \param[out] rx_buf Pointer to store the received SPI character */ bool adp_interface_read_response(uint8_t* rx_buf, uint16_t length) { bool status; /* Send SPI start condition */ adp_interface_send_start(); status = spi_read_buffer_wait(&edbg_spi, rx_buf, length, 0xFF); /* Send SPI end condition */ adp_interface_send_stop(); return status; }
/** * \brief Read response on SPI from PC * * return Status * \param[in] rx_buf Pointer to receive the data * \param[in] length The length of the read data * \param[out] rx_buf Pointer to store the received SPI character */ enum status_code adp_interface_read_response(uint8_t* rx_buf, uint16_t length) { enum status_code status; /* Send SPI start condition */ adp_interface_send_start(); status = spi_read_packet(EDBG_SPI_MODULE, rx_buf, length); /* Send SPI end condition */ adp_interface_send_stop(); return status; }