forked from mirrors/qmk_firmware
working led via A3
This commit is contained in:
parent
955ea5c7fb
commit
c8e29bc7f1
2 changed files with 7 additions and 6 deletions
|
@ -12,7 +12,7 @@ static uint8_t *fb;
|
||||||
static int sLeds;
|
static int sLeds;
|
||||||
static stm32_gpio_t *sPort;
|
static stm32_gpio_t *sPort;
|
||||||
static uint32_t sMask;
|
static uint32_t sMask;
|
||||||
uint16_t* dma_source;
|
uint8_t* dma_source;
|
||||||
|
|
||||||
void setColor(uint8_t color, uint8_t *buf,uint32_t mask){
|
void setColor(uint8_t color, uint8_t *buf,uint32_t mask){
|
||||||
int i;
|
int i;
|
||||||
|
@ -72,7 +72,7 @@ void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb)
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
dma_source = chHeapAlloc(NULL, 2);
|
dma_source = chHeapAlloc(NULL, 1);
|
||||||
fb = chHeapAlloc(NULL, ((sLeds) * 24)+10);
|
fb = chHeapAlloc(NULL, ((sLeds) * 24)+10);
|
||||||
*o_fb=fb;
|
*o_fb=fb;
|
||||||
int j;
|
int j;
|
||||||
|
@ -91,9 +91,9 @@ void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb)
|
||||||
dmaStreamAllocate(STM32_DMA1_STREAM3, 10, NULL, NULL);
|
dmaStreamAllocate(STM32_DMA1_STREAM3, 10, NULL, NULL);
|
||||||
dmaStreamSetPeripheral(STM32_DMA1_STREAM3, &(sPort->BSRR.H.set));
|
dmaStreamSetPeripheral(STM32_DMA1_STREAM3, &(sPort->BSRR.H.set));
|
||||||
dmaStreamSetMemory0(STM32_DMA1_STREAM3, dma_source);
|
dmaStreamSetMemory0(STM32_DMA1_STREAM3, dma_source);
|
||||||
dmaStreamSetTransactionSize(STM32_DMA1_STREAM3, 2);
|
dmaStreamSetTransactionSize(STM32_DMA1_STREAM3, 1);
|
||||||
dmaStreamSetMode(
|
dmaStreamSetMode(
|
||||||
STM32_DMA1_STREAM3, STM32_DMA_CR_TEIE | STM32_DMA_CR_MINC |
|
STM32_DMA1_STREAM3, STM32_DMA_CR_TEIE|
|
||||||
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_BYTE
|
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_BYTE
|
||||||
| STM32_DMA_CR_MSIZE_BYTE | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
|
| STM32_DMA_CR_MSIZE_BYTE | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
|
||||||
// DMA stream 6, triggered by channel1 update event. reset output value late to indicate "1" bit to ws2812.
|
// DMA stream 6, triggered by channel1 update event. reset output value late to indicate "1" bit to ws2812.
|
||||||
|
@ -101,10 +101,10 @@ void ledDriverInit(int leds, stm32_gpio_t *port, uint32_t mask, uint8_t **o_fb)
|
||||||
dmaStreamAllocate(STM32_DMA1_STREAM6, 10, NULL, NULL);
|
dmaStreamAllocate(STM32_DMA1_STREAM6, 10, NULL, NULL);
|
||||||
dmaStreamSetPeripheral(STM32_DMA1_STREAM6, &(sPort->BSRR.H.clear));
|
dmaStreamSetPeripheral(STM32_DMA1_STREAM6, &(sPort->BSRR.H.clear));
|
||||||
dmaStreamSetMemory0(STM32_DMA1_STREAM6, dma_source);
|
dmaStreamSetMemory0(STM32_DMA1_STREAM6, dma_source);
|
||||||
dmaStreamSetTransactionSize(STM32_DMA1_STREAM6, 2);
|
dmaStreamSetTransactionSize(STM32_DMA1_STREAM6, 1);
|
||||||
dmaStreamSetMode(
|
dmaStreamSetMode(
|
||||||
STM32_DMA1_STREAM6,
|
STM32_DMA1_STREAM6,
|
||||||
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_MINC | STM32_DMA_CR_PSIZE_BYTE
|
STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_PSIZE_BYTE
|
||||||
| STM32_DMA_CR_MSIZE_BYTE | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
|
| STM32_DMA_CR_MSIZE_BYTE | STM32_DMA_CR_CIRC | STM32_DMA_CR_PL(3));
|
||||||
pwmStart(&PWMD2, &pwmc2);
|
pwmStart(&PWMD2, &pwmc2);
|
||||||
pwmStart(&PWMD3, &pwmc3);
|
pwmStart(&PWMD3, &pwmc3);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
uint8_t *o_fb;
|
uint8_t *o_fb;
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
void matrix_init_kb(void) {
|
||||||
|
palSetPadMode(GPIOB, 8, PAL_STM32_PUPDR_FLOATING);
|
||||||
ledDriverInit(1, GPIOA, 0b1000, &o_fb);
|
ledDriverInit(1, GPIOA, 0b1000, &o_fb);
|
||||||
testPatternFB(o_fb);
|
testPatternFB(o_fb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue