42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
67#define ENOCEAN3_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST )
78#define ENOCEAN3_RETVAL uint8_t
80#define ENOCEAN3_OK 0x00
81#define ENOCEAN3_INIT_ERROR 0xFF
88#define DRV_RX_BUFFER_SIZE 500
89#define DRV_TX_BUFFER_SIZE 100
93#define ENOCEAN3_SYNC_BYTE 0x55
94#define ENOCEAN3_MAX_BUFF_SIZE 256
95#define ENOCEAN3_HEADER_SIZE 0x04
96#define ENOCEAN3_BUFF_EMPTY 0x00
99#define ENOCEAN3_RESPONSE_READY 0x01
100#define ENOCEAN3_RESPONSE_NOT_READY 0x00
101#define ENOCEAN3_UART_RX_READY 0x01
102#define ENOCEAN3_UART_RX_NOT_READY 0x00
103#define ENOCEAN3_OK 0x00
104#define ENOCEAN3_INVALID_PACKET_SIZE 0x01
106#define ENOCEAN3_PACK_TYPE_EVENT 0x04
107#define ENOCEAN3_PACK_TYPE_COMMON_COMMAND 0x05
108#define ENOCEAN3_CO_EVENT_SECUREDEVICES 0x05
109#define ENOCEAN3_CO_WR_FILTER_ADD 0x0B
110#define ENOCEAN3_CO_WR_FILTER_ENABLE 0x0E
111#define ENOCEAN3_CO_WR_REPEATER 0x09
112#define ENOCEAN3_CO_SET_NOISETHRESHOLD 0x32
114#define ENOCEAN3_FILT_TYPE_SOURCE_ID 0x00
115#define ENOCEAN3_FILT_TYPE_R_ORG 0x01
116#define ENOCEAN3_FILT_TYPE_RSSI 0x02
117#define ENOCEAN3_FILT_TYPE_DEST_ID 0x03
118#define ENOCEAN3_FILT_KIND_NEG_TEL_FWRD 0x00
119#define ENOCEAN3_FILT_KIND_POS_TEL_FWRD 0x80
120#define ENOCEAN3_FILT_KIND_NEG_TEL_RPT 0x40
121#define ENOCEAN3_FILT_KIND_POS_TEL_RPT 0xC0
122#define ENOCEAN3_FILT_FWRD_OFF 0x00
123#define ENOCEAN3_FILT_FWRD_ON 0x01
124#define ENOCEAN3_FILT_OP_OR_ALL_FILT 0x00
125#define ENOCEAN3_FILT_OP_AND_ALL_FILT 0x01
126#define ENOCEAN3_FILT_OP_OR_RADIO_INTER_AND_FILT_RPT 0x08
127#define ENOCEAN3_FILT_OP_AND_RADIO_INTER_OR_FILT_RPT 0x09
128#define ENOCEAN3_RPT_OFF 0x00
129#define ENOCEAN3_RPT_ALL_TELEG 0x01
130#define ENOCEAN3_RPT_SELECTIVE 0x02
131#define ENOCEAN3_RPT_LEVEL_OFF 0x00
132#define ENOCEAN3_RPT_LEVEL_ONE 0x01
133#define ENOCEAN3_RPT_LEVEL_TWO 0x02
134#define ENOCEAN3_RSSI_LEVEL_100_DBM_NEG 0x2E
135#define ENOCEAN3_RSSI_LEVEL_99_DBM_NEG 0x2F
136#define ENOCEAN3_RSSI_LEVEL_98_DBM_NEG 0x30
137#define ENOCEAN3_RSSI_LEVEL_97_DBM_NEG 0x31
138#define ENOCEAN3_RSSI_LEVEL_96_DBM_NEG 0x32
139#define ENOCEAN3_RSSI_LEVEL_95_DBM_NEG 0x33
140#define ENOCEAN3_RSSI_LEVEL_94_DBM_NEG 0x34
141#define ENOCEAN3_RSSI_LEVEL_93_DBM_NEG 0x35
142#define ENOCEAN3_RSSI_LEVEL_92_DBM_NEG 0x36
143#define ENOCEAN3_RSSI_LEVEL_91_DBM_NEG 0x37
144#define ENOCEAN3_RSSI_LEVEL_90_DBM_NEG 0x38
159 uint8_t data_buff[ 256 ];
uint8_t enocean3_error_t
Error type.
Definition enocean3.h:213
void(* enocean3_hdl_t)(enocean3_packet_t *, uint16_t *)
Definition enocean3.h:163
#define DRV_RX_BUFFER_SIZE
Definition enocean3.h:88
#define DRV_TX_BUFFER_SIZE
Definition enocean3.h:89
#define ENOCEAN3_RETVAL
Definition enocean3.h:78
ENOCEAN3_RETVAL enocean3_init(enocean3_t *ctx, enocean3_cfg_t *cfg)
Initialization function.
void enocean3_cfg_setup(enocean3_cfg_t *cfg)
Config Object Initialization function.
uint8_t enocean3_send_packet(enocean3_t *ctx, enocean3_packet_t *packet)
Packet Send function.
void enocean3_generic_write(enocean3_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void enocean3_uart_isr(enocean3_t *ctx)
UART Interrupt Routine function.
void enocean3_set_rst_pin(enocean3_t *ctx, uint8_t state)
Set RST ( reset ) pin state.
int32_t enocean3_generic_read(enocean3_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
uint8_t enocean3_response_ready(enocean3_t *ctx)
Response Ready function.
void enocean3_response_handler_set(enocean3_t *ctx, enocean3_hdl_t handler)
Handler Set function.
Click configuration structure definition.
Definition enocean3.h:190
uint32_t baud_rate
Definition enocean3.h:202
bool uart_blocking
Definition enocean3.h:203
uart_data_bits_t data_bit
Definition enocean3.h:204
pin_name_t tx_pin
Definition enocean3.h:194
pin_name_t rx_pin
Definition enocean3.h:193
uart_stop_bits_t stop_bit
Definition enocean3.h:206
uart_parity_t parity_bit
Definition enocean3.h:205
pin_name_t rst
Definition enocean3.h:198
Definition enocean3.h:154
uint16_t data_length
Definition enocean3.h:156
uint8_t opt_length
Definition enocean3.h:157
uint8_t packet_type
Definition enocean3.h:158
Click ctx object definition.
Definition enocean3.h:169
uint8_t response_ready
Definition enocean3.h:182
uart_t uart
Definition enocean3.h:176
digital_out_t rst
Definition enocean3.h:172
enocean3_hdl_t driver_hdl
Definition enocean3.h:181