From a441cdf5d2d03bc4efaee82cee7b6a4936fd41b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 5 Aug 2018 22:47:55 +0200 Subject: [PATCH] Delete debug_over_spi.[ch] --- left/src/debug_over_spi.c | 50 --------------------------------------- left/src/debug_over_spi.h | 27 --------------------- 2 files changed, 77 deletions(-) delete mode 100644 left/src/debug_over_spi.c delete mode 100644 left/src/debug_over_spi.h diff --git a/left/src/debug_over_spi.c b/left/src/debug_over_spi.c deleted file mode 100644 index d1665d8..0000000 --- a/left/src/debug_over_spi.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "debug_over_spi.h" -#include "fsl_gpio.h" - -#define EXAMPLE_SPI_MASTER (SPI0) -#define EXAMPLE_SPI_MASTER_SOURCE_CLOCK (kCLOCK_BusClk) - -#define BUFFER_SIZE (64) -static uint8_t srcBuff[BUFFER_SIZE]; - -static spi_transfer_t xfer = {0}; -static spi_master_config_t userConfig; -spi_master_handle_t handle; - -static volatile bool masterFinished = true; - -static void masterCallback(SPI_Type *base, spi_master_handle_t *masterHandle, status_t status, void *userData) -{ - masterFinished = true; -} - -void DebugOverSpi_Init(void) -{ - CLOCK_EnableClock(DEBUG_OVER_SPI_MOSI_CLOCK); - CLOCK_EnableClock(DEBUG_OVER_SPI_SCK_CLOCK); - - PORT_SetPinMux(DEBUG_OVER_SPI_MOSI_PORT, DEBUG_OVER_SPI_MOSI_PIN, kPORT_MuxAlt3); - PORT_SetPinMux(DEBUG_OVER_SPI_SCK_PORT, DEBUG_OVER_SPI_SCK_PIN, kPORT_MuxAlt3); - - GPIO_PinInit(DEBUG_OVER_SPI_MOSI_GPIO, DEBUG_OVER_SPI_MOSI_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 0}); - GPIO_PinInit(DEBUG_OVER_SPI_SCK_GPIO, DEBUG_OVER_SPI_SCK_PIN, &(gpio_pin_config_t){kGPIO_DigitalOutput, 0}); - - GPIO_SetPinsOutput(DEBUG_OVER_SPI_MOSI_GPIO, 1U << DEBUG_OVER_SPI_MOSI_PIN); - GPIO_SetPinsOutput(DEBUG_OVER_SPI_SCK_GPIO, 1U << DEBUG_OVER_SPI_SCK_PIN); - - SPI_MasterGetDefaultConfig(&userConfig); - uint32_t srcFreq = CLOCK_GetFreq(EXAMPLE_SPI_MASTER_SOURCE_CLOCK); - SPI_MasterInit(EXAMPLE_SPI_MASTER, &userConfig, srcFreq); - SPI_MasterTransferCreateHandle(EXAMPLE_SPI_MASTER, &handle, masterCallback, NULL); -} - -void DebugOverSpi_Send(uint8_t *tx, uint8_t len) -{ - if (masterFinished) { - masterFinished = false; - memcpy(srcBuff, tx, MIN(BUFFER_SIZE, len)); - xfer.txData = srcBuff; - xfer.dataSize = len; - SPI_MasterTransferNonBlocking(EXAMPLE_SPI_MASTER, &handle, &xfer); - } -} diff --git a/left/src/debug_over_spi.h b/left/src/debug_over_spi.h deleted file mode 100644 index a97d8ae..0000000 --- a/left/src/debug_over_spi.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __DEBUG_OVER_SPI_H__ -#define __DEBUG_OVER_SPI_H__ - -// Includes: - - #include "fsl_common.h" - #include "fsl_port.h" - #include "fsl_spi.h" - -// Macros: - - #define DEBUG_OVER_SPI_MOSI_PORT PORTA - #define DEBUG_OVER_SPI_MOSI_GPIO GPIOA - #define DEBUG_OVER_SPI_MOSI_CLOCK kCLOCK_PortA - #define DEBUG_OVER_SPI_MOSI_PIN 7 - - #define DEBUG_OVER_SPI_SCK_PORT PORTB - #define DEBUG_OVER_SPI_SCK_GPIO GPIOB - #define DEBUG_OVER_SPI_SCK_CLOCK kCLOCK_PortB - #define DEBUG_OVER_SPI_SCK_PIN 0 - -// Functions: - - void DebugOverSpi_Init(void); - void DebugOverSpi_Send(uint8_t *tx, uint8_t len); - -#endif