Skip to content

Commit 1590ff2

Browse files
committed
platform/move_hub: move port VCC to platform.c
We have a better understanding of what this pin does now, so moving it to platform.c next to main power pin like other hubs.
1 parent 75dd240 commit 1590ff2

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/pbio/drv/move_hub/motor.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
#include <pbio/config.h>
1616

1717
void _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

lib/pbio/platform/move_hub/platform.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)