Loading...
Searching...
No Matches
bh1900nux.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Nalys
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20#include "periph/i2c.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
32#define BH1900NUX_ADDR_1 (0x48)
33#define BH1900NUX_ADDR_2 (0x49)
34#define BH1900NUX_ADDR_3 (0x4a)
35#define BH1900NUX_ADDR_4 (0x4b)
36#define BH1900NUX_ADDR_5 (0x4c)
37#define BH1900NUX_ADDR_6 (0x4d)
38#define BH1900NUX_ADDR_7 (0x4e)
39#define BH1900NUX_ADDR_8 (0x4f)
41
48#define BH1900NUX_REG_ADDR (0x00)
50
54#define BH1900NUX_DEFAULT_ADDR BH1900NUX_ADDR_1
55
59#define BH1900NUX_I2C_MAX_CLK I2C_SPEED_FAST
60
64enum {
67};
68
72typedef struct {
74 uint8_t addr;
76
80typedef struct {
82 uint8_t addr;
84
95
108int bh1900nux_read(const bh1900nux_t *dev, int16_t *temp);
109
110#ifdef __cplusplus
111}
112#endif
113
int bh1900nux_read(const bh1900nux_t *dev, int16_t *temp)
Read the temperature measerd by the device [MILICELSIUS].
int bh1900nux_init(bh1900nux_t *dev, const bh1900nux_params_t *params)
Initialize the given BH1900NUX device.
@ BH1900NUX_OK
everything was fine
Definition bh1900nux.h:65
@ BH1900NUX_ERR_I2C
error initializing the I2C bus
Definition bh1900nux.h:66
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Set of configuration parameters for BH1900NUX devices.
Definition bh1900nux.h:80
i2c_t i2c
I2C bus the device is connected to.
Definition bh1900nux.h:81
uint8_t addr
slave address of the device
Definition bh1900nux.h:82
Device descriptor for BH1900NUX devices.
Definition bh1900nux.h:72
uint8_t addr
slave address of the device
Definition bh1900nux.h:74
i2c_t i2c
I2C bus the device is connected to.
Definition bh1900nux.h:73