Skip to content

Conversation

@songzhishuo
Copy link

No description provided.

宋志硕 added 2 commits January 27, 2022 23:47
fix PinDescription gpio pin and port define
fix incorrect use of pointers in ADC deinit function
void Error_Handler(void);
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc);

void analogReference(uint32_t val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

analogReference 是参考电压 这个地方 不是很明确 意思

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里我理解错误,我理解成误差设置了。那就没法支持参考电压设置了


for (int i = 0; i < ADC_COUNT; i++)
{
if(hadc->Init.channel == adcPinState[i].hadc.Init.channel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(hadc->Init.channel == adcPinState[i].hadc.Init.channel) if 后面空格 所有的都改一下

if (hadc->Instance == ADC)
{
__HAL_RCC_ADC_CLK_ENABLE();
__HAL_RCC_GPIO_CLK_ENABLE();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__HAL_RCC_GPIO_CLK_ENABLE(); 可以注释掉 因为wiring.c init函数中已经调用过一次

uint32_t val = 0;
uint8_t channel_index = 0;

if(g_APinDescription[pin].ulPinAttribute & PIN_ATTR_ANALOG)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空格

#include "pins_arduino.h"
#include "./include/driver/wm_hal.h"

#include "./include/driver/wm_adc.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是包含 #include "./include/driver/wm_hal.h" 会包含所有 hal层 的.h 文件


if(g_pinStatus[pin] != PIN_ATTR_ANALOG)
{
g_pinStatus[pin] = PIN_ATTR_ANALOG;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哪些地方 设置非ADC状态?

ADC_Channel1 = ADC_ANA_CR_CH_0,
ADC_Channel2 = ADC_ANA_CR_CH_1,
ADC_Channel3 = ADC_ANA_CR_CH_2,
ADC_Channel4 = ADC_ANA_CR_CH_3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该把差分ADC 频道也加进来

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

差分的话目前没法直接通过analogread去配置,目前先支持标准功能吧,差分后面再加上


for (i = 0; i < 4; i++)
{
if (adcPinState[i].ch_state == ADC_INIT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ADC_INIT 标记位没有起作用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants