From f1c8696ec53b020d3b6d0d5f5465c07c001218d8 Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 24 Jan 2025 13:22:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2=D1=83=D1=8E=20=D0=BE=D1=80?= =?UTF-8?q?=D0=B3=D0=B0=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8E=20GONEC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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..2ff518e --- /dev/null +++ b/modular.json @@ -0,0 +1,17 @@ +{ + "dep": [ + { + "type": "git", + "provider": "GONEC", + "repo": "AdcInterface" + } + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "*.c" + ] + } +} \ No newline at end of file