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 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define POWERRESET_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.sta= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
53  cfg.rst= MIKROBUS( mikrobus, MIKROBUS_INT );
54 
60 #define POWERRESET_RETVAL uint8_t
61 #define powerreset_state_t uint8_t
62 
63 #define POWERRESET_OK 0x00
64 #define POWERRESET_INIT_ERROR 0xFF
65 
71 #define POWERRESET_ACTIVE 1
72 #define POWERRESET_INACTIVE 0
73  // End group macro
76 // --------------------------------------------------------------- PUBLIC TYPES
85 typedef struct
86 {
87  // Input pins
88 
89  digital_in_t sta;
90  digital_in_t rst;
91 
92 } powerreset_t;
93 
97 typedef struct
98 {
99  // Additional gpio pins
100 
101  pin_name_t sta;
102  pin_name_t rst;
103 
105  // End types group
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
127 
136 
147 
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 #endif // _POWERRESET_H_
163  // End public_function group
166 
167 // ------------------------------------------------------------------------- END
powerreset_cfg_t::sta
pin_name_t sta
Definition: powerreset.h:101
powerreset_state_t
#define powerreset_state_t
Definition: powerreset.h:61
powerreset_init
POWERRESET_RETVAL powerreset_init(powerreset_t *ctx, powerreset_cfg_t *cfg)
Initialization function.
powerreset_t::sta
digital_in_t sta
Definition: powerreset.h:89
powerreset_get_rst
powerreset_state_t powerreset_get_rst(powerreset_t *ctx)
Reset Check function.
powerreset_t::rst
digital_in_t rst
Definition: powerreset.h:90
powerreset_t
Click ctx object definition.
Definition: powerreset.h:86
powerreset_cfg_setup
void powerreset_cfg_setup(powerreset_cfg_t *cfg)
Config Object Initialization function.
powerreset_cfg_t::rst
pin_name_t rst
Definition: powerreset.h:102
powerreset_cfg_t
Click configuration structure definition.
Definition: powerreset.h:98
powerreset_get_pwr
powerreset_state_t powerreset_get_pwr(powerreset_t *ctx)
Power Check function.
POWERRESET_RETVAL
#define POWERRESET_RETVAL
Definition: powerreset.h:60