commit 4a1d08654b247b0dc6c8c1d79ed3b0742d704be9 Author: cfif Date: Mon Jun 2 13:26:40 2025 +0300 Init diff --git a/PwmSim7600e.c b/PwmSim7600e.c new file mode 100644 index 0000000..65c2137 --- /dev/null +++ b/PwmSim7600e.c @@ -0,0 +1,55 @@ +// +// Created by xemon on 04.01.23. +// + +#include "SystemDelayInterface.h" +#include "PwmSim7600e.h" + + +bool PwmSim7600e_Startup(tSim7600ePower *env) { + GpioPinEnable(&env->gsm.PowerGsm); + uint32_t tm = SystemGetMs() + 1000; + while (tm > SystemGetMs()){ + GpioPinEnable(&env->gsm.powerKey); + SystemDelayMs(500); + GpioPinDisable(&env->gsm.powerKey); + SystemDelayMs(100); + if(GpioPinGet(&env->gsm.PowerCheckGsm) == true){ + return true; + } + } + return false; +} + +void PwmSim7600e_SimChipSelector(tSim7600ePower *env, tThisSimChip thisSimChip) { + env->thisSimChip = thisSimChip; + if(env->thisSimChip == CHIP_ERA) { + GpioPinSet(&env->SimSelector, false); + } else{ + GpioPinSet(&env->SimSelector, true); + } +} + +bool PwmSim7600e_ShutDown(tSim7600ePower *env) { + GpioPinDisable(&env->gsm.PowerGsm); + GpioPinDisable(&env->gsm.disCharge); + SystemDelayMs(100); + GpioPinEnable(&env->dtr); + SystemDelayMs(100); + GpioPinEnable(&env->gsm.disCharge); + SystemDelayMs(500); + GpioPinDisable(&env->gsm.disCharge); + SystemDelayMs(500); + return false; +} + +bool PwmSim7600e_WhiteIsLoad(tSim7600ePower *env) { +// uint64_t time = SystemGetMs() + 5000; +// +// while (SystemGetMs() < time){ +// if(GpioPinGet(&env->powerStatus)){ +// return true; +// } +// } +// return false; +} \ No newline at end of file diff --git a/PwmSim7600e.h b/PwmSim7600e.h new file mode 100644 index 0000000..5720bb5 --- /dev/null +++ b/PwmSim7600e.h @@ -0,0 +1,37 @@ +// +// Created by xemon on 04.01.23. +// + +#ifndef UVEOS_ON_NATION_PWMSIM7600E_H +#define UVEOS_ON_NATION_PWMSIM7600E_H + +#include "GpioPin.h" + +typedef enum { + CHIP_ERA = 0, + CHIP_COMERS = 1, +} tThisSimChip; + +typedef struct { + struct { + tGpioPin PowerGsm; + tGpioPin ChargeC; + tGpioPin disCharge; + tGpioPin powerKey; + tGpioPin PowerCheckGsm; + } gsm; + tGpioPin dtr; + tGpioPin powerStatus; + tGpioPin reset; + tGpioPin convertOE; + tGpioPin LNASupport; + tGpioPin SimSelector; + tThisSimChip thisSimChip; +} tSim7600ePower; + +bool PwmSim7600e_Startup(tSim7600ePower *env); +bool PwmSim7600e_ShutDown(tSim7600ePower *env); +void PwmSim7600e_SimChipSelector(tSim7600ePower *env, tThisSimChip thisSimChip); +bool PwmSim7600e_WhiteIsLoad(tSim7600ePower *env); + +#endif //UVEOS_ON_NATION_PWMSIM7600E_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..d21aef0 --- /dev/null +++ b/modular.json @@ -0,0 +1,22 @@ +{ + "dep": [ + { + "type": "git", + "provider": "Smart_Components_Aurus", + "repo": "GpioPinInterface" + }, + { + "type": "git", + "provider": "Smart_Components_Aurus", + "repo": "SystemDelayInterface" + } + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file