diff options
| author | Stanley Lwin <[email protected]> | 2022-05-28 19:22:33 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-05-29 10:22:33 +0800 |
| commit | 04a17d469a686282254f038f78d634a7420a1e0d (patch) | |
| tree | d2cda9ffef9084744f7e014d1a2da7983fe7ef98 /bsp | |
| parent | ccfd2c3b285feb108469a6947859c3729f265ea1 (diff) | |
[device][adc] implement adc_get_vref (#5988)
* add adc_get_vref
add stm32_adc_get_vref
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_adc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c index dcff684461..f3ed29b255 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2021, RT-Thread Development Team + * Copyright (c) 2006-2022, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -10,6 +10,7 @@ * 2019-02-01 yuneizhilin fix the stm32_adc_init function initialization issue * 2020-06-17 thread-liu Porting for stm32mp1xx * 2020-10-14 Dozingfiretruck Porting for stm32wbxx + * 2022-05-22 Stanley Lwin Add stm32_adc_get_vref */ #include <board.h> @@ -170,6 +171,12 @@ static rt_uint32_t stm32_adc_get_channel(rt_uint32_t channel) return stm32_channel; } +static rt_int16_t stm32_adc_get_vref (struct rt_adc_device *device) +{ + RT_ASSERT(device); + return 3300; +} + static rt_err_t stm32_adc_get_value(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value) { ADC_ChannelConfTypeDef ADC_ChanConf; @@ -285,6 +292,7 @@ static const struct rt_adc_ops stm_adc_ops = .enabled = stm32_adc_enabled, .convert = stm32_adc_get_value, .get_resolution = stm32_adc_get_resolution, + .get_vref = stm32_adc_get_vref, }; static int stm32_adc_init(void) |
