Init
This commit is contained in:
commit
4a1d08654b
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue