bh1900nux.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Nalys
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef BH1900NUX_H
22 #define BH1900NUX_H
23 
24 #include "periph/i2c.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
36 #define BH1900NUX_ADDR_1 (0x48)
37 #define BH1900NUX_ADDR_2 (0x49)
38 #define BH1900NUX_ADDR_3 (0x4a)
39 #define BH1900NUX_ADDR_4 (0x4b)
40 #define BH1900NUX_ADDR_5 (0x4c)
41 #define BH1900NUX_ADDR_6 (0x4d)
42 #define BH1900NUX_ADDR_7 (0x4e)
43 #define BH1900NUX_ADDR_8 (0x4f)
52 #define BH1900NUX_REG_ADDR (0x00)
53 
58 #define BH1900NUX_DEFAULT_ADDR BH1900NUX_ADDR_1
59 
63 #define BH1900NUX_I2C_MAX_CLK I2C_SPEED_FAST
64 
68 enum {
71 };
72 
76 typedef struct {
78  uint8_t addr;
79 } bh1900nux_t;
80 
84 typedef struct {
86  uint8_t addr;
88 
98 int bh1900nux_init(bh1900nux_t *dev, const bh1900nux_params_t *params);
99 
112 int bh1900nux_read(const bh1900nux_t *dev, int16_t *temp);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif /* BH1900NUX_H */
119 
BH1900NUX_OK
@ BH1900NUX_OK
everything was fine
Definition: bh1900nux.h:69
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
bh1900nux_params_t
Set of configuration parameters for BH1900NUX devices.
Definition: bh1900nux.h:84
bh1900nux_init
int bh1900nux_init(bh1900nux_t *dev, const bh1900nux_params_t *params)
Initialize the given BH1900NUX device.
BH1900NUX_ERR_I2C
@ BH1900NUX_ERR_I2C
error initializing the I2C bus
Definition: bh1900nux.h:70
bh1900nux_t
Device descriptor for BH1900NUX devices.
Definition: bh1900nux.h:76
bh1900nux_t::addr
uint8_t addr
slave address of the device
Definition: bh1900nux.h:78
bh1900nux_read
int bh1900nux_read(const bh1900nux_t *dev, int16_t *temp)
Read the temperature measerd by the device [MILICELSIUS].
i2c.h
Low-level I2C peripheral driver interface definition.
bh1900nux_params_t::addr
uint8_t addr
slave address of the device
Definition: bh1900nux.h:86
bh1900nux_t::i2c
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1900nux.h:77
bh1900nux_params_t::i2c
i2c_t i2c
I2C bus the device is connected to.
Definition: bh1900nux.h:85