Component Library:Sensor Driver for NMH1000  v1.0
Platform agnostic sensor driver interfaces for NMH1000 sensor
nmh1000_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2021 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /**
9  * @file nmh1000_driver.h
10  * @brief This header contains definitions and interface for the nmh1000 sensor driver.
11 */
12 #ifndef NMH1000_DRIVER_H_
13 #define NMH1000_DRIVER_H_
14 
15 /*******************************************************************************
16  * Includes
17  ******************************************************************************/
18 #include "nmh1000_regdef.h"
19 #include "sensor_common.h"
20 /*******************************************************************************
21  * Definitions
22  ******************************************************************************/
23 
24 /*******************************************************************************
25  * Typedefs
26  ******************************************************************************/
27 
28 
29 /*!
30  * @brief nmh1000 error_code
31  */
32 typedef enum nmh1000_error_code
33 {
34  NMH1000_DEVICE_NOT_FOUND = 1, /*!< Device not found, wrong who I am value.*/
35  NMH1000_DEVICE_ERROR = 2, /*!< Device error, Wrong data.*/
37 
38 /*!
39 * nmh1000 driver handler
40 */
41 typedef struct nmh1000_driver
42 {
43  sensor_comm_handle_t comHandle; /*!< Pointer to the communication handler*/
44  uint8_t whoAMI; /*!< Who AMI value of the device*/
46 
47 /*******************************************************************************
48  * Constants
49  ******************************************************************************/
50 
51 /*******************************************************************************
52  * Global Variables
53  ******************************************************************************/
54 
55 /*******************************************************************************
56  * APIs Prototype
57  ******************************************************************************/
58 
59 /*! @brief The interface function to initialize the nmh1000 sensor.
60  * @details This function initialize the nmh1000 sensor.
61  * @param[in] pDriver - Pointer to the driver.
62  * @return returns the status of the operation.
63  *
64  */
65 uint8_t nmh1000_init(nmh1000_driver_t *pDriver);
66 
67 /*! @brief The interface function read from the nmh1000 sensor register.
68  * @details This function read a register value from a nmh1000 sensor register. Note: it supports only single byte read at a time
69  * @param[in] pDriver - Pointer to the driver.
70  * @param[in] address - Address from the register to read.
71  * @param[out] pReadBuffer - a pointer to read buffer to to store the requested data read.
72  * @return returns the status of the operation.
73  */
74 uint8_t nmh1000_read_reg(nmh1000_driver_t *pDriver, uint16_t address, uint8_t *pReadBuffer);
75 /*! @brief The interface function write to a nmh1000 sensor register.
76  * @details This function write to the nmh1000 sensor register.Note: it supports only single byte write at a time
77  * @param[in] pDriver - Pointer to the driver.
78  * @param[in] pWriteAddress - Address from the register to read.
79  * @param[in] data - data to be written.
80  * @return returns the status of the operation.
81  */
82 uint8_t nmh1000_write_reg(nmh1000_driver_t *pDriver, uint16_t pWriteAddress, uint8_t data);
83 /*! @brief The interface function to get magnetic data.
84  * @details read magnetic data from the OUT_M_REG register
85  * @param[in] pDriver - Pointer to the driver.
86  * @param[out] pPressure - return the pressure data
87  * @return returns the status of the operation.
88  */
89 uint8_t nmh1000_get_magnetic_data(nmh1000_driver_t *pDriver, uint8_t *pMagData);
90 
91 #endif /* FXPS7XXX_DRIVER_H_ */
sensor_comm_handle_t comHandle
enum nmh1000_error_code nmh1000_error_code_t
nmh1000 error_code
uint8_t nmh1000_write_reg(nmh1000_driver_t *pDriver, uint16_t pWriteAddress, uint8_t data)
The interface function write to a nmh1000 sensor register.
struct nmh1000_driver nmh1000_driver_t
nmh1000_error_code
nmh1000 error_code
uint8_t nmh1000_read_reg(nmh1000_driver_t *pDriver, uint16_t address, uint8_t *pReadBuffer)
The interface function read from the nmh1000 sensor register.
uint8_t nmh1000_init(nmh1000_driver_t *pDriver)
The interface function to initialize the nmh1000 sensor.
uint8_t nmh1000_get_magnetic_data(nmh1000_driver_t *pDriver, uint8_t *pMagData)
The interface function to get magnetic data.