ooktx 2.1.0.0
ooktx.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 OOKTX_H
29#define OOKTX_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51
73#define OOKTX_TRAINING_BYTES { 0xAA, 0xAA, 0xAA, 0xAA }
74#define OOKTX_MAN_MSB 0x8000
75#define OOKTX_MAN_BIT_LEN_US 2000
76#define OOKTX_MAX_DATA_LEN 255
77#define OOKTX_CALIB_ENABLE 0x01
78#define OOKTX_CALIB_DISABLE 0x00
79#define OOKTX_CFG_ENABLE 0x01
80#define OOKTX_CFG_DISABLE 0x00
81#define OOKTX_CFG_DEFAULT 0xF6F0
82#define OOKTX_CFG_F_433MHZ 0xF000
83#define OOKTX_CFG_CX_18PF 0x0600
84#define OOKTX_CFG_P_13DB 0x00F0
85#define OOKTX_CFG_P_10DB 0x00C0
86#define OOKTX_CFG_P_7DB 0x0090
87#define OOKTX_CFG_P_3DB 0x0050
88#define OOKTX_CFG_P_0DB 0x0020
89#define OOKTX_CFG_CT_0PF 0x0000
90
91 // ooktx_cfg
92
107#define OOKTX_MAP_MIKROBUS( cfg, mikrobus ) \
108 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_CS ); \
109 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_PWM )
110
111 // ooktx_map
112 // ooktx
113
118typedef struct
119{
120 digital_out_t sda;
121 digital_out_t sck;
123} ooktx_t;
124
129typedef struct
130{
131 pin_name_t sda;
132 pin_name_t sck;
135
140typedef enum
141{
143 OOKTX_ERROR = -1
144
146
163
177err_t ooktx_init ( ooktx_t *ctx, ooktx_cfg_t *cfg );
178
188
198
208
218
230void ooktx_start ( ooktx_t *ctx, uint8_t calib_en, uint8_t cfg_en, uint16_t cfg );
231
243void ooktx_stop ( ooktx_t *ctx );
244
245#ifdef __cplusplus
246}
247#endif
248#endif // OOKTX_H
249
250 // ooktx
251
252// ------------------------------------------------------------------------ END
void ooktx_clear_clock_pin(ooktx_t *ctx)
OOK TX clear clock pin function.
void ooktx_stop(ooktx_t *ctx)
OOK TX stop function.
void ooktx_cfg_setup(ooktx_cfg_t *cfg)
OOK TX configuration object setup function.
void ooktx_clear_data_pin(ooktx_t *ctx)
OOK TX clear data pin function.
err_t ooktx_init(ooktx_t *ctx, ooktx_cfg_t *cfg)
OOK TX initialization function.
void ooktx_start(ooktx_t *ctx, uint8_t calib_en, uint8_t cfg_en, uint16_t cfg)
OOK TX start function.
void ooktx_set_clock_pin(ooktx_t *ctx)
OOK TX set clock pin function.
void ooktx_set_data_pin(ooktx_t *ctx)
OOK TX set data pin function.
ooktx_return_value_t
OOK TX Click return value data.
Definition ooktx.h:141
@ OOKTX_ERROR
Definition ooktx.h:143
@ OOKTX_OK
Definition ooktx.h:142
OOK TX Click configuration object.
Definition ooktx.h:130
pin_name_t sck
Definition ooktx.h:132
pin_name_t sda
Definition ooktx.h:131
OOK TX Click context object.
Definition ooktx.h:119
digital_out_t sck
Definition ooktx.h:121
digital_out_t sda
Definition ooktx.h:120