From 8097e6cf7381ee4941462e9ba4552c5cfd8ef258 Mon Sep 17 00:00:00 2001 From: cfif Date: Mon, 26 May 2025 14:41:46 +0300 Subject: [PATCH] Init --- Adcs.c | 27 +++++++++++++++++++++++++++ Adcs.h | 20 ++++++++++++++++++++ modular.json | 17 +++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 Adcs.c create mode 100644 Adcs.h create mode 100644 modular.json diff --git a/Adcs.c b/Adcs.c new file mode 100644 index 0000000..fce7815 --- /dev/null +++ b/Adcs.c @@ -0,0 +1,27 @@ +// +// Created by xemon on 29.08.22. +// +#include "Adcs.h" +#include "at32f435_437.h" +//#include "GpioPin.h" + +tAdcs ADCS; + +void Adcs_Init() { + tAdcs *env = &ADCS; + + gpio_init_type gpio_initstructure; + crm_periph_clock_enable(CRM_GPIOF_PERIPH_CLOCK, TRUE); + crm_periph_clock_enable(CRM_ADC3_PERIPH_CLOCK, TRUE); + + gpio_default_para_init(&gpio_initstructure); + + /* config adc pin as analog input mode */ + gpio_initstructure.gpio_mode = GPIO_MODE_ANALOG; + gpio_initstructure.gpio_pins = GPIO_PINS_8; + gpio_init(GPIOF, &gpio_initstructure); + + env->vcc = ADC_Initial(ADC3, ADC_CHANNEL_6, 0, 1, 1); + env->vccIo = vAdcGetIo(&env->vcc); + +} \ No newline at end of file diff --git a/Adcs.h b/Adcs.h new file mode 100644 index 0000000..74e1e53 --- /dev/null +++ b/Adcs.h @@ -0,0 +1,20 @@ +// +// Created by xemon on 29.08.22. +// + +#ifndef UVEOS_DEMO_ON_NIIET_MCU_ADCS_H +#define UVEOS_DEMO_ON_NIIET_MCU_ADCS_H + +#include "AdcArtery.h" + + +typedef struct { + tAdcArtery vcc; + tAdcIO vccIo; +} tAdcs; + +extern tAdcs ADCS; + +void Adcs_Init(); + +#endif //UVEOS_DEMO_ON_NIIET_MCU_ADCS_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..6431d83 --- /dev/null +++ b/modular.json @@ -0,0 +1,17 @@ +{ + "dep": [ + { + "type": "git", + "provider": "GONEC_NEW", + "repo": "AdcInterface" + } + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "*.c" + ] + } +} \ No newline at end of file