driver/sensor: user specifies device register number

N/A

Change-Id: Idd11461f933dd21b7271cd3ca87a2e33127a9d34
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu
2020-11-02 18:02:04 +08:00
committed by Xiang Xiao
parent 0d92e50c42
commit 2482052228
5 changed files with 68 additions and 65 deletions
+11 -8
View File
@@ -581,9 +581,11 @@ extern "C"
* numbers. eg: accel0, accel1
*
* Input Parameters:
* dev - A pointer to an instance of lower half sensor driver. This
* instance is bound to the sensor driver and must persists as long
* as the driver persists.
* dev - A pointer to an instance of lower half sensor driver. This
* instance is bound to the sensor driver and must persists as long
* as the driver persists.
* devno - The user specifies which device of this type, from 0. If the
* devno alerady exists, -EEXIST will be returned.
*
* Returned Value:
* OK if the driver was successfully register; A negated errno value is
@@ -591,7 +593,7 @@ extern "C"
*
****************************************************************************/
int sensor_register(FAR struct sensor_lowerhalf_s *dev);
int sensor_register(FAR struct sensor_lowerhalf_s *dev, int devno);
/****************************************************************************
* Name: sensor_unregister
@@ -601,12 +603,13 @@ int sensor_register(FAR struct sensor_lowerhalf_s *dev);
* upper half driver.
*
* Input Parameters:
* dev - A pointer to an instance of lower half sensor driver. This
* instance is bound to the sensor driver and must persists as long
* as the driver persists.
* dev - A pointer to an instance of lower half sensor driver. This
* instance is bound to the sensor driver and must persists as long
* as the driver persists.
* devno - The user specifies which device of this type, from 0.
****************************************************************************/
void sensor_unregister(FAR struct sensor_lowerhalf_s *dev);
void sensor_unregister(FAR struct sensor_lowerhalf_s *dev, int devno);
#undef EXTERN
#if defined(__cplusplus)
+2 -1
View File
@@ -49,13 +49,14 @@ extern "C"
*
* Input Parameters:
* devpath - The full path to the driver to read data source by serial tty.
* devno - The user specifies device number, from 0.
*
* Returned Value:
* OK if the driver was successfully initialize; A negated errno value is
* returned on any failure.
****************************************************************************/
int wtgahrs2_initialize(FAR const char *path);
int wtgahrs2_initialize(FAR const char *path, int devno);
#ifdef __cplusplus
}