diff --git a/include/nuttx/sensors/adxl345.h b/include/nuttx/sensors/adxl345.h index 5c22137251..f2066a58df 100644 --- a/include/nuttx/sensors/adxl345.h +++ b/include/nuttx/sensors/adxl345.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/input/adxl345.h * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. @@ -31,24 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_INPUT_ADXL345_H #define __INCLUDE_NUTTX_INPUT_ADXL345_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include #include #if defined(CONFIG_SENSORS_ADXL345) -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ -/* Configuration ****************************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ + /* Prerequisites: * * CONFIG_SCHED_WORKQUEUE - Work queue support is required @@ -64,15 +66,16 @@ * going high, it will start high and will go low when an interrupt * is fired. Default: Active high/rising edge. * CONFIG_ADXL345_REGDEBUG - * Enable very low register-level debug output. Requires CONFIG_DEBUG_FEATURES. + * Enable very low register-level debug output. + * Requires CONFIG_DEBUG_FEATURES. */ #ifndef CONFIG_SCHED_WORKQUEUE # error "Work queue support required. CONFIG_SCHED_WORKQUEUE must be selected." #endif -/* The ADXL345 interfaces with the target CPU via a I2C or SPI interface. The pin IN_1 - * allows the selection of interface protocol at reset state. +/* The ADXL345 interfaces with the target CPU via a I2C or SPI interface. + * The pin IN_1 allows the selection of interface protocol at reset state. */ #if !defined(CONFIG_ADXL345_SPI) && !defined(CONFIG_ADXL345_I2C) @@ -93,9 +96,10 @@ # endif #endif -/* I2C **************************************************************************************/ -/* ADXL345 Address: The ADXL345 may have 7-bit address 0x41 or 0x44, depending upon the - * state of the ADDR0 pin. +/* I2C **********************************************************************/ + +/* ADXL345 Address: The ADXL345 may have 7-bit address 0x41 or 0x44, + * depending upon the state of the ADDR0 pin. */ #define ADXL345_I2C_ADDRESS_MASK (0x78) /* Bits 3-7: Invariant part of ADXL345 address */ @@ -109,7 +113,8 @@ #define ADXL345_I2C_MAXFREQUENCY 400000 /* 400KHz */ -/* SPI **************************************************************************************/ +/* SPI **********************************************************************/ + /* The device always operates in mode 0 */ #define ADXL345_SPI_MODE SPIDEV_MODE0 /* Mode 0 */ @@ -118,11 +123,12 @@ #define ADXL345_SPI_MAXFREQUENCY 500000 /* 5MHz */ -/* ADXL345 Registers ************************************************************************/ +/* ADXL345 Registers ********************************************************/ + /* Register Addresses */ #define ADXL345_DEVID 0x00 /* Device identification (8-bit) */ - /* 0x01 to 0x1C Reserved*/ + /* 0x01 to 0x1C Reserved */ #define ADXL345_THRESH_TAP 0x1d /* Tap threshold */ #define ADXL345_OFSX 0x1e /* X-axis offset */ #define ADXL345_OFSY 0x1f /* Y-axis offset */ @@ -189,9 +195,9 @@ /* Register 0x2C - BW_RATE */ -#define BWR_RATE_SHIFT 0 /* Bit 0-3: Rate bits: up to 3200Hz output data rate */ +#define BWR_RATE_SHIFT 0 /* Bit 0-3: Rate bits: up to 3200Hz output data rate */ #define BWR_RATE_MASK (15 << RATE_SHIFT) /* Bit 0: Master interrupt enable */ -#define BWR_LOW_POWER (1 << 4) /* Bit 4: Set low power operation */ +#define BWR_LOW_POWER (1 << 4) /* Bit 4: Set low power operation */ /* Register 0x2d - POWER_CTL */ @@ -271,23 +277,27 @@ #define FIFO_STATUS_ENTRIES_MASK (63 << FIFO_STATUS_ENTRIES_SHIFT) #define FIFO_STATUS_TRIG (1 << 7) /* Bit 7: A 1 reports a trigger event occurred, 0 means no event */ -/******************************************************************************************** +/**************************************************************************** * Public Types - ********************************************************************************************/ + ****************************************************************************/ -/* Form of the GPIO "interrupt handler" callback. Callbacks do not occur from an interrupt - * handler but rather from the context of the worker thread with interrupts enabled. +/* Form of the GPIO "interrupt handler" callback. + * Callbacks do not occur from an interrupt handler but rather from the + * context of the worker thread with interrupts enabled. */ -typedef CODE void (*adxl345_handler_t)(FAR struct adxl345_config_s *config, FAR void *arg); +typedef CODE void (*adxl345_handler_t)(FAR struct adxl345_config_s *config, + FAR void *arg); -/* A reference to a structure of this type must be passed to the ADXL345 driver when the - * driver is instantiated. This structure provides information about the configuration of the - * ADXL345 and provides some board-specific hooks. +/* A reference to a structure of this type must be passed to the ADXL345 + * driver when the driver is instantiated. + * This structure provides information about the configuration of the ADXL345 + * and provides some board-specific hooks. * - * Memory for this structure is provided by the caller. It is not copied by the driver - * and is presumed to persist while the driver is active. The memory must be writeable - * because, under certain circumstances, the driver may modify the frequency. + * Memory for this structure is provided by the caller. + * It is not copied by the driver and is presumed to persist while the driver + * is active. The memory must be writeable because, under certain + * circumstances, the driver may modify the frequency. */ struct adxl345_config_s @@ -308,7 +318,8 @@ struct adxl345_config_s * clear - Acknowledge/clear any pending GPIO interrupt */ - int (*attach)(FAR struct adxl345_config_s *state, adxl345_handler_t handler, + int (*attach)(FAR struct adxl345_config_s *state, + adxl345_handler_t handler, FAR void *arg); void (*enable)(FAR struct adxl345_config_s *state, bool enable); void (*clear)(FAR struct adxl345_config_s *state); @@ -319,9 +330,9 @@ typedef FAR void *ADXL345_HANDLE; struct i2c_master_s; struct spi_dev_s; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" @@ -331,22 +342,23 @@ extern "C" #define EXTERN extern #endif -/******************************************************************************************** +/**************************************************************************** * Name: adxl345_instantiate * * Description: - * Instantiate and configure the ADXL345 device driver to use the provided I2C or SPI - * device instance. + * Instantiate and configure the ADXL345 device driver to use the provided + * I2C or SPI device instance. * * Input Parameters: * dev - An I2C or SPI driver instance * config - Persistent board configuration data * * Returned Value: - * A non-zero handle is returned on success. This handle may then be used to configure - * the ADXL345 driver as necessary. A NULL handle value is returned on failure. + * A non-zero handle is returned on success. + * This handle may then be used to configure the ADXL345 driver as + * necessary. A NULL handle value is returned on failure. * - ********************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADXL345_SPI ADXL345_HANDLE adxl345_instantiate(FAR struct spi_dev_s *dev, @@ -356,7 +368,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev, FAR struct adxl345_config_s *config); #endif -/******************************************************************************************** +/**************************************************************************** * Name: adxl345_register * * Description: @@ -368,10 +380,10 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev, * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. * - ********************************************************************************************/ + ****************************************************************************/ int adxl345_register(ADXL345_HANDLE handle, int minor); diff --git a/include/nuttx/sensors/ak09912.h b/include/nuttx/sensors/ak09912.h index 306e2f5ce1..4a3bf82454 100644 --- a/include/nuttx/sensors/ak09912.h +++ b/include/nuttx/sensors/ak09912.h @@ -36,11 +36,13 @@ #ifndef __INCLUDE_NUTTX_SENSORS_AK09912_H #define __INCLUDE_NUTTX_SENSORS_AK09912_H +/**************************************************************************** + * Included Files + ****************************************************************************/ #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_AK09912) || defined (CONFIG_SENSORS_AK09912_SCU)) - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/include/nuttx/sensors/apds9930.h b/include/nuttx/sensors/apds9930.h index 2feaa48acd..055552eaf1 100644 --- a/include/nuttx/sensors/apds9930.h +++ b/include/nuttx/sensors/apds9930.h @@ -36,6 +36,9 @@ #ifndef __INCLUDE_NUTTX_SENSORS_APDS9930_H #define __INCLUDE_NUTTX_SENSORS_APDS9930_H +/**************************************************************************** + * Included Files + ****************************************************************************/ #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_APDS9930) || defined(CONFIG_SENSORS_APDS9930_SCU)) diff --git a/include/nuttx/sensors/apds9960.h b/include/nuttx/sensors/apds9960.h index c73d0913c6..9dcb0073af 100644 --- a/include/nuttx/sensors/apds9960.h +++ b/include/nuttx/sensors/apds9960.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * drivers/sensors/apds9960.h * * Copyright (C) 2017 Gregory Nutt. All rights reserved. @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_APDS9960_H #define __INCLUDE_NUTTX_SENSORS_APDS9960_H @@ -61,237 +61,247 @@ /* Registers mapping */ -#define APDS9960_ENABLE 0x80 /* Power ON, Prox./ALS/Gest (Int.) Enable */ -#define APDS9960_ATIME 0x82 /* ALS ADC Integration Time */ -#define APDS9960_WTIME 0x83 /* Wait Time */ -#define APDS9960_AILTL 0x84 /* ALS Low Threshold, lower byte */ -#define APDS9960_AILTH 0x85 /* ALS Low Threshold, higher byte */ -#define APDS9960_AIHTL 0x86 /* ALS High Threshold, lower byte */ -#define APDS9960_AIHTH 0x87 /* ALS High Threshold, higher byte */ -#define APDS9960_PILT 0x89 /* Proximity Low Threshold */ -#define APDS9960_PIHT 0x8b /* Proximity High Threshold */ -#define APDS9960_PERS 0x8c /* Proximity Persistence */ -#define APDS9960_CONFIG1 0x8d /* Wait Long Enable */ -#define APDS9960_PPULSE 0x8e /* Proximity Pulse */ -#define APDS9960_CONTROL 0x8f /* Gain and LED control */ -#define APDS9960_CONFIG2 0x90 /* Saturation interrupt and LED Boost config. */ -#define APDS9960_ID 0x92 /* APDS-9960 Identification register */ -#define APDS9960_STATUS 0x93 /* Proximity Saturation/Inter/Valid status */ -#define APDS9960_CDATAL 0x94 /* Clear Data, Low byte */ -#define APDS9960_CDATAH 0x95 /* Clear Data, High byte */ -#define APDS9960_RDATAL 0x96 /* Red Data, Low byte */ -#define APDS9960_RDATAH 0x97 /* Red Data, High byte */ -#define APDS9960_GDATAL 0x98 /* Green Data, Low byte */ -#define APDS9960_GDATAH 0x99 /* Green Data, High byte */ -#define APDS9960_BDATAL 0x9a /* Blue Data, Low byte */ -#define APDS9960_BDATAH 0x9b /* Blue Data, High byte */ -#define APDS9960_PDATA 0x9c /* Proximity data */ -#define APDS9960_POFFSET_UR 0x9d /* Prox. offset UP/RIGHT */ -#define APDS9960_POFFSET_DL 0x9e /* Prox. offset DOWN/LEFT */ -#define APDS9960_CONFIG3 0x9f /* Prox. gain compensation U/D/L/R Mask config */ -#define APDS9960_GPENTH 0xa0 /* Gesture Prox. Entry Threshold */ -#define APDS9960_GEXTH 0xa1 /* Gesture Exit Threshold */ -#define APDS9960_GCONFIG1 0xa2 /* Gesture Config1 register */ -#define APDS9960_GCONFIG2 0xa3 /* Gesture Config2 register */ -#define APDS9960_GOFFSET_U 0xa4 /* Gesture Offset Up */ -#define APDS9960_GOFFSET_D 0xa5 /* Gesture Offset Down */ -#define APDS9960_GPULSE 0xa6 /* Gesture Pulse config */ -#define APDS9960_GOFFSET_L 0xa7 /* Gesture Offset Left */ -#define APDS9960_GOFFSET_R 0xa9 /* Gesture Offset Up */ -#define APDS9960_GCONFIG3 0xaa /* Gesture Config3 register */ -#define APDS9960_GCONFIG4 0xab /* Gesture Config4 register */ -#define APDS9960_GFLVL 0xae /* Gesture FIFO level */ -#define APDS9960_GSTATUS 0xaf /* Gesture Status */ -#define APDS9960_PICLEAR 0xe5 /* Proximity Interrupt Clear */ -#define APDS9960_CICLEAR 0xe5 /* Clear Channel Interrupt Clear */ -#define APDS9960_AICLEAR 0xe7 /* All Non-Gesture Interrupt Clear */ -#define APDS9960_GFIFO_U 0xfc /* Gesture FIFO Data UP */ -#define APDS9960_GFIFO_D 0xfd /* Gesture FIFO Data DOWN */ -#define APDS9960_GFIFO_L 0xfe /* Gesture FIFO Data LEFT */ -#define APDS9960_GFIFO_R 0xff /* Gesture FIFO Data RIGHT */ +#define APDS9960_ENABLE 0x80 /* Power ON, Prox./ALS/Gest (Int.) Enable */ +#define APDS9960_ATIME 0x82 /* ALS ADC Integration Time */ +#define APDS9960_WTIME 0x83 /* Wait Time */ +#define APDS9960_AILTL 0x84 /* ALS Low Threshold, lower byte */ +#define APDS9960_AILTH 0x85 /* ALS Low Threshold, higher byte */ +#define APDS9960_AIHTL 0x86 /* ALS High Threshold, lower byte */ +#define APDS9960_AIHTH 0x87 /* ALS High Threshold, higher byte */ +#define APDS9960_PILT 0x89 /* Proximity Low Threshold */ +#define APDS9960_PIHT 0x8b /* Proximity High Threshold */ +#define APDS9960_PERS 0x8c /* Proximity Persistence */ +#define APDS9960_CONFIG1 0x8d /* Wait Long Enable */ +#define APDS9960_PPULSE 0x8e /* Proximity Pulse */ +#define APDS9960_CONTROL 0x8f /* Gain and LED control */ +#define APDS9960_CONFIG2 0x90 /* Saturation interrupt and LED Boost config. */ +#define APDS9960_ID 0x92 /* APDS-9960 Identification register */ +#define APDS9960_STATUS 0x93 /* Proximity Saturation/Inter/Valid status */ +#define APDS9960_CDATAL 0x94 /* Clear Data, Low byte */ +#define APDS9960_CDATAH 0x95 /* Clear Data, High byte */ +#define APDS9960_RDATAL 0x96 /* Red Data, Low byte */ +#define APDS9960_RDATAH 0x97 /* Red Data, High byte */ +#define APDS9960_GDATAL 0x98 /* Green Data, Low byte */ +#define APDS9960_GDATAH 0x99 /* Green Data, High byte */ +#define APDS9960_BDATAL 0x9a /* Blue Data, Low byte */ +#define APDS9960_BDATAH 0x9b /* Blue Data, High byte */ +#define APDS9960_PDATA 0x9c /* Proximity data */ +#define APDS9960_POFFSET_UR 0x9d /* Prox. offset UP/RIGHT */ +#define APDS9960_POFFSET_DL 0x9e /* Prox. offset DOWN/LEFT */ +#define APDS9960_CONFIG3 0x9f /* Prox. gain compensation U/D/L/R Mask config */ +#define APDS9960_GPENTH 0xa0 /* Gesture Prox. Entry Threshold */ +#define APDS9960_GEXTH 0xa1 /* Gesture Exit Threshold */ +#define APDS9960_GCONFIG1 0xa2 /* Gesture Config1 register */ +#define APDS9960_GCONFIG2 0xa3 /* Gesture Config2 register */ +#define APDS9960_GOFFSET_U 0xa4 /* Gesture Offset Up */ +#define APDS9960_GOFFSET_D 0xa5 /* Gesture Offset Down */ +#define APDS9960_GPULSE 0xa6 /* Gesture Pulse config */ +#define APDS9960_GOFFSET_L 0xa7 /* Gesture Offset Left */ +#define APDS9960_GOFFSET_R 0xa9 /* Gesture Offset Up */ +#define APDS9960_GCONFIG3 0xaa /* Gesture Config3 register */ +#define APDS9960_GCONFIG4 0xab /* Gesture Config4 register */ +#define APDS9960_GFLVL 0xae /* Gesture FIFO level */ +#define APDS9960_GSTATUS 0xaf /* Gesture Status */ +#define APDS9960_PICLEAR 0xe5 /* Proximity Interrupt Clear */ +#define APDS9960_CICLEAR 0xe5 /* Clear Channel Interrupt Clear */ +#define APDS9960_AICLEAR 0xe7 /* All Non-Gesture Interrupt Clear */ +#define APDS9960_GFIFO_U 0xfc /* Gesture FIFO Data UP */ +#define APDS9960_GFIFO_D 0xfd /* Gesture FIFO Data DOWN */ +#define APDS9960_GFIFO_L 0xfe /* Gesture FIFO Data LEFT */ +#define APDS9960_GFIFO_R 0xff /* Gesture FIFO Data RIGHT */ /* ENABLE Register */ -#define PON (1 << 0) /* Bit 0: Power ON */ -#define AEN (1 << 1) /* Bit 1: ALS Enable ??? */ -#define PEN (1 << 2) /* Bit 2: Prox. Enable */ -#define WEN (1 << 3) /* Bit 3: Wait Enable */ -#define AIEN (1 << 4) /* Bit 4: ALS Int. Enable */ -#define PIEN (1 << 5) /* Bit 5: Prox. Int. Enable */ -#define GEN (1 << 6) /* Bit 6: Gesture Enable */ +#define PON (1 << 0) /* Bit 0: Power ON */ +#define AEN (1 << 1) /* Bit 1: ALS Enable ??? */ +#define PEN (1 << 2) /* Bit 2: Prox. Enable */ +#define WEN (1 << 3) /* Bit 3: Wait Enable */ +#define AIEN (1 << 4) /* Bit 4: ALS Int. Enable */ +#define PIEN (1 << 5) /* Bit 5: Prox. Int. Enable */ +#define GEN (1 << 6) /* Bit 6: Gesture Enable */ /* PERS Register */ -#define APERS_SHIFT 0 /* Bits 0-3: ALS Int. Persistence */ -#define APERS_MASK (0xf << PERS_APERS_SHIFT) -#define PPERS_SHIFT 4 /* Bits 4-7: Prox. Int. Persistence */ -#define PPERS_MASK (0xf << PERS_APERS_SHIFT) +#define APERS_SHIFT 0 /* Bits 0-3: ALS Int. Persistence */ +#define APERS_MASK (0xf << PERS_APERS_SHIFT) +#define PPERS_SHIFT 4 /* Bits 4-7: Prox. Int. Persistence */ +#define PPERS_MASK (0xf << PERS_APERS_SHIFT) /* CONFIG1 Register */ -#define LOWPOW (1 << 0) /* Bit 0: Low Power (Gesture) */ -#define WLONG (1 << 1) /* Bit 1: Wait Long Enable (ALS) */ +#define LOWPOW (1 << 0) /* Bit 0: Low Power (Gesture) */ +#define WLONG (1 << 1) /* Bit 1: Wait Long Enable (ALS) */ /* PPULSE Register */ -#define PPULSE_SHIFT 0 /* Bits 0-5: Prox. Pulse Count (1 up to 64 pulses) */ -#define PPULSE_MASK (0x3f << PPULSE_SHIFT) -# define PPULSE_NUM(n) ((n-1) << PPULSE_SHIFT) -#define PPLEN_SHIFT 6 /* Bits 6-7: Prox. Pulse Length */ -#define PPLEN_MASK (3 << PPLEN_SHIFT) -# define PPLEN_4US (0 << PPLEN_SHIFT) -# define PPLEN_8US (1 << PPLEN_SHIFT) -# define PPLEN_16US (2 << PPLEN_SHIFT) -# define PPLEN_32US (3 << PPLEN_SHIFT) +#define PPULSE_SHIFT 0 /* Bits 0-5: Prox. Pulse Count (1 up to 64 pulses) */ +#define PPULSE_MASK (0x3f << PPULSE_SHIFT) +#define PPULSE_NUM(n) ((n-1) << PPULSE_SHIFT) +#define PPLEN_SHIFT 6 /* Bits 6-7: Prox. Pulse Length */ +#define PPLEN_MASK (3 << PPLEN_SHIFT) +#define PPLEN_4US (0 << PPLEN_SHIFT) +#define PPLEN_8US (1 << PPLEN_SHIFT) +#define PPLEN_16US (2 << PPLEN_SHIFT) +#define PPLEN_32US (3 << PPLEN_SHIFT) /* CONTROL Register */ -#define AGAIN_SHIFT 0 /* Bits 0-1: ALS Gain Control */ -#define AGAIN_MASK (3 << AGAIN_SHIFT) -# define AGAIN_1X (0 << AGAIN_SHIFT) -# define AGAIN_2X (1 << AGAIN_SHIFT) -# define AGAIN_4X (2 << AGAIN_SHIFT) -# define AGAIN_8X (3 << AGAIN_SHIFT) -#define PGAIN_SHIFT 2 /* Bits 2-3: Proximity Gain Control */ -#define PGAIN_MASK (3 << PGAIN_SHIFT) -# define PGAIN_1X (0 << PGAIN_SHIFT) -# define PGAIN_2X (1 << PGAIN_SHIFT) -# define PGAIN_4X (2 << PGAIN_SHIFT) -# define PGAIN_8X (3 << PGAIN_SHIFT) -#define LDRIVE_SHIFT 6 /* Bits 6-7: LED Drive Strength */ -#define LDRIVE_MASK (3 << LDRIVE_SHIFT) -# define LDRIVE_100MA (0 << LDRIVE_SHIFT) -# define LDRIVE_50MA (1 << LDRIVE_SHIFT) -# define LDRIVE_25MA (2 << LDRIVE_SHIFT) -# define LDRIVE_12p5MA (3 << LDRIVE_SHIFT) +#define AGAIN_SHIFT 0 /* Bits 0-1: ALS Gain Control */ +#define AGAIN_MASK (3 << AGAIN_SHIFT) +#define AGAIN_1X (0 << AGAIN_SHIFT) +#define AGAIN_2X (1 << AGAIN_SHIFT) +#define AGAIN_4X (2 << AGAIN_SHIFT) +#define AGAIN_8X (3 << AGAIN_SHIFT) +#define PGAIN_SHIFT 2 /* Bits 2-3: Proximity Gain Control */ +#define PGAIN_MASK (3 << PGAIN_SHIFT) +#define PGAIN_1X (0 << PGAIN_SHIFT) +#define PGAIN_2X (1 << PGAIN_SHIFT) +#define PGAIN_4X (2 << PGAIN_SHIFT) +#define PGAIN_8X (3 << PGAIN_SHIFT) +#define LDRIVE_SHIFT 6 /* Bits 6-7: LED Drive Strength */ +#define LDRIVE_MASK (3 << LDRIVE_SHIFT) +#define LDRIVE_100MA (0 << LDRIVE_SHIFT) +#define LDRIVE_50MA (1 << LDRIVE_SHIFT) +#define LDRIVE_25MA (2 << LDRIVE_SHIFT) +#define LDRIVE_12p5MA (3 << LDRIVE_SHIFT) /* CONFIG2 Register */ -#define LEDBOOST_SHIFT 4 /* Bits 4-5: Proximity/Gesture LED Boost */ -#define LEDBOOST_MASK (3 << LEDBOOST_SHIFT) -# define LEDBOOST_100 (0 << LEDBOOST_SHIFT) /* Boost LED 100% */ -# define LEDBOOST_150 (1 << LEDBOOST_SHIFT) /* Boost LED 150% */ -# define LEDBOOST_200 (2 << LEDBOOST_SHIFT) /* Boost LED 200% */ -# define LEDBOOST_300 (3 << LEDBOOST_SHIFT) /* Boost LED 300% */ -#define CPSIEN (1 << 6) /* Bit 6: Clear diode Saturation Interrupt Enable */ -#define PSIEN (1 << 7) /* Bit 7: Proximity Saturation Interrupt Enable */ +#define LEDBOOST_SHIFT 4 /* Bits 4-5: Proximity/Gesture LED Boost */ +#define LEDBOOST_MASK (3 << LEDBOOST_SHIFT) +#define LEDBOOST_100 (0 << LEDBOOST_SHIFT) /* Boost LED 100% */ +#define LEDBOOST_150 (1 << LEDBOOST_SHIFT) /* Boost LED 150% */ +#define LEDBOOST_200 (2 << LEDBOOST_SHIFT) /* Boost LED 200% */ +#define LEDBOOST_300 (3 << LEDBOOST_SHIFT) /* Boost LED 300% */ +#define CPSIEN (1 << 6) /* Bit 6: Clear diode Saturation Interrupt Enable */ +#define PSIEN (1 << 7) /* Bit 7: Proximity Saturation Interrupt Enable */ /* STATUS Register */ -#define AVALID (1 << 0) /* Bit 0: ALS Valid */ -#define PVALID (1 << 1) /* Bit 1: Proximity Valid */ -#define AINT (1 << 4) /* Bit 4: ALS Interrupt */ -#define PINT (1 << 5) /* Bit 5: Proximity Interrupt */ -#define PGSAT (1 << 6) /* Bit 6: Proximity Saturation */ -#define CPSAT (1 << 7) /* Bit 7: ALS Interrupt */ +#define AVALID (1 << 0) /* Bit 0: ALS Valid */ +#define PVALID (1 << 1) /* Bit 1: Proximity Valid */ +#define AINT (1 << 4) /* Bit 4: ALS Interrupt */ +#define PINT (1 << 5) /* Bit 5: Proximity Interrupt */ +#define PGSAT (1 << 6) /* Bit 6: Proximity Saturation */ +#define CPSAT (1 << 7) /* Bit 7: ALS Interrupt */ /* CONFIG3 Register */ -#define PMSK_R (1 << 0) /* Bit 0: Proximity Mask RIGHT Enable */ -#define PMSK_L (1 << 1) /* Bit 1: Proximity Mask LEFT Enable */ -#define PMSK_D (1 << 2) /* Bit 2: Proximity Mask DOWN Enable */ -#define PMSK_U (1 << 3) /* Bit 3: Proximity Mask UP Enable */ -#define PCMP (1 << 5) /* Bit 5: Proximity Gain Compensation Enable */ +#define PMSK_R (1 << 0) /* Bit 0: Proximity Mask RIGHT Enable */ +#define PMSK_L (1 << 1) /* Bit 1: Proximity Mask LEFT Enable */ +#define PMSK_D (1 << 2) /* Bit 2: Proximity Mask DOWN Enable */ +#define PMSK_U (1 << 3) /* Bit 3: Proximity Mask UP Enable */ +#define PCMP (1 << 5) /* Bit 5: Proximity Gain Compensation Enable */ /* GCONFIG1 Register */ -#define GEXPERS_SHIFT 0 /* Bits 0-1: Gesture Exit Persistence */ -#define GEXPERS_MASK (3 << GEXPERS_SHIFT) -# define GEXPERS_1ST (0 << GEXPERS_SHIFT) /* 1st 'gesture end' exits */ -# define GEXPERS_2ND (1 << GEXPERS_SHIFT) /* 2nd 'gesture end' exits */ -# define GEXPERS_4TH (2 << GEXPERS_SHIFT) /* 4th 'gesture end' exits */ -# define GEXPERS_7TH (3 << GEXPERS_SHIFT) /* 7th 'gesture end' exits */ -#define GEXMSK_SHIFT 2 /* Bits 2-5: Gesture Exit Mask */ -#define GEXMSK_MASK (0xf << GEXMSK_SHIFT) -#define GFIFOTH_SHIFT 6 /* Bits 6-7: Gesture FIFO Threshold */ -#define GFIFOTH_MASK (3 << GFIFOTH_SHIFT) -# define GFIFOTH_1DS (0 << GFIFOTH_SHIFT) /* Interrupt after 1 dataset */ -# define GFIFOTH_4DS (1 << GFIFOTH_SHIFT) /* Interrupt after 4 datasets */ -# define GFIFOTH_8DS (2 << GFIFOTH_SHIFT) /* Interrupt after 8 datasets */ -# define GFIFOTH_16DS (3 << GFIFOTH_SHIFT) /* Interrupt after 8 datasets */ +#define GEXPERS_SHIFT 0 /* Bits 0-1: Gesture Exit Persistence */ + +#define GEXPERS_MASK (3 << GEXPERS_SHIFT) +#define GEXPERS_1ST (0 << GEXPERS_SHIFT) /* 1st 'gesture end' exits */ +#define GEXPERS_2ND (1 << GEXPERS_SHIFT) /* 2nd 'gesture end' exits */ +#define GEXPERS_4TH (2 << GEXPERS_SHIFT) /* 4th 'gesture end' exits */ +#define GEXPERS_7TH (3 << GEXPERS_SHIFT) /* 7th 'gesture end' exits */ + +#define GEXMSK_SHIFT 2 /* Bits 2-5: Gesture Exit Mask */ +#define GEXMSK_MASK (0xf << GEXMSK_SHIFT) +#define GFIFOTH_SHIFT 6 /* Bits 6-7: Gesture FIFO Threshold */ + +#define GFIFOTH_MASK (3 << GFIFOTH_SHIFT) +#define GFIFOTH_1DS (0 << GFIFOTH_SHIFT) /* Interrupt after 1 dataset */ +#define GFIFOTH_4DS (1 << GFIFOTH_SHIFT) /* Interrupt after 4 datasets */ +#define GFIFOTH_8DS (2 << GFIFOTH_SHIFT) /* Interrupt after 8 datasets */ +#define GFIFOTH_16DS (3 << GFIFOTH_SHIFT) /* Interrupt after 8 datasets */ /* GCONFIG2 Register */ -#define GWTIME_SHIFT 0 /* Bits 0-2: Gesture Wait Time */ -#define GWTIME_MASK (7 << GWTIME_SHIFT) -# define GWTIME_0MS (0 << GWTIME_SHIFT) -# define GWTIME_2p8MS (1 << GWTIME_SHIFT) -# define GWTIME_5p6MS (2 << GWTIME_SHIFT) -# define GWTIME_8p4MS (3 << GWTIME_SHIFT) -# define GWTIME_14MS (4 << GWTIME_SHIFT) -# define GWTIME_22p4MS (5 << GWTIME_SHIFT) -# define GWTIME_30p8MS (6 << GWTIME_SHIFT) -# define GWTIME_39p2MS (7 << GWTIME_SHIFT) -#define GLDRIVE_SHIFT 3 /* Bits 3-4: Gesture LED Drive Strength */ -#define GLDRIVE_MASK (3 << GLDRIVE_SHIFT) -# define GLDRIVE_100MA (0 << GLDRIVE_SHIFT) -# define GLDRIVE_50MA (1 << GLDRIVE_SHIFT) -# define GLDRIVE_25MA (2 << GLDRIVE_SHIFT) -# define GLDRIVE_12p5MA (3 << GLDRIVE_SHIFT) -#define GGAIN_SHIFT 5 /* Bits 5-6: Gesture Gain Control */ -#define GGAIN_MASK (3 << GGAIN_SHIFT) -# define GGAIN_1X (0 << GGAIN_SHIFT) -# define GGAIN_2X (1 << GGAIN_SHIFT) -# define GGAIN_4X (2 << GGAIN_SHIFT) -# define GGAIN_8X (3 << GGAIN_SHIFT) +#define GWTIME_SHIFT 0 /* Bits 0-2: Gesture Wait Time */ +#define GWTIME_MASK (7 << GWTIME_SHIFT) +#define GWTIME_0MS (0 << GWTIME_SHIFT) +#define GWTIME_2p8MS (1 << GWTIME_SHIFT) +#define GWTIME_5p6MS (2 << GWTIME_SHIFT) +#define GWTIME_8p4MS (3 << GWTIME_SHIFT) +#define GWTIME_14MS (4 << GWTIME_SHIFT) +#define GWTIME_22p4MS (5 << GWTIME_SHIFT) +#define GWTIME_30p8MS (6 << GWTIME_SHIFT) +#define GWTIME_39p2MS (7 << GWTIME_SHIFT) +#define GLDRIVE_SHIFT 3 /* Bits 3-4: Gesture LED Drive Strength */ +#define GLDRIVE_MASK (3 << GLDRIVE_SHIFT) +#define GLDRIVE_100MA (0 << GLDRIVE_SHIFT) +#define GLDRIVE_50MA (1 << GLDRIVE_SHIFT) +#define GLDRIVE_25MA (2 << GLDRIVE_SHIFT) +#define GLDRIVE_12p5MA (3 << GLDRIVE_SHIFT) +#define GGAIN_SHIFT 5 /* Bits 5-6: Gesture Gain Control */ +#define GGAIN_MASK (3 << GGAIN_SHIFT) +#define GGAIN_1X (0 << GGAIN_SHIFT) +#define GGAIN_2X (1 << GGAIN_SHIFT) +#define GGAIN_4X (2 << GGAIN_SHIFT) +#define GGAIN_8X (3 << GGAIN_SHIFT) /* GPULSE Register */ -#define GPULSE_SHIFT 0 /* Bits 0-5: Pulse Count */ -#define GPULSE_MASK (0x3f << GPULSE_SHIFT) -# define GPULSE_NUM(n) ((n-1) << GPULSE_SHIFT) -#define GPLEN_SHIFT 6 /* Bit 6-7: Gesture Pulse Length */ -#define GPLEN_MASK (3 << GPLEN_SHIFT) -# define GPLEN_4US (0 << GPLEN_SHIFT) -# define GPLEN_8US (1 << GPLEN_SHIFT) -# define GPLEN_16US (2 << GPLEN_SHIFT) -# define GPLEN_32US (3 << GPLEN_SHIFT) +#define GPULSE_SHIFT 0 /* Bits 0-5: Pulse Count */ +#define GPULSE_MASK (0x3f << GPULSE_SHIFT) +#define GPULSE_NUM(n) ((n-1) << GPULSE_SHIFT) +#define GPLEN_SHIFT 6 /* Bit 6-7: Gesture Pulse Length */ +#define GPLEN_MASK (3 << GPLEN_SHIFT) +#define GPLEN_4US (0 << GPLEN_SHIFT) +#define GPLEN_8US (1 << GPLEN_SHIFT) +#define GPLEN_16US (2 << GPLEN_SHIFT) +#define GPLEN_32US (3 << GPLEN_SHIFT) /* GCONFIG3 Register */ -#define GDIMS_SHIFT 0 /* Bits 0-1: Gesture Dimension Select */ -#define GDIMS_MASK (3 << GDIMS_SHIFT) +#define GDIMS_SHIFT 0 /* Bits 0-1: Gesture Dimension Select */ +#define GDIMS_MASK (3 << GDIMS_SHIFT) /* GCONFIG4 Register */ -#define GMODE (1 << 0) /* Bit 0: Gesture Mode */ -#define GIEN (1 << 1) /* Bit 1: Gesture Interrupt Enable */ +#define GMODE (1 << 0) /* Bit 0: Gesture Mode */ +#define GIEN (1 << 1) /* Bit 1: Gesture Interrupt Enable */ /* GSTATUS Register */ -#define GVALID (1 << 0) /* Bit 0: Gesture Valid */ -#define GFOV (1 << 1) /* Bit 1: Gesture FIFO Overflow */ +#define GVALID (1 << 0) /* Bit 0: Gesture Valid */ +#define GFOV (1 << 1) /* Bit 1: Gesture FIFO Overflow */ /* Default values for device initialization */ -#define DEFAULT_ATIME 219 /* 103ms */ -#define DEFAULT_WTIME 246 /* 27ms */ -#define DEFAULT_PPULSE (PPLEN_16US | PPULSE_NUM(8)) /* 16us and 8 pulses */ -#define DEFAULT_POFFSET_UR 0 /* 0 offset */ -#define DEFAULT_POFFSET_DL 0 /* 0 offset */ -#define DEFAULT_CONFIG1 0x60 /* No 12x wait (WTIME) factor */ -#define DEFAULT_PILT 0 /* Low proximity threshold */ -#define DEFAULT_PIHT 50 /* High proximity threshold */ -#define DEFAULT_PERS 0x11 /* 2 consecutive prox or ALS for int. */ -#define DEFAULT_CONTROL (AGAIN_4X | PGAIN_4X | LDRIVE_100MA) -#define DEFAULT_CONFIG2 0x01 /* No saturation interrupts or LED boost */ -#define DEFAULT_CONFIG3 0 /* Enable all photodiodes, no SAI */ -#define DEFAULT_GPENTH 40 /* Threshold for entering gesture mode */ -#define DEFAULT_GEXTH 30 /* Threshold for exiting gesture mode */ -#define DEFAULT_GCONFIG1 GFIFOTH_8DS /* 8 gesture events for int., 1 for exit */ -#define DEFAULT_GCONFIG2 (GGAIN_4X | GLDRIVE_100MA /*| GWTIME_2p8MS*/ ) -#define DEFAULT_GOFFSET_U 0 /* No offset scaling for gesture mode */ -#define DEFAULT_GOFFSET_D 0 /* No offset scaling for gesture mode */ -#define DEFAULT_GOFFSET_L 0 /* No offset scaling for gesture mode */ -#define DEFAULT_GOFFSET_R 0 /* No offset scaling for gesture mode */ -#define DEFAULT_GPULSE (GPLEN_32US | GPULSE_NUM(10)) /* 32us, 10 pulses */ -#define DEFAULT_GCONFIG3 0 /* All photodiodes active during gesture */ -#define DEFAULT_GCONFIG4 0 /* Disable gesture interrupts */ -#define DEFAULT_AILTL 0xFF /* Force interrupt for calibration */ -#define DEFAULT_AILTH 0xFF /* Force interrupt for calibration */ -#define DEFAULT_AIHTL 0 -#define DEFAULT_AIHTH 0 -#define FIFO_PAUSE_TIME 30000 /* Wait period (ms) between FIFO reads */ +#define DEFAULT_ATIME 219 /* 103ms */ +#define DEFAULT_WTIME 246 /* 27ms */ + +#define DEFAULT_PPULSE (PPLEN_16US | PPULSE_NUM(8)) /* 16us and 8 pulses */ + +#define DEFAULT_POFFSET_UR 0 /* 0 offset */ +#define DEFAULT_POFFSET_DL 0 /* 0 offset */ +#define DEFAULT_CONFIG1 0x60 /* No 12x wait (WTIME) factor */ +#define DEFAULT_PILT 0 /* Low proximity threshold */ +#define DEFAULT_PIHT 50 /* High proximity threshold */ +#define DEFAULT_PERS 0x11 /* 2 consecutive prox or ALS for int. */ +#define DEFAULT_CONTROL (AGAIN_4X | PGAIN_4X | LDRIVE_100MA) +#define DEFAULT_CONFIG2 0x01 /* No saturation interrupts or LED boost */ +#define DEFAULT_CONFIG3 0 /* Enable all photodiodes, no SAI */ +#define DEFAULT_GPENTH 40 /* Threshold for entering gesture mode */ +#define DEFAULT_GEXTH 30 /* Threshold for exiting gesture mode */ + +#define DEFAULT_GCONFIG1 GFIFOTH_8DS /* 8 gesture events for int., 1 for exit */ + +#define DEFAULT_GCONFIG2 (GGAIN_4X | GLDRIVE_100MA) /* | GWTIME_2p8MS) */ + +#define DEFAULT_GOFFSET_U 0 /* No offset scaling for gesture mode */ +#define DEFAULT_GOFFSET_D 0 /* No offset scaling for gesture mode */ +#define DEFAULT_GOFFSET_L 0 /* No offset scaling for gesture mode */ +#define DEFAULT_GOFFSET_R 0 /* No offset scaling for gesture mode */ + +#define DEFAULT_GPULSE (GPLEN_32US | GPULSE_NUM(10)) /* 32us, 10 pulses */ + +#define DEFAULT_GCONFIG3 0 /* All photodiodes active during gesture */ +#define DEFAULT_GCONFIG4 0 /* Disable gesture interrupts */ +#define DEFAULT_AILTL 0xFF /* Force interrupt for calibration */ +#define DEFAULT_AILTH 0xFF /* Force interrupt for calibration */ +#define DEFAULT_AIHTL 0 +#define DEFAULT_AIHTH 0 +#define FIFO_PAUSE_TIME 30000 /* Wait period (ms) between FIFO reads */ /* Gesture parameters */ @@ -300,7 +310,7 @@ #define GESTURE_SENSITIVITY_2 20 /**************************************************************************** - * Private Types + * Public Types ****************************************************************************/ /* Direction definitions */ diff --git a/include/nuttx/sensors/as5048b.h b/include/nuttx/sensors/as5048b.h index 377012f501..25df637a95 100644 --- a/include/nuttx/sensors/as5048b.h +++ b/include/nuttx/sensors/as5048b.h @@ -48,6 +48,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************ * Prerequisites: * @@ -69,6 +70,7 @@ #define AS5048B_MAX 0x3fff /* Maximum value (14 bits) */ /* Register Definitions *****************************************************/ + /* Register Addresses */ #define AS5048B_PROG_REG 0x03 /* Programming Control Register */ @@ -124,13 +126,15 @@ extern "C" * addr - The I2C address of the AS5048B. * * Returned Value: - * A new lower half quadrature encoder interface for the AS5048B on success; + * A new lower half quadrature encoder interface for the AS5048B + * on success; * NULL on failure. * ****************************************************************************/ FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c, - uint8_t addr, uint32_t frequency); + uint8_t addr, + uint32_t frequency); #undef EXTERN #ifdef __cplusplus diff --git a/include/nuttx/sensors/bh1721fvc.h b/include/nuttx/sensors/bh1721fvc.h index 1f689466a8..1b3d8d4279 100644 --- a/include/nuttx/sensors/bh1721fvc.h +++ b/include/nuttx/sensors/bh1721fvc.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_BH1721FVC_H #define __INCLUDE_NUTTX_SENSORS_BH1721FVC_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BH1721FVC) || defined(CONFIG_SENSORS_BH1721FVC_SCU) @@ -92,10 +96,12 @@ int bh1721fvc_init(FAR struct i2c_master_s *i2c, int port); * Name: bh1721fvcals_register * * Description: - * Register the BH1721FVC ambient light sensor character device as 'devpath' + * Register the BH1721FVC ambient light sensor character device as + * 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/light0" + * devpath - The full path to the driver to register. E.g., + * "/dev/light0" * minor - minor device number * i2c - An instance of the I2C interface to use to communicate with * BH1721FVC diff --git a/include/nuttx/sensors/bh1745nuc.h b/include/nuttx/sensors/bh1745nuc.h index 59056e89ee..a8e41a08c9 100644 --- a/include/nuttx/sensors/bh1745nuc.h +++ b/include/nuttx/sensors/bh1745nuc.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_BH1745NUC_H #define __INCLUDE_NUTTX_SENSORS_BH1745NUC_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_BH1745NUC) || defined(CONFIG_SENSORS_BH1745NUC_SCU)) diff --git a/include/nuttx/sensors/bm1383glv.h b/include/nuttx/sensors/bm1383glv.h index 1d4c98776a..e238be03a3 100644 --- a/include/nuttx/sensors/bm1383glv.h +++ b/include/nuttx/sensors/bm1383glv.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_BM1383GLV_H #define __INCLUDE_NUTTX_SENSORS_BM1383GLV_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BM1383GLV) || defined(CONFIG_SENSORS_BM1383GLV_SCU) diff --git a/include/nuttx/sensors/bm1422gmv.h b/include/nuttx/sensors/bm1422gmv.h index 8407fe101b..0b62a54d04 100644 --- a/include/nuttx/sensors/bm1422gmv.h +++ b/include/nuttx/sensors/bm1422gmv.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_BM1422GMV_H #define __INCLUDE_NUTTX_SENSORS_BM1422GMV_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_BM1422GMV) || defined(CONFIG_SENSORS_BM1422GMV_SCU)) diff --git a/include/nuttx/sensors/bmg160.h b/include/nuttx/sensors/bmg160.h index ba2fa2c84a..75009c87a5 100644 --- a/include/nuttx/sensors/bmg160.h +++ b/include/nuttx/sensors/bmg160.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/sensors/bmg160.h * * Copyright (C) 2016 DS-Automotion GmbH. All rights reserved. @@ -32,14 +32,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_BMG160_H #define __INCLUDE_NUTTX_SENSORS_BMG160_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include #include @@ -48,11 +48,11 @@ #if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_BMG160) -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ -/* BMG160 Register Definitions **************************************************************/ +/* BMG160 Register Definitions **********************************************/ /* Chip ID */ @@ -140,7 +140,7 @@ * the FIFO-full flag cleared when writing to FIFO_CONFIG_1 register */ #define BMG160_FIFO_DATA_REG (0x3F) /* FIFO data readout register */ -/* Control Register Definitions *************************************************************/ +/* Control Register Definitions *********************************************/ /* BMG160 RANGE_REG Definitions */ @@ -178,8 +178,7 @@ #define BMG160_HBW_REG_DATA_HIGH_BW_bm (1 << 7) /* Enable unfiltered data reading */ #define BMG160_HBW_REG_SHW_DIS_bm (1 << 6) /* Disable shadow mechanism for the rate data output register */ - -/* Interrupt Status Register Definitions ****************************************************/ +/* Interrupt Status Register Definitions ************************************/ /* BMG160 INT_EN_0_REG Definitions */ @@ -219,7 +218,7 @@ #define BMG160_INT_ZERO_REG_SLOW_OFF_UN_bm (1 << 5) /* Selects unfiltered data for slow offset compensation */ #define BMG160_INT_ZERO_REG_HIGH_UN_D_bm (1 << 3) /* Selects unfiltered data for high rate interrupt */ -#define BMG160_INT_ZERO_REG_ANY_UN_D_bm (1 << 1) /* Selects unfiltered data for any motion interrupt +#define BMG160_INT_ZERO_REG_ANY_UN_D_bm (1 << 1) /* Selects unfiltered data for any motion interrupt */ /* BMG160 INT_ONE_REG Definitions */ @@ -233,7 +232,7 @@ /* BMG160 INT_FOUR_REG Definitions */ -#define BMG160_INT_FOUR_REG_FIFO_WM_EN_bm (1 << 2) /* Enables fifo water mark level interrupt +#define BMG160_INT_FOUR_REG_FIFO_WM_EN_bm (1 << 2) /* Enables fifo water mark level interrupt */ /* BMG160 INT_RST_LATCH_REG Definitions */ @@ -245,7 +244,7 @@ #define BMG160_INT_RST_LATCH_REG_LATCH_INT_1_bm (1 << 1) /* Latch mode selection bit 1 */ #define BMG160_INT_RST_LATCH_REG_LATCH_INT_0_bm (1 << 0) /* Latch mode selection bit 0 */ -/* Interrupt High Rate Configuration Register Definitions ************************************/ +/* Interrupt High Rate Configuration Register Definitions *******************/ /* BMG160 HIGH_TH_X_REG Definitions */ @@ -313,7 +312,7 @@ #define BMG160_HIGH_DUR_Z_REG_1_bm (1 << 1) #define BMG160_HIGH_DUR_Z_REG_0_bm (1 << 0) -/* Offset Register Definitions **************************************************************/ +/* Offset Register Definitions **********************************************/ /* BMG160 SOC_REG */ @@ -328,7 +327,7 @@ #define BMG160_FOC_REG_FAST_OFF_EN_Y_bm (1 << 1) /* Enables fast offset compensation for y-axis */ #define BMG160_FOC_REG_FAST_OFF_EN_X_bm (1 << 0) /* Enables fast offset compensation for x-axis */ -/* NVM Control Register Definitions *********************************************************/ +/* NVM Control Register Definitions *****************************************/ /* BMG160 TRIM_NVM_CTRL_REG */ @@ -338,7 +337,7 @@ * the NVM_RDY flag must be '1' prior to triggering the update */ #define BMG160_TRIM_NVM_CTRL_REG_NVM_PROG_MODE_bm (1 << 0) /* unlock NVM write operation */ -/* Digital Interface Register Definitions ***************************************************/ +/* Digital Interface Register Definitions ***********************************/ /* BMG160 BGW_SPI3_WDT_REG */ @@ -346,9 +345,9 @@ #define BMG160_BGW_SPI3_WDT_REG_I2C_WDT_SEL_bm (1 << 1) /* Select an I2C watchdog timer period of 50ms */ #define BMG160_BGW_SPI3_WDT_REG_SPI3_bm (1 << 0) /* Enable 3-wire SPI mode */ -/* Offset Configuration Register Definitions ************************************************/ +/* Offset Configuration Register Definitions ********************************/ -/* FIFO Register Definitions ****************************************************************/ +/* FIFO Register Definitions ************************************************/ /* BMG160 FIFO_CONFIG_0_REG */ @@ -361,14 +360,14 @@ #define BMG160_FIFO_CONFIG_1_REG_DATA_SEL_1_bm (1 << 1) /* FIFO data selection bit 1 */ #define BMG160_FIFO_CONFIG_1_REG_DATA_SEL_0_bm (1 << 0) /* FIFO data selection bit 0 */ -/* SPI BUS PARAMETERS ***********************************************************************/ +/* SPI BUS PARAMETERS *******************************************************/ #define BMG160_SPI_FREQUENCY (4000000) /* 4 MHz */ #define BMG160_SPI_MODE (SPIDEV_MODE3) /* Device uses SPI Mode 3: CPOL=1, CPHA=1 */ -/******************************************************************************************** +/**************************************************************************** * Public Types - ********************************************************************************************/ + ****************************************************************************/ /* A reference to a structure of this type must be passed to the BMG160 * driver. This structure provides information about the configuration @@ -400,9 +399,9 @@ struct bmg160_config_s int (*attach)(FAR struct bmg160_config_s *, xcpt_t); }; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" @@ -412,7 +411,7 @@ extern "C" #define EXTERN extern #endif -/******************************************************************************************** +/**************************************************************************** * Name: bmg160_register * * Description: @@ -421,12 +420,13 @@ extern "C" * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/gyr0" * spi - An instance of the SPI interface to use to communicate with BMG160 - * config - configuration for the BMG160 driver. For details see description above. + * config - configuration for the BMG160 driver. + * For details see description above. * * Returned Value: * Zero (OK) on success; a negated errno value on failure. * - ********************************************************************************************/ + ****************************************************************************/ int bmg160_register(FAR const char *devpath, FAR struct spi_dev_s *spi, FAR struct bmg160_config_s *config); diff --git a/include/nuttx/sensors/bmi160.h b/include/nuttx/sensors/bmi160.h index bfd2c58cb9..abd0d8a71d 100644 --- a/include/nuttx/sensors/bmi160.h +++ b/include/nuttx/sensors/bmi160.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_BMI160_H #define __INCLUDE_NUTTX_SENSORS_BMI160_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #include @@ -89,6 +93,7 @@ /**************************************************************************** * struct 6-axis data ****************************************************************************/ + struct accel_t { int16_t x; diff --git a/include/nuttx/sensors/bmp180.h b/include/nuttx/sensors/bmp180.h index 2449219a64..9320181680 100644 --- a/include/nuttx/sensors/bmp180.h +++ b/include/nuttx/sensors/bmp180.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * drivers/sensors/bmp180.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,22 +31,27 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_BMP180_H #define __INCLUDE_NUTTX_SENSORS_BMP180_H -#include - #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BMP180) -/******************************************************************************************** +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ #define BMP180_I2C_PORTNO 1 -/* Configuration ****************************************************************************/ +/* Configuration ************************************************************/ + /* Prerequisites: * * CONFIG_SENSORS_BMP180 @@ -59,9 +64,9 @@ struct i2c_master_s; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" diff --git a/include/nuttx/sensors/cluster_driver.h b/include/nuttx/sensors/cluster_driver.h index 5d22b56001..c03d50e660 100644 --- a/include/nuttx/sensors/cluster_driver.h +++ b/include/nuttx/sensors/cluster_driver.h @@ -63,8 +63,8 @@ * interface and is permitted to be called from a kernel task, this function * is reused. But rather than being called by the board initialization * function, the cluster drivers registration function is called from the - * board initialization function; and the cluster drivers registration function - * calls the leaf driver's registration function. + * board initialization function; and the cluster drivers registration + * function calls the leaf driver's registration function. * * To be "cluster driver interface" enabled the leaf driver's registration * function must communicate the leaf driver's instance back to the cluster @@ -91,8 +91,8 @@ * leaf_handle (struct spi_dev_s *) field that is also passed as an in/out * parameter in the leaf driver's registration function. * - * With the above information, the sensor cluster driver may efficiently access - * multiple sensors and aggregate their data. + * With the above information, the sensor cluster driver may efficiently + * access multiple sensors and aggregate their data. * ****************************************************************************/ @@ -118,9 +118,9 @@ struct sensor_cluster_operations_s CODE int (*driver_resume)(FAR void *instance_handle, int32_t arg); }; -/************************************************************************** +/**************************************************************************** * Public Function Prototypes - **************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" @@ -130,7 +130,7 @@ extern "C" #define EXTERN extern #endif -/***************************************************************************** +/**************************************************************************** * Name: xxxxxx_register <-- for a leaf driver. * * Description: @@ -149,11 +149,11 @@ extern "C" * Input Parameters: * devpath - The full path to the leaf driver to register. E.g., * "/dev/acl0" - * spi - An instance of the SPI interface to use to communicate with the - * leaf driver. Or, it could be the I2C driver instance if the - * sensor is on an I2C bus. - * config - configuration struct for the sensor leaf driver. This struct is - * defined in the leaf driver's xxxxxx.h file. + * spi - An instance of the SPI interface to use to communicate with + * the leaf driver. Or, it could be the I2C driver instance if + * the sensor is on an I2C bus. + * config - configuration struct for the sensor leaf driver. + * This struct is defined in the leaf driver's xxxxxx.h file. * * For a SPI sensor, this structure must contain: * diff --git a/include/nuttx/sensors/ina219.h b/include/nuttx/sensors/ina219.h index 04eac1a34b..de445b0fee 100644 --- a/include/nuttx/sensors/ina219.h +++ b/include/nuttx/sensors/ina219.h @@ -49,7 +49,8 @@ * Pre-processor Definitions ****************************************************************************/ -/* INA219 Register Definitions ***********************************************/ +/* INA219 Register Definitions **********************************************/ + /* INA219 Config Register bits */ #define INA219_CONFIG_SADC_SHIFT 3 @@ -116,19 +117,19 @@ extern "C" * Name: ina219_register * * Description: - * Register the ina219 character device as 'devpath' + * Register the ina219 character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" - * i2c - An instance of the I2C interface to use to communicate with INA219 - * addr - The I2C address of the INA219. The base I2C address of the INA219 - * is 0x40. Bits 0-3 can be controlled to get 16 unique addresses from 0x40 - * through 0x4f. - * shuntval - resistor value in microohms - * config - a combination of the constants defined earlier in this file + * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" + * i2c - An instance of the I2C interface to use to communicate with INA219 + * addr - The I2C address of the INA219. The base I2C address of the INA219 + * is 0x40. Bits 0-3 can be controlled to get 16 unique addresses from 0x40 + * through 0x4f. + * shuntval - resistor value in microohms + * config - a combination of the constants defined earlier in this file * * Returned Value: - * Zero (OK) on success; a negated errno value on failure. + * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/sensors/ina226.h b/include/nuttx/sensors/ina226.h index 9e9e733a86..2096815cf2 100644 --- a/include/nuttx/sensors/ina226.h +++ b/include/nuttx/sensors/ina226.h @@ -50,7 +50,7 @@ * Pre-processor Definitions ****************************************************************************/ -/* INA226 Register Definitions ***********************************************/ +/* INA226 Register Definitions **********************************************/ #define INA226_REG_CONFIG 0 /* See below */ #define INA226_REG_SHUNT_VOLTAGE 1 /* Shunt voltage in 2.5 uV units */ diff --git a/include/nuttx/sensors/ina3221.h b/include/nuttx/sensors/ina3221.h index 5e4c734e2f..f4bacc0397 100644 --- a/include/nuttx/sensors/ina3221.h +++ b/include/nuttx/sensors/ina3221.h @@ -54,7 +54,8 @@ #define INA3221_I2C_ADDR2 0x42 #define INA3221_I2C_ADDR3 0x43 -/* INA3221 Register Definitions ***********************************************/ +/* INA3221 Register Definitions *********************************************/ + /* INA3221 Config Register bits */ #define INA3221_CONFIG_MODE_POWERDOWN 0x0 @@ -137,19 +138,20 @@ extern "C" * Name: ina3221_register * * Description: - * Register the ina3221 character device as 'devpath' + * Register the ina3221 character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" - * i2c - An instance of the I2C interface to use to communicate with INA3221 - * addr - The I2C address of the INA3221. The base I2C address of the INA3221 - * is 0x80. Bits 0-1 can be controlled to get 4 unique addresses from 0x80 - * through 0x83. - * shuntval - resistor value in microohms - * config - a combination of the constants defined earlier in this file + * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" + * i2c - An instance of the I2C interface to use to communicate with INA3221 + * addr - The I2C address of the INA3221. + * The base I2C address of the INA3221 is 0x80. + * Bits 0-1 can be controlled to get 4 unique addresses from 0x80 + * through 0x83. + * shuntval - resistor value in microohms + * config - a combination of the constants defined earlier in this file * * Returned Value: - * Zero (OK) on success; a negated errno value on failure. + * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/sensors/ioctl.h b/include/nuttx/sensors/ioctl.h index 776a1fad9e..1db6cbd250 100644 --- a/include/nuttx/sensors/ioctl.h +++ b/include/nuttx/sensors/ioctl.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * include/nuttx/sensors/ioctl.h * * Copyright (C) 2016-2019 Gregory Nutt. All rights reserved. @@ -31,21 +31,21 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_IOCTL_H #define __INCLUDE_NUTTX_SENSORS_IOCTL_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ /* IOCTL commands unique to the BH1750FVI */ @@ -260,25 +260,30 @@ #define SNIOC_BATCH _SNIOC(0x0069) /* Command: SNIOC_GET_NEVENTBUF - * Description: the number of sensor events that sensor buffer of upper half holds. + * Description: the number of sensor events that sensor buffer of upper half + * holds. * Argument: This is the number of events pointer, is output parameter. - * Note: Tell the application layer number of sensor events in sensor buffer. - * This buffer is used to solve the problem that the application layer - * can't read the sensor event in time. Recommend the number of sensor - * events in application layer's buffer is same as result by call this - * function. - * This is number of sensor events rather than the length of buffer. + * Note: Tell the application layer number of sensor events in sensor + * buffer. + * This buffer is used to solve the problem that the + * application layer can't read the sensor event in time. + * Recommend the number of sensor events in application layer's + * buffer is same as result by call this function. + * This is number of sensor events rather than the length of + * buffer. * See sensor.h(struct sensor_lower_half_s buffer_bytes). */ #define SNIOC_GET_NEVENTBUF _SNIOC(0x0070) /* Command: SNIOC_SET_BUFFER_SIZE - * Description: Set size of intermediate circualr buffer in upper half driver. + * Description: Set size of intermediate circualr buffer in upper half + * driver. * Argument: This is the size of buffer pointer. - * Note: The application layer can set size of intermediate circualr buffer - * by this ioctl command. The size is in bytes, it should be a multiple - * of an event. + * Note: The application layer can set size of intermediate circualr + * buffer + * by this ioctl command. The size is in bytes, it should be a + * multiple of an event. */ #define SNIOC_SET_BUFFER_SIZE _SNIOC(0x0071) diff --git a/include/nuttx/sensors/kx022.h b/include/nuttx/sensors/kx022.h index c803e1cceb..376faf64bf 100644 --- a/include/nuttx/sensors/kx022.h +++ b/include/nuttx/sensors/kx022.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_KX022_H #define __INCLUDE_NUTTX_SENSORS_KX022_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_KX022) || defined(CONFIG_SENSORS_KX022_SCU)) diff --git a/include/nuttx/sensors/kxtj9.h b/include/nuttx/sensors/kxtj9.h index 7c97253111..8537bb943f 100644 --- a/include/nuttx/sensors/kxtj9.h +++ b/include/nuttx/sensors/kxtj9.h @@ -10,28 +10,29 @@ * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ diff --git a/include/nuttx/sensors/lis2dh.h b/include/nuttx/sensors/lis2dh.h index 7d05c0caef..87f9dfae4a 100644 --- a/include/nuttx/sensors/lis2dh.h +++ b/include/nuttx/sensors/lis2dh.h @@ -58,7 +58,7 @@ extern "C" #define ST_LIS2DH_WHOAMI_VALUE 0x33 /* Valid WHOAMI register value */ -/* LIS2DH Internal Registers **********************************************/ +/* LIS2DH Internal Registers ************************************************/ #define ST_LIS2DH_WHOAMI_REG 0x0f /* WHOAMI register */ @@ -142,7 +142,7 @@ extern "C" #define ST_LIS2DH_CTRL_REG6 0x25 #define ST_LIS2DH_REFERENCE_REG 0x26 -#define ST_LIS2DH_STATUS_REG 0x27 /* Status Register */ +#define ST_LIS2DH_STATUS_REG 0x27 /* Status Register */ #define ST_LIS2DH_SR_ZYXOR 0x80 /* OR'ed X,Y and Z data over-run */ #define ST_LIS2DH_SR_ZOR 0x40 /* individual data over-run ... */ #define ST_LIS2DH_SR_YOR 0x20 @@ -217,9 +217,9 @@ extern "C" #define ST_LIS2DH_ACT_DUR_REG 0x3f -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ enum lis2dh_ouput_data_rate { @@ -275,7 +275,9 @@ enum lis2dh_interrupt_mode begin_packed_struct struct lis2dh_vector_s { - int16_t x, y, z; + int16_t x; + int16_t y; + int16_t z; } end_packed_struct; begin_packed_struct struct lis2dh_res_header @@ -389,14 +391,17 @@ struct lis2dh_config_s * callbacks to isolate the lis2dh driver from differences in GPIO * interrupt handling by varying boards and MCUs. * - * irq_attach - Attach the lis2dh interrupt handler to the GPIO interrupt - * irq_enable - Enable or disable the GPIO interrupt - * clear_irq - Acknowledge/clear any pending GPIO interrupt + * irq_attach - Attach the lis2dh interrupt handler to the GPIO interrupt + * irq_enable - Enable or disable the GPIO interrupt + * clear_irq - Acknowledge/clear any pending GPIO interrupt * */ - CODE int (*irq_attach)(FAR struct lis2dh_config_s *state, xcpt_t isr, FAR void *arg); - CODE void (*irq_enable)(FAR const struct lis2dh_config_s *state, bool enable); + CODE int (*irq_attach)(FAR struct lis2dh_config_s *state, + xcpt_t isr, + FAR void *arg); + CODE void (*irq_enable)(FAR const struct lis2dh_config_s *state, + bool enable); CODE void (*irq_clear)(FAR const struct lis2dh_config_s *state); CODE bool (*read_int1_pin)(void); CODE bool (*read_int2_pin)(void); @@ -419,15 +424,17 @@ typedef struct lis2dh_raw_data_s lis2dh_raw_data_t; * Name: lis2dh_register * * Description: - * Register the LIS2DH character device as 'devpath' + * Register the LIS2DH character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/acc0" - * i2c - An instance of the I2C interface to use to communicate with LIS2DH - * addr - The I2C address of the LIS2DH. The base I2C address of the LIS2DH - * is 0x18. Bit 0 can be controlled via SA0 pad - when connected to - * voltage supply the address is 0x19. - * config - Pointer to LIS2DH configuration + * devpath - The full path to the driver to register. E.g., "/dev/acc0" + * i2c - An instance of the I2C interface to use to communicate with + * LIS2DH + * addr - The I2C address of the LIS2DH. The base I2C address of the + * LIS2DH is 0x18. + * Bit 0 can be controlled via SA0 pad - when connected to + * voltage supply the address is 0x19. + * config - Pointer to LIS2DH configuration * * Returned Value: * Zero (OK) on success; a negated errno value on failure. diff --git a/include/nuttx/sensors/lis331dl.h b/include/nuttx/sensors/lis331dl.h index ab86728aa2..461cf79695 100644 --- a/include/nuttx/sensors/lis331dl.h +++ b/include/nuttx/sensors/lis331dl.h @@ -38,14 +38,18 @@ #ifndef __INCLUDE_NUTTX_SENSORS_LIS331DL_H #define __INCLUDE_NUTTX_SENSORS_LIS331DL_H +#if defined(CONFIG_I2C) && defined(CONFIG_LIS331DL) + +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #include -#if defined(CONFIG_I2C) && defined(CONFIG_LIS331DL) - -/************************************************************************************ +/**************************************************************************** * Pre-Processor Declarations - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ @@ -58,9 +62,9 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Data Types - ************************************************************************************/ + ****************************************************************************/ struct lis331dl_dev_s; @@ -73,11 +77,11 @@ struct lis331dl_vector_s struct i2c_master_s; -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_init * * Description: @@ -88,58 +92,59 @@ struct i2c_master_s; * address - I2C Address of the proposed device * * Returned Value: - * Pointer to newly allocated ST LIS331DL structure or NULL on error with errno - * set. + * Pointer to newly allocated ST LIS331DL structure or NULL on error with + * errno set. * * Possible errno as set by this function on error: - * - ENODEV: When device addressed on given address is not compatible or it is not - * a LIS331DL + * - ENODEV: When device addressed on given address is not compatible or it + * is not a LIS331DL * - EFAULT: When there is no device at given address. * - EBUSY: When device is already addressed by other device driver (not yet * supported by low-level driver) * - ************************************************************************************/ + ****************************************************************************/ FAR struct lis331dl_dev_s *lis331dl_init(FAR struct i2c_master_s *i2c, uint16_t address); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_deinit * * Description: * Uninitialize ST LIS331DL Chip * * Input Parameters: - * dev - Device to LIS331DL device structure, as returned by the lis331dl_init() + * dev - Device to LIS331DL device structure, as returned by the + * lis331dl_init() * * Returned Value: * OK On success * - ************************************************************************************/ + ****************************************************************************/ int lis331dl_deinit(FAR struct lis331dl_dev_s *dev); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_powerup * * Description: * Power up device, start conversion * - ************************************************************************************/ + ****************************************************************************/ int lis331dl_powerup(FAR struct lis331dl_dev_s *dev); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_powerdown * * Description: * Power down device, stop conversion * - ************************************************************************************/ + ****************************************************************************/ int lis331dl_powerdown(FAR struct lis331dl_dev_s *dev); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_setconversion * * Description: @@ -153,11 +158,13 @@ int lis331dl_powerdown(FAR struct lis331dl_dev_s *dev); * Returned Value: * OK on success or errno is set * - ************************************************************************************/ + ****************************************************************************/ -int lis331dl_setconversion(FAR struct lis331dl_dev_s *dev, bool full, bool fast); +int lis331dl_setconversion(FAR struct lis331dl_dev_s *dev, + bool full, + bool fast); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_getprecision * * Description: @@ -166,11 +173,11 @@ int lis331dl_setconversion(FAR struct lis331dl_dev_s *dev, bool full, bool fast) * Returned Value: * Precision of 1 LSB in terms of unit [mg] * - ************************************************************************************/ + ****************************************************************************/ int lis331dl_getprecision(FAR struct lis331dl_dev_s *dev); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_getsamplerate * * Description: @@ -179,11 +186,11 @@ int lis331dl_getprecision(FAR struct lis331dl_dev_s *dev); * Returned Value: * Sample rate in units of [Hz] * - ************************************************************************************/ + ****************************************************************************/ int lis331dl_getsamplerate(FAR struct lis331dl_dev_s *dev); -/************************************************************************************ +/**************************************************************************** * Name: lis331dl_getreadings * * Description: @@ -193,11 +200,11 @@ int lis331dl_getsamplerate(FAR struct lis331dl_dev_s *dev); * dev - Device to LIS331DL device structure * * Returned Value: - * Ptr to vector acceleration [x,y,z] on success, or NULL on error with errno - * set. If data is not yet ready to be read from the LIS331 then errno is set - * to EAGAIN otherwise errno is set by I2C_TRANSFER(). + * Ptr to vector acceleration [x,y,z] on success, or NULL on error with + * errno set. If data is not yet ready to be read from the LIS331 then + * errno is set to EAGAIN otherwise errno is set by I2C_TRANSFER(). * - ************************************************************************************/ + ****************************************************************************/ FAR const struct lis331dl_vector_s * lis331dl_getreadings(FAR struct lis331dl_dev_s *dev); diff --git a/include/nuttx/sensors/lis3dh.h b/include/nuttx/sensors/lis3dh.h index 849d7a72d3..ac17068dc1 100644 --- a/include/nuttx/sensors/lis3dh.h +++ b/include/nuttx/sensors/lis3dh.h @@ -100,7 +100,7 @@ #define LIS3DH_ACT_THS (0x3E) #define LIS3DH_ACT_DUR (0x3F) -/* LIS3DH STATUS_REG_AUX Definitions **********************************************/ +/* LIS3DH STATUS_REG_AUX Definitions ****************************************/ #define LIS3DH_STATUS_REG_AUX_321OR (1 << 7) #define LIS3DH_STATUS_REG_AUX_3OR (1 << 6) @@ -111,16 +111,16 @@ #define LIS3DH_STATUS_REG_AUX_2DA (1 << 1) #define LIS3DH_STATUS_REG_AUX_1DA (1 << 0) -/* LIS3DH CTRL_REG0 Definitions **********************************************/ +/* LIS3DH CTRL_REG0 Definitions *********************************************/ #define LIS3DH_CTRL_REG0_SDO_PU_DISC (1 << 7) /* Disconnect SDO/SA0 pull-up */ -/* LIS3DH TEMP_CFG_REG Definitions **********************************************/ +/* LIS3DH TEMP_CFG_REG Definitions ******************************************/ #define LIS3DH_TEMP_CFG_REG_ADC_EN (1 << 7) /* ADC enable */ #define LIS3DH_TEMP_CFG_REG_TEMP_EN (1 << 6) /* Temperator sensor enable */ -/* LIS3DH CTRL_REG1 Definitions **********************************************/ +/* LIS3DH CTRL_REG1 Definitions *********************************************/ #define LIS3DH_CTRL_REG1_ODR_SHIFT (4) #define LIS3DH_CTRL_REG1_ODR_MASK (0xf << LIS3DH_CTRL_REG1_ODR_SHIFT) @@ -142,9 +142,9 @@ #define LIS3DH_CTRL_REG1_YEN (1 << 1) /* Y axis enable */ #define LIS3DH_CTRL_REG1_XEN (1 << 0) /* X axis enable */ -/* LIS3DH CTRL_REG2 Definitions **********************************************/ +/* LIS3DH CTRL_REG2 Definitions *********************************************/ -/* LIS3DH CTRL_REG3 Definitions **********************************************/ +/* LIS3DH CTRL_REG3 Definitions *********************************************/ #define LIS3DH_CTRL_REG3_I1_CLICK (1 << 6) /* Click interrupt on INT1 */ #define LIS3DH_CTRL_REG3_I1_IA1 (1 << 6) /* IA1 interrupt on INT1 */ @@ -154,7 +154,7 @@ #define LIS3DH_CTRL_REG3_I1_WTM (1 << 2) /* FIFO watermark interrupt on INT1 */ #define LIS3DH_CTRL_REG3_I1_OVERRUN (1 << 1) /* FIFO overrun interrupt on INT1 */ -/* LIS3DH CTRL_REG4 Definitions **********************************************/ +/* LIS3DH CTRL_REG4 Definitions *********************************************/ #define LIS3DH_CTRL_REG4_BDU (1 << 7) /* Block data update */ #define LIS3DH_CTRL_REG4_BLE (1 << 6) /* Endian selection. 0: LSB first, 1: MSB first */ @@ -167,7 +167,7 @@ #define LIS3DH_CTRL_REG4_ST0 (1 << 1) /* Self test 0 */ #define LIS3DH_CTRL_REG4_SIM (1 << 0) /* SPI serial interface mode selection (0: 4-wire, 1: 3-wire) */ -/* LIS3DH CTRL_REG5 Definitions **********************************************/ +/* LIS3DH CTRL_REG5 Definitions *********************************************/ #define LIS3DH_CTRL_REG5_BOOT (1 << 7) /* Reboot memory content */ #define LIS3DH_CTRL_REG5_FIFO_EN (1 << 6) /* FIFO enable */ @@ -176,7 +176,7 @@ #define LIS3DH_CTRL_REG5_LIR_INT2 (1 << 1) /* Latch interrupt request on INT2_SRC register */ #define LIS3DH_CTRL_REG5_D4D_INT2 (1 << 0) /* 4D detection enable on INT2 */ -/* LIS3DH CTRL_REG6 Definitions **********************************************/ +/* LIS3DH CTRL_REG6 Definitions *********************************************/ #define LIS3DH_CTRL_REG6_I2_CLICK (1 << 6) /* Click interrupt on INT2 */ #define LIS3DH_CTRL_REG6_I2_IA1 (1 << 6) /* IA1 interrupt on INT2 */ @@ -185,7 +185,7 @@ #define LIS3DH_CTRL_REG6_I2_ACT (1 << 3) /* Enable activity interrupt on INT2 */ #define LIS3DH_CTRL_REG6_INT_POLARITY (1 << 1) /* INT1 and INT2 pin polarity */ -/* LIS3DH STATUS_REG Definitions **********************************************/ +/* LIS3DH STATUS_REG Definitions ********************************************/ #define LIS3DH_STATUS_ZYXOR (1 << 7) /* X,Y,Z axis data overrun */ #define LIS3DH_STATUS_ZOR (1 << 6) /* Z axis data overrun */ @@ -196,7 +196,7 @@ #define LIS3DH_STATUS_REG_YDA (1 << 1) /* Y axis data available */ #define LIS3DH_STATUS_REG_XDA (1 << 0) /* X axis data available */ -/* LIS3DH FIFO_CTRL_REG Definitions **********************************************/ +/* LIS3DH FIFO_CTRL_REG Definitions *****************************************/ #define LIS3DH_FIFO_CTRL_REG_MODE_STREAM2 (3 << 6) #define LIS3DH_FIFO_CTRL_REG_MODE_STREAM (2 << 6) @@ -204,24 +204,24 @@ #define LIS3DH_FIFO_CTRL_REG_MODE_BYPASS (0 << 6) #define LIS3DH_FIFO_CTRL_REG_TR (1 << 5) -/* LIS3DH FIFO_SRC_REG Definitions **********************************************/ +/* LIS3DH FIFO_SRC_REG Definitions ******************************************/ #define LIS3DH_FIFO_SRC_REG_WTM (1 << 7) #define LIS3DH_FIFO_SRC_REG_OVRN_FIFO (1 << 6) #define LIS3DH_FIFO_SRC_REG_EMPTY (1 << 5) -/* SPI parameters ***************************************************************/ +/* SPI parameters ***********************************************************/ #define LIS3DH_SPI_FREQUENCY (9600000) /* SPI Clock Frequency */ #define LIS3DH_SPI_MODE (SPIDEV_MODE3) /* Device uses SPI Mode 3: CPOL=1, CPHA=1 */ -/* Power Modes ******************************************************************/ +/* Power Modes **************************************************************/ #define LIS3DH_POWER_LOW (0x0) /* Lower power 8bit output */ #define LIS3DH_POWER_NORMAL (0x1) /* Normal 10bit */ #define LIS3DH_POWER_HIGH (0x2) /* HR 12bit mode */ -/* Output Data Rates ***********************************************************/ +/* Output Data Rates *******************************************************/ #define LIS3DH_ODR_POWER_DOWN (0) /* Disable output */ #define LIS3DH_ODR_1HZ (0x1) /* 1Hz in all power modes */ diff --git a/include/nuttx/sensors/lm75.h b/include/nuttx/sensors/lm75.h index ba12d3114f..730d54bb7d 100644 --- a/include/nuttx/sensors/lm75.h +++ b/include/nuttx/sensors/lm75.h @@ -48,7 +48,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************ + +/* Configuration + * * CONFIG_I2C - Enables support for I2C drivers * CONFIG_LM75_I2C - Enables support for the LM-75 driver */ @@ -64,6 +66,7 @@ #define CONFIG_LM75_ADDR7 (CONFIG_LM75_BASEADDR + 7) /* LM-75 Register Definitions ***********************************************/ + /* LM-75 Registers addresses */ #define LM75_TEMP_REG 0x00 /* Temperature Register */ diff --git a/include/nuttx/sensors/lm92.h b/include/nuttx/sensors/lm92.h index 1c7f278d35..ddee75b893 100644 --- a/include/nuttx/sensors/lm92.h +++ b/include/nuttx/sensors/lm92.h @@ -50,7 +50,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* Configuration ************************************************************ + +/* Configuration + * * CONFIG_I2C - Enables support for I2C drivers * CONFIG_SENSORS_LM92 - Enables support for the LM92 driver */ @@ -61,7 +63,8 @@ #define CONFIG_LM92_ADDR2 (CONFIG_LM92_BASEADDR + 2) #define CONFIG_LM92_ADDR3 (CONFIG_LM92_BASEADDR + 3) -/* LM92 Register Definitions ***********************************************/ +/* LM92 Register Definitions ************************************************/ + /* LM92 Register Addresses */ #define LM92_TEMP_REG 0x00 /* Temperature Register */ diff --git a/include/nuttx/sensors/lsm303agr.h b/include/nuttx/sensors/lsm303agr.h index 486b54cfbd..a86ff10566 100644 --- a/include/nuttx/sensors/lsm303agr.h +++ b/include/nuttx/sensors/lsm303agr.h @@ -183,12 +183,12 @@ struct lsm303agr_ops_s struct lsm303agr_dev_s { - FAR struct i2c_master_s *i2c; /* I2C interface */ + FAR struct i2c_master_s *i2c; /* I2C interface */ uint8_t addr; /* I2C address */ FAR const struct lsm303agr_ops_s *ops; - uint8_t datareg; /* Output data register of X low byte */ + uint8_t datareg; /* Output data register of X low byte */ struct lsm303agr_sensor_data_s sensor_data; /* Sensor data container */ }; diff --git a/include/nuttx/sensors/lsm6dsl.h b/include/nuttx/sensors/lsm6dsl.h index ae7e148bda..69db52e356 100644 --- a/include/nuttx/sensors/lsm6dsl.h +++ b/include/nuttx/sensors/lsm6dsl.h @@ -1,4 +1,4 @@ -/**************************************************************************************************** +/**************************************************************************** * include/nuttx/sensors/lsm6dsl.h [from the IKS01A2 MEMS board STM] * * Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved. @@ -31,25 +31,25 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ****************************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_LSM6DSL #define __INCLUDE_NUTTX_SENSORS_LSM6DSL -/**************************************************************************************************** +/**************************************************************************** * Included Files - ****************************************************************************************************/ + ****************************************************************************/ #include #include #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_LSM6DSL) -/**************************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ****************************************************************************************************/ + ****************************************************************************/ -/* I2C Addresses ************************************************************************************/ +/* I2C Addresses ************************************************************/ /* Accelerometer addresses */ @@ -61,7 +61,7 @@ #define LSM6DSLGYRO_ADDR0 0xd4 #define LSM6DSLGYRO_ADDR1 0xd6 -/* Register Addresses *******************************************************************************/ +/* Register Addresses *******************************************************/ /* Accelerometer and gyroscope registers */ @@ -202,14 +202,17 @@ #define LSM6DSL_A_WRIST_TILT_THS 0x54 /* Absolute Wrist Tilt threshold register (r/w). */ #define LSM6DSL_A_WRIST_TILT_Mask 0x59 /* Absolute Wrist Tilt mask register (r/w). */ -/**************************************************************************************************** +/**************************************************************************** * Register Bit Definitions * - * For this sensor it is chosen to not define each pin individually...its set bitwise like: - * 0b000[0]0000 with preferred hex value! Where [] is showing the [not defined in datasheet] bit. - * A complete definition is written below, just not all registers are validated!! + * For this sensor it is chosen to not define each pin individually...its set + * bitwise like: + * 0b000[0]0000 with preferred hex value! + * Where [] is showing the [not defined in datasheet] bit. + * A complete definition is written below, just not all registers are + * validated!! * - ****************************************************************************************************/ + ****************************************************************************/ #define LSM6DSL_FUNC_CFG_ACCESS_FUNC_CFG_EN (1 << 5) #define LSM6DSL_FUNC_CFG_ACCESS_FUNC_CFG_EN_B (1 << 7) @@ -245,7 +248,7 @@ #define LSM6DSL_FIFO_CTRL4_DEC_DS3_FIFO_MASK (3 << LSM6DSL_FIFO_CTRL4_DEC_DS3_FIFO_SHIFT) #define LSM6DSL_FIFO_CTRL4_DEC_DS4_FIFO_SHIFT 3 #define LSM6DSL_FIFO_CTRL4_DEC_DS4_FIFO_MASK (3 << LSM6DSL_FIFO_CTRL4_DEC_DS4_FIFO_SHIFT) -#define LSM6DSL_FIFO_CTRL4_ONLY_HIGH_DATA (1 << 6)/* */ +#define LSM6DSL_FIFO_CTRL4_ONLY_HIGH_DATA (1 << 6) /* */ #define LSM6DSL_FIFO_CTRL4_STOP_ON_FTH (1 << 7) /* .*/ #define LSM6DSL_FIFO_CTRL5_FIFO_MODE_SHIFT 0 @@ -811,9 +814,9 @@ #define LSM6DSL_A_WRIST_TILT_Mask_SHIFT 2 #define LSM6DSL_A_WRIST_TILT_Mask_MASK (63 << LSM6DSL_A_WRIST_TILT_Mask_SHIFT) -/**************************************************************************************************** +/**************************************************************************** * Public Types - ****************************************************************************************************/ + ****************************************************************************/ struct i2c_master_s; @@ -831,9 +834,9 @@ struct lsm6dsl_sensor_data_s uint16_t timestamp; }; -/**************************************************************************************************** +/**************************************************************************** * Public Types - ****************************************************************************************************/ + ****************************************************************************/ struct lsm6dsl_dev_s; struct lsm6dsl_ops_s @@ -854,20 +857,20 @@ struct lsm6dsl_dev_s FAR const struct lsm6dsl_ops_s *ops; - uint8_t datareg; /* Output data register of X low byte */ - struct lsm6dsl_sensor_data_s sensor_data; /* Sensor data container */ + uint8_t datareg; /* Output data register of X low byte */ + struct lsm6dsl_sensor_data_s sensor_data; /* Sensor data container */ }; -/**************************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ****************************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus extern "C" { #endif -/**************************************************************************************************** +/**************************************************************************** * Name: lsm6dslaccel_register * * Description: @@ -881,7 +884,7 @@ extern "C" * Returned Value: * Zero (OK) on success; a negated errno value on failure. * - ****************************************************************************************************/ + ****************************************************************************/ int lsm6dsl_sensor_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, diff --git a/include/nuttx/sensors/lsm9ds1.h b/include/nuttx/sensors/lsm9ds1.h index bc160507c9..e28a5b3c1c 100644 --- a/include/nuttx/sensors/lsm9ds1.h +++ b/include/nuttx/sensors/lsm9ds1.h @@ -50,6 +50,7 @@ ****************************************************************************/ /* I2C Addresses ************************************************************/ + /* Accelerometer addresses */ #define LSM9DS1ACCEL_ADDR0 0x6a @@ -96,7 +97,8 @@ extern "C" * ****************************************************************************/ -int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, +int lsm9ds1accel_register(FAR const char *devpath, + FAR struct i2c_master_s *i2c, uint8_t addr); /**************************************************************************** @@ -115,7 +117,8 @@ int lsm9ds1accel_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, * ****************************************************************************/ -int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, +int lsm9ds1gyro_register(FAR const char *devpath, + FAR struct i2c_master_s *i2c, uint8_t addr); /**************************************************************************** @@ -134,7 +137,8 @@ int lsm9ds1gyro_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, * ****************************************************************************/ -int lsm9ds1mag_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, +int lsm9ds1mag_register(FAR const char *devpath, + FAR struct i2c_master_s *i2c, uint8_t addr); #ifdef __cplusplus diff --git a/include/nuttx/sensors/lt1pa01.h b/include/nuttx/sensors/lt1pa01.h index 181422aa72..e2e1c39ee0 100644 --- a/include/nuttx/sensors/lt1pa01.h +++ b/include/nuttx/sensors/lt1pa01.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_LT1PA01_H #define __INCLUDE_NUTTX_SENSORS_LT1PA01_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_LT1PA01) || defined(CONFIG_SENSORS_LT1PA01_SCU)) diff --git a/include/nuttx/sensors/ltc4151.h b/include/nuttx/sensors/ltc4151.h index 85fbc9dbce..f7a4a74133 100644 --- a/include/nuttx/sensors/ltc4151.h +++ b/include/nuttx/sensors/ltc4151.h @@ -62,7 +62,8 @@ #define CONFIG_LTC4151_ADDR8 (CONFIG_LTC4151_BASEADDR + 8) #define CONFIG_LTC4151_ADDR9 (CONFIG_LTC4151_BASEADDR + 9) -/* LTC4151 Register Definitions ***********************************************/ +/* LTC4151 Register Definitions *********************************************/ + /* LTC4151 Registers addresses */ #define LTC4151_CURR_REG 0x00 /* Current Register start address */ @@ -103,14 +104,15 @@ extern "C" * Name: ltc4151_register * * Description: - * Register the ltc4151 character device as 'devpath' + * Register the ltc4151 character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" - * i2c - An instance of the I2C interface to use to communicate with LTC4151 - * addr - The I2C address of the LTC4151. The base I2C address of the LTC4151 - * is 0x18. Bits 0-3 can be controlled to get 8 unique addresses from 0x18 - * through 0x1f. + * devpath - The full path to the driver to register. E.g., "/dev/pwrmntr0" + * i2c - An instance of the I2C interface to use to communicate with LTC4151 + * addr - The I2C address of the LTC4151. + * The base I2C address of the LTC4151 is 0x18. + * Bits 0-3 can be controlled to get 8 unique addresses from 0x18 + * through 0x1f. * shunt_resistor_value - resistor value in ohm * * Returned Value: diff --git a/include/nuttx/sensors/max44009.h b/include/nuttx/sensors/max44009.h index 9cf1a2723b..286ee266aa 100644 --- a/include/nuttx/sensors/max44009.h +++ b/include/nuttx/sensors/max44009.h @@ -70,9 +70,13 @@ enum max44009_integration_time_e struct max44009_config_s { - CODE int (*irq_attach)(FAR struct max44009_config_s * state, xcpt_t isr, FAR void *arg); - CODE void (*irq_enable)(FAR const struct max44009_config_s * state, bool enable); - CODE int (*set_power)(FAR const struct max44009_config_s * state, bool on); + CODE int (*irq_attach)(FAR struct max44009_config_s * state, + xcpt_t isr, + FAR void *arg); + CODE void (*irq_enable)(FAR const struct max44009_config_s * state, + bool enable); + CODE int (*set_power)(FAR const struct max44009_config_s * state, + bool on); }; /* Configuration structure for MAX44009 */ @@ -87,6 +91,7 @@ struct max44009_init_s * photodiode current goes to the ADC, true - * 1/8 (must be used in high-brightness * situations) */ + enum max44009_integration_time_e integr_time; /* Integration time */ }; @@ -95,8 +100,9 @@ struct max44009_threshold_s uint8_t upper_threshold; /* Upper threshold high-byte */ uint8_t lower_threshold; /* Lower threshold high-byte */ uint8_t threshold_timer; /* 0 - interrupt will be triggered as soon as - * the light level exceeds either threshold */ -} ; + * the light level exceeds either threshold + */ +}; /* Data transfer structure */ diff --git a/include/nuttx/sensors/mb7040.h b/include/nuttx/sensors/mb7040.h index 70c40ac2c6..f512073e0b 100644 --- a/include/nuttx/sensors/mb7040.h +++ b/include/nuttx/sensors/mb7040.h @@ -48,6 +48,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************ * Prerequisites: * @@ -62,6 +63,7 @@ #define MB7040_DEFAULTADDR 0x70 /* Default I2C Address */ /* Register Definitions *****************************************************/ + /* Register Addresses */ #define MB7040_RANGE_REG 0x51 diff --git a/include/nuttx/sensors/mcp9844.h b/include/nuttx/sensors/mcp9844.h index 6ae95f0065..5409de4e9a 100644 --- a/include/nuttx/sensors/mcp9844.h +++ b/include/nuttx/sensors/mcp9844.h @@ -103,15 +103,15 @@ extern "C" * Name: mcp9844_register * * Description: - * Register the MCP9844 character device as 'devpath' + * Register the MCP9844 character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/temp0" - * i2c - An instance of the I2C interface to use to communicate with MCP9844 - * addr - The I2C address of the MCP9844. + * devpath - The full path to the driver to register. E.g., "/dev/temp0" + * i2c - An instance of the I2C interface to use to communicate with MCP9844 + * addr - The I2C address of the MCP9844. * * Returned Value: - * Zero (OK) on success; a negated errno value on failure. + * Zero (OK) on success; a negated errno value on failure. * ****************************************************************************/ diff --git a/include/nuttx/sensors/mlx90614.h b/include/nuttx/sensors/mlx90614.h index 854fa75a30..5fa4ab0a9b 100644 --- a/include/nuttx/sensors/mlx90614.h +++ b/include/nuttx/sensors/mlx90614.h @@ -91,26 +91,29 @@ /* CONFIG_REG1 */ -#define CONFIG_REG1_IIR_SHIFT (0) /* Bits 2:0 - Configure IIR Coefficients */ +#define CONFIG_REG1_IIR_SHIFT (0) /* Bits 2:0 - Configure IIR Coefficients */ #define CONFIG_REG1_IIR_MASK (7 << CONFIG_REG1_IIR_SHIFT) #define CONFIG_REG1_IIR_0p5_0p5 (0 << CONFIG_REG1_IIR_SHIFT) /* a1 = 0.5 and b1 = 0.5 */ #define CONFIG_REG1_IIR_0p57_0p42 (7 << CONFIG_REG1_IIR_SHIFT) /* a1 = 0.571428571 and b1 = 0.428571428 */ #define CONFIG_REG1_IIR_0p66_0p33 (6 << CONFIG_REG1_IIR_SHIFT) /* a1 = 0.666... and b1 = 0.333... */ #define CONFIG_REG1_IIR_0p8_0p2 (5 << CONFIG_REG1_IIR_SHIFT) /* a1 = 0.8 and b1 = 0.2 */ #define CONFIG_REG1_IIR_BYPASS (4 << CONFIG_REG1_IIR_SHIFT) /* a1 = 1 and b1 = 0 => IIR bypassed */ -#define CONFIG_REG1_AMB_SENSOR_PTC (1 << 3) /* Ambient temperature sensor: 1 = PTC, 0 = PTAT */ -#define CONFIG_REG1_DATA_PWM_SHIFT (4) /* Bits 5:4 - Data transmitted through PWM */ + +#define CONFIG_REG1_AMB_SENSOR_PTC (1 << 3) /* Ambient temperature sensor: 1 = PTC, 0 = PTAT */ +#define CONFIG_REG1_DATA_PWM_SHIFT (4) /* Bits 5:4 - Data transmitted through PWM */ #define CONFIG_REG1_DATA_PWM_MASK (3 << CONFIG_REG1_DATA_PWM_SHIFT) #define CONFIG_REG1_DATA_PWM_TA_IR1 (0 << CONFIG_REG1_DATA_PWM_SHIFT) /* Data1 = Ta and Data2 = IR1 */ #define CONFIG_REG1_DATA_PWM_TA_IR2 (1 << CONFIG_REG1_DATA_PWM_SHIFT) /* Data1 = Ta and Data2 = IR2 */ #define CONFIG_REG1_DATA_PWM_IR1_IR2 (2 << CONFIG_REG1_DATA_PWM_SHIFT) /* Data1 = IR1 and Data2 = IR2 */ #define CONFIG_REG1_DATA_PWM_IR1_UND (3 << CONFIG_REG1_DATA_PWM_SHIFT) /* Data1 = IR2 and Data2 = Undefined */ -#define CONFIG_REG1_NUM_SENSORS (1 << 6) /* Number of sensors: 1 = 2 sensors, 0 = 1 sensor */ -#define CONFIG_REG1_KS (1 << 7) /* Define the sign Ks. Factory calibration, do not alter */ -#define CONFIG_REG1_FIR_SHIFT (8) /* Bits 10:8 - Configure coefficient N of FIR digital filter */ + +#define CONFIG_REG1_NUM_SENSORS (1 << 6) /* Number of sensors: 1 = 2 sensors, 0 = 1 sensor */ +#define CONFIG_REG1_KS (1 << 7) /* Define the sign Ks. Factory calibration, do not alter */ +#define CONFIG_REG1_FIR_SHIFT (8) /* Bits 10:8 - Configure coefficient N of FIR digital filter */ #define CONFIG_REG1_FIR_MASK (7 << CONFIG_REG1_FIR_SHIFT) #define CONFIG_REG1_FIR_N(n) (((n >> 3) - 1) << CONFIG_REG1_FIR_SHIFT) /* n = 8, 16, 32, 64 ... 1024 */ -#define CONFIG_REG1_AMP_GAIN_SHIFT (11) /* Bits 13:11 - Configure the gain of amplifier */ + +#define CONFIG_REG1_AMP_GAIN_SHIFT (11) /* Bits 13:11 - Configure the gain of amplifier */ #define CONFIG_REG1_AMP_GAIN_MASK (7 << CONFIG_REG1_AMP_GAIN_SHIFT) #define CONFIG_REG1_AMP_GAIN_1 (0 << CONFIG_REG1_AMP_GAIN_SHIFT) /* Gain = 1 => preamplifier bypassed */ #define CONFIG_REG1_AMP_GAIN_3 (1 << CONFIG_REG1_AMP_GAIN_SHIFT) /* Gain = 3 */ @@ -120,6 +123,7 @@ #define CONFIG_REG1_AMP_GAIN_50 (5 << CONFIG_REG1_AMP_GAIN_SHIFT) /* Gain = 50 */ #define CONFIG_REG1_AMP_GAIN_100 (6 << CONFIG_REG1_AMP_GAIN_SHIFT) /* Gain = 100 */ #define CONFIG_REG1_AMP_GAIN_200 (7 << CONFIG_REG1_AMP_GAIN_SHIFT) /* Gain = 200 */ + #define CONFIG_REG1_THERMOSHOCK_NEG (1 << 15) /* Define the sign of thermosock: 1 - negative, 0 - positive */ /* MLX90614 RAM Register ****************************************************/ diff --git a/include/nuttx/sensors/mpl115a.h b/include/nuttx/sensors/mpl115a.h index 94e306c0f3..bde071bb77 100644 --- a/include/nuttx/sensors/mpl115a.h +++ b/include/nuttx/sensors/mpl115a.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * drivers/sensors/mpl115a.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,33 +31,42 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_MPL115A_H #define __INCLUDE_NUTTX_SENSORS_MPL115A_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_MPL115A) -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ -/* Configuration ****************************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ + /* Prerequisites: * * CONFIG_SENSORS_MPL115A * Enables support for the MPL115A driver * CONFIG_MPL115A_REGDEBUG - * Enable very low register-level debug output. Requires CONFIG_DEBUG_FEATURES. + * Enable very low register-level debug output. + * Requires CONFIG_DEBUG_FEATURES. */ -/* There are two types of MPL115A chips. The MPL115A1 communicates with the target CPU - * via a SPI interface. The MPL115A2 communicates via I2C interface. +/* There are two types of MPL115A chips. + * The MPL115A1 communicates with the target CPU via a SPI interface. + * The MPL115A2 communicates via I2C interface. * Note: This driver only supports MPL115A1 (SPI Interface). */ -/* SPI **************************************************************************************/ +/* SPI **********************************************************************/ + /* The device always operates in mode 0 */ #define MPL115A_SPI_MODE SPIDEV_MODE0 /* Mode 0 */ @@ -66,7 +75,8 @@ #define MPL115A_SPI_MAXFREQUENCY 800000 /* 8MHz */ -/* MPL115A Registers ************************************************************************/ +/* MPL115A Registers ********************************************************/ + /* Register Addresses */ #define MPL115A_BASE_CMD 0x80 @@ -85,15 +95,15 @@ /* 0x0c - 0x11 are reserved */ #define MPL115A_CONVERT 0x12 /* Start Pressure and Temperature Conversion */ -/******************************************************************************************** +/**************************************************************************** * Public Types - ********************************************************************************************/ + ****************************************************************************/ struct spi_dev_s; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" diff --git a/include/nuttx/sensors/ms58xx.h b/include/nuttx/sensors/ms58xx.h index 44c5c05a26..42fbddb13e 100644 --- a/include/nuttx/sensors/ms58xx.h +++ b/include/nuttx/sensors/ms58xx.h @@ -48,6 +48,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************ * Prerequisites: * diff --git a/include/nuttx/sensors/qencoder.h b/include/nuttx/sensors/qencoder.h index 5379f471ed..629cf986ce 100644 --- a/include/nuttx/sensors/qencoder.h +++ b/include/nuttx/sensors/qencoder.h @@ -50,7 +50,8 @@ ****************************************************************************/ /* Configuration ************************************************************ - * CONFIG_SENSORS_QENCODER - Enables support for the quadrature encoder upper half + * CONFIG_SENSORS_QENCODER - Enables support for the quadrature encoder upper + * half */ /* IOCTL Commands ***********************************************************/ diff --git a/include/nuttx/sensors/rpr0521rs.h b/include/nuttx/sensors/rpr0521rs.h index ba50a3d1a9..f368a34c2e 100644 --- a/include/nuttx/sensors/rpr0521rs.h +++ b/include/nuttx/sensors/rpr0521rs.h @@ -36,6 +36,10 @@ #ifndef __INCLUDE_NUTTX_SENSORS_RPR0521RS_H #define __INCLUDE_NUTTX_SENSORS_RPR0521RS_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include #if defined(CONFIG_I2C) && (defined(CONFIG_SENSORS_RPR0521RS) || defined(CONFIG_SENSORS_RPR0521RS_SCU)) @@ -100,7 +104,8 @@ int rpr0521rs_init(FAR struct i2c_master_s *i2c, int port); * Name: rpr0521rsals_register * * Description: - * Register the RPR0521RS ambient light sensor character device as 'devpath' + * Register the RPR0521RS ambient light sensor character device as + * 'devpath' * * Input Parameters: * devpath - The full path to the driver to register. E.g., "/dev/light0" diff --git a/include/nuttx/sensors/sps30.h b/include/nuttx/sensors/sps30.h index 675fe53bdb..923e8138db 100644 --- a/include/nuttx/sensors/sps30.h +++ b/include/nuttx/sensors/sps30.h @@ -91,7 +91,8 @@ struct sps30_conv_data_s * Register the SPS30 character device as 'devpath' * * Input Parameters: - * devpath - The full path to the driver to register. E.g., "/dev/particle0" + * devpath - The full path to the driver to register. E.g., + * "/dev/particle0" * i2c - An instance of the I2C interface to use to communicate with * the SPS30 * addr - The I2C address of the SPS30. The I2C address of SPS30 diff --git a/include/nuttx/sensors/veml6070.h b/include/nuttx/sensors/veml6070.h index 986f0b6b7e..c015762e46 100644 --- a/include/nuttx/sensors/veml6070.h +++ b/include/nuttx/sensors/veml6070.h @@ -64,7 +64,6 @@ * NOTE: The RSV Bit 1 needs to be always 1 */ - #define VEML6070_CMD_SD 0x01 /* Shutdown command */ #define VEML6070_CMD_RSV 0x02 #define VEML6070_CMD_IT_0_5T 0x00 /* IT1=0 : IT0=0 */ @@ -72,8 +71,8 @@ #define VEML6070_CMD_IT_2T 0x08 /* IT1=1 : IT0=0 */ #define VEML6070_CMD_IT_4T 0x0c /* IT1=1 : IT0=1 */ #define VEML6070_CMD_ACK_THD 0x10 /* Acknowledge threshold: - 0 = 102 steps - 1 = 145 steps */ + * 0 = 102 steps + * 1 = 145 steps */ #define VEML6070_CMD_ACK 0x20 /* Acknowledge activity */ /**************************************************************************** diff --git a/include/nuttx/sensors/vl53l1x.h b/include/nuttx/sensors/vl53l1x.h index d160b18edb..9a1e66e1a1 100644 --- a/include/nuttx/sensors/vl53l1x.h +++ b/include/nuttx/sensors/vl53l1x.h @@ -36,6 +36,9 @@ #ifndef __INCLUDE_NUTTX_SENSORS_VL53L1X_H #define __INCLUDE_NUTTX_SENSORS_VL53L1X_H +/**************************************************************************** + * Included Files + ****************************************************************************/ #include #if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_VL53L1X) diff --git a/include/nuttx/sensors/xen1210.h b/include/nuttx/sensors/xen1210.h index 295e9cc4bf..1a793930d0 100644 --- a/include/nuttx/sensors/xen1210.h +++ b/include/nuttx/sensors/xen1210.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/input/xen1210.h * * Copyright (C) 2016 Gregory Nutt. All rights reserved. @@ -31,25 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_SENSORS_XEN1210_H #define __INCLUDE_NUTTX_SENSORS_XEN1210_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include #include #if defined(CONFIG_SENSORS_XEN1210) -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ -/* Configuration ****************************************************************************/ /* Prerequisites: * * CONFIG_SCHED_WORKQUEUE - Work queue support is required @@ -63,7 +64,7 @@ /* The XEN1210 interfaces with the target CPU via a SPI interface. */ -/* SPI **************************************************************************************/ +/* SPI **********************************************************************/ /* The device always operates in mode 1 */ @@ -73,7 +74,8 @@ #define XEN1210_SPI_MAXFREQUENCY 100000 /* 100KHz */ -/* XEN1210 Commands ************************************************************************/ +/* XEN1210 Commands ********************************************************/ + /* Operation Commands */ #define XEN1210_RESET 0x10 /* System-Reset command */ @@ -100,24 +102,28 @@ #define XEN1210_TESTVALUE 0x3A00 /* Default value to be used with Test command */ -/******************************************************************************************** +/**************************************************************************** * Public Types - ********************************************************************************************/ + ****************************************************************************/ -/* Form of the GPIO "interrupt handler" callback. Callbacks do not occur from an interrupt - * handler but rather from the context of the worker thread with interrupts enabled. +/* Form of the GPIO "interrupt handler" callback. Callbacks do not occur + * from an interrupt handler but rather from the context of the worker thread + * with interrupts enabled. */ struct xen1210_config_s; -typedef CODE void (*xen1210_handler_t)(FAR struct xen1210_config_s *config, FAR void *arg); +typedef CODE void (*xen1210_handler_t)(FAR struct xen1210_config_s *config, + FAR void *arg); -/* A reference to a structure of this type must be passed to the XEN1210 driver when the - * driver is instantiated. This structure provides information about the configuration of - * the XEN1210 and provides some board-specific hooks. +/* A reference to a structure of this type must be passed to the XEN1210 + * driver when the driver is instantiated. + * This structure provides information about the configuration of the XEN1210 + * and provides some board-specific hooks. * - * Memory for this structure is provided by the caller. It is not copied by the driver - * and is presumed to persist while the driver is active. The memory must be writeable - * because, under certain circumstances, the driver may modify the frequency. + * Memory for this structure is provided by the caller. + * It is not copied by the driver and is presumed to persist while the driver + * is active. The memory must be writeable because, under certain + * circumstances, the driver may modify the frequency. */ struct xen1210_config_s @@ -135,9 +141,11 @@ struct xen1210_config_s * clear - Acknowledge/clear any pending GPIO interrupt */ - int (*attach)(FAR struct xen1210_config_s *state, xen1210_handler_t handler, + int (*attach)(FAR struct xen1210_config_s *state, + xen1210_handler_t handler, FAR void *arg); - void (*enable)(FAR struct xen1210_config_s *state, bool enable); + void (*enable)(FAR struct xen1210_config_s *state, + bool enable); void (*clear)(FAR struct xen1210_config_s *state); }; @@ -145,9 +153,9 @@ typedef FAR void *XEN1210_HANDLE; struct spi_dev_s; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" @@ -157,27 +165,29 @@ extern "C" #define EXTERN extern #endif -/******************************************************************************************** +/**************************************************************************** * Name: xen1210_instantiate * * Description: - * Instantiate and configure the XEN1210 device driver to use the provided I2C or SPI - * device instance. + * Instantiate and configure the XEN1210 device driver to use the provided + * I2C or SPI device instance. * * Input Parameters: * dev - A SPI driver instance * config - Persistent board configuration data * * Returned Value: - * A non-zero handle is returned on success. This handle may then be used to configure - * the XEN1210 driver as necessary. A NULL handle value is returned on failure. + * A non-zero handle is returned on success. + * This handle may then be used to configure the XEN1210 driver as + * necessary. + * A NULL handle value is returned on failure. * - ********************************************************************************************/ + ****************************************************************************/ XEN1210_HANDLE xen1210_instantiate(FAR struct spi_dev_s *dev, FAR struct xen1210_config_s *config); -/******************************************************************************************** +/**************************************************************************** * Name: xen1210_register * * Description: @@ -189,10 +199,11 @@ XEN1210_HANDLE xen1210_instantiate(FAR struct spi_dev_s *dev, * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to indicate - * the nature of the failure. + * Zero is returned on success. + * Otherwise, a negated errno value is returned to indicate the nature + * of the failure. * - ********************************************************************************************/ + ****************************************************************************/ int xen1210_register(XEN1210_HANDLE handle, int minor); diff --git a/include/nuttx/sensors/zerocross.h b/include/nuttx/sensors/zerocross.h index f1a252864e..5628fde1f6 100644 --- a/include/nuttx/sensors/zerocross.h +++ b/include/nuttx/sensors/zerocross.h @@ -50,9 +50,10 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************ - * CONFIG_SENSORS_ZEROCROSS - Enables support for the zero cross AC detection upper - * half + * CONFIG_SENSORS_ZEROCROSS - Enables support for the zero cross AC detection + * upper half */ /* Command: ZCIOC_REGISTER