diff options
| author | GuEe-GUI <[email protected]> | 2024-11-01 13:29:44 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2024-12-02 21:15:17 +0800 |
| commit | e3340eca342e921c2af1ad6e62a657b9c9c71059 (patch) | |
| tree | 3810e811f475f6757c7d7dadc151ea3e6faff34e /components/drivers/include | |
| parent | 16608279db514efb6f0cf796519f3d71c641c310 (diff) | |
[DM/FEATURE] Support virtual pin
1. There is only one GPIO device in System.
2. For Pin API input is pin number
3. Add sets pin debounce time API.
So we need a virtual pin for multi gpio chip.
Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/dev_pin.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/dev_pin.h b/components/drivers/include/drivers/dev_pin.h index e6ed7b6e83..b1705ae6dd 100644 --- a/components/drivers/include/drivers/dev_pin.h +++ b/components/drivers/include/drivers/dev_pin.h @@ -89,6 +89,8 @@ struct rt_pin_irqchip int irq; rt_base_t pin_range[2]; }; + +struct rt_pin_irq_hdr; #endif /* RT_USING_DM */ /** @@ -98,7 +100,13 @@ struct rt_device_pin { struct rt_device parent; #ifdef RT_USING_DM + /* MUST keep the order member after parent */ struct rt_pin_irqchip irqchip; + /* Fill by DM */ + rt_base_t pin_start; + rt_size_t pin_nr; + rt_list_t list; + struct rt_pin_irq_hdr *legacy_isr; #endif /* RT_USING_DM */ const struct rt_pin_ops *ops; }; @@ -212,6 +220,7 @@ struct rt_pin_ops rt_err_t (*pin_detach_irq)(struct rt_device *device, rt_base_t pin); rt_err_t (*pin_irq_enable)(struct rt_device *device, rt_base_t pin, rt_uint8_t enabled); rt_base_t (*pin_get)(const char *name); + rt_err_t (*pin_debounce)(struct rt_device *device, rt_base_t pin, rt_uint32_t debounce); #ifdef RT_USING_DM rt_err_t (*pin_irq_mode)(struct rt_device *device, rt_base_t pin, rt_uint8_t mode); rt_ssize_t (*pin_parse)(struct rt_device *device, struct rt_ofw_cell_args *args, rt_uint32_t *flags); @@ -284,6 +293,14 @@ rt_err_t rt_pin_detach_irq(rt_base_t pin); */ rt_err_t rt_pin_irq_enable(rt_base_t pin, rt_uint8_t enabled); +/** + * @brief set the pin's debounce time + * @param pin the pin number + * @param debounce time + * @return rt_err_t error code + */ +rt_err_t rt_pin_debounce(rt_base_t pin, rt_uint32_t debounce); + #ifdef RT_USING_DM rt_ssize_t rt_pin_get_named_pin(struct rt_device *dev, const char *propname, int index, rt_uint8_t *out_mode, rt_uint8_t *out_value); |
