63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
//
|
|
// Created by cfif on 15.11.22.
|
|
//
|
|
#include <SystemDelayInterface.h>
|
|
#include "PowerManagement.h"
|
|
|
|
void Pwm_Init(
|
|
tPowerManagement *env,
|
|
tPower *Power,
|
|
tSIM800FPower *SIM800FPower,
|
|
tPRO04Power *PRO04Power
|
|
) {
|
|
env->Power = Power;
|
|
env->SIM800FPower = SIM800FPower;
|
|
env->PRO04Power = PRO04Power;
|
|
}
|
|
|
|
void Pwm_Power(tPowerManagement *env) {
|
|
// GpioPinSet(&env->Power->discretOut1_pd3, true);
|
|
GpioPinSet(&env->Power->discretOut1_pd0, true);
|
|
|
|
GpioPinSet(&env->Power->gonec_boot, false);
|
|
|
|
GpioPinSet(&env->Power->gonec_reset, true);
|
|
|
|
|
|
GpioPinSet(&env->Power->tx_pwr_5, true);
|
|
GpioPinSet(&env->Power->tx_pwr_en, false);
|
|
}
|
|
|
|
void Pwm_PRO04Startup(tPowerManagement *env) {
|
|
GpioPinSet(&env->PRO04Power->reset, false);
|
|
GpioPinSet(&env->PRO04Power->onOff, false);
|
|
GpioPinSet(&env->PRO04Power->pwr_en, false);
|
|
|
|
SystemDelayMs(50);
|
|
GpioPinSet(&env->PRO04Power->onOff, true);
|
|
SystemDelayMs(50);
|
|
GpioPinSet(&env->PRO04Power->reset, true);
|
|
SystemDelayMs(50);
|
|
}
|
|
|
|
void Pwm_SIM800FStartup(tPowerManagement *env) {
|
|
|
|
// Sleep
|
|
GpioPinSet(&env->SIM800FPower->dtr_sleep, false);
|
|
// Reset
|
|
GpioPinSet(&env->SIM800FPower->reset, true);
|
|
// Рабочее состояние
|
|
GpioPinSet(&env->SIM800FPower->pwrkey, false);
|
|
// Подача питания
|
|
GpioPinSet(&env->SIM800FPower->pwr_en, true);
|
|
|
|
SystemDelayMs(50);
|
|
// Включение
|
|
GpioPinSet(&env->SIM800FPower->pwrkey, true);
|
|
SystemDelayMs(1000);
|
|
// Возврат в рабочее состояние
|
|
GpioPinSet(&env->SIM800FPower->pwrkey, false);
|
|
SystemDelayMs(50);
|
|
|
|
}
|