Touch Sensor API 参考
Touch Sensor
-
typedef void (*wm_drv_touch_sensor_callback_t)(wm_touch_sensor_num_t touch_num, void *priv)
Prototype touch sensor driver callback function.
-
int wm_drv_touch_sensor_register_callback(wm_device_t *dev, wm_touch_sensor_num_t touch_num, wm_drv_touch_sensor_callback_t callback, void *priv)
Registers a callback function for touch sensor.
- 参数:
dev – [in] Pointer to the touch sensor device structure.
touch_num – [in] Touch sensor number, range [0, WM_TOUCH_NUM_MAX].
callback – [in] Pointer to the callback function .
priv – [in] Pointer to user data to be passed to the callback function.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_touch_sensor_set_threshold(wm_device_t *dev, wm_touch_sensor_num_t touch_num, uint32_t threshold)
Sets the threshold value for touch sensing.
- 参数:
dev – [in] Pointer to the touch sensor device.
touch_num – [in] Touch sensor number, range [0, WM_TOUCH_NUM_MAX].
threshold – [in] Threshold value to set, max value is WM_TOUCH_THRESHOLD_MAX.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_touch_sensor_get_threshold(wm_device_t *dev, wm_touch_sensor_num_t touch_num, uint32_t *threshold)
Gets the threshold value for touch sensing.
- 参数:
dev – [in] Pointer to the touch sensor device.
touch_num – [in] Touch sensor number, range [0, WM_TOUCH_NUM_MAX].
threshold – [out] Threshold value to get.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_touch_sensor_read_countnum(wm_device_t *dev, wm_touch_sensor_num_t touch_num, uint32_t *countnum)
Reads the count number from the touch sensor.
- 参数:
dev – [in] Pointer to the touch sensor device structure.
touch_num – [in] Touch sensor number [0, WM_TOUCH_NUM_MAX].
countnum – [out] Countnum value to get.
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_touch_sensor_start(wm_device_t *dev, wm_touch_sensor_num_t touch_num)
start touch sensor driver
- 参数:
dev – [in] Pointer to the touch sensor device structure.
touch_num – [in] Touch sensor number [0, WM_TOUCH_NUM_MAX].
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
int wm_drv_touch_sensor_stop(wm_device_t *dev, wm_touch_sensor_num_t touch_num)
stop touch sensor driver
- 参数:
dev – [in] Pointer to the touch sensor device structure.
touch_num – [in] Touch sensor number [0, WM_TOUCH_NUM_MAX].
- 返回:
WM_ERR_SUCCESS: succeed
others: failed
-
wm_device_t *wm_drv_touch_sensor_init(const char *dev_name)
Initialize touch sensor driver.
- 参数:
dev_name – [in] touch sensor device name
- 返回:
NULL: failed
others: succeed
-
int wm_drv_touch_sensor_deinit(wm_device_t *dev)
deinit touch sensor driver
- 参数:
dev – [in] touch sensor driver device
- 返回:
WM_ERR_SUCCESS: succeed
WM_ERR_INVALID_PARAM: invalid argument
others: failed