This commit is contained in:
cfif 2026-03-30 14:25:13 +03:00
commit 053dfc28ba
3 changed files with 79 additions and 0 deletions

34
Gpios.c Normal file
View File

@ -0,0 +1,34 @@
//
// Created by cfif on 05.05.23.
//
#include "Gpios.h"
#include "SystemDelayInterface.h"
tGpios GPIOS;
static void Gpios_Led(tLed *env) {
env->ledR1 = InitGpioPin(GPIOE, GPIO_PINS_12, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
env->ledG1 = InitGpioPin(GPIOE, GPIO_PINS_13, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
env->ledR2 = InitGpioPin(GPIOF, GPIO_PINS_14, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
env->ledG2 = InitGpioPin(GPIOF, GPIO_PINS_15, GPIO_MODE_OUTPUT, 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;
// env->comIntDir.de = InitGpioPin(GPIOD, GPIO_PINS_12, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
env->CAN1_STB = InitGpioPin(GPIOD, GPIO_PINS_13, GPIO_MODE_OUTPUT, GPIO_PIN_NOREVERSE);
GpioPinSet(&env->CAN1_STB, false);
Gpios_Led(&env->Led);
}

23
Gpios.h Normal file
View File

@ -0,0 +1,23 @@
//
// Created by cfif on 05.05.23.
//
#ifndef WATER_BOX_BSD_GPIOS_H
#define WATER_BOX_BSD_GPIOS_H
#include "SerialPorts.h"
#include "GpioPin.h"
#include "PowerManagement.h"
typedef struct {
tLed Led;
tRs485DirectionPins comIntDir;
tGpioPin CAN1_STB;
tGpioPin CAN2_STB;
} tGpios;
extern tGpios GPIOS;
void Gpios_Init();
#endif //WATER_BOX_BSD_GPIOS_H

22
modular.json Normal file
View File

@ -0,0 +1,22 @@
{
"dep": [
{
"type": "git",
"provider": "HVAC_DEV",
"repo": "GpioPin_ARTERY_AT32"
},
{
"type": "git",
"provider": "HVAC_DEV",
"repo": "SystemDelay_CMSIS_RTOS"
}
],
"cmake": {
"inc_dirs": [
"./"
],
"srcs": [
"Gpios.c"
]
}
}