dcmotor14 2.0.0.0
dcmotor14.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 DCMOTOR14_H
36#define DCMOTOR14_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 DCMOTOR14_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.in1= MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.in2= MIKROBUS( mikrobus, MIKROBUS_RST )
68
75#define DCMOTOR14_RETVAL uint8_t
76
77#define DCMOTOR14_OK 0x00
78#define DCMOTOR14_INIT_ERROR 0xFF
85#define DCMOTOR14_HIGH 1
86#define DCMOTOR14_LOW 0
89 // End group macro
90// --------------------------------------------------------------- PUBLIC TYPES
99typedef struct
100{
101 // Output pins
102
103 digital_out_t in1;
104 digital_out_t in2;
105
107
111typedef struct
112{
113 // Additional gpio pins
114
115 pin_name_t in1;
116 pin_name_t in2;
117
119
120 // End types group
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
150
159void dcmotor14_set_an_state ( dcmotor14_t *ctx, uint8_t state );
160
169void dcmotor14_set_rst_state ( dcmotor14_t *ctx, uint8_t state );
170
179
188
197
206
207#ifdef __cplusplus
208}
209#endif
210#endif // _DCMOTOR14_H_
211
212 // End public_function group
214
215// ------------------------------------------------------------------------- END
#define DCMOTOR14_RETVAL
Definition dcmotor14.h:75
void dcmotor14_brake(dcmotor14_t *ctx)
Brake function.
void dcmotor14_forward(dcmotor14_t *ctx)
Forward function.
void dcmotor14_reverse(dcmotor14_t *ctx)
Reverse function.
void dcmotor14_set_rst_state(dcmotor14_t *ctx, uint8_t state)
Set rst pin state function.
void dcmotor14_cfg_setup(dcmotor14_cfg_t *cfg)
Config Object Initialization function.
void dcmotor14_stop(dcmotor14_t *ctx)
Stop function.
DCMOTOR14_RETVAL dcmotor14_init(dcmotor14_t *ctx, dcmotor14_cfg_t *cfg)
Initialization function.
void dcmotor14_set_an_state(dcmotor14_t *ctx, uint8_t state)
Set an pin state function.
Click configuration structure definition.
Definition dcmotor14.h:112
pin_name_t in2
Definition dcmotor14.h:116
pin_name_t in1
Definition dcmotor14.h:115
Click ctx object definition.
Definition dcmotor14.h:100
digital_out_t in2
Definition dcmotor14.h:104
digital_out_t in1
Definition dcmotor14.h:103