48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
//
|
|
// Created by xemon on 29.08.22.
|
|
//
|
|
#include "Gpios.h"
|
|
#include "SystemDelayInterface.h"
|
|
|
|
tGpios GPIOS;
|
|
|
|
static void vPowerManagementInitComInt485(tRs485DirectionPins *env) {
|
|
env->transmit = InitGpioPin(GPIOD, GPIO_PINS_4, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->receive = InitGpioPin(GPIOD, GPIO_PINS_4, GPIO_MODE_OUTPUT, GPIO_PIN_REVERSE);
|
|
}
|
|
|
|
static void Gpios_Power(tPower *env) {
|
|
|
|
}
|
|
|
|
static void Gpios_InitSIM7682E(tSIM7682EPower *env) {
|
|
env->pwrkey = InitGpioPin(GPIOG, GPIO_PINS_9, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->reset = InitGpioPin(GPIOG, GPIO_PINS_11, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->pwr_en = InitGpioPin(GPIOD, GPIO_PINS_15, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->pwr_mon = InitGpioPin(GPIOG, GPIO_PINS_0, GPIO_MODE_INPUT, GPIO_PIN_NOREVERSE);
|
|
}
|
|
|
|
static void Gpios_InitSIM68(tSIM68Power *env) {
|
|
env->reset = InitGpioPin(GPIOD, GPIO_PINS_13, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->pwr_en = InitGpioPin(GPIOD, GPIO_PINS_14, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
|
|
env->ppc_mcu = InitGpioPin(GPIOD, GPIO_PINS_12, GPIO_MODE_INPUT, GPIO_PIN_NOREVERSE);
|
|
}
|
|
|
|
|
|
void Gpios_Init() {
|
|
crm_periph_clock_enable(CRM_GPIOA_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOD_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOE_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOF_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOH_PERIPH_CLOCK, TRUE);
|
|
crm_periph_clock_enable(CRM_GPIOG_PERIPH_CLOCK, TRUE);
|
|
|
|
tGpios *env = &GPIOS;
|
|
|
|
vPowerManagementInitComInt485(&env->comIntDir);
|
|
Gpios_Power(&env->Power);
|
|
Gpios_InitSIM7682E(&env->SIM7682EPower);
|
|
Gpios_InitSIM68(&env->SIM68Power);
|
|
} |