relay3 2.0.0.0
relay3.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 RELAY3_H
36#define RELAY3_H
37
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define RELAY3_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.re1= MIKROBUS( mikrobus, MIKROBUS_RST ); \
53 cfg.re2= MIKROBUS( mikrobus, MIKROBUS_CS );
60#define RELAY3_RETVAL uint8_t
61
62#define RELAY3_OK 0x00
63#define RELAY3_INIT_ERROR 0xFF
70#define RELAY3_RELAY_1 0x01
71#define RELAY3_RELAY_2 0x02
72#define RELAY3_BOTH_RELAYS 0x03
79#define RELAY3_SECONDS 0x00
80#define RELAY3_MILISECONDS 0x01 // End group macro
84// --------------------------------------------------------------- PUBLIC TYPES
93typedef struct
94{
95 // Output pins
96
97 digital_out_t re1;
98 digital_out_t re2;
99
100} relay3_t;
101
105typedef struct
106{
107 // Additional gpio pins
108
109 pin_name_t re1;
110 pin_name_t re2;
111
113 // End types group
115// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
116
122#ifdef __cplusplus
123extern "C"{
124#endif
125
135
144
153void relay3_relay_on ( relay3_t *ctx, uint8_t relay );
154
163void relay3_relay_off ( relay3_t *ctx, uint8_t relay );
164
175void relay3_on_delay ( relay3_t *ctx, uint8_t relay, uint8_t units, uint16_t time );
176
187void relay3_on_delay ( relay3_t *ctx, uint8_t relay, uint8_t units, uint16_t time );
188
189#ifdef __cplusplus
190}
191#endif
192#endif // _RELAY3_H_
193 // End public_function group
196
197// ------------------------------------------------------------------------- END
#define RELAY3_RETVAL
Definition: relay3.h:60
void relay3_relay_on(relay3_t *ctx, uint8_t relay)
Relay on function.
RELAY3_RETVAL relay3_init(relay3_t *ctx, relay3_cfg_t *cfg)
Initialization function.
void relay3_relay_off(relay3_t *ctx, uint8_t relay)
Relay off function.
void relay3_cfg_setup(relay3_cfg_t *cfg)
Config Object Initialization function.
void relay3_on_delay(relay3_t *ctx, uint8_t relay, uint8_t units, uint16_t time)
Relay on with delay function.
Click configuration structure definition.
Definition: relay3.h:106
pin_name_t re1
Definition: relay3.h:109
pin_name_t re2
Definition: relay3.h:110
Click ctx object definition.
Definition: relay3.h:94
digital_out_t re1
Definition: relay3.h:97
digital_out_t re2
Definition: relay3.h:98