Обновление
This commit is contained in:
commit
6e542218f8
|
|
@ -0,0 +1,75 @@
|
||||||
|
//
|
||||||
|
// Created by ilya on 14.12.23.
|
||||||
|
//
|
||||||
|
#include <stdbool.h>
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue