heartrate7 2.0.0.0
heartrate7.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef HEARTRATE7_H
29#define HEARTRATE7_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52
78#define HEARTRATE7_REG0H 0x00
79#define HEARTRATE7_REG1H 0x01
80#define HEARTRATE7_REG2H 0x02
81#define HEARTRATE7_REG3H 0x03
82#define HEARTRATE7_REG4H 0x04
83#define HEARTRATE7_REG5H 0x05
84#define HEARTRATE7_REG6H 0x06
85#define HEARTRATE7_REG7H 0x07
86#define HEARTRATE7_REG8H 0x08
87#define HEARTRATE7_REG9H 0x09
88#define HEARTRATE7_REGAH 0x0A
89#define HEARTRATE7_REGBH 0x0B
90#define HEARTRATE7_REGCH 0x0C
91#define HEARTRATE7_REGDH 0x0D
92#define HEARTRATE7_REGEH 0x0E
93#define HEARTRATE7_REGFH 0x0F
94#define HEARTRATE7_REG10H 0x10
95#define HEARTRATE7_REG11H 0x11
96#define HEARTRATE7_REG12H 0x12
97#define HEARTRATE7_REG13H 0x13
98#define HEARTRATE7_REG14H 0x14
99#define HEARTRATE7_REG15H 0x15
100#define HEARTRATE7_REG16H 0x16
101#define HEARTRATE7_REG17H 0x17
102#define HEARTRATE7_REG18H 0x18
103#define HEARTRATE7_REG19H 0x19
104#define HEARTRATE7_REG1AH 0x1A
105#define HEARTRATE7_REG1BH 0x1B
106#define HEARTRATE7_REG1CH 0x1C
107#define HEARTRATE7_REG1DH 0x1D
108#define HEARTRATE7_REG1EH 0x1E
109#define HEARTRATE7_REG20H 0x20
110#define HEARTRATE7_REG21H 0x21
111#define HEARTRATE7_REG22H 0x22
112#define HEARTRATE7_REG23H 0x23
113#define HEARTRATE7_REG29H 0x29
114#define HEARTRATE7_REG2AH 0x2A
115#define HEARTRATE7_REG2BH 0x2B
116#define HEARTRATE7_REG2CH 0x2C
117#define HEARTRATE7_REG2DH 0x2D
118#define HEARTRATE7_REG2EH 0x2E
119#define HEARTRATE7_REG2FH 0x2F
120#define HEARTRATE7_REG31H 0x31
121
127#define HEARTRATE7_REG32H 0x32
128#define HEARTRATE7_REG33H 0x33
129#define HEARTRATE7_REG34H 0x34
130#define HEARTRATE7_REG35H 0x35
131
137#define HEARTRATE7_REG36H 0x36
138#define HEARTRATE7_REG37H 0x37
139#define HEARTRATE7_REG39H 0x39
140#define HEARTRATE7_REG3AH 0x3A
141#define HEARTRATE7_REG3DH 0x3D
142#define HEARTRATE7_REG3FH 0x3F
143#define HEARTRATE7_REG40H 0x40
144
145 // heartrate7_reg
146
162#define HEARTRATE7_SET_DEV_ADDR 0x58
163
164 // heartrate7_set
165
180#define HEARTRATE7_MAP_MIKROBUS( cfg, mikrobus ) \
181 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
182 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
183 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
184 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
185
186 // heartrate7_map
187 // heartrate7
188
193typedef struct
194{
195 // Output pins
196 digital_out_t rst;
198 // Input pins
199 digital_in_t int_pin;
201 // Modules
202 i2c_master_t i2c;
204 // I2C slave address
208
213typedef struct
214{
215 pin_name_t scl;
216 pin_name_t sda;
218 pin_name_t rst;
219 pin_name_t int_pin;
221 uint32_t i2c_speed;
222 uint8_t i2c_address;
225
236
253
268
283
298err_t heartrate7_generic_write ( heartrate7_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len );
299
314err_t heartrate7_generic_read ( heartrate7_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len );
315
326void heartrate7_write_reg( heartrate7_t *ctx, uint8_t reg_addr, uint32_t write_data );
327
337uint32_t heartrate7_read_reg( heartrate7_t *ctx, uint8_t reg_addr );
338
347
356
365
374
383
392
401
410
411#ifdef __cplusplus
412}
413#endif
414#endif // HEARTRATE7_H
415
416 // heartrate7
417
418// ------------------------------------------------------------------------ END
void heartrate7_hw_reset(heartrate7_t *ctx)
Heart Rate 7 hardware reset function.
uint32_t heartrate7_get_led1_val(heartrate7_t *ctx)
Heart Rate 7 get LED1 data function.
err_t heartrate7_default_cfg(heartrate7_t *ctx)
Heart Rate 7 default configuration function.
err_t heartrate7_generic_write(heartrate7_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Heart Rate 7 I2C writing function.
err_t heartrate7_init(heartrate7_t *ctx, heartrate7_cfg_t *cfg)
Heart Rate 7 initialization function.
uint32_t heartrate7_read_reg(heartrate7_t *ctx, uint8_t reg_addr)
Heart Rate 7 register reading function.
err_t heartrate7_generic_read(heartrate7_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Heart Rate 7 I2C reading function.
uint32_t heartrate7_get_led2_aled2_val(heartrate7_t *ctx)
Heart Rate 7 get LED2_ALED2 data function.
uint32_t heartrate7_get_led2_val(heartrate7_t *ctx)
Heart Rate 7 get LED2 data function.
uint32_t heartrate7_get_led1_aled1_val(heartrate7_t *ctx)
Heart Rate 7 get LED1_ALED1 data function.
uint32_t heartrate7_get_aled1_val(heartrate7_t *ctx)
Heart Rate 7 get ALED1 data function.
void heartrate7_sw_reset(heartrate7_t *ctx)
Heart Rate 7 software reset function.
void heartrate7_cfg_setup(heartrate7_cfg_t *cfg)
Heart Rate 7 configuration object setup function.
uint32_t heartrate7_get_aled2_val_led3v_al(heartrate7_t *ctx)
Heart Rate 7 get ALED2 data function.
void heartrate7_write_reg(heartrate7_t *ctx, uint8_t reg_addr, uint32_t write_data)
Heart Rate 7 register writing function.
heartrate7_return_value_t
Heart Rate 7 Click return value data.
Definition heartrate7.h:231
@ HEARTRATE7_OK
Definition heartrate7.h:232
@ HEARTRATE7_ERROR
Definition heartrate7.h:233
Heart Rate 7 Click configuration object.
Definition heartrate7.h:214
uint32_t i2c_speed
Definition heartrate7.h:221
pin_name_t scl
Definition heartrate7.h:215
pin_name_t int_pin
Definition heartrate7.h:219
pin_name_t sda
Definition heartrate7.h:216
pin_name_t rst
Definition heartrate7.h:218
uint8_t i2c_address
Definition heartrate7.h:222
Heart Rate 7 Click context object.
Definition heartrate7.h:194
digital_in_t int_pin
Definition heartrate7.h:199
i2c_master_t i2c
Definition heartrate7.h:202
digital_out_t rst
Definition heartrate7.h:196
uint8_t slave_address
Definition heartrate7.h:205