Go to the documentation of this file.
54 #include "drv_digital_out.h"
55 #include "drv_digital_in.h"
56 #include "drv_i2c_master.h"
80 #define OXIMETER2_SLAVE_ADDRESS 0x64
94 #define OXIMETER2_MAP_MIKROBUS( cfg, mikrobus ) \
95 cfg.scl_pin = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
96 cfg.sda_pin = MIKROBUS( mikrobus, MIKROBUS_SDA );
107 #define OXIMETER2_RETVAL uint8_t
109 #define OXIMETER2_OK 0x00
110 #define OXIMETER2_INIT_ERROR 0xFF
117 #define OXIMETER2_STATUS_REG 0x00
118 #define OXIMETER2_INT_MASK_REG 0x01
119 #define OXIMETER2_INT_IO_CTL_REG 0x02
120 #define OXIMETER2_FIFO_THRESH_REG 0x06
121 #define OXIMETER2_DEVID_REG 0x08
122 #define OXIMETER2_CLK_RATIO_REG 0x0A
123 #define OXIMETER2_MODE_REG 0x10
124 #define OXIMETER2_SLOT_EN_REG 0x11
125 #define OXIMETER2_FSAMPLE_REG 0x12
126 #define OXIMETER2_PD_LED_SELECT_REG 0x14
127 #define OXIMETER2_NUM_AVG_REG 0x15
128 #define OXIMETER2_SLOTA_CH1_OFFSET_REG 0x18
129 #define OXIMETER2_SLOTA_CH2_OFFSET_REG 0x19
130 #define OXIMETER2_SLOTA_CH3_OFFSET_REG 0x1A
131 #define OXIMETER2_SLOTA_CH4_OFFSET_REG 0x1B
132 #define OXIMETER2_SLOTB_CH1_OFFSET_REG 0x1E
133 #define OXIMETER2_SLOTB_CH2_OFFSET_REG 0x1F
134 #define OXIMETER2_SLOTB_CH3_OFFSET_REG 0x20
135 #define OXIMETER2_SLOTB_CH4_OFFSET_REG 0x21
136 #define OXIMETER2_ILED1_COARSE_REG 0x23
137 #define OXIMETER2_ILED2_COARSE_REG 0x24
138 #define OXIMETER2_ILED_FINE_REG 0x25
139 #define OXIMETER2_SLOTA_LEDMODE_REG 0x30
140 #define OXIMETER2_SLOTA_NUMPULSES_REG 0x31
141 #define OXIMETER2_LED_DISABLE_REG 0x34
142 #define OXIMETER2_SLOTB_LEDMODE_REG 0x35
143 #define OXIMETER2_SLOTB_NUMPULSES_REG 0x36
144 #define OXIMETER2_EXT_SYNC_STARTUP_REG 0x38
145 #define OXIMETER2_SLOTA_AFEMODE_REG 0x39
146 #define OXIMETER2_SLOTB_AFEMODE_REG 0x3B
147 #define OXIMETER2_SLOTA_GAIN_REG 0x42
148 #define OXIMETER2_SLOTA_AFE_CON_REG 0x43
149 #define OXIMETER2_SLOTB_GAIN_REG 0x44
150 #define OXIMETER2_SLOTB_AFE_CON_REG 0x45
151 #define OXIMETER2_SAMPLE_CLK_REG 0x4B
152 #define OXIMETER2_CLK32M_ADJUST_REG 0x4D
153 #define OXIMETER2_ADC_TIMING_REG 0x4E
154 #define OXIMETER2_EXT_SYNC_SEL_REG 0x4F
155 #define OXIMETER2_CLK32M_CAL_EN_REG 0x50
156 #define OXIMETER2_TIA_INDEP_GAIN_REG 0x55
157 #define OXIMETER2_DATA_ACCESS_CTL_REG 0x5F
158 #define OXIMETER2_FIFO_ACCESS 0x60
159 #define OXIMETER2_SLOTA_PD1_16BIT_REG 0x64
160 #define OXIMETER2_SLOTA_PD2_16BIT_REG 0x65
161 #define OXIMETER2_SLOTA_PD3_16BIT_REG 0x66
162 #define OXIMETER2_SLOTA_PD4_16BIT_REG 0x67
163 #define OXIMETER2_SLOTB_PD1_16BIT_REG 0x68
164 #define OXIMETER2_SLOTB_PD2_16BIT_REG 0x69
165 #define OXIMETER2_SLOTB_PD3_16BIT_REG 0x6A
166 #define OXIMETER2_SLOTB_PD4_16BIT_REG 0x6B
167 #define OXIMETER2_A_PD1_LOW_REG 0x70
168 #define OXIMETER2_A_PD2_LOW_REG 0x71
169 #define OXIMETER2_A_PD3_LOW_REG 0x72
170 #define OXIMETER2_A_PD4_LOW_REG 0x73
171 #define OXIMETER2_A_PD1_HIGH_REG 0x74
172 #define OXIMETER2_A_PD2_HIGH_REG 0x75
173 #define OXIMETER2_A_PD3_HIGH_REG 0x76
174 #define OXIMETER2_A_PD4_HIGH_REG 0x77
175 #define OXIMETER2_B_PD1_LOW_REG 0x78
176 #define OXIMETER2_B_PD2_LOW_REG 0x79
177 #define OXIMETER2_B_PD3_LOW_REG 0x7A
178 #define OXIMETER2_B_PD4_LOW_REG 0x7B
179 #define OXIMETER2_B_PD1_HIGH_REG 0x7C
180 #define OXIMETER2_B_PD2_HIGH_REG 0x7D
181 #define OXIMETER2_B_PD3_HIGH_REG 0x7E
182 #define OXIMETER2_B_PD4_HIGH_REG 0x7F
188 #define OXIMETER2_DIS_SLOT 0x00
189 #define OXIMETER2_EN_SLOT 0x01
197 #define OXIMETER2_MODE_STANDBY 0x0000
198 #define OXIMETER2_MODE_PROGRAM 0x0001
199 #define OXIMETER2_MODE_SAMPLE 0x0002
206 #define OXIMETER2_SAMPLE_CLK_CLK32K_EN 0x0080
213 #define OXIMETER2_DATA_ACCESS_CTL_SLOTA_DATA_HOLD 0x0002
214 #define OXIMETER2_DATA_ACCESS_CTL_SLOTB_DATA_HOLD 0x0004
221 #define SLOTA_LED_SEL_LEDX1 0x0001
222 #define SLOTA_LED_SEL_LEDX2 0x0002
224 #define SLOTB_LED_SEL_LEDX1 0x0004
225 #define SLOTB_LED_SEL_LEDX2 0x0008
232 #define OXIMETER2_ALL_CHANNELS_SELECTED 0x00
233 #define OXIMETER2_CH3_CH4_SELECTED 0x01
240 #define OXIMETER2_LEDX1_EN 0x00
241 #define OXIMETER2_LEDX2_EN 0x01
242 #define OXIMETER2_DIS_LED 0x02
250 #define SLOTA_PD_SEL_CH3_CH4 0x0010
251 #define SLOTA_PD_SEL_ALL_CH 0x0040
252 #define SLOTB_PD_SEL_CH3_CH4 0x1000
253 #define SLOTB_PD_SEL_ALL_CH 0x0400
261 #define OXIMETER2_SLOT_A_EN 0x0001
262 #define OXIMETER2_SLOT_B_EN 0x0020
269 #define OXIMETER2_AVERAGE_RES_MODE 0x00
270 #define OXIMETER2_SUM_RES_MODE 0x01
273 #define OXIMETER2_16_BIT_DATA_MASK 0x0000FFFF
274 #define OXIMETER2_CLEAR_INTERRUPTS 0x00FF
275 #define OXIMETER2_PREVENT_UPDATE_OF_DATA_REGS 0x0006
276 #define OXIMETER2_ALLOW_UPDATE_OF_DATA_REGS 0x0000
437 #endif // _OXIMETER2_H_
uint8_t oximeter2_read_reg(oximeter2_t *cfg, uint8_t register_address, uint16_t *data_out, uint8_t num_of_regs)
Generic Read function.
pin_name_t scl_pin
Definition: oximeter2.h:316
void oximeter2_reset(oximeter2_t *ctx)
Oximeter 2 Reset function.
uint8_t dev_enabled_slot_b
Definition: oximeter2.h:324
Oximeter 2 hardware selector.
Definition: oximeter2.h:333
Oximeter 2 Click context object.
Definition: oximeter2.h:292
uint32_t i2c_speed
Definition: oximeter2.h:320
uint8_t oximeter2_set_time_slot_b(oximeter2_t *ctx, enable_t *dev_enable)
Time Slot B Set function.
uint8_t i2c_address
Definition: oximeter2.h:321
uint8_t enable_photodiode
Definition: oximeter2.h:335
uint8_t oximeter2_set_mode(oximeter2_t *ctx, uint8_t desired_mode)
Oximeter 2 Mode Set function.
uint8_t enabled_channel
Definition: oximeter2.h:300
Oximeter 2 Click configuration object.
Definition: oximeter2.h:314
uint8_t slave_address
Definition: oximeter2.h:297
uint8_t dev_enabled_slot_a
Definition: oximeter2.h:323
uint8_t oximeter2_write_reg(oximeter2_t *ctx, uint8_t register_address, uint16_t transfer_data)
Generic Write function.
pin_name_t sda_pin
Definition: oximeter2.h:317
i2c_master_t i2c
Definition: oximeter2.h:294
uint8_t enabled_slot_b
Definition: oximeter2.h:304
uint8_t oximeter2_set_time_slot_a(oximeter2_t *ctx, enable_t *dev_enable)
Time Slot A Set function.
OXIMETER2_RETVAL oximeter2_init(oximeter2_t *ctx, oximeter2_cfg_t *cfg)
Initialization function.
void oximeter2_default_cfg(oximeter2_t *ctx)
Click Default Configuration function.
#define OXIMETER2_RETVAL
Definition: oximeter2.h:107
uint8_t enable_slot
Definition: oximeter2.h:334
uint8_t dev_enabled_channel
Definition: oximeter2.h:322
void oximeter2_cfg_setup(oximeter2_cfg_t *cfg)
Oximeter 2 configuration object setup function.
uint8_t enabled_slot_a
Definition: oximeter2.h:303
void oximeter2_read_data(oximeter2_t *ctx, uint32_t *channel_results)
Oximeter 2 Data Read function.