hallcurrent6  2.0.0.0
hallcurrent6.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright (c) 2019, MikroElektronika - www.mikroe.com
4  * All rights reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef HALLCURRENT6_H
36 #define HALLCURRENT6_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
41 
42 
43 // -------------------------------------------------------------- PUBLIC MACROS
53 #define HALLCURRENT6_MAP_MIKROBUS( cfg, mikrobus ) \
54  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA );
56 
62 #define HALLCURRENT6_RETVAL uint8_t
63 
64 #define HALLCURRENT6_OK 0x00
65 #define HALLCURRENT6_INIT_ERROR 0xFF
66  // End group macro
70 // --------------------------------------------------------------- PUBLIC TYPES
71 
75 typedef struct
76 {
77 
78  // Modules
79 
80  i2c_master_t i2c;
81 
82  // ctx variable
83 
84  //hal_i2c_address_t slave_address;
85  uint8_t slave_address;
86 
88 
92 typedef struct
93 {
94  // Communication gpio pins
95 
96  pin_name_t scl;
97  pin_name_t sda;
98 
99 
100  // static variable
101 
102  hal_i2c_speed_t i2c_speed;
103  hal_i2c_address_t i2c_address;
104 
106  // End types group
108 
109 
110 #ifdef __cplusplus
111 extern "C"{
112 #endif
113 
123 
133 
144 void hallcurrent6_generic_write ( hallcurrent6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
145 
157 void hallcurrent6_generic_read ( hallcurrent6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
158 
169 void hallcurrent6_generic_write ( hallcurrent6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
170 
180 uint16_t hallcurrent6_read_data ( hallcurrent6_t *ctx );
181 
192 
193 
194 #ifdef __cplusplus
195 }
196 #endif
197 #endif // _HALLCURRENT6_H_
198  // End public_function group
201 
202 // ------------------------------------------------------------------------- END
#define HALLCURRENT6_RETVAL
Definition: hallcurrent6.h:62
void hallcurrent6_generic_write(hallcurrent6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void hallcurrent6_cfg_setup(hallcurrent6_cfg_t *cfg)
Config Object Initialization function.
float hallcurrent6_get_current(hallcurrent6_t *ctx)
Reads current data.
HALLCURRENT6_RETVAL hallcurrent6_init(hallcurrent6_t *ctx, hallcurrent6_cfg_t *cfg)
Initialization function.
i2c_master_t i2c
Definition: hallcurrent6.h:80
Click ctx object definition.
Definition: hallcurrent6.h:75
hal_i2c_speed_t i2c_speed
Definition: hallcurrent6.h:102
pin_name_t sda
Definition: hallcurrent6.h:97
hal_i2c_address_t i2c_address
Definition: hallcurrent6.h:103
uint16_t hallcurrent6_read_data(hallcurrent6_t *ctx)
Reads ADC current data.
pin_name_t scl
Definition: hallcurrent6.h:96
uint8_t slave_address
Definition: hallcurrent6.h:85
Click configuration structure definition.
Definition: hallcurrent6.h:92
void hallcurrent6_generic_read(hallcurrent6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.