sensors: mx5611: Add support for MS5607

MS5607 has few differences between MS5611.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
This commit is contained in:
Takumi Ando
2023-11-28 10:06:04 +09:00
committed by Alan Carvalho de Assis
parent 6dfe1bf58c
commit 3353bd3ced
5 changed files with 165 additions and 142 deletions
+2 -2
View File
@@ -188,8 +188,8 @@ if(CONFIG_SENSORS)
list(APPEND SRCS mlx90614.c)
endif()
if(CONFIG_SENSORS_MS5611)
list(APPEND SRCS ms5611_uorb.c)
if(CONFIG_SENSORS_MS56XX)
list(APPEND SRCS ms56xx_uorb.c)
endif()
if(CONFIG_SENSORS_MS58XX)
+14 -14
View File
@@ -737,45 +737,45 @@ config MCP9844_I2C_FREQUENCY
range 1 400000
depends on SENSORS_MCP9844
config SENSORS_MS5611
bool "MS5611 Barometric Pressure Sensor support"
config SENSORS_MS56XX
bool "MS56XX Barometric Pressure Sensor support"
default n
---help---
Enable driver support for MEAS MS5511 barometer.
if SENSORS_MS5611
if SENSORS_MS56XX
choice
prompt "MS5611 Interface"
default MS5611_I2C
prompt "MS56XX Interface"
default MS56XX_I2C
config MS5611_I2C
bool "MS5611 I2C Interface"
config MS56XX_I2C
bool "MS56XX I2C Interface"
select I2C
---help---
Enables support for the I2C interface
config MS5611_SPI
bool "MS5611 SPI Interface"
config MS56XX_SPI
bool "MS56XX SPI Interface"
select SPI
---help---
Enables support for the SPI interface.
endchoice
config MS5611_THREAD_STACKSIZE
config MS56XX_THREAD_STACKSIZE
int "Worker thread stack size"
default 1024
---help---
The stack size for the worker thread
config MS5611_I2C_FREQUENCY
int "MS5611 I2C frequency"
config MS56XX_I2C_FREQUENCY
int "MS56XX I2C frequency"
default 400000
range 1 400000
depends on MS5611_I2C
depends on MS56XX_I2C
endif # SENSORS_MS5611
endif # SENSORS_MS56XX
config SENSORS_MS58XX
bool "MEAS MS58XX Altimeter support"
+2 -2
View File
@@ -210,8 +210,8 @@ ifeq ($(CONFIG_SENSORS_MLX90614),y)
CSRCS += mlx90614.c
endif
ifeq ($(CONFIG_SENSORS_MS5611),y)
CSRCS += ms5611_uorb.c
ifeq ($(CONFIG_SENSORS_MS56XX),y)
CSRCS += ms56xx_uorb.c
endif
ifeq ($(CONFIG_SENSORS_MS58XX),y)
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
/****************************************************************************
* include/nuttx/sensors/ms5611.h
* include/nuttx/sensors/ms56xx.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,8 +18,8 @@
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_SENSORS_MS5611_H
#define __INCLUDE_NUTTX_SENSORS_MS5611_H
#ifndef __INCLUDE_NUTTX_SENSORS_MS56XX_H
#define __INCLUDE_NUTTX_SENSORS_MS56XX_H
/****************************************************************************
* Included Files
@@ -28,7 +28,7 @@
#include <nuttx/config.h>
#include <nuttx/sensors/ioctl.h>
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_MS5611)
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_MS56XX)
/****************************************************************************
* Pre-processor Definitions
@@ -39,20 +39,26 @@
*
* CONFIG_I2C
* Enables support for I2C drivers
* CONFIG_SENSORS_MS5611
* Enables support for the MS5611 driver
* CONFIG_SENSORS_MS56XX
* Enables support for the MS56XX driver
*/
/* I2C Address **************************************************************/
#define MS5611_ADDR0 0x77
#define MS5611_ADDR1 0x76
#define MS56XX_ADDR0 0x77
#define MS56XX_ADDR1 0x76
/****************************************************************************
* Public Types
****************************************************************************/
struct ms5611_measure_s
enum ms56xx_model_e
{
MS56XX_MODEL_MS5607 = 0,
MS56XX_MODEL_MS5611 = 1,
};
struct ms56xx_measure_s
{
int32_t temperature; /* in Degree x100 */
int32_t pressure; /* in mBar x10 */
@@ -73,27 +79,29 @@ extern "C"
#endif
/****************************************************************************
* Name: ms5611_register
* Name: ms56xx_register
*
* Description:
* Register the MS5611 character device as 'devpath'.
* Register the MS56XX character device as 'devpath'.
*
* Input Parameters:
* i2c - An I2C driver instance.
* devno - Number of device (i.e. baro0, baro1, ...)
* addr - The I2C address of the MS5611.
* addr - The I2C address of the MS56XX.
* model - The MS56XX model.
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int ms5611_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr);
int ms56xx_register(FAR struct i2c_master_s *i2c, int devno, uint8_t addr,
enum ms56xx_model_e model);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_I2C && CONFIG_SENSORS_MS5611 */
#endif /* __INCLUDE_NUTTX_SENSORS_MS5611_H */
#endif /* CONFIG_I2C && CONFIG_SENSORS_MS56XX */
#endif /* __INCLUDE_NUTTX_SENSORS_MS56XX_H */