mcp73871 2.0.0.0
mcp73871.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 */
32// ----------------------------------------------------------------------------
33
34#ifndef MCP73871_H
35#define MCP73871_H
36
41#ifdef PREINIT_SUPPORTED
42#include "preinit.h"
43#endif
44
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
47 #include "delays.h"
48 #endif
49#endif
50
51#include "drv_digital_out.h"
52#include "drv_digital_in.h"
53
54// -------------------------------------------------------------- PUBLIC MACROS
64#define MCP73871_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.pg2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
66 cfg.ce = MIKROBUS( mikrobus, MIKROBUS_CS ); \
67 cfg.te = MIKROBUS( mikrobus, MIKROBUS_PWM )
74#define MCP73871_RETVAL uint8_t
75
76#define MCP73871_OK 0x00
77#define MCP73871_INIT_ERROR 0xFF
80 // End group macro
81// --------------------------------------------------------------- PUBLIC TYPES
90typedef struct
91{
92 // Output pins
93
94 digital_out_t pg2;
95 digital_out_t ce;
96 digital_out_t te;
97
99
103typedef struct
104{
105 // Additional gpio pins
106
107 pin_name_t pg2;
108 pin_name_t ce;
109 pin_name_t te;
110
112
113 // End types group
114// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
115
121#ifdef __cplusplus
122extern "C"{
123#endif
124
134
143
152void mcp73871_enable_pin_control ( mcp73871_t *ctx, uint8_t pin_state );
153
162void mcp73871_prog_pin_control ( mcp73871_t *ctx, uint8_t pin_state );
163
172void mcp73871_timer_pin_control ( mcp73871_t *ctx, uint8_t pin_state );
173
174#ifdef __cplusplus
175}
176#endif
177#endif // _MCP73871_H_
178
179 // End public_function group
181
182// ------------------------------------------------------------------------- END
#define MCP73871_RETVAL
Definition mcp73871.h:74
void mcp73871_prog_pin_control(mcp73871_t *ctx, uint8_t pin_state)
Prog pin control.
void mcp73871_timer_pin_control(mcp73871_t *ctx, uint8_t pin_state)
Timer pin control.
void mcp73871_enable_pin_control(mcp73871_t *ctx, uint8_t pin_state)
Enable pin control.
void mcp73871_cfg_setup(mcp73871_cfg_t *cfg)
Config Object Initialization function.
MCP73871_RETVAL mcp73871_init(mcp73871_t *ctx, mcp73871_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition mcp73871.h:104
pin_name_t ce
Definition mcp73871.h:108
pin_name_t te
Definition mcp73871.h:109
pin_name_t pg2
Definition mcp73871.h:107
Click ctx object definition.
Definition mcp73871.h:91
digital_out_t pg2
Definition mcp73871.h:94
digital_out_t te
Definition mcp73871.h:96
digital_out_t ce
Definition mcp73871.h:95