Invert LED outputs, set to open drain
This commit is contained in:
parent
fe7a2f1869
commit
8891670bb7
|
@ -1 +1 @@
|
||||||
80
|
82
|
||||||
|
|
11
src/led.c
11
src/led.c
|
@ -42,11 +42,11 @@ static void LED_RefreshDMABuffer(void)
|
||||||
{
|
{
|
||||||
if(gamma_corrected & (1 << j))
|
if(gamma_corrected & (1 << j))
|
||||||
{
|
{
|
||||||
LED_DMABuffer[j] |= 1 << i;
|
LED_DMABuffer[j] &= ~(1 << i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LED_DMABuffer[j] &= ~(1 << i);
|
LED_DMABuffer[j] |= 1 << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,14 +118,14 @@ static void LED_StartBCM(void)
|
||||||
"nop;"
|
"nop;"
|
||||||
"nop;"
|
"nop;"
|
||||||
"nop;"
|
"nop;"
|
||||||
"str %[zero], [%[odr]];"
|
"str %[off], [%[odr]];"
|
||||||
:
|
:
|
||||||
: [odr] "l" ((uint32_t)&(GPIOA->ODR)),
|
: [odr] "l" ((uint32_t)&(GPIOA->ODR)),
|
||||||
[d0] "r" (LED_DMABuffer[0]),
|
[d0] "r" (LED_DMABuffer[0]),
|
||||||
[d1] "r" (LED_DMABuffer[1]),
|
[d1] "r" (LED_DMABuffer[1]),
|
||||||
[d2] "r" (LED_DMABuffer[2]),
|
[d2] "r" (LED_DMABuffer[2]),
|
||||||
[d3] "r" (LED_DMABuffer[3]),
|
[d3] "r" (LED_DMABuffer[3]),
|
||||||
[zero] "r" (0)
|
[off] "r" (LED_ODR_MASK)
|
||||||
:);
|
:);
|
||||||
|
|
||||||
// Enable TIM3 for the rest of the bits
|
// Enable TIM3 for the rest of the bits
|
||||||
|
@ -138,7 +138,8 @@ void LED_Init(void)
|
||||||
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
|
RCC->AHBENR |= RCC_AHBENR_DMA1EN;
|
||||||
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
|
RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
|
||||||
|
|
||||||
GPIOA->ODR &= ~LED_ODR_MASK;
|
GPIOA->ODR |= LED_ODR_MASK;
|
||||||
|
GPIOA->OTYPER |= LED_ODR_MASK;
|
||||||
GPIOA->MODER = (GPIOA->MODER & ~LED_MODER_MASK) | LED_MODER;
|
GPIOA->MODER = (GPIOA->MODER & ~LED_MODER_MASK) | LED_MODER;
|
||||||
|
|
||||||
TIM3->CR1 = 0x0000;
|
TIM3->CR1 = 0x0000;
|
||||||
|
|
Loading…
Reference in a new issue