optoencoder5 2.1.0.0
optoencoder5.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef OPTOENCODER5_H
29#define OPTOENCODER5_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "mikrosdk_version.h"
36
37#ifdef __GNUC__
38#if mikroSDK_GET_VERSION < 20800ul
39#include "rcu_delays.h"
40#else
41#include "delays.h"
42#endif
43#endif
44
45#include "drv_digital_out.h"
46#include "drv_digital_in.h"
47
63#define OPTOENCODER5_OUT_STATE_SWITCH_OPEN 0
64#define OPTOENCODER5_OUT_STATE_SWITCH_CLOSED 1
65 // optoencoder5_set
67
82#define OPTOENCODER5_MAP_MIKROBUS( cfg, mikrobus ) \
83 cfg.on = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
84 cfg.out = MIKROBUS( mikrobus, MIKROBUS_INT )
85 // optoencoder5_map // optoencoder5
88
93typedef struct
94{
95 digital_out_t on;
96 digital_in_t out;
99
104typedef struct
105{
106 pin_name_t on;
107 pin_name_t out;
110
115typedef enum
116{
119
121
138
153
164
175
187
188#ifdef __cplusplus
189}
190#endif
191#endif // OPTOENCODER5_H
192 // optoencoder5
194
195// ------------------------------------------------------------------------ END
void optoencoder5_disable(optoencoder5_t *ctx)
Opto Encoder 5 disable function.
void optoencoder5_enable(optoencoder5_t *ctx)
Opto Encoder 5 enable function.
err_t optoencoder5_init(optoencoder5_t *ctx, optoencoder5_cfg_t *cfg)
Opto Encoder 5 initialization function.
void optoencoder5_cfg_setup(optoencoder5_cfg_t *cfg)
Opto Encoder 5 configuration object setup function.
uint8_t optoencoder5_get_out_state(optoencoder5_t *ctx)
Opto Encoder 5 get state function.
optoencoder5_return_value_t
Opto Encoder 5 Click return value data.
Definition: optoencoder5.h:116
@ OPTOENCODER5_OK
Definition: optoencoder5.h:117
@ OPTOENCODER5_ERROR
Definition: optoencoder5.h:118
Opto Encoder 5 Click configuration object.
Definition: optoencoder5.h:105
pin_name_t out
Definition: optoencoder5.h:107
pin_name_t on
Definition: optoencoder5.h:106
Opto Encoder 5 Click context object.
Definition: optoencoder5.h:94
digital_in_t out
Definition: optoencoder5.h:96
digital_out_t on
Definition: optoencoder5.h:95