feat: use (only) dedicated charge led on compatible Jumper handsets (#5512)

This commit is contained in:
3djc
2024-09-11 18:50:16 +10:00
committed by GitHub
parent b78da3436e
commit f680d86034
4 changed files with 31 additions and 35 deletions
+16 -2
View File
@@ -114,6 +114,20 @@ void boardInit()
LL_APB1_GRP1_EnableClock(AUDIO_RCC_APB1Periph);
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
#if defined(USB_CHARGE_LED) && !defined(DEBUG_DISABLE_USB)
usbInit();
// prime debounce state...
usbPlugged();
if (usbPlugged()) {
delaysInit();
while (usbPlugged()) {
delay_ms(1000);
}
pwrOff();
}
#endif
#if defined(BLUETOOTH) && !defined(PCBX9E)
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE, true);
#endif
@@ -158,7 +172,7 @@ void boardInit()
// TODO: needs refactoring if any other manufacturer implements either of the following:
// - function switches and the radio supports charging
// - single USB for data + charge which powers on radio
#if defined(MANUFACTURER_JUMPER)
#if defined(MANUFACTURER_JUMPER) && !defined(USB_CHARGE_LED)
// This is needed to prevent radio from starting when usb is plugged to charge
usbInit();
// prime debounce state...
@@ -166,13 +180,13 @@ void boardInit()
if (usbPlugged()) {
delaysInit();
__enable_irq();
adcInit(&_adc_driver);
getADC();
pwrOn(); // required to get bat adc reads
INTERNAL_MODULE_OFF();
EXTERNAL_MODULE_OFF();
delay_ms(2000); // let this stabilize
while (usbPlugged()) {
// // Let it charge ...
getADC(); // Warning: the value read does not include VBAT calibration