drivers: l3gd20 supports the sensor driver model

Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu
2020-11-17 14:02:06 +08:00
committed by Xiang Xiao
parent 9393572aea
commit 60d1755e04
3 changed files with 163 additions and 214 deletions
+4 -13
View File
@@ -229,16 +229,6 @@ struct l3gd20_config_s
int (*attach)(FAR struct l3gd20_config_s *, xcpt_t);
};
/* Data returned by reading from the L3GD20 is returned in this format. */
struct l3gd20_sensor_data_s
{
int16_t x_gyr; /* Measurement result for x axis */
int16_t y_gyr; /* Measurement result for y axis */
int16_t z_gyr; /* Measurement result for z axis */
int8_t temperature; /* Measurement result for temperature sensor */
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -258,8 +248,9 @@ extern "C"
* Register the L3DF20 character device as 'devpath'.
*
* Input Parameters:
* devpath - The full path to the driver to register, e.g., "/dev/gyr0".
* i2c - An SPI driver instance.
* devno - The device number, used to build the device path
* as /dev/sensor/gyro_uncalN
* spi - An SPI driver instance.
* config - configuration for the L3GD20 driver. For details see
* description above.
*
@@ -268,7 +259,7 @@ extern "C"
*
****************************************************************************/
int l3gd20_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
int l3gd20_register(int devno, FAR struct spi_dev_s *spi,
FAR struct l3gd20_config_s *config);
#undef EXTERN