mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[device]Detailed classification of devices types (#5769)
This commit is contained in:
@@ -29,6 +29,10 @@
|
||||
#define RT_ALARM_MINUTE 0x2000 /* alarm each minute at a certain second */
|
||||
#define RT_ALARM_SECOND 0x4000 /* alarm each second */
|
||||
|
||||
#define RT_ALARM_STATE_INITED 0x02
|
||||
#define RT_ALARM_STATE_START 0x01
|
||||
#define RT_ALARM_STATE_STOP 0x00
|
||||
|
||||
/* alarm control cmd */
|
||||
#define RT_ALARM_CTRL_MODIFY 1 /* modify alarm time or alarm flag */
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef struct rt_dac_device *rt_dac_device_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RT_DAC_CMD_ENABLE,
|
||||
RT_DAC_CMD_DISABLE,
|
||||
RT_DAC_CMD_ENABLE = RT_DEVICE_CTRL_BASE(DAC) + 0,
|
||||
RT_DAC_CMD_DISABLE = RT_DEVICE_CTRL_BASE(DAC) + 1,
|
||||
} rt_dac_cmd_t;
|
||||
|
||||
rt_err_t rt_hw_dac_register(rt_dac_device_t dac,const char *name, const struct rt_dac_ops *ops, const void *user_data);
|
||||
|
||||
@@ -19,10 +19,10 @@ extern "C" {
|
||||
/* Timer Control Command */
|
||||
typedef enum
|
||||
{
|
||||
HWTIMER_CTRL_FREQ_SET = 0x01, /* set the count frequency */
|
||||
HWTIMER_CTRL_STOP, /* stop timer */
|
||||
HWTIMER_CTRL_INFO_GET, /* get a timer feature information */
|
||||
HWTIMER_CTRL_MODE_SET /* Setting the timing mode(oneshot/period) */
|
||||
HWTIMER_CTRL_FREQ_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x01, /* set the count frequency */
|
||||
HWTIMER_CTRL_STOP = RT_DEVICE_CTRL_BASE(Timer) + 0x02, /* stop timer */
|
||||
HWTIMER_CTRL_INFO_GET = RT_DEVICE_CTRL_BASE(Timer) + 0x03, /* get a timer feature information */
|
||||
HWTIMER_CTRL_MODE_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x04 /* Setting the timing mode(oneshot/period) */
|
||||
} rt_hwtimer_ctrl_t;
|
||||
|
||||
/* Timing Mode */
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RT_I2C_DEV_CTRL_10BIT 0x20
|
||||
#define RT_I2C_DEV_CTRL_TIMEOUT 0x22
|
||||
#define RT_I2C_DEV_CTRL_RW 0x23
|
||||
#define RT_I2C_DEV_CTRL_CLK 0x24
|
||||
#define RT_I2C_DEV_CTRL_10BIT (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x01)
|
||||
#define RT_I2C_DEV_CTRL_ADDR (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x02)
|
||||
#define RT_I2C_DEV_CTRL_TIMEOUT (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x03)
|
||||
#define RT_I2C_DEV_CTRL_RW (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x04)
|
||||
#define RT_I2C_DEV_CTRL_CLK (RT_DEVICE_CTRL_BASE(I2CBUS) + 0x05)
|
||||
|
||||
struct rt_i2c_priv_data
|
||||
{
|
||||
|
||||
@@ -115,8 +115,8 @@ enum pm_module_id {
|
||||
/**
|
||||
* device control flag to request or release power
|
||||
*/
|
||||
#define RT_PM_DEVICE_CTRL_REQUEST 0x01
|
||||
#define RT_PM_DEVICE_CTRL_RELEASE 0x00
|
||||
#define RT_PM_DEVICE_CTRL_RELEASE (RT_DEVICE_CTRL_BASE(PM) + 0x00)
|
||||
#define RT_PM_DEVICE_CTRL_REQUEST (RT_DEVICE_CTRL_BASE(PM) + 0x01)
|
||||
|
||||
struct rt_pm;
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#define PWM_CMD_ENABLE (128 + 0)
|
||||
#define PWM_CMD_DISABLE (128 + 1)
|
||||
#define PWM_CMD_SET (128 + 2)
|
||||
#define PWM_CMD_GET (128 + 3)
|
||||
#define PWMN_CMD_ENABLE (128 + 4)
|
||||
#define PWMN_CMD_DISABLE (128 + 5)
|
||||
#define PWM_CMD_ENABLE (RT_DEVICE_CTRL_BASE(PWM) + 0)
|
||||
#define PWM_CMD_DISABLE (RT_DEVICE_CTRL_BASE(PWM) + 1)
|
||||
#define PWM_CMD_SET (RT_DEVICE_CTRL_BASE(PWM) + 2)
|
||||
#define PWM_CMD_GET (RT_DEVICE_CTRL_BASE(PWM) + 3)
|
||||
#define PWMN_CMD_ENABLE (RT_DEVICE_CTRL_BASE(PWM) + 4)
|
||||
#define PWMN_CMD_DISABLE (RT_DEVICE_CTRL_BASE(PWM) + 5)
|
||||
|
||||
struct rt_pwm_configuration
|
||||
{
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIME 0x20 /**< get second time */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_TIME 0x21 /**< set second time */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIMEVAL 0x22 /**< get timeval for gettimeofday */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_TIMEVAL 0x23 /**< set timeval for gettimeofday */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_ALARM 0x24 /**< get alarm */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x25 /**< set alarm */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIME (RT_DEVICE_CTRL_BASE(RTC) + 0x01) /**< get second time */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_TIME (RT_DEVICE_CTRL_BASE(RTC) + 0x02) /**< set second time */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_TIMEVAL (RT_DEVICE_CTRL_BASE(RTC) + 0x03) /**< get timeval for gettimeofday */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_TIMEVAL (RT_DEVICE_CTRL_BASE(RTC) + 0x04) /**< set timeval for gettimeofday */
|
||||
#define RT_DEVICE_CTRL_RTC_GET_ALARM (RT_DEVICE_CTRL_BASE(RTC) + 0x05) /**< get alarm */
|
||||
#define RT_DEVICE_CTRL_RTC_SET_ALARM (RT_DEVICE_CTRL_BASE(RTC) + 0x06) /**< set alarm */
|
||||
|
||||
struct rt_rtc_ops
|
||||
{
|
||||
|
||||
@@ -119,13 +119,13 @@ extern "C" {
|
||||
|
||||
/* Sensor control cmd types */
|
||||
|
||||
#define RT_SENSOR_CTRL_GET_ID (0) /* Get device id */
|
||||
#define RT_SENSOR_CTRL_GET_INFO (1) /* Get sensor info */
|
||||
#define RT_SENSOR_CTRL_SET_RANGE (2) /* Set the measure range of sensor. unit is info of sensor */
|
||||
#define RT_SENSOR_CTRL_SET_ODR (3) /* Set output date rate. unit is HZ */
|
||||
#define RT_SENSOR_CTRL_SET_MODE (4) /* Set sensor's work mode. ex. RT_SENSOR_MODE_POLLING,RT_SENSOR_MODE_INT */
|
||||
#define RT_SENSOR_CTRL_SET_POWER (5) /* Set power mode. args type of sensor power mode. ex. RT_SENSOR_POWER_DOWN,RT_SENSOR_POWER_NORMAL */
|
||||
#define RT_SENSOR_CTRL_SELF_TEST (6) /* Take a self test */
|
||||
#define RT_SENSOR_CTRL_GET_ID (RT_DEVICE_CTRL_BASE(Sensor) + 0) /* Get device id */
|
||||
#define RT_SENSOR_CTRL_GET_INFO (RT_DEVICE_CTRL_BASE(Sensor) + 1) /* Get sensor info */
|
||||
#define RT_SENSOR_CTRL_SET_RANGE (RT_DEVICE_CTRL_BASE(Sensor) + 2) /* Set the measure range of sensor. unit is info of sensor */
|
||||
#define RT_SENSOR_CTRL_SET_ODR (RT_DEVICE_CTRL_BASE(Sensor) + 3) /* Set output date rate. unit is HZ */
|
||||
#define RT_SENSOR_CTRL_SET_MODE (RT_DEVICE_CTRL_BASE(Sensor) + 4) /* Set sensor's work mode. ex. RT_SENSOR_MODE_POLLING,RT_SENSOR_MODE_INT */
|
||||
#define RT_SENSOR_CTRL_SET_POWER (RT_DEVICE_CTRL_BASE(Sensor) + 5) /* Set power mode. args type of sensor power mode. ex. RT_SENSOR_POWER_DOWN,RT_SENSOR_POWER_NORMAL */
|
||||
#define RT_SENSOR_CTRL_SELF_TEST (RT_DEVICE_CTRL_BASE(Sensor) + 6) /* Take a self test */
|
||||
|
||||
#define RT_SENSOR_CTRL_USER_CMD_START 0x100 /* User commands should be greater than 0x100 */
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#define RT_DEVICE_CTRL_WDT_GET_TIMEOUT (1) /* get timeout(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_SET_TIMEOUT (2) /* set timeout(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_GET_TIMELEFT (3) /* get the left time before reboot(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_KEEPALIVE (4) /* refresh watchdog */
|
||||
#define RT_DEVICE_CTRL_WDT_START (5) /* start watchdog */
|
||||
#define RT_DEVICE_CTRL_WDT_STOP (6) /* stop watchdog */
|
||||
#define RT_DEVICE_CTRL_WDT_GET_TIMEOUT (RT_DEVICE_CTRL_BASE(WDT) + 1) /* get timeout(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_SET_TIMEOUT (RT_DEVICE_CTRL_BASE(WDT) + 2) /* set timeout(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_GET_TIMELEFT (RT_DEVICE_CTRL_BASE(WDT) + 3) /* get the left time before reboot(in seconds) */
|
||||
#define RT_DEVICE_CTRL_WDT_KEEPALIVE (RT_DEVICE_CTRL_BASE(WDT) + 4) /* refresh watchdog */
|
||||
#define RT_DEVICE_CTRL_WDT_START (RT_DEVICE_CTRL_BASE(WDT) + 5) /* start watchdog */
|
||||
#define RT_DEVICE_CTRL_WDT_STOP (RT_DEVICE_CTRL_BASE(WDT) + 6) /* stop watchdog */
|
||||
|
||||
struct rt_watchdog_ops;
|
||||
struct rt_watchdog_device
|
||||
|
||||
Reference in New Issue
Block a user