powerreset 2.0.0.0
powerreset.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 POWERRESET_H
36#define POWERRESET_H
37
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54
55// -------------------------------------------------------------- PUBLIC MACROS
65#define POWERRESET_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.sta= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
67 cfg.rst= MIKROBUS( mikrobus, MIKROBUS_INT );
74#define POWERRESET_RETVAL uint8_t
75#define powerreset_state_t uint8_t
76
77#define POWERRESET_OK 0x00
78#define POWERRESET_INIT_ERROR 0xFF
85#define POWERRESET_ACTIVE 1
86#define POWERRESET_INACTIVE 0
89 // End group macro
90// --------------------------------------------------------------- PUBLIC TYPES
99typedef struct
100{
101 // Input pins
102
103 digital_in_t sta;
104 digital_in_t rst;
105
107
111typedef struct
112{
113 // Additional gpio pins
114
115 pin_name_t sta;
116 pin_name_t rst;
117
119
120 // End types group
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
150
161
172
173#ifdef __cplusplus
174}
175#endif
176#endif // _POWERRESET_H_
177
178 // End public_function group
180
181// ------------------------------------------------------------------------- END
#define POWERRESET_RETVAL
Definition powerreset.h:74
#define powerreset_state_t
Definition powerreset.h:75
powerreset_state_t powerreset_get_pwr(powerreset_t *ctx)
Power Check function.
void powerreset_cfg_setup(powerreset_cfg_t *cfg)
Config Object Initialization function.
powerreset_state_t powerreset_get_rst(powerreset_t *ctx)
Reset Check function.
POWERRESET_RETVAL powerreset_init(powerreset_t *ctx, powerreset_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition powerreset.h:112
pin_name_t sta
Definition powerreset.h:115
pin_name_t rst
Definition powerreset.h:116
Click ctx object definition.
Definition powerreset.h:100
digital_in_t sta
Definition powerreset.h:103
digital_in_t rst
Definition powerreset.h:104