BSB Developer Docs
Loading...
Searching...
No Matches
bh1730_reg.h
1#pragma once
2
3#include <assert.h>
4#include <core/common_defines.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define BH1730_I2C_ADDRESS (0x52)
11#define BH1730_I2C_TIMEOUT (50)
12
13#define BH1730_COMMAND_WRITE (0x80)
14
15#define BH1730_REG_CONTROL (0x00)
16#define BH1730_REG_TIMING (0x01)
17#define BH1730_REG_INTERRUPT (0x02)
18#define BH1730_REG_THLLOW (0x03)
19#define BH1730_REG_THLHIGH (0x04)
20#define BH1730_REG_THHLOW (0x05)
21#define BH1730_REG_THHHIGH (0x06)
22#define BH1730_REG_GAIN (0x07)
23#define BH1730_REG_ID (0x12)
24#define BH1730_REG_DATA0LOW (0x14)
25#define BH1730_REG_DATA0HIGH (0x15)
26#define BH1730_REG_DATA1LOW (0x16)
27#define BH1730_REG_DATA1HIGH (0x17)
28
29#define BH1730_REG_GAIN_X1 (0x00)
30#define BH1730_REG_GAIN_X2 (0x01)
31#define BH1730_REG_GAIN_X64 (0x02)
32#define BH1730_REG_GAIN_X128 (0x03)
33
34typedef struct {
35 uint8_t POWER : 1;
36 uint8_t ADC_EN : 1;
37 uint8_t DATA_SEL : 1;
38 uint8_t ONE_TIME : 1;
39 uint8_t ADC_VALID : 1;
40 uint8_t ADC_INTR : 1;
41 uint8_t _RSVD : 2;
43
44static_assert(sizeof(Bh1730RegControl) == 1, "Bh1730RegControl size mismatch");
45
46typedef struct {
47 uint8_t PERSIST : 4;
48 uint8_t INT_EN : 1;
49 uint8_t _RSVD1 : 1;
50 uint8_t INT_STOP : 1;
51 uint8_t _RSVD0 : 1;
53
54static_assert(sizeof(Bh1730RegInterrupt) == 1, "Bh1730RegInterrupt size mismatch");
55
56typedef struct {
57 uint8_t _RSVD : 5;
58 uint8_t GAIN : 3;
60
61static_assert(sizeof(Bh1730RegGain) == 1, "Bh1730RegGain size mismatch");
62
63typedef struct {
64 uint8_t PART_NUM : 4;
65 uint8_t REV_ID : 4;
67
68static_assert(sizeof(Bh1730RegId) == 1, "Bh1730RegId size mismatch");
69
70#ifdef __cplusplus
71}
72#endif
Definition bh1730_reg.h:34
Definition bh1730_reg.h:56
Definition bh1730_reg.h:63
Definition bh1730_reg.h:46