Go to the documentation of this file.
53 #include "mikrosdk_version.h"
56 #if mikroSDK_GET_VERSION < 20800ul
57 #include "rcu_delays.h"
63 #include "drv_digital_out.h"
64 #include "drv_digital_in.h"
65 #include "drv_i2c_master.h"
89 #define OXIMETER2_SLAVE_ADDRESS 0x64
103 #define OXIMETER2_MAP_MIKROBUS( cfg, mikrobus ) \
104 cfg.scl_pin = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
105 cfg.sda_pin = MIKROBUS( mikrobus, MIKROBUS_SDA );
116 #define OXIMETER2_RETVAL uint8_t
118 #define OXIMETER2_OK 0x00
119 #define OXIMETER2_INIT_ERROR 0xFF
126 #define OXIMETER2_STATUS_REG 0x00
127 #define OXIMETER2_INT_MASK_REG 0x01
128 #define OXIMETER2_INT_IO_CTL_REG 0x02
129 #define OXIMETER2_FIFO_THRESH_REG 0x06
130 #define OXIMETER2_DEVID_REG 0x08
131 #define OXIMETER2_CLK_RATIO_REG 0x0A
132 #define OXIMETER2_MODE_REG 0x10
133 #define OXIMETER2_SLOT_EN_REG 0x11
134 #define OXIMETER2_FSAMPLE_REG 0x12
135 #define OXIMETER2_PD_LED_SELECT_REG 0x14
136 #define OXIMETER2_NUM_AVG_REG 0x15
137 #define OXIMETER2_SLOTA_CH1_OFFSET_REG 0x18
138 #define OXIMETER2_SLOTA_CH2_OFFSET_REG 0x19
139 #define OXIMETER2_SLOTA_CH3_OFFSET_REG 0x1A
140 #define OXIMETER2_SLOTA_CH4_OFFSET_REG 0x1B
141 #define OXIMETER2_SLOTB_CH1_OFFSET_REG 0x1E
142 #define OXIMETER2_SLOTB_CH2_OFFSET_REG 0x1F
143 #define OXIMETER2_SLOTB_CH3_OFFSET_REG 0x20
144 #define OXIMETER2_SLOTB_CH4_OFFSET_REG 0x21
145 #define OXIMETER2_ILED1_COARSE_REG 0x23
146 #define OXIMETER2_ILED2_COARSE_REG 0x24
147 #define OXIMETER2_ILED_FINE_REG 0x25
148 #define OXIMETER2_SLOTA_LEDMODE_REG 0x30
149 #define OXIMETER2_SLOTA_NUMPULSES_REG 0x31
150 #define OXIMETER2_LED_DISABLE_REG 0x34
151 #define OXIMETER2_SLOTB_LEDMODE_REG 0x35
152 #define OXIMETER2_SLOTB_NUMPULSES_REG 0x36
153 #define OXIMETER2_EXT_SYNC_STARTUP_REG 0x38
154 #define OXIMETER2_SLOTA_AFEMODE_REG 0x39
155 #define OXIMETER2_SLOTB_AFEMODE_REG 0x3B
156 #define OXIMETER2_SLOTA_GAIN_REG 0x42
157 #define OXIMETER2_SLOTA_AFE_CON_REG 0x43
158 #define OXIMETER2_SLOTB_GAIN_REG 0x44
159 #define OXIMETER2_SLOTB_AFE_CON_REG 0x45
160 #define OXIMETER2_SAMPLE_CLK_REG 0x4B
161 #define OXIMETER2_CLK32M_ADJUST_REG 0x4D
162 #define OXIMETER2_ADC_TIMING_REG 0x4E
163 #define OXIMETER2_EXT_SYNC_SEL_REG 0x4F
164 #define OXIMETER2_CLK32M_CAL_EN_REG 0x50
165 #define OXIMETER2_TIA_INDEP_GAIN_REG 0x55
166 #define OXIMETER2_DATA_ACCESS_CTL_REG 0x5F
167 #define OXIMETER2_FIFO_ACCESS 0x60
168 #define OXIMETER2_SLOTA_PD1_16BIT_REG 0x64
169 #define OXIMETER2_SLOTA_PD2_16BIT_REG 0x65
170 #define OXIMETER2_SLOTA_PD3_16BIT_REG 0x66
171 #define OXIMETER2_SLOTA_PD4_16BIT_REG 0x67
172 #define OXIMETER2_SLOTB_PD1_16BIT_REG 0x68
173 #define OXIMETER2_SLOTB_PD2_16BIT_REG 0x69
174 #define OXIMETER2_SLOTB_PD3_16BIT_REG 0x6A
175 #define OXIMETER2_SLOTB_PD4_16BIT_REG 0x6B
176 #define OXIMETER2_A_PD1_LOW_REG 0x70
177 #define OXIMETER2_A_PD2_LOW_REG 0x71
178 #define OXIMETER2_A_PD3_LOW_REG 0x72
179 #define OXIMETER2_A_PD4_LOW_REG 0x73
180 #define OXIMETER2_A_PD1_HIGH_REG 0x74
181 #define OXIMETER2_A_PD2_HIGH_REG 0x75
182 #define OXIMETER2_A_PD3_HIGH_REG 0x76
183 #define OXIMETER2_A_PD4_HIGH_REG 0x77
184 #define OXIMETER2_B_PD1_LOW_REG 0x78
185 #define OXIMETER2_B_PD2_LOW_REG 0x79
186 #define OXIMETER2_B_PD3_LOW_REG 0x7A
187 #define OXIMETER2_B_PD4_LOW_REG 0x7B
188 #define OXIMETER2_B_PD1_HIGH_REG 0x7C
189 #define OXIMETER2_B_PD2_HIGH_REG 0x7D
190 #define OXIMETER2_B_PD3_HIGH_REG 0x7E
191 #define OXIMETER2_B_PD4_HIGH_REG 0x7F
197 #define OXIMETER2_DIS_SLOT 0x00
198 #define OXIMETER2_EN_SLOT 0x01
206 #define OXIMETER2_MODE_STANDBY 0x0000
207 #define OXIMETER2_MODE_PROGRAM 0x0001
208 #define OXIMETER2_MODE_SAMPLE 0x0002
215 #define OXIMETER2_SAMPLE_CLK_CLK32K_EN 0x0080
222 #define OXIMETER2_DATA_ACCESS_CTL_SLOTA_DATA_HOLD 0x0002
223 #define OXIMETER2_DATA_ACCESS_CTL_SLOTB_DATA_HOLD 0x0004
230 #define SLOTA_LED_SEL_LEDX1 0x0001
231 #define SLOTA_LED_SEL_LEDX2 0x0002
233 #define SLOTB_LED_SEL_LEDX1 0x0004
234 #define SLOTB_LED_SEL_LEDX2 0x0008
241 #define OXIMETER2_ALL_CHANNELS_SELECTED 0x00
242 #define OXIMETER2_CH3_CH4_SELECTED 0x01
249 #define OXIMETER2_LEDX1_EN 0x00
250 #define OXIMETER2_LEDX2_EN 0x01
251 #define OXIMETER2_DIS_LED 0x02
259 #define SLOTA_PD_SEL_CH3_CH4 0x0010
260 #define SLOTA_PD_SEL_ALL_CH 0x0040
261 #define SLOTB_PD_SEL_CH3_CH4 0x1000
262 #define SLOTB_PD_SEL_ALL_CH 0x0400
270 #define OXIMETER2_SLOT_A_EN 0x0001
271 #define OXIMETER2_SLOT_B_EN 0x0020
278 #define OXIMETER2_AVERAGE_RES_MODE 0x00
279 #define OXIMETER2_SUM_RES_MODE 0x01
282 #define OXIMETER2_16_BIT_DATA_MASK 0x0000FFFF
283 #define OXIMETER2_CLEAR_INTERRUPTS 0x00FF
284 #define OXIMETER2_PREVENT_UPDATE_OF_DATA_REGS 0x0006
285 #define OXIMETER2_ALLOW_UPDATE_OF_DATA_REGS 0x0000
446 #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:325
void oximeter2_reset(oximeter2_t *ctx)
Oximeter 2 Reset function.
uint8_t dev_enabled_slot_b
Definition: oximeter2.h:333
Oximeter 2 hardware selector.
Definition: oximeter2.h:342
Oximeter 2 Click context object.
Definition: oximeter2.h:301
uint32_t i2c_speed
Definition: oximeter2.h:329
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:330
uint8_t enable_photodiode
Definition: oximeter2.h:344
uint8_t oximeter2_set_mode(oximeter2_t *ctx, uint8_t desired_mode)
Oximeter 2 Mode Set function.
uint8_t enabled_channel
Definition: oximeter2.h:309
Oximeter 2 Click configuration object.
Definition: oximeter2.h:323
uint8_t slave_address
Definition: oximeter2.h:306
uint8_t dev_enabled_slot_a
Definition: oximeter2.h:332
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:326
i2c_master_t i2c
Definition: oximeter2.h:303
uint8_t enabled_slot_b
Definition: oximeter2.h:313
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:116
uint8_t enable_slot
Definition: oximeter2.h:343
uint8_t dev_enabled_channel
Definition: oximeter2.h:331
void oximeter2_cfg_setup(oximeter2_cfg_t *cfg)
Oximeter 2 configuration object setup function.
uint8_t enabled_slot_a
Definition: oximeter2.h:312
void oximeter2_read_data(oximeter2_t *ctx, uint32_t *channel_results)
Oximeter 2 Data Read function.