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
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
72#define EFUSE7_CONVERSION_MUL 156.25f
73#define EFUSE7_MAX_RESISTANCE 12000
74#define EFUSE7_R5_RESISTANCE 2000
75#define EFUSE7_LIMIT_1A_RESISTANCE 10500
76#define EFUSE7_LIMIT_2A_RESISTANCE 5200
77#define EFUSE7_LIMIT_2A5_RESISTANCE 4200
78#define EFUSE7_LIMIT_3A_RESISTANCE 3500
79#define EFUSE7_LIMIT_3A5_RESISTANCE 3000
80#define EFUSE7_LIMIT_4A_RESISTANCE 2700
81#define EFUSE7_LIMIT_4A5_RESISTANCE 2400
82#define EFUSE7_LIMIT_5A_RESISTANCE 2100
83#define EFUSE7_POT_STEPS 64
84
89#define EFUSE7_CURRENT_LIMIT_1A 0x00
90#define EFUSE7_CURRENT_LIMIT_2A 0x01
91#define EFUSE7_CURRENT_LIMIT_2A5 0x02
92#define EFUSE7_CURRENT_LIMIT_3A 0x03
93#define EFUSE7_CURRENT_LIMIT_3A5 0x04
94#define EFUSE7_CURRENT_LIMIT_4A 0x05
95#define EFUSE7_CURRENT_LIMIT_4A5 0x06
96#define EFUSE7_CURRENT_LIMIT_5A 0x07
97
98
99 // efuse7_set
100
115#define EFUSE7_MAP_MIKROBUS( cfg, mikrobus ) \
116 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
117 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
118 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
119 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI )
120
121 // efuse7_map
122 // efuse7
123
128typedef struct
129{
130
131 digital_out_t rst;
132 digital_out_t cs;
133 digital_out_t sck;
134 digital_out_t mosi;
136} efuse7_t;
137
142typedef struct
143{
144 pin_name_t rst;
145 pin_name_t cs;
146 pin_name_t sck;
147 pin_name_t mosi;
150
155typedef enum
156{
158 EFUSE7_ERROR = -1
159
161
178
192err_t efuse7_init ( efuse7_t *ctx, efuse7_cfg_t *cfg );
193
207
218
229
240void efuse7_wiper_inc ( efuse7_t *ctx, uint8_t inc_num );
241
252void efuse7_wiper_dec ( efuse7_t *ctx, uint8_t dec_num );
253
266err_t efuse7_set_resistance ( efuse7_t *ctx, uint16_t resistance );
267
280err_t efuse7_set_limit ( efuse7_t *ctx, uint8_t set_current );
281
282#ifdef __cplusplus
283}
284#endif
285#endif // EFUSE7_H
286
287 // efuse7
288
289// ------------------------------------------------------------------------ END
efuse7_return_value_t
eFuse 7 Click return value data.
Definition efuse7.h:156
@ EFUSE7_ERROR
Definition efuse7.h:158
@ EFUSE7_OK
Definition efuse7.h:157
err_t efuse7_set_limit(efuse7_t *ctx, uint8_t set_current)
eFuse 7 set current limit function.
err_t efuse7_init(efuse7_t *ctx, efuse7_cfg_t *cfg)
eFuse 7 initialization function.
void efuse7_cfg_setup(efuse7_cfg_t *cfg)
eFuse 7 configuration object setup function.
void efuse7_wiper_inc(efuse7_t *ctx, uint8_t inc_num)
eFuse 7 wiper position increase function.
void efuse7_enable_output(efuse7_t *ctx)
eFuse 7 output enable function.
void efuse7_disable_output(efuse7_t *ctx)
eFuse 7 output disable function.
void efuse7_wiper_dec(efuse7_t *ctx, uint8_t dec_num)
eFuse 7 wiper position decrease function.
err_t efuse7_set_resistance(efuse7_t *ctx, uint16_t resistance)
eFuse 7 set digital potentiometer resistance function.
err_t efuse7_default_cfg(efuse7_t *ctx)
eFuse 7 default configuration function.
eFuse 7 Click configuration object.
Definition efuse7.h:143
pin_name_t sck
Definition efuse7.h:146
pin_name_t mosi
Definition efuse7.h:147
pin_name_t rst
Definition efuse7.h:144
pin_name_t cs
Definition efuse7.h:145
eFuse 7 Click context object.
Definition efuse7.h:129
digital_out_t cs
Definition efuse7.h:132
digital_out_t sck
Definition efuse7.h:133
digital_out_t mosi
Definition efuse7.h:134
digital_out_t rst
Definition efuse7.h:131