LibDriver MS5837
Loading...
Searching...
No Matches
ms5837 base driver function

ms5837 base driver modules More...

Collaboration diagram for ms5837 base driver function:

Data Structures

struct  ms5837_handle_s
 ms5837 handle structure definition More...
struct  ms5837_info_s
 ms5837 information structure definition More...

Typedefs

typedef struct ms5837_handle_s ms5837_handle_t
 ms5837 handle structure definition
typedef struct ms5837_info_s ms5837_info_t
 ms5837 information structure definition

Enumerations

enum  ms5837_type_t { MS5837_TYPE_02BA01 = 0x00 , MS5837_TYPE_02BA21 = 0x01 , MS5837_TYPE_30BA26 = 0x02 }
 ms5837 type enumeration definition More...
enum  ms5837_osr_t {
  MS5837_OSR_256 = 0x00 , MS5837_OSR_512 = 0x01 , MS5837_OSR_1024 = 0x02 , MS5837_OSR_2048 = 0x03 ,
  MS5837_OSR_4096 = 0x04 , MS5837_OSR_8192 = 0x05
}
 ms5837 osr enumeration definition More...

Functions

uint8_t ms5837_info (ms5837_info_t *info)
 get chip's information
uint8_t ms5837_init (ms5837_handle_t *handle)
 initialize the chip
uint8_t ms5837_deinit (ms5837_handle_t *handle)
 close the chip
uint8_t ms5837_read_temperature_pressure (ms5837_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_mbar)
 read the temperature and pressure
uint8_t ms5837_read_pressure (ms5837_handle_t *handle, uint32_t *pressure_raw, float *pressure_mbar)
 read the pressure
uint8_t ms5837_read_temperature (ms5837_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
 read the temperature
uint8_t ms5837_set_type (ms5837_handle_t *handle, ms5837_type_t type)
 set the device type
uint8_t ms5837_get_type (ms5837_handle_t *handle, ms5837_type_t *type)
 get the device type
uint8_t ms5837_set_temperature_osr (ms5837_handle_t *handle, ms5837_osr_t osr)
 set the adc temperature osr
uint8_t ms5837_get_temperature_osr (ms5837_handle_t *handle, ms5837_osr_t *osr)
 get the adc temperature osr
uint8_t ms5837_set_pressure_osr (ms5837_handle_t *handle, ms5837_osr_t osr)
 set the adc pressure osr
uint8_t ms5837_get_pressure_osr (ms5837_handle_t *handle, ms5837_osr_t *osr)
 get the adc pressure osr
uint8_t ms5837_reset (ms5837_handle_t *handle)
 reset the device

Detailed Description

ms5837 base driver modules

Typedef Documentation

◆ ms5837_handle_t

ms5837 handle structure definition

◆ ms5837_info_t

typedef struct ms5837_info_s ms5837_info_t

ms5837 information structure definition

Enumeration Type Documentation

◆ ms5837_osr_t

ms5837 osr enumeration definition

Enumerator
MS5837_OSR_256 

max 0.6ms

MS5837_OSR_512 

max 1.17ms

MS5837_OSR_1024 

max 2.28ms

MS5837_OSR_2048 

max 4.54ms

MS5837_OSR_4096 

max 9.04ms

MS5837_OSR_8192 

max 18.08ms

Definition at line 72 of file driver_ms5837.h.

◆ ms5837_type_t

ms5837 type enumeration definition

Enumerator
MS5837_TYPE_02BA01 

ms5837 02ba01

MS5837_TYPE_02BA21 

ms5837 02ba21

MS5837_TYPE_30BA26 

ms5837 30ba26

Definition at line 62 of file driver_ms5837.h.

Function Documentation

◆ ms5837_deinit()

uint8_t ms5837_deinit ( ms5837_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an ms5837 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 reset failed
Note
none

Definition at line 411 of file driver_ms5837.c.

◆ ms5837_get_pressure_osr()

uint8_t ms5837_get_pressure_osr ( ms5837_handle_t * handle,
ms5837_osr_t * osr )

get the adc pressure osr

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*osrpointer to an osr buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 564 of file driver_ms5837.c.

◆ ms5837_get_temperature_osr()

uint8_t ms5837_get_temperature_osr ( ms5837_handle_t * handle,
ms5837_osr_t * osr )

get the adc temperature osr

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*osrpointer to an osr buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 503 of file driver_ms5837.c.

◆ ms5837_get_type()

uint8_t ms5837_get_type ( ms5837_handle_t * handle,
ms5837_type_t * type )

get the device type

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*typepointer to a type buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 451 of file driver_ms5837.c.

◆ ms5837_info()

uint8_t ms5837_info ( ms5837_info_t * info)

get chip's information

Parameters
[out]*infopointer to an ms5837 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1013 of file driver_ms5837.c.

◆ ms5837_init()

uint8_t ms5837_init ( ms5837_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an ms5837 handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset failed
  • 5 read prom failed
  • 6 crc is error
  • 7 type is invalid
Note
none

Definition at line 285 of file driver_ms5837.c.

◆ ms5837_read_pressure()

uint8_t ms5837_read_pressure ( ms5837_handle_t * handle,
uint32_t * pressure_raw,
float * pressure_mbar )

read the pressure

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*pressure_rawpointer to a raw pressure buffer
[out]*pressure_mbarpointer to a converted pressure buffer
Returns
status code
  • 0 success
  • 1 read pressure failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 736 of file driver_ms5837.c.

◆ ms5837_read_temperature()

uint8_t ms5837_read_temperature ( ms5837_handle_t * handle,
uint32_t * temperature_raw,
float * temperature_c )

read the temperature

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_cpointer to a converted temperature buffer
Returns
status code
  • 0 success
  • 1 read temperature failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 844 of file driver_ms5837.c.

◆ ms5837_read_temperature_pressure()

uint8_t ms5837_read_temperature_pressure ( ms5837_handle_t * handle,
uint32_t * temperature_raw,
float * temperature_c,
uint32_t * pressure_raw,
float * pressure_mbar )

read the temperature and pressure

Parameters
[in]*handlepointer to an ms5837 handle structure
[out]*temperature_rawpointer to a raw temperature buffer
[out]*temperature_cpointer to a converted temperature buffer
[out]*pressure_rawpointer to a raw pressure buffer
[out]*pressure_mbarpointer to a converted pressure buffer
Returns
status code
  • 0 success
  • 1 read temperature pressure failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 629 of file driver_ms5837.c.

◆ ms5837_reset()

uint8_t ms5837_reset ( ms5837_handle_t * handle)

reset the device

Parameters
[in]*handlepointer to an ms5837 handle structure
Returns
status code
  • 0 success
  • 1 reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 909 of file driver_ms5837.c.

◆ ms5837_set_pressure_osr()

uint8_t ms5837_set_pressure_osr ( ms5837_handle_t * handle,
ms5837_osr_t osr )

set the adc pressure osr

Parameters
[in]*handlepointer to an ms5837 handle structure
[in]osradc osr
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 30ba26 can't support osr 8192
Note
none

Definition at line 591 of file driver_ms5837.c.

◆ ms5837_set_temperature_osr()

uint8_t ms5837_set_temperature_osr ( ms5837_handle_t * handle,
ms5837_osr_t osr )

set the adc temperature osr

Parameters
[in]*handlepointer to an ms5837 handle structure
[in]osradc osr
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 30ba26 can't support osr 8192
Note
none

Definition at line 530 of file driver_ms5837.c.

◆ ms5837_set_type()

uint8_t ms5837_set_type ( ms5837_handle_t * handle,
ms5837_type_t type )

set the device type

Parameters
[in]*handlepointer to an ms5837 handle structure
[in]typedevice type
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 477 of file driver_ms5837.c.