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
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37
58#define EFUSE7_CONVERSION_MUL 156.25f
59#define EFUSE7_MAX_RESISTANCE 12000
60#define EFUSE7_R5_RESISTANCE 2000
61#define EFUSE7_LIMIT_1A_RESISTANCE 10500
62#define EFUSE7_LIMIT_2A_RESISTANCE 5200
63#define EFUSE7_LIMIT_2A5_RESISTANCE 4200
64#define EFUSE7_LIMIT_3A_RESISTANCE 3500
65#define EFUSE7_LIMIT_3A5_RESISTANCE 3000
66#define EFUSE7_LIMIT_4A_RESISTANCE 2700
67#define EFUSE7_LIMIT_4A5_RESISTANCE 2400
68#define EFUSE7_LIMIT_5A_RESISTANCE 2100
69#define EFUSE7_POT_STEPS 64
70
75#define EFUSE7_CURRENT_LIMIT_1A 0x00
76#define EFUSE7_CURRENT_LIMIT_2A 0x01
77#define EFUSE7_CURRENT_LIMIT_2A5 0x02
78#define EFUSE7_CURRENT_LIMIT_3A 0x03
79#define EFUSE7_CURRENT_LIMIT_3A5 0x04
80#define EFUSE7_CURRENT_LIMIT_4A 0x05
81#define EFUSE7_CURRENT_LIMIT_4A5 0x06
82#define EFUSE7_CURRENT_LIMIT_5A 0x07
83
84 // efuse7_set
86
101#define EFUSE7_MAP_MIKROBUS( cfg, mikrobus ) \
102 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
103 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
104 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
105 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI )
106 // efuse7_map // efuse7
109
114typedef struct
115{
116
117 digital_out_t rst;
118 digital_out_t cs;
119 digital_out_t sck;
120 digital_out_t mosi;
122} efuse7_t;
123
128typedef struct
129{
130 pin_name_t rst;
131 pin_name_t cs;
132 pin_name_t sck;
133 pin_name_t mosi;
136
141typedef enum
142{
144 EFUSE7_ERROR = -1
145
147
164
178err_t efuse7_init ( efuse7_t *ctx, efuse7_cfg_t *cfg );
179
193
204
215
226void efuse7_wiper_inc ( efuse7_t *ctx, uint8_t inc_num );
227
238void efuse7_wiper_dec ( efuse7_t *ctx, uint8_t dec_num );
239
252err_t efuse7_set_resistance ( efuse7_t *ctx, uint16_t resistance );
253
266err_t efuse7_set_limit ( efuse7_t *ctx, uint8_t set_current );
267
268#ifdef __cplusplus
269}
270#endif
271#endif // EFUSE7_H
272 // efuse7
274
275// ------------------------------------------------------------------------ END
efuse7_return_value_t
eFuse 7 Click return value data.
Definition: efuse7.h:142
@ EFUSE7_ERROR
Definition: efuse7.h:144
@ EFUSE7_OK
Definition: efuse7.h:143
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:129
pin_name_t sck
Definition: efuse7.h:132
pin_name_t mosi
Definition: efuse7.h:133
pin_name_t rst
Definition: efuse7.h:130
pin_name_t cs
Definition: efuse7.h:131
eFuse 7 Click context object.
Definition: efuse7.h:115
digital_out_t cs
Definition: efuse7.h:118
digital_out_t sck
Definition: efuse7.h:119
digital_out_t mosi
Definition: efuse7.h:120
digital_out_t rst
Definition: efuse7.h:117