kopia lustrzana https://github.com/SP8EBC/ParaTNC
switchin vbatt_m on and off
rodzic
922aa3a51e
commit
da3dd53302
|
@ -127,6 +127,15 @@ inline void io___cntrl_vbat_r_disable(void) {
|
|||
|
||||
}
|
||||
|
||||
inline void io___cntrl_vbat_m_enable(void) {
|
||||
GPIOB->BSRR |= GPIO_BSRR_BS0;
|
||||
|
||||
}
|
||||
inline void io___cntrl_vbat_m_disable(void) {
|
||||
GPIOB->BSRR |= GPIO_BSRR_BR0;
|
||||
|
||||
}
|
||||
|
||||
inline void io___cntrl_gprs_pwrkey_press() {
|
||||
GPIOA->BSRR |= GPIO_BSRR_BS7;
|
||||
|
||||
|
|
10
src/io.c
10
src/io.c
|
@ -241,10 +241,20 @@ void io_pwr_init(void) {
|
|||
GPIO_InitTypeDef.Alternate = LL_GPIO_AF_7;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitTypeDef);
|
||||
|
||||
// PB0 - UC_CNTRL_VM
|
||||
GPIO_InitTypeDef.Mode = LL_GPIO_MODE_OUTPUT;
|
||||
GPIO_InitTypeDef.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitTypeDef.Pin = LL_GPIO_PIN_0;
|
||||
GPIO_InitTypeDef.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitTypeDef.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;
|
||||
GPIO_InitTypeDef.Alternate = LL_GPIO_AF_7;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitTypeDef);
|
||||
|
||||
io___cntrl_vbat_r_disable();
|
||||
io___cntrl_vbat_g_disable();
|
||||
io___cntrl_vbat_c_disable();
|
||||
io___cntrl_vbat_s_disable();
|
||||
io___cntrl_vbat_m_disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -301,6 +301,8 @@ int pwr_save_switch_mode_to_c0(void) {
|
|||
// turn ON +5V_S
|
||||
io___cntrl_vbat_s_enable();
|
||||
|
||||
io___cntrl_vbat_m_enable();
|
||||
|
||||
// turn ON +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_enable();
|
||||
|
||||
|
@ -336,6 +338,8 @@ int pwr_save_switch_mode_to_c1(void) {
|
|||
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_enable();
|
||||
|
||||
io___cntrl_vbat_m_enable();
|
||||
|
||||
// turn ON +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_enable();
|
||||
|
||||
|
@ -372,6 +376,8 @@ void pwr_save_switch_mode_to_c2(void) {
|
|||
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_disable();
|
||||
|
||||
io___cntrl_vbat_m_disable();
|
||||
|
||||
// turn ON +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_enable();
|
||||
|
||||
|
@ -404,6 +410,8 @@ void pwr_save_switch_mode_to_c3(void) {
|
|||
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_disable();
|
||||
|
||||
io___cntrl_vbat_m_disable();
|
||||
|
||||
// turn ON +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_enable();
|
||||
|
||||
|
@ -437,6 +445,8 @@ int pwr_save_switch_mode_to_m4(void) {
|
|||
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_enable();
|
||||
|
||||
io___cntrl_vbat_m_enable();
|
||||
|
||||
// turn OFF +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_disable();
|
||||
|
||||
|
@ -469,6 +479,8 @@ int pwr_save_switch_mode_to_m4a(void) {
|
|||
// turn ON +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_enable();
|
||||
|
||||
io___cntrl_vbat_m_enable();
|
||||
|
||||
// turn OFF +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_disable();
|
||||
|
||||
|
@ -502,6 +514,8 @@ void pwr_save_switch_mode_to_i5(void) {
|
|||
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_disable();
|
||||
|
||||
io___cntrl_vbat_m_disable();
|
||||
|
||||
// turn OFF +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_disable();
|
||||
|
||||
|
@ -550,6 +564,8 @@ void pwr_save_switch_mode_to_l6(uint16_t sleep_time) {
|
|||
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_disable();
|
||||
|
||||
io___cntrl_vbat_m_disable();
|
||||
|
||||
// turn OFF +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_disable();
|
||||
|
||||
|
@ -613,6 +629,8 @@ void pwr_save_switch_mode_to_l7(uint16_t sleep_time) {
|
|||
// turn OFF +5V_S (and internal VHF radio module in HW-RevB)
|
||||
io___cntrl_vbat_s_disable();
|
||||
|
||||
io___cntrl_vbat_m_disable();
|
||||
|
||||
// turn OFF +5V_R and VBATT_SW_R
|
||||
io___cntrl_vbat_r_disable();
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ void wx_pwr_switch_periodic_handle(void) {
|
|||
|
||||
#if (defined STM32L471xx)
|
||||
io___cntrl_vbat_s_disable();
|
||||
io___cntrl_vbat_m_disable();
|
||||
#endif
|
||||
// setting the last_good timers to current value to prevent reset loop
|
||||
wx_last_good_temperature_time = master_time;
|
||||
|
|
Ładowanie…
Reference in New Issue