From 053dfc28ba893fe9297b882f531a908ae2226670 Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 30 Mar 2026 14:25:13 +0300 Subject: [PATCH] Init --- Gpios.c | 34 ++++++++++++++++++++++++++++++++++ Gpios.h | 23 +++++++++++++++++++++++ modular.json | 22 ++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 Gpios.c create mode 100644 Gpios.h create mode 100644 modular.json diff --git a/Gpios.c b/Gpios.c new file mode 100644 index 0000000..2a5a9c0 --- /dev/null +++ b/Gpios.c @@ -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); +} \ No newline at end of file diff --git a/Gpios.h b/Gpios.h new file mode 100644 index 0000000..1675082 --- /dev/null +++ b/Gpios.h @@ -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 diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..c005240 --- /dev/null +++ b/modular.json @@ -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" + ] + } +} \ No newline at end of file