Skip to content

Commit 07fd7d7

Browse files
committed
Remove unused SPI test code
1 parent 06249e6 commit 07fd7d7

File tree

1 file changed

+1
-56
lines changed

1 file changed

+1
-56
lines changed

main.c

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,6 +1394,7 @@ void update_log_message_esc(TELEMETRY_DATA * esc_telemetry, LOG_ESC * log_messag
13941394
#define FW5_PACKET_LENGTH 73
13951395
void process_packet_vesc(unsigned char *data, unsigned int len) {
13961396
// Additionally comparing with FW5_PACKET_LENGTH to safeguard against non-esc communication
1397+
// IE. Smart BMS that use COMM_GET_VALUES to relay BMS data instead of ESC
13971398
if (data[0] == COMM_GET_VALUES && len == FW5_PACKET_LENGTH){
13981399
int32_t index = 1;
13991400
esc_telemetry.temp_mos = buffer_get_float16(data,10.0,&index);
@@ -2541,62 +2542,6 @@ void play_game(){
25412542
#endif
25422543

25432544

2544-
#define SPI_INSTANCE 2 /**< SPI instance index. */
2545-
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */
2546-
static volatile bool spi_xfer_done; /**< Flag used to indicate that SPI instance completed the transfer. */
2547-
2548-
#define TEST_STRING "Nordic"
2549-
static uint8_t m_tx_buf[] = TEST_STRING; /**< TX buffer. */
2550-
static uint8_t m_rx_buf[sizeof(TEST_STRING) + 1]; /**< RX buffer. */
2551-
static const uint8_t m_length = sizeof(m_tx_buf); /**< Transfer length. */
2552-
2553-
/**
2554-
* @brief SPI user event handler.
2555-
* @param event
2556-
*/
2557-
void spi_event_handler(nrf_drv_spi_evt_t const * p_event,
2558-
void * p_context)
2559-
{
2560-
spi_xfer_done = true;
2561-
NRF_LOG_INFO("Transfer completed.");
2562-
if (m_rx_buf[0] != 0)
2563-
{
2564-
NRF_LOG_INFO(" Received:");
2565-
NRF_LOG_HEXDUMP_INFO(m_rx_buf, strlen((const char *)m_rx_buf));
2566-
}
2567-
}
2568-
2569-
//TODO: remove SPI if not in use
2570-
void spi_init(void)
2571-
{
2572-
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
2573-
spi_config.ss_pin = 31;
2574-
spi_config.miso_pin = 30;
2575-
spi_config.mosi_pin = 29;
2576-
spi_config.sck_pin = 28;
2577-
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));
2578-
2579-
NRF_LOG_INFO("SPI example started.");
2580-
while (0)
2581-
{
2582-
// Reset rx buffer and transfer done flag
2583-
memset(m_rx_buf, 0, m_length);
2584-
spi_xfer_done = false;
2585-
2586-
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, m_tx_buf, m_length, m_rx_buf, m_length));
2587-
2588-
while (!spi_xfer_done)
2589-
{
2590-
__WFE();
2591-
}
2592-
2593-
NRF_LOG_FLUSH();
2594-
2595-
bsp_board_led_invert(BSP_BOARD_LED_0);
2596-
nrf_delay_ms(200);
2597-
}
2598-
}
2599-
26002545
char ble_pin[7] = {0};
26012546
uint16_t duration_button_pressed = 0;
26022547
bool is_pin_displayed = false;

0 commit comments

Comments
 (0)