Skip to content

Commit

Permalink
Implement USB power mode on uno
Browse files Browse the repository at this point in the history
  • Loading branch information
robbederks committed Nov 27, 2019
1 parent 670f90c commit a6797a2
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions board/boards/uno.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,28 @@ void uno_set_gps_load_switch(bool enabled) {
set_gpio_output(GPIOC, 12, enabled);
}

void uno_set_phone_power(bool enabled){
set_gpio_output(GPIOB, 4, enabled);
}

void uno_set_usb_power_mode(uint8_t mode) {
UNUSED(mode);
puts("Setting USB mode makes no sense on UNO\n");
bool valid = false;
switch (mode) {
case USB_POWER_CLIENT:
uno_set_phone_power(false);
valid = true;
break;
case USB_POWER_CDP:
uno_set_phone_power(true);
valid = true;
break;
default:
puts("Invalid USB power mode\n");
break;
}
if (valid) {
usb_power_mode = mode;
}
}

void uno_set_esp_gps_mode(uint8_t mode) {
Expand Down Expand Up @@ -140,10 +159,6 @@ uint32_t uno_read_current(void){
return 0U;
}

void uno_set_phone_power(bool enabled){
set_gpio_output(GPIOB, 4, enabled);
}

void uno_init(void) {
common_init_gpio();

Expand Down

0 comments on commit a6797a2

Please sign in to comment.