leddriver7 2.0.0.0
leddriver7.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef LEDDRIVER7_H
36#define LEDDRIVER7_H
37
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40#include "drv_i2c_master.h"
41
42
43// -------------------------------------------------------------- PUBLIC MACROS
53#define LEDDRIVER7_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA )
62#define LEDDRIVER7_RETVAL uint8_t
63
64#define LEDDRIVER7_OK 0x00
65#define LEDDRIVER7_INIT_ERROR 0xFF
72#define LEDDRIVER7_SLAVE_ADR_GND 0x2C
73#define LEDDRIVER7_SLAVE_ADR_VCC 0x2D
80#define LEDDRIVER7_ONE_TIME_PRG 0x80
81#define LEDDRIVER7_NORM_OP_MODE 0x00
88#define LEDDRIVER7_OTP_RDY_PRG 0x00
89#define LEDDRIVER7_OTP_TEST_FUSE_NOT_BLOWN 0x40
90#define LEDDRIVER7_OTP_FATAL_ERR 0x80
91#define LEDDRIVER7_OTP_SUCCESSFULL 0xC0 // End group macro
95// --------------------------------------------------------------- PUBLIC TYPES
104typedef struct
105{
106 // Modules
107
108 i2c_master_t i2c;
109
110 // ctx variable
111
113
115
119typedef struct
120{
121 // Communication gpio pins
122
123 pin_name_t scl;
124 pin_name_t sda;
125
126 // static variable
127
128 uint32_t i2c_speed;
129 uint8_t i2c_address;
130
132 // End types group
134// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
135
141#ifdef __cplusplus
142extern "C"{
143#endif
144
154
163
174void leddriver7_generic_write ( leddriver7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
175
187void leddriver7_generic_read ( leddriver7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
188
189#ifdef __cplusplus
190}
191#endif
192#endif // _LEDDRIVER7_H_
193 // End public_function group
196
197// ------------------------------------------------------------------------- END
#define LEDDRIVER7_RETVAL
Definition: leddriver7.h:62
LEDDRIVER7_RETVAL leddriver7_init(leddriver7_t *ctx, leddriver7_cfg_t *cfg)
Initialization function.
void leddriver7_cfg_setup(leddriver7_cfg_t *cfg)
Config Object Initialization function.
void leddriver7_generic_read(leddriver7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void leddriver7_generic_write(leddriver7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
Click configuration structure definition.
Definition: leddriver7.h:120
uint32_t i2c_speed
Definition: leddriver7.h:128
pin_name_t scl
Definition: leddriver7.h:123
pin_name_t sda
Definition: leddriver7.h:124
uint8_t i2c_address
Definition: leddriver7.h:129
Click ctx object definition.
Definition: leddriver7.h:105
i2c_master_t i2c
Definition: leddriver7.h:108
uint8_t slave_address
Definition: leddriver7.h:112