diff --git a/platform/targets/DM-1801/hwconfig.h b/platform/targets/DM-1801/hwconfig.h index aea63ff8..d497e687 100644 --- a/platform/targets/DM-1801/hwconfig.h +++ b/platform/targets/DM-1801/hwconfig.h @@ -46,6 +46,9 @@ /* Battery type */ #define BAT_LIPO_2S +/* Power keep switch */ +#define PWR_SW GPIOE,26 + /* Display */ #define LCD_BKLIGHT GPIOC,4 #define LCD_CS GPIOC,8 diff --git a/platform/targets/DM-1801/platform.c b/platform/targets/DM-1801/platform.c index 3c64ad28..7360477f 100644 --- a/platform/targets/DM-1801/platform.c +++ b/platform/targets/DM-1801/platform.c @@ -46,6 +46,8 @@ void platform_init() gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PWR_SW, OUTPUT); + /* * Configure backlight PWM: 58.5kHz, 8 bit resolution */ @@ -102,6 +104,9 @@ void platform_terminate() gpio_clearPin(GREEN_LED); adc0_terminate(); + + /* Finally, remove power supply */ + gpio_clearPin(PWR_SW, OUTPUT); } float platform_getVbat() diff --git a/platform/targets/GD-77/hwconfig.h b/platform/targets/GD-77/hwconfig.h index 86b54446..1bf3689e 100644 --- a/platform/targets/GD-77/hwconfig.h +++ b/platform/targets/GD-77/hwconfig.h @@ -46,6 +46,9 @@ /* Battery type */ #define BAT_LIPO_2S +/* Power keep switch */ +#define PWR_SW GPIOE,26 + /* Display */ #define LCD_BKLIGHT GPIOC,4 #define LCD_CS GPIOC,8 diff --git a/platform/targets/GD-77/platform.c b/platform/targets/GD-77/platform.c index ee05e938..39b80aa0 100644 --- a/platform/targets/GD-77/platform.c +++ b/platform/targets/GD-77/platform.c @@ -46,6 +46,8 @@ void platform_init() gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PWR_SW, OUTPUT); + /* * Configure backlight PWM: 58.5kHz, 8 bit resolution */ @@ -102,6 +104,9 @@ void platform_terminate() gpio_clearPin(GREEN_LED); adc0_terminate(); + + /* Finally, remove power supply */ + gpio_clearPin(PWR_SW, OUTPUT); } float platform_getVbat() diff --git a/platform/targets/MD-3x0/hwconfig.h b/platform/targets/MD-3x0/hwconfig.h index 3b0e8b76..2e8869cb 100644 --- a/platform/targets/MD-3x0/hwconfig.h +++ b/platform/targets/MD-3x0/hwconfig.h @@ -51,6 +51,9 @@ /* Battery type */ #define BAT_LIPO_2S +/* Power keep switch */ +#define PWR_SW GPIOA,7 + /* Display */ #define LCD_D0 GPIOD,14 #define LCD_D1 GPIOD,15 diff --git a/platform/targets/MD-3x0/platform.c b/platform/targets/MD-3x0/platform.c index c5169aa7..648eeafc 100644 --- a/platform/targets/MD-3x0/platform.c +++ b/platform/targets/MD-3x0/platform.c @@ -46,6 +46,8 @@ void platform_init() gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PWR_SW, OUTPUT); + /* * Initialise ADC1, for vbat, RSSI, ... * Configuration of corresponding GPIOs in analog input mode is done inside @@ -104,6 +106,9 @@ void platform_terminate() nvm_terminate(); toneGen_terminate(); rtc_terminate(); + + /* Finally, remove power supply */ + gpio_clearPin(PWR_SW, OUTPUT); } float platform_getVbat() diff --git a/platform/targets/MD-UV380/hwconfig.h b/platform/targets/MD-UV380/hwconfig.h index 2f4bb3b2..a31d10fb 100644 --- a/platform/targets/MD-UV380/hwconfig.h +++ b/platform/targets/MD-UV380/hwconfig.h @@ -48,6 +48,9 @@ /* Battery type */ #define BAT_LIPO_2S +/* Power keep switch */ +#define PWR_SW GPIOA,7 + /* Display */ #define LCD_D0 GPIOD,14 #define LCD_D1 GPIOD,15 diff --git a/platform/targets/MD-UV380/platform.c b/platform/targets/MD-UV380/platform.c index e10126b2..400de43c 100644 --- a/platform/targets/MD-UV380/platform.c +++ b/platform/targets/MD-UV380/platform.c @@ -65,6 +65,8 @@ void platform_init() gpio_setMode(PTT_SW, INPUT); + gpio_setMode(PWR_SW, OUTPUT); + /* * Initialise ADC1, for vbat, RSSI, ... * Configuration of corresponding GPIOs in analog input mode is done inside @@ -128,6 +130,9 @@ void platform_terminate() adc1_terminate(); nvm_terminate(); rtc_terminate(); + + /* Finally, remove power supply */ + gpio_clearPin(PWR_SW, OUTPUT); } float platform_getVbat()