Browse Source

SPI do work.

Vladimir N. Shilov 3 years ago
parent
commit
09abc87d35
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Src/main.c

+ 4 - 2
Src/main.c

@@ -179,7 +179,7 @@ int main(void)
   //LL_SPI_EnableDMAReq_TX(SPI1);
   /* Start SPI transfer */
   //LATCH_DOWN;
-  LL_SPI_Enable(SPI1);
+  //LL_SPI_Enable(SPI1);
 
 //  COLOR_R(0);
 //  COLOR_G(0);
@@ -197,7 +197,7 @@ int main(void)
     LL_mDelay(500);
 
     IN15_OFF;
-    COLOR_RGB(0xFF, 0x7E, 0x0); // or FFBF00
+    COLOR_RGB(0xFF, 0x12, 0x0); // FF7E00 or FFBF00
     SPI_Send();
     LL_mDelay(500);
     /* USER CODE END WHILE */
@@ -217,6 +217,7 @@ int main(void)
 static void SPI_Send(void) {
   int i;
 
+  SPI1->CR1 |= SPI_CR1_SPE;
   LATCH_DOWN;
 
   for (i=0; i<SPI_BUFFER_SIZE; i++) {
@@ -228,6 +229,7 @@ static void SPI_Send(void) {
 
   while ((SPI1->SR & SPI_SR_FTLVL) != 0);
   while ((SPI1->SR & SPI_SR_BSY) != 0);
+  SPI1->CR1 &= ~SPI_CR1_SPE;
   LATCH_UP;
 }