Init
This commit is contained in:
commit
5ce1eb2440
|
|
@ -0,0 +1,62 @@
|
||||||
|
//
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
//
|
||||||
|
// Created by cfif on 27.09.22.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef POWERMANAGEMENT_H
|
||||||
|
#define POWERMANAGEMENT_H
|
||||||
|
|
||||||
|
#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;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
tGpioPin onOff;
|
||||||
|
tGpioPin reset;
|
||||||
|
tGpioPin pwr_en;
|
||||||
|
} tPRO04Power;
|
||||||
|
|
||||||
|
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;
|
||||||
|
tPower *Power;
|
||||||
|
} tPowerManagement;
|
||||||
|
|
||||||
|
void Pwm_Init(
|
||||||
|
tPowerManagement *env,
|
||||||
|
tPower *Power,
|
||||||
|
tSIM800FPower *SIM800FPower,
|
||||||
|
tPRO04Power *PRO04Power
|
||||||
|
);
|
||||||
|
|
||||||
|
void Pwm_Power(tPowerManagement *env);
|
||||||
|
void Pwm_SIM800FStartup(tPowerManagement *env);
|
||||||
|
void Pwm_PRO04Startup(tPowerManagement *env);
|
||||||
|
|
||||||
|
#endif //POWERMANAGEMENT_H
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue