parent
4b3358c921
commit
0894b28f1e
|
@ -162,6 +162,9 @@ void black_init(void) {
|
|||
// Turn on USB load switch.
|
||||
black_set_usb_load_switch(true);
|
||||
|
||||
// Set right power mode
|
||||
black_set_usb_power_mode(USB_POWER_CDP);
|
||||
|
||||
// Initialize harness
|
||||
harness_init();
|
||||
|
||||
|
|
|
@ -288,6 +288,16 @@ void white_init(void) {
|
|||
EXTI->RTSR |= (1U << 1);
|
||||
EXTI->FTSR |= (1U << 1);
|
||||
NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
|
||||
// Init usb power mode
|
||||
uint32_t voltage = adc_get_voltage();
|
||||
// Init in CDP mode only if panda is powered by 12V.
|
||||
// Otherwise a PC would not be able to flash a standalone panda with EON build
|
||||
if (voltage > 8000U) { // 8V threshold
|
||||
white_set_usb_power_mode(USB_POWER_CDP);
|
||||
} else {
|
||||
white_set_usb_power_mode(USB_POWER_CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
const harness_configuration white_harness_config = {
|
||||
|
|
|
@ -32,6 +32,7 @@ const board *current_board;
|
|||
|
||||
#include "drivers/clock.h"
|
||||
#include "drivers/llgpio.h"
|
||||
#include "drivers/adc.h"
|
||||
|
||||
#include "board.h"
|
||||
|
||||
|
@ -68,8 +69,6 @@ int main(void) {
|
|||
detect_configuration();
|
||||
detect_board_type();
|
||||
|
||||
current_board->set_usb_power_mode(USB_POWER_CLIENT);
|
||||
|
||||
if (enter_bootloader_mode == ENTER_SOFTLOADER_MAGIC) {
|
||||
enter_bootloader_mode = 0;
|
||||
soft_flasher_start();
|
||||
|
|
10
board/main.c
10
board/main.c
|
@ -652,16 +652,6 @@ int main(void) {
|
|||
// init board
|
||||
current_board->init();
|
||||
|
||||
// init usb power mode
|
||||
uint32_t voltage = adc_get_voltage();
|
||||
// init in CDP mode only if panda is powered by 12V.
|
||||
// Otherwise a PC would not be able to flash a standalone panda with EON build
|
||||
if (voltage > 8000U) { // 8V threshold
|
||||
current_board->set_usb_power_mode(USB_POWER_CDP);
|
||||
} else {
|
||||
current_board->set_usb_power_mode(USB_POWER_CLIENT);
|
||||
}
|
||||
|
||||
// panda has an FPU, let's use it!
|
||||
enable_fpu();
|
||||
|
||||
|
|
Loading…
Reference in New Issue