Skip to content

Commit

Permalink
H7: enable USB LDO and fix RGB LED gpios (commaai#1148)
Browse files Browse the repository at this point in the history
* enable USB LDO

* open drain for RGB LED gpios

* naming

* comment
  • Loading branch information
briskspirit committed Nov 11, 2022
1 parent eae58b3 commit a9e0357
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion board/boards/tres.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
// Tres + Harness //
// /////////////////

void tres_init(void) {
// Enable USB 3.3V LDO for USB block
register_set_bits(&(PWR->CR3), PWR_CR3_USBREGEN);
register_set_bits(&(PWR->CR3), PWR_CR3_USB33DEN);
while ((PWR->CR3 & PWR_CR3_USB33RDY) == 0);

red_chiplet_init();
}

const board board_tres = {
.board_type = "Tres",
.board_tick = unused_board_tick,
Expand All @@ -13,7 +22,7 @@ const board board_tres = {
.has_canfd = true,
.has_rtc_battery = true,
.fan_max_rpm = 0U,
.init = red_chiplet_init,
.init = tres_init,
.enable_can_transceiver = red_chiplet_enable_can_transceiver,
.enable_can_transceivers = red_chiplet_enable_can_transceivers,
.set_led = red_set_led,
Expand Down
3 changes: 3 additions & 0 deletions board/stm32h7/peripherals.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ void common_init_gpio(void) {
/// E2,E3,E4: RGB LED
set_gpio_pullup(GPIOE, 2, PULL_NONE);
set_gpio_mode(GPIOE, 2, MODE_OUTPUT);
set_gpio_output_type(GPIOE, 2, OUTPUT_TYPE_OPEN_DRAIN);

set_gpio_pullup(GPIOE, 3, PULL_NONE);
set_gpio_mode(GPIOE, 3, MODE_OUTPUT);
set_gpio_output_type(GPIOE, 3, OUTPUT_TYPE_OPEN_DRAIN);

set_gpio_pullup(GPIOE, 4, PULL_NONE);
set_gpio_mode(GPIOE, 4, MODE_OUTPUT);
set_gpio_output_type(GPIOE, 4, OUTPUT_TYPE_OPEN_DRAIN);

// F7,F8,F9,F10: BOARD ID
set_gpio_pullup(GPIOF, 7, PULL_NONE);
Expand Down

0 comments on commit a9e0357

Please sign in to comment.