swieeprom 2.1.0.0
swieeprom.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 SWIEEPROM_H
29#define SWIEEPROM_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
62#define SWIEEPROM_OP_CODE_EEPROM 0xA0
63#define SWIEEPROM_OP_CODE_SECURITY 0xB0
64#define SWIEEPROM_OP_CODE_LOCK 0x20
65#define SWIEEPROM_OP_CODE_ROM 0x70
66#define SWIEEPROM_OP_CODE_FREEZE_ROM 0x10
67#define SWIEEPROM_OP_CODE_ID 0xC0
68#define SWIEEPROM_OP_CODE_STDN_SPEED 0xD0
69#define SWIEEPROM_OP_CODE_HIGH_SPEED 0xE0
70
80#define SWIEEPROM_DEVICE_ID 0x00D200
81
82 // swieeprom_set
83 // swieeprom
84
85
90typedef err_t ( *drv_reset_t ) ( void );
91typedef void ( *drv_set_t ) ( void );
92typedef uint8_t ( *drv_get_t ) ( void );
93
109
120
139
151
164err_t swieeprom_mem_write ( swieeprom_t *ctx, uint8_t start_addr, uint8_t data_in );
165
179err_t swieeprom_mem_write_page ( swieeprom_t *ctx, uint8_t start_addr, uint8_t *data_in, uint8_t len );
180
194err_t swieeprom_mem_read ( swieeprom_t *ctx, uint8_t start_addr, uint8_t *data_out, uint8_t len );
195
207
208#ifdef __cplusplus
209}
210#endif
211#endif // SWIEEPROM_H
212
213 // swieeprom
214
215// ------------------------------------------------------------------------ END
err_t swieeprom_mem_write(swieeprom_t *ctx, uint8_t start_addr, uint8_t data_in)
SWI EEPROM memory write function.
err_t swieeprom_mem_read(swieeprom_t *ctx, uint8_t start_addr, uint8_t *data_out, uint8_t len)
SWI EEPROM memory read function.
err_t swieeprom_init(swieeprom_t *ctx)
SWI EEPROM initialization function.
err_t swieeprom_mem_clear(swieeprom_t *ctx)
SWI EEPROM memory clear function.
err_t swieeprom_mem_write_page(swieeprom_t *ctx, uint8_t start_addr, uint8_t *data_in, uint8_t len)
SWI EEPROM memory write page function.
err_t swieeprom_check_communication(swieeprom_t *ctx)
SWI EEPROM check communication function.
SWI EEPROM Click context object.
Definition swieeprom.h:99
drv_reset_t swi_reset
Definition swieeprom.h:102
drv_get_t swi_logic_read
Definition swieeprom.h:106
drv_set_t swi_logic_0
Definition swieeprom.h:104
drv_set_t swi_logic_1
Definition swieeprom.h:105
drv_set_t swi_start_stop
Definition swieeprom.h:103
uint8_t slave_address
Definition swieeprom.h:100
uint8_t(* drv_get_t)(void)
Definition swieeprom.h:92
swieeprom_return_value_t
SWI EEPROM Click return value data.
Definition swieeprom.h:115
@ SWIEEPROM_ERROR
Definition swieeprom.h:117
@ SWIEEPROM_OK
Definition swieeprom.h:116
err_t(* drv_reset_t)(void)
Function pointers for gpio settings.
Definition swieeprom.h:90
void(* drv_set_t)(void)
Definition swieeprom.h:91