mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-24 05:04:10 +08:00
[Driver][MISC] Update ADC/PWM (#11003)
* [DM][MISC] Make Kconfig(ADC/PWM) import for DM * [Driver][MISC][ADC] Fixup ADC 1. Fixup error no. 2. Fixup type of control for args. 3. Fixup value no init. * [Driver][MISC][PWM] Enable `rt_pwm_get` API Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
config RT_USING_ADC
|
||||
menuconfig RT_USING_ADC
|
||||
bool "Using ADC device drivers"
|
||||
default n
|
||||
|
||||
if RT_USING_DM && RT_USING_ADC
|
||||
osource "$(SOC_DM_ADC_DIR)/Kconfig"
|
||||
endif
|
||||
|
||||
config RT_USING_DAC
|
||||
bool "Using DAC device drivers"
|
||||
default n
|
||||
@@ -18,10 +22,14 @@ config RT_USING_RANDOM
|
||||
bool "Using RANDOM device drivers"
|
||||
default n
|
||||
|
||||
config RT_USING_PWM
|
||||
menuconfig RT_USING_PWM
|
||||
bool "Using PWM device drivers"
|
||||
default n
|
||||
|
||||
if RT_USING_DM && RT_USING_PWM
|
||||
osource "$(SOC_DM_PWM_DIR)/Kconfig"
|
||||
endif
|
||||
|
||||
config RT_USING_PULSE_ENCODER
|
||||
bool "Using PULSE ENCODER device drivers"
|
||||
default n
|
||||
|
||||
@@ -43,7 +43,7 @@ static rt_ssize_t _adc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size
|
||||
static rt_err_t _adc_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
rt_adc_device_t adc = (struct rt_adc_device *)dev;
|
||||
rt_err_t result = RT_ERROR;
|
||||
rt_err_t result = -RT_ERROR;
|
||||
|
||||
if (cmd == RT_ADC_CMD_ENABLE && adc->ops->enabled)
|
||||
{
|
||||
@@ -167,7 +167,7 @@ rt_int16_t rt_adc_voltage(rt_adc_device_t dev, rt_int8_t channel)
|
||||
RT_ASSERT(dev);
|
||||
|
||||
rt_uint32_t value;
|
||||
rt_int16_t vref, voltage;
|
||||
rt_int16_t vref, voltage = 0;
|
||||
rt_uint8_t resolution;
|
||||
rt_err_t result;
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ rt_err_t rt_pwm_set_phase(struct rt_device_pwm *device, int channel, rt_uint32_t
|
||||
return result;
|
||||
}
|
||||
|
||||
static rt_err_t rt_pwm_get(struct rt_device_pwm *device, struct rt_pwm_configuration *cfg)
|
||||
rt_err_t rt_pwm_get(struct rt_device_pwm *device, struct rt_pwm_configuration *cfg)
|
||||
{
|
||||
rt_err_t result = RT_EOK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user