eeram5v 2.0.0.0
eeram5v.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
27// ----------------------------------------------------------------------------
28
29#ifndef EERAM5V_H
30#define EERAM5V_H
31
32#ifdef __cplusplus
33extern "C"{
34#endif
35
36#include "drv_digital_out.h"
37#include "drv_digital_in.h"
38#include "drv_i2c_master.h"
39
60#define EERAM5V_ADDRESS_SRAM 0x50
61#define EERAM5V_ADDRESS_CONTROL 0x18
62#define EERAM5V_CMD_STORE 0x33
63#define EERAM5V_CMD_RECALL 0xDD
64 // eeram5v_const
66
81#define EERAM5V_MAP_MIKROBUS( cfg, mikrobus ) \
82 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
83 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
84 cfg.hs = MIKROBUS( mikrobus, MIKROBUS_INT )
85 // eeram5v_map // eeram5v
88
93typedef struct
94{
95
96 digital_out_t hs;
98 // Modules
99
100 i2c_master_t i2c;
102 // I2C slave address
103
106} eeram5v_t;
107
112typedef struct
113{
114 pin_name_t scl;
115 pin_name_t sda;
117 pin_name_t hs;
119 uint32_t i2c_speed;
120 uint8_t i2c_address;
123
128typedef enum
129{
131 EERAM5V_ERROR = -1
132
134
152
169
186void eeram5v_generic_write ( eeram5v_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len );
187
204void eeram5v_generic_read ( eeram5v_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len );
205
216void eeram5v_status_write ( eeram5v_t *ctx, uint8_t command );
217
227
240void eeram5v_read ( eeram5v_t *ctx, uint16_t address, uint8_t *data_out, uint8_t count_out );
241
253 void eeram5v_write ( eeram5v_t *ctx, uint16_t address, uint8_t * data_in, uint8_t count_in );
254
255#ifdef __cplusplus
256}
257#endif
258#endif // EERAM5V_H
259 // eeram5v
261
262// ------------------------------------------------------------------------ END
eeram5v_return_value_t
EERAM 5V Click return value data.
Definition: eeram5v.h:129
@ EERAM5V_ERROR
Definition: eeram5v.h:131
@ EERAM5V_OK
Definition: eeram5v.h:130
void eeram5v_generic_read(eeram5v_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
EERAM 5V I2C reading function.
void eeram5v_cfg_setup(eeram5v_cfg_t *cfg)
EERAM 5V configuration object setup function.
void eeram5v_read(eeram5v_t *ctx, uint16_t address, uint8_t *data_out, uint8_t count_out)
EERAM 5V Click SRAM Read.
void eeram5v_write(eeram5v_t *ctx, uint16_t address, uint8_t *data_in, uint8_t count_in)
EERAM 5V Click SRAM Write.
err_t eeram5v_init(eeram5v_t *ctx, eeram5v_cfg_t *cfg)
EERAM 5V initialization function.
uint8_t eeram5v_status_read(eeram5v_t *ctx)
EERAM 5V Click Status Read.
void eeram5v_status_write(eeram5v_t *ctx, uint8_t command)
EERAM 5V Click Status Write.
void eeram5v_generic_write(eeram5v_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
EERAM 5V I2C writing function.
EERAM 5V Click configuration object.
Definition: eeram5v.h:113
pin_name_t hs
Definition: eeram5v.h:117
uint32_t i2c_speed
Definition: eeram5v.h:119
pin_name_t scl
Definition: eeram5v.h:114
pin_name_t sda
Definition: eeram5v.h:115
uint8_t i2c_address
Definition: eeram5v.h:120
EERAM 5V Click context object.
Definition: eeram5v.h:94
i2c_master_t i2c
Definition: eeram5v.h:100
digital_out_t hs
Definition: eeram5v.h:96
uint8_t slave_address
Definition: eeram5v.h:104