-
Notifications
You must be signed in to change notification settings - Fork 21
ADC function and gpio status map #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analogReference 是参考电压 这个地方 不是很明确 意思
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该把差分ADC 频道也加进来
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADC_INIT 标记位没有起作用
No description provided.