diff options
author | Oxore <oxore@protonmail.com> | 2022-10-09 22:19:24 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2022-10-09 22:19:24 +0300 |
commit | 2a5b767d52fe47ae83dda6f3303af312b72b3acf (patch) | |
tree | 094beadf3b36331a1cc58d1da55314d9bac60230 | |
parent | b1c8bb5df090d65cdd37a7acafb5dee8e3c530c6 (diff) |
WIP: blocking SPI write experimentsaddressable-leds-control
-rw-r--r-- | Libraries/LED_Driver/led_driver_config.c | 43 | ||||
-rw-r--r-- | Libraries/LED_Driver/led_driver_process.c | 23 |
2 files changed, 21 insertions, 45 deletions
diff --git a/Libraries/LED_Driver/led_driver_config.c b/Libraries/LED_Driver/led_driver_config.c index d2df9d4..d71792d 100644 --- a/Libraries/LED_Driver/led_driver_config.c +++ b/Libraries/LED_Driver/led_driver_config.c @@ -121,7 +121,7 @@ static void LED_SPIConfig ( void ) SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low; SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; - SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64; + SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_8; SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; SPI_InitStructure.SPI_CRCPolynomial = 7; SPI_InitStructure.SPI_Mode = SPI_Mode_Master; @@ -141,44 +141,3 @@ static void LED_SPIConfig ( void ) LED_ST_PIN_RESET; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Libraries/LED_Driver/led_driver_process.c b/Libraries/LED_Driver/led_driver_process.c index 2389212..f809688 100644 --- a/Libraries/LED_Driver/led_driver_process.c +++ b/Libraries/LED_Driver/led_driver_process.c @@ -8,6 +8,23 @@ // ---------------------------------------------------------------------------- void LEDDriverProcessFromISR ( void ) { - LED_ST_PIN_RESET; - SPI_I2S_SendData16 ( LED_SPIx, (uint16_t)0 ); -}
\ No newline at end of file + asm volatile("cpsid i"); + LED_ST_PIN_RESET; + for (int j = 0; j < 4; j++) { + LED_SPIx->DR = 0; + while (SPI_I2S_FLAG_BSY & LED_SPIx->SR); + for (int i = 0; i < 4; i++) { + LED_SPIx->DR = 0xf8f8; + while (SPI_I2S_FLAG_BSY & LED_SPIx->SR); + } + for (int i = 0; i < 4; i++) { + LED_SPIx->DR = 0xe0e0; + while (SPI_I2S_FLAG_BSY & LED_SPIx->SR); + } + for (int i = 0; i < 4; i++) { + LED_SPIx->DR = 0xe0e0; + while (SPI_I2S_FLAG_BSY & LED_SPIx->SR); + } + } + asm volatile("cpsie i"); +} |