Advertisement
Guest User

SPI Fail

a guest
Feb 10th, 2024
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.32 KB | None | 0 0
  1. #include "main.h"
  2.  
  3. /* Private includes ----------------------------------------------------------*/
  4. /* USER CODE BEGIN Includes */
  5.  
  6. /* USER CODE END Includes */
  7.  
  8. /* Private typedef -----------------------------------------------------------*/
  9. /* USER CODE BEGIN PTD */
  10.  
  11. /* USER CODE END PTD */
  12.  
  13. /* Private define ------------------------------------------------------------*/
  14. /* USER CODE BEGIN PD */
  15.  
  16. /* USER CODE END PD */
  17.  
  18. /* Private macro -------------------------------------------------------------*/
  19. /* USER CODE BEGIN PM */
  20.  
  21. /* USER CODE END PM */
  22.  
  23. /* Private variables ---------------------------------------------------------*/
  24.  
  25. SPI_HandleTypeDef hspi1;
  26. SPI_HandleTypeDef hspi2;
  27. SPI_HandleTypeDef hspi3;
  28. SPI_HandleTypeDef hspi4;
  29. SPI_HandleTypeDef hspi5;
  30. SPI_HandleTypeDef hspi6;
  31.  
  32. UART_HandleTypeDef huart3;
  33.  
  34. /* USER CODE BEGIN PV */
  35. #include "lcd_config.h"
  36. #include "lcd_driver.h"
  37.  
  38.  
  39. lcd_entry_t lcd_devices[5];
  40. /* USER CODE END PV */
  41.  
  42. /* Private function prototypes -----------------------------------------------*/
  43. void SystemClock_Config(void);
  44. static void MX_GPIO_Init(void);
  45. static void MX_USART3_UART_Init(void);
  46. static void MX_SPI2_Init(void);
  47. static void MX_SPI3_Init(void);
  48. static void MX_SPI1_Init(void);
  49. static void MX_SPI5_Init(void);
  50. static void MX_SPI6_Init(void);
  51. static void MX_SPI4_Init(void);
  52. /* USER CODE BEGIN PFP */
  53.  
  54. /* USER CODE END PFP */
  55.  
  56. /* Private user code ---------------------------------------------------------*/
  57. /* USER CODE BEGIN 0 */
  58.  
  59. void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef * hspi)
  60. {
  61.   HAL_UART_Transmit(&huart3,(uint8_t*)"TX\n",3,0xFFFF);
  62.    
  63. }
  64. /* USER CODE END 0 */
  65.  
  66. /**
  67.   * @brief  The application entry point.
  68.   * @retval int
  69.   */
  70. int main(void)
  71. {
  72.   /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  73.   HAL_Init();
  74.  
  75.   /* Configure the system clock */
  76.   SystemClock_Config();
  77.  
  78.    /* Initialize all configured peripherals */
  79.   MX_GPIO_Init();
  80.   MX_USART3_UART_Init();
  81.   MX_SPI2_Init();
  82.   MX_SPI3_Init();
  83.   MX_SPI1_Init();
  84.   MX_SPI5_Init();
  85.   MX_SPI6_Init();
  86.   MX_SPI4_Init();
  87.  
  88.   /* Infinite loop */
  89.   /* USER CODE BEGIN WHILE */
  90.   while (1)
  91.   {
  92.     HAL_SPI_Transmit_IT(&hspi1,lcd_devices[0].buffer1,16*1024);
  93.     HAL_Delay(1000);
  94.     /* USER CODE END WHILE */
  95.  
  96.     /* USER CODE BEGIN 3 */
  97.   }
  98. }
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement