完善PGA设置:ADC通道改为CH6、添加PB4(PGA2_OUT)模拟模式、配置CHSMPR2采样时间
This commit is contained in:
+5
-1
@@ -116,6 +116,9 @@ static void gpio_pin_init(void)
|
||||
cfg.port = GPIOB;
|
||||
cfg.pin = 3;
|
||||
gpio_init(&cfg);
|
||||
cfg.port = GPIOB;
|
||||
cfg.pin = 4;
|
||||
gpio_init(&cfg);
|
||||
}
|
||||
|
||||
static void uart_config_all(void)
|
||||
@@ -210,7 +213,8 @@ int main(void)
|
||||
|
||||
log_out("INFO: System initialized\n");
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
work_task_run();
|
||||
monitor_task_run();
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ ret_code_t adc_init(void)
|
||||
|
||||
ADC1->CFGR1 = ADC_CFGR1_RES_1;
|
||||
|
||||
ADC1->CHSMPR2 = (0x7 << 0);
|
||||
ADC1->CHSMPR2 = (0x7 << 3);
|
||||
|
||||
ADC1->SMPR1 = 0x07;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "sys_data_bus.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define PGA_ADC_CH ADC_CH_0
|
||||
#define PGA_ADC_CH ADC_CH_6
|
||||
|
||||
#define PGA_GAIN_1 0x00
|
||||
#define PGA_GAIN_2 0x01
|
||||
|
||||
Reference in New Issue
Block a user