commit 6e542218f8a7172271b68464c8e8d3fc80095931 Author: cfif Date: Thu Oct 9 10:58:41 2025 +0300 Обновление diff --git a/Adcs.c b/Adcs.c new file mode 100644 index 0000000..e585054 --- /dev/null +++ b/Adcs.c @@ -0,0 +1,75 @@ +// +// Created by ilya on 14.12.23. +// +#include +#include "fc7xxx_driver_port.h" +#include "Adcs.h" + + +tAdcs ADCS; + +void Bsp_ADC0_HandleResult(const uint32_t *const pBuffer) { + +} + +#define ADC0_CHN_NUM_EN 2 + +static uint32_t s_aAdc0ResultBuf[ADC0_CHN_NUM_EN] = {0U}; + +static const ADC_ChannelCfgType s_aChannels[ADC0_CHN_NUM_EN] = + { + { + .eChannel = ADC_CHANNEL_10, + .eSampleTimeOption = ADC_SAMPLE_TIME_OPTION_1 + }, + { + .eChannel = ADC_CHANNEL_11, + .eSampleTimeOption = ADC_SAMPLE_TIME_OPTION_1 + } + }; + + +void Adcs_Init() { + tAdcs *env = &ADCS; + + PORT_InitType tInitStruct = {0}; + + /* PTD16: ADC0_SE10 */ + tInitStruct.u32PortPins = PORT_PIN_16; + tInitStruct.uPortPinMux.u32PortPinMode = PORTD_16_ADC0_SE10_CMP0_IN0; + tInitStruct.bPullEn = false; + tInitStruct.ePullSel = PORT_PULL_UP; + PORT_InitPins(PORT_D, &tInitStruct); + + /* PTD15: ADC0_SE11 */ + tInitStruct.u32PortPins = PORT_PIN_15; + tInitStruct.uPortPinMux.u32PortPinMode = PORTD_15_ADC0_SE11_CMP0_IN1; + tInitStruct.bPullEn = false; + tInitStruct.ePullSel = PORT_PULL_UP; + PORT_InitPins(PORT_D, &tInitStruct); + + env->vcc = ADC_Initial( + ADC_INSTANCE_0, // ADC_INSTANCE_0, ADC_INSTANCE_1 + + PCC_CLK_ADC0, // PCC_CLK_ADC0, PCC_CLK_ADC1 + + DMA_CHANNEL_3, // DMA_CHANNEL_0 .. DMA_CHANNEL_15 + + DMA2_IRQn, + 0x55, + 2, + + s_aAdc0ResultBuf, + + ADC0_CHN_NUM_EN, + (ADC_ChannelCfgType *)s_aChannels, + + 0, + 0, + 0, + + Bsp_ADC0_HandleResult + ); + + env->vccIo = vAdcGetIo(&env->vcc); +} diff --git a/Adcs.h b/Adcs.h new file mode 100644 index 0000000..2c4fd81 --- /dev/null +++ b/Adcs.h @@ -0,0 +1,19 @@ +// +// Created by ilya on 14.12.23. +// + +#ifndef FLAG_ADCS_H +#define FLAG_ADCS_H + +#include "AdcFlagchip.h" + +typedef struct { + tAdcFlagchip vcc; + tAdcIO vccIo; +} tAdcs; + +extern tAdcs ADCS; + +void Adcs_Init(); + +#endif //FLAG_ADCS_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..9589ff8 --- /dev/null +++ b/modular.json @@ -0,0 +1,13 @@ +{ + "dep": [ + + ], + "cmake": { + "inc_dirs": [ + "./" + ], + "srcs": [ + "./**.c" + ] + } +} \ No newline at end of file