| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef __WS1812B_SPI_H_
- #define __WS1812B_SPI_H_
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdio.h>
- #include <stdlib.h>
- #include "define.h"
- #define USER_WS2812B_GPIO_RCC_ENABLE RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOB, ENABLE);
- #define USER_WS2812B_SPI_RCC_ENABLE RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);
- #define USER_WS2812B_DMA_RCC_ENABLE RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
- #define USER_WS2812B_SPI SPI2
- #define USER_WS2812B_DMA_CHANNEL DMA1_Channel5
- #define USER_WS2812B_DMA_IRQn DMA1_Channel5_IRQn
- #define USER_WS2812B_DMA_IRQHandler DMA1_Channel5_IRQHandler
- #define USER_WS2812B_DMA_IT_TC DMA1_IT_TC5
- #define USER_WS2812B_SPI_MOSI_GPIO GPIOB
- #define USER_WS2812B_SPI_MOSI_PIN GPIO_Pin_15
- #define USER_WS2812B_SPI_SCLK_GPIO GPIOB
- #define USER_WS2812B_SPI_SCLK_PIN GPIO_Pin_13
- void ws2812b_spi_Init(void);
- bool bWs2812b_spi_WriteByte(volatile uint8_t *TxData, uint32_t TxSize);
- void Ws2812b_spi_dma_init(uint8_t *txData, uint32_t txSize);
- #ifdef __cplusplus
- }
- #endif
- #endif /* __WS1812B_SPI_H_ */
|