File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change 1515#include <pbio/config.h>
1616
1717void _pbdrv_motor_init (void ) {
18- // it isn't clear what PB2 does yet, but tacho doesn't work without setting it high.
19- // maybe it switches power to the IR LEDs? plus more?
20-
21- // PB2 output, high
22- GPIOB -> BSRR = GPIO_BSRR_BS_2 ;
23- GPIOB -> MODER = (GPIOB -> MODER & ~GPIO_MODER_MODER2_Msk ) | (1 << GPIO_MODER_MODER2_Pos );
24-
2518 // TIM1 provides PWM for ports A/B
2619 RCC -> APB2ENR |= RCC_APB2ENR_TIM1EN ;
2720 TIM1 -> PSC = 3 ; // divide by 4 (= 3 + 1), so ticks are 12MHz
Original file line number Diff line number Diff line change @@ -130,6 +130,10 @@ void SystemInit(void) {
130130 GPIOB -> BSRR = GPIO_BSRR_BS_11 ;
131131 GPIOB -> MODER = (GPIOB -> MODER & ~GPIO_MODER_MODER11_Msk ) | (1 << GPIO_MODER_MODER11_Pos );
132132
133+ // PB2 controls I/O port VCC
134+ GPIOB -> BSRR = GPIO_BSRR_BS_2 ;
135+ GPIOB -> MODER = (GPIOB -> MODER & ~GPIO_MODER_MODER2_Msk ) | (1 << GPIO_MODER_MODER2_Pos );
136+
133137 // not sure what the rest of these pins do
134138
135139 // PF0 output, high
You can’t perform that action at this time.
0 commit comments