Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions components/drivers/include/drivers/dev_pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ rt_err_t rt_pwm_set_dead_time(struct rt_device_pwm *device, int channel, rt_uint
*/
rt_err_t rt_pwm_set_phase(struct rt_device_pwm *device, int channel, rt_uint32_t phase);

/**
* @brief get the PWM configuration
* @param device the PWM device
* @param cfg the configuration of PWM
* @return rt_err_t error code
*/
rt_err_t rt_pwm_get(struct rt_device_pwm *device, struct rt_pwm_configuration *cfg);

/*! @}*/

#endif /* __DEV_PWM_H__ */
12 changes: 10 additions & 2 deletions components/drivers/misc/Kconfig
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions components/drivers/misc/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion components/drivers/misc/rt_drv_pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down