Изменения на новые настройки пинов и устройств

This commit is contained in:
cfif 2025-05-28 15:16:06 +03:00
parent 5ce1eb2440
commit cd69a1a277
2 changed files with 23 additions and 60 deletions

View File

@ -7,56 +7,38 @@
void Pwm_Init(
tPowerManagement *env,
tPower *Power,
tSIM800FPower *SIM800FPower,
tPRO04Power *PRO04Power
tSIM7682EPower *SIM7682EPower,
tSIM68Power *SIM68Power
) {
env->Power = Power;
env->SIM800FPower = SIM800FPower;
env->PRO04Power = PRO04Power;
env->SIM7682EPower = SIM7682EPower;
env->SIM68Power = SIM68Power;
}
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_SIM68Startup(tPowerManagement *env) {
GpioPinSet(&env->SIM68Power->reset, true);
GpioPinSet(&env->SIM68Power->pwr_en, false);
}
void Pwm_SIM800FStartup(tPowerManagement *env) {
void Pwm_SIM7682EStartup(tPowerManagement *env) {
// Sleep
GpioPinSet(&env->SIM800FPower->dtr_sleep, false);
// Reset
GpioPinSet(&env->SIM800FPower->reset, true);
GpioPinSet(&env->SIM7682EPower->reset, true);
// Рабочее состояние
GpioPinSet(&env->SIM800FPower->pwrkey, false);
GpioPinSet(&env->SIM7682EPower->pwrkey, false);
// Подача питания
GpioPinSet(&env->SIM800FPower->pwr_en, true);
GpioPinSet(&env->SIM7682EPower->pwr_en, true);
SystemDelayMs(50);
// Включение
GpioPinSet(&env->SIM800FPower->pwrkey, true);
GpioPinSet(&env->SIM7682EPower->pwrkey, true);
SystemDelayMs(1000);
// Возврат в рабочее состояние
GpioPinSet(&env->SIM800FPower->pwrkey, false);
GpioPinSet(&env->SIM7682EPower->pwrkey, false);
SystemDelayMs(50);
}

View File

@ -8,57 +8,38 @@
#include "SerialPorts.h"
#include "stdint.h"
#include "GpioPin.h"
#include "SpiPorts.h"
typedef struct {
tGpioPin pwrkey;
tGpioPin reset;
tGpioPin pwr_en;
tGpioPin dtr_sleep;
} tSIM800FPower;
tGpioPin pwr_mon;
} tSIM7682EPower;
typedef struct {
tGpioPin onOff;
tGpioPin reset;
tGpioPin pwr_en;
} tPRO04Power;
tGpioPin ppc_mcu;
} tSIM68Power;
typedef struct {
tGpioPin gpio1;
tGpioPin gpio4;
tGpioPin gonec_pwr_amp;
// tGpioPin gonec_is_prm;
tGpioPin gonec_boot;
tGpioPin gonec_reset;
tGpioPin tx_pwr_en;
tGpioPin tx_pwr_5;
tGpioPin tx_pwr_good;
tGpioPin discretOut1_pd3;
tGpioPin discretOut1_pd0;
tGpioPin discretIn1_pg3;
tGpioPin discretIn1_pg2;
} tPower;
typedef struct {
tSIM800FPower *SIM800FPower;
tPRO04Power *PRO04Power;
tSIM7682EPower *SIM7682EPower;
tSIM68Power *SIM68Power;
tPower *Power;
} tPowerManagement;
void Pwm_Init(
tPowerManagement *env,
tPower *Power,
tSIM800FPower *SIM800FPower,
tPRO04Power *PRO04Power
tSIM7682EPower *SIM7682EPower,
tSIM68Power *SIM68Power
);
void Pwm_Power(tPowerManagement *env);
void Pwm_SIM800FStartup(tPowerManagement *env);
void Pwm_PRO04Startup(tPowerManagement *env);
void Pwm_SIM7682EStartup(tPowerManagement *env);
void Pwm_SIM68Startup(tPowerManagement *env);
#endif //POWERMANAGEMENT_H