ismrx2 2.1.0.0
ismrx2.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 ISMRX2_H
29#define ISMRX2_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37
52#define ISMRX2_PIN_STATE_HIGH 1
53#define ISMRX2_PIN_STATE_LOW 0
54#define ISMRX2_DEFAULT_SYNC_BYTE 0xCE35
55#define ISMRX2_FSK_DEFAULT_SYNC_BYTE 0xFF
56
57 // ismrx2_set
59
74#define ISMRX2_MAP_MIKROBUS( cfg, mikrobus ) \
75 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
76 cfg.stb = MIKROBUS( mikrobus, MIKROBUS_CS ); \
77 cfg.mst = MIKROBUS( mikrobus, MIKROBUS_INT ); \
78 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX )
79 // ismrx2_map // ismrx2
82
87typedef struct
88{
89 digital_out_t rst;
90 digital_out_t stb;
92 digital_in_t rx_pin;
93 digital_in_t mst;
95} ismrx2_t;
96
101typedef struct
102{
103 pin_name_t rst;
104 pin_name_t stb;
105 pin_name_t rx_pin;
106 pin_name_t mst;
109
114typedef enum
115{
117 ISMRX2_ERROR = -1
118
120
137
151err_t ismrx2_init ( ismrx2_t *ctx, ismrx2_cfg_t *cfg );
152
166
176void ismrx2_set_rst_pin_state ( ismrx2_t *ctx, uint8_t state );
177
187void ismrx2_set_stb_pin_state ( ismrx2_t *ctx, uint8_t state );
188
198
208
220err_t ismrx2_read_manchester_data ( ismrx2_t *ctx, uint8_t *data_out );
221
233err_t ismrx2_read_rf_data ( ismrx2_t *ctx, uint8_t *data_out );
234
235#ifdef __cplusplus
236}
237#endif
238#endif // ISMRX2_H
239 // ismrx2
241
242// ------------------------------------------------------------------------ END
err_t ismrx2_read_rf_data(ismrx2_t *ctx, uint8_t *data_out)
ISM RX 2 read data function.
err_t ismrx2_read_manchester_data(ismrx2_t *ctx, uint8_t *data_out)
ISM RX 2 read manchester encoded data function.
uint8_t ismrx2_get_data_pin_state(ismrx2_t *ctx)
ISM RX 2 get state of DATA pin function.
void ismrx2_cfg_setup(ismrx2_cfg_t *cfg)
ISM RX 2 configuration object setup function.
uint8_t ismrx2_get_mst_pin_state(ismrx2_t *ctx)
ISM RX 2 get state of MST pin function.
void ismrx2_set_stb_pin_state(ismrx2_t *ctx, uint8_t state)
ISM RX 2 set state of STB pin function.
void ismrx2_set_rst_pin_state(ismrx2_t *ctx, uint8_t state)
ISM RX 2 set state of RST pin function.
err_t ismrx2_default_cfg(ismrx2_t *ctx)
ISM RX 2 default configuration function.
err_t ismrx2_init(ismrx2_t *ctx, ismrx2_cfg_t *cfg)
ISM RX 2 initialization function.
ismrx2_return_value_t
ISM RX 2 Click return value data.
Definition: ismrx2.h:115
@ ISMRX2_OK
Definition: ismrx2.h:116
@ ISMRX2_ERROR
Definition: ismrx2.h:117
ISM RX 2 Click configuration object.
Definition: ismrx2.h:102
pin_name_t mst
Definition: ismrx2.h:106
pin_name_t rx_pin
Definition: ismrx2.h:105
pin_name_t rst
Definition: ismrx2.h:103
pin_name_t stb
Definition: ismrx2.h:104
ISM RX 2 Click context object.
Definition: ismrx2.h:88
digital_in_t mst
Definition: ismrx2.h:93
digital_in_t rx_pin
Definition: ismrx2.h:92
digital_out_t stb
Definition: ismrx2.h:90
digital_out_t rst
Definition: ismrx2.h:89