efuse7  2.1.0.0
efuse7.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 EFUSE7_H
29 #define EFUSE7_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 
68 #define EFUSE7_CONVERSION_MUL 156.25f
69 #define EFUSE7_MAX_RESISTANCE 12000
70 #define EFUSE7_R5_RESISTANCE 2000
71 #define EFUSE7_LIMIT_1A_RESISTANCE 10500
72 #define EFUSE7_LIMIT_2A_RESISTANCE 5200
73 #define EFUSE7_LIMIT_2A5_RESISTANCE 4200
74 #define EFUSE7_LIMIT_3A_RESISTANCE 3500
75 #define EFUSE7_LIMIT_3A5_RESISTANCE 3000
76 #define EFUSE7_LIMIT_4A_RESISTANCE 2700
77 #define EFUSE7_LIMIT_4A5_RESISTANCE 2400
78 #define EFUSE7_LIMIT_5A_RESISTANCE 2100
79 #define EFUSE7_POT_STEPS 64
80 
85 #define EFUSE7_CURRENT_LIMIT_1A 0x00
86 #define EFUSE7_CURRENT_LIMIT_2A 0x01
87 #define EFUSE7_CURRENT_LIMIT_2A5 0x02
88 #define EFUSE7_CURRENT_LIMIT_3A 0x03
89 #define EFUSE7_CURRENT_LIMIT_3A5 0x04
90 #define EFUSE7_CURRENT_LIMIT_4A 0x05
91 #define EFUSE7_CURRENT_LIMIT_4A5 0x06
92 #define EFUSE7_CURRENT_LIMIT_5A 0x07
93 
94  // efuse7_set
96 
111 #define EFUSE7_MAP_MIKROBUS( cfg, mikrobus ) \
112  cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
113  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
114  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
115  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI )
116  // efuse7_map // efuse7
119 
124 typedef struct
125 {
126 
127  digital_out_t rst;
128  digital_out_t cs;
129  digital_out_t sck;
130  digital_out_t mosi;
132 } efuse7_t;
133 
138 typedef struct
139 {
140  pin_name_t rst;
141  pin_name_t cs;
142  pin_name_t sck;
143  pin_name_t mosi;
145 } efuse7_cfg_t;
146 
151 typedef enum
152 {
154  EFUSE7_ERROR = -1
155 
157 
174 
188 err_t efuse7_init ( efuse7_t *ctx, efuse7_cfg_t *cfg );
189 
203 
214 
225 
236 void efuse7_wiper_inc ( efuse7_t *ctx, uint8_t inc_num );
237 
248 void efuse7_wiper_dec ( efuse7_t *ctx, uint8_t dec_num );
249 
262 err_t efuse7_set_resistance ( efuse7_t *ctx, uint16_t resistance );
263 
276 err_t efuse7_set_limit ( efuse7_t *ctx, uint8_t set_current );
277 
278 #ifdef __cplusplus
279 }
280 #endif
281 #endif // EFUSE7_H
282  // efuse7
284 
285 // ------------------------------------------------------------------------ END
efuse7_cfg_t
eFuse 7 Click configuration object.
Definition: efuse7.h:139
efuse7_wiper_inc
void efuse7_wiper_inc(efuse7_t *ctx, uint8_t inc_num)
eFuse 7 wiper position increase function.
efuse7_cfg_t::mosi
pin_name_t mosi
Definition: efuse7.h:143
EFUSE7_ERROR
@ EFUSE7_ERROR
Definition: efuse7.h:154
efuse7_set_limit
err_t efuse7_set_limit(efuse7_t *ctx, uint8_t set_current)
eFuse 7 set current limit function.
efuse7_init
err_t efuse7_init(efuse7_t *ctx, efuse7_cfg_t *cfg)
eFuse 7 initialization function.
efuse7_cfg_t::sck
pin_name_t sck
Definition: efuse7.h:142
efuse7_default_cfg
err_t efuse7_default_cfg(efuse7_t *ctx)
eFuse 7 default configuration function.
efuse7_cfg_t::cs
pin_name_t cs
Definition: efuse7.h:141
efuse7_t::cs
digital_out_t cs
Definition: efuse7.h:128
efuse7_t::rst
digital_out_t rst
Definition: efuse7.h:127
efuse7_return_value_t
efuse7_return_value_t
eFuse 7 Click return value data.
Definition: efuse7.h:152
efuse7_set_resistance
err_t efuse7_set_resistance(efuse7_t *ctx, uint16_t resistance)
eFuse 7 set digital potentiometer resistance function.
efuse7_enable_output
void efuse7_enable_output(efuse7_t *ctx)
eFuse 7 output enable function.
EFUSE7_OK
@ EFUSE7_OK
Definition: efuse7.h:153
efuse7_t
eFuse 7 Click context object.
Definition: efuse7.h:125
efuse7_disable_output
void efuse7_disable_output(efuse7_t *ctx)
eFuse 7 output disable function.
efuse7_t::sck
digital_out_t sck
Definition: efuse7.h:129
efuse7_cfg_setup
void efuse7_cfg_setup(efuse7_cfg_t *cfg)
eFuse 7 configuration object setup function.
efuse7_cfg_t::rst
pin_name_t rst
Definition: efuse7.h:140
efuse7_t::mosi
digital_out_t mosi
Definition: efuse7.h:130
efuse7_wiper_dec
void efuse7_wiper_dec(efuse7_t *ctx, uint8_t dec_num)
eFuse 7 wiper position decrease function.