File tree Expand file tree Collapse file tree 6 files changed +5
-11
lines changed Expand file tree Collapse file tree 6 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 1414
1515// setup LED PWMs and pins
1616void _pbdrv_light_init (void ) {
17- RCC -> APB2ENR |= RCC_APB2ENR_TIM16EN | RCC_APB2ENR_TIM15EN ;
18-
1917 // RGB values are 0-255, so multiplying by 5 here to limit brightness to
2018 // 1/5 of max possible without having to do division later. It should also
2119 // give use smoother steps than the official LEGO firmware since we aren't
Original file line number Diff line number Diff line change 1414
1515// setup LED PWMs and pins
1616void _pbdrv_light_init (void ) {
17- RCC -> APB1ENR |= RCC_APB1ENR_TIM3EN | RCC_APB1ENR_TIM4EN | RCC_APB1ENR_TIM12EN ;
18-
1917 // RGB values are 0-255, so setup timer to allow using those values
2018 // directly in TIMx->CCRx
2119 TIM12 -> PSC = 187 ;
Original file line number Diff line number Diff line change 1414
1515// setup LED PWMs and pins
1616void _pbdrv_light_init (void ) {
17- RCC -> APB2ENR |= RCC_APB2ENR_TIM16EN | RCC_APB2ENR_TIM15EN ;
18-
1917 // RGB values are 0-255, so multiplying by 5 here to limit brightness to
2018 // 1/5 of max possible without having to do division later. It should also
2119 // give use smoother steps than the official LEGO firmware since we aren't
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ void SystemInit(void) {
101101 RCC -> AHBENR |= RCC_AHBENR_DMAEN | RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN
102102 | RCC_AHBENR_GPIOCEN | RCC_AHBENR_GPIODEN | RCC_AHBENR_GPIOFEN ;
103103 RCC -> APB1ENR |= RCC_APB1ENR_SPI2EN | RCC_APB1ENR_USART3EN | RCC_APB1ENR_USART4EN ;
104- RCC -> APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN ;
104+ RCC -> APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN | RCC_APB2ENR_TIM16EN | RCC_APB2ENR_TIM15EN ;
105105
106106
107107 // Keep main power on
Original file line number Diff line number Diff line change @@ -214,11 +214,12 @@ void SystemInit(void) {
214214 // dpgeorge: enable 8-byte stack alignment for IRQ handlers, in accord with EABI
215215 SCB -> CCR |= SCB_CCR_STKALIGN_Msk ;
216216
217- // enable GPIO clocks
217+ // enable all of the hardware modules we are using
218218 RCC -> AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN | RCC_AHB1ENR_GPIOCEN |
219219 RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_GPIOEEN | RCC_AHB1ENR_GPIOFEN |
220220 RCC_AHB1ENR_GPIOGEN | RCC_AHB1ENR_DMA2EN ;
221- RCC -> APB1ENR |= RCC_APB1ENR_TIM2EN | RCC_APB1ENR_USART2EN ;
221+ RCC -> APB1ENR |= RCC_APB1ENR_TIM2EN | RCC_APB1ENR_TIM3EN | RCC_APB1ENR_TIM4EN |
222+ RCC_APB1ENR_TIM12EN | RCC_APB1ENR_USART2EN ;
222223 RCC -> APB2ENR |= RCC_APB2ENR_ADC3EN | RCC_APB2ENR_USART6EN ;
223224
224225 // UART for terminal
Original file line number Diff line number Diff line change @@ -124,8 +124,7 @@ void SystemInit(void) {
124124 RCC -> AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOCEN
125125 | RCC_AHBENR_GPIODEN | RCC_AHBENR_GPIOFEN ;
126126 RCC -> APB1ENR |= RCC_APB1ENR_USART3EN | RCC_APB1ENR_USART4EN ;
127- RCC -> APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN ;
128-
127+ RCC -> APB2ENR |= RCC_APB2ENR_SYSCFGCOMPEN | RCC_APB2ENR_TIM16EN | RCC_APB2ENR_TIM15EN ;
129128
130129 // Keep BOOST alive
131130 GPIOB -> BSRR = GPIO_BSRR_BS_11 ;
You can’t perform that action at this time.
0 commit comments