42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
68#define BEE_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.wa = MIKROBUS( mikrobus, MIKROBUS_AN ); \
74 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
75 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
91#define BEE_PANIDL 0x01
92#define BEE_PANIDH 0x02
100#define BEE_EADR5 0x0A
101#define BEE_EADR6 0x0B
102#define BEE_EADR7 0x0C
103#define BEE_RXFLUSH 0x0D
104#define BEE_ORDER 0x10
105#define BEE_TXMCR 0x11
106#define BEE_ACKTMOUT 0x12
107#define BEE_ESLOTG1 0x13
108#define BEE_SYMTICKL 0x14
109#define BEE_SYMTICKH 0x15
110#define BEE_PACON0 0x16
111#define BEE_PACON1 0x17
112#define BEE_PACON2 0x18
113#define BEE_TXBCON0 0x1A
114#define BEE_TXNCON 0x1B
115#define BEE_TXG1CON 0x1C
116#define BEE_TXG2CON 0x1D
117#define BEE_ESLOTG23 0x1E
118#define BEE_ESLOTG45 0x1F
119#define BEE_ESLOTG67 0x20
120#define BEE_TXPEND 0x21
121#define BEE_WAKECON 0x22
122#define BEE_FRMOFFSET 0x23
123#define BEE_TXSTAT 0x24
124#define BEE_TXBCON1 0x25
125#define BEE_GATECLK 0x26
126#define BEE_TXTIME 0x27
127#define BEE_HSYMTMRL 0x28
128#define BEE_HSYMTMRH 0x29
129#define BEE_SOFTRST 0x2A
130#define BEE_SECCON0 0x2C
131#define BEE_SECCON1 0x2D
132#define BEE_TXSTBL 0x2E
134#define BEE_INTSTAT 0x31
135#define BEE_INTCON_M 0x32
137#define BEE_TRISGPIO 0x34
138#define BEE_SLPACK 0x35
139#define BEE_RFCTL 0x36
140#define BEE_SECCR2 0x37
141#define BEE_BBREG0 0x38
142#define BEE_BBREG1 0x39
143#define BEE_BBREG2 0x3A
144#define BEE_BBREG3 0x3B
145#define BEE_BBREG4 0x3C
146#define BEE_BBREG6 0x3E
147#define BEE_CCAEDTH 0x3F
154#define BEE_RFCON0 0x0200
155#define BEE_RFCON1 0x0201
156#define BEE_RFCON2 0x0202
157#define BEE_RFCON3 0x0203
158#define BEE_RFCON5 0x0205
159#define BEE_RFCON6 0x0206
160#define BEE_RFCON7 0x0207
161#define BEE_RFCON8 0x0208
162#define BEE_SLPCAL0 0x0209
163#define BEE_SLPCAL1 0x020A
164#define BEE_SLPCAL2 0x020B
165#define BEE_RFSTATE 0x020F
166#define BEE_RSSI 0x0210
167#define BEE_SLPCON0 0x0211
168#define BEE_SLPCON1 0x0220
169#define BEE_WAKETIMEL 0x0222
170#define BEE_WAKETIMEH 0x0223
171#define BEE_REMCNTL 0x0224
172#define BEE_REMCNTH 0x0225
173#define BEE_MAINCNT0 0x0226
174#define BEE_MAINCNT1 0x0227
175#define BEE_MAINCNT2 0x0228
176#define BEE_MAINCNT3 0x0229
177#define BEE_ASSOEADR0 0x0230
178#define BEE_ASSOEADR1 0x0231
179#define BEE_ASSOEADR2 0x0232
180#define BEE_ASSOEADR3 0x0233
181#define BEE_ASSOEADR4 0x0234
182#define BEE_ASSOEADR5 0x0235
183#define BEE_ASSOEADR6 0x0236
184#define BEE_ASSOEADR7 0x0237
185#define BEE_ASSOSADR0 0x0238
186#define BEE_ASSOSADR1 0x0239
187#define BEE_UPNONCE0 0x0240
188#define BEE_UPNONCE1 0x0241
189#define BEE_UPNONCE2 0x0242
190#define BEE_UPNONCE3 0x0243
191#define BEE_UPNONCE4 0x0244
192#define BEE_UPNONCE5 0x0245
193#define BEE_UPNONCE6 0x0246
194#define BEE_UPNONCE7 0x0247
195#define BEE_UPNONCE8 0x0248
196#define BEE_UPNONCE9 0x0249
197#define BEE_UPNONCE10 0x024A
198#define BEE_UPNONCE11 0x024B
199#define BEE_UPNONCE12 0x024C
200#define BEE_RX_FIFO 0x0300
201#define BEE_DATA_LENGHT 6
202#define BEE_HEADER_LENGHT 11
213#define BEE_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
214#define BEE_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
void bee_generic_transfer(bee_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void bee_basic_init(bee_t *ctx)
Basic initialization module function.
void bee_soft_reset(bee_t *ctx)
Soft reset function.
void bee_set_ack(bee_t *ctx)
Set ACK request function.
void bee_power_reset(bee_t *ctx)
Power reset function.
void bee_write_byte_short(bee_t *ctx, uint8_t reg_address, uint8_t write_data)
Write the byte of data to the short register address function.
void bee_set_reception_mode(bee_t *ctx, uint8_t r_mode)
Set reception mode function.
void bee_read_rx_fifo(bee_t *ctx, uint8_t *rx_data)
Read RX FIFO function.
uint8_t bee_interrupt_activity(bee_t *ctx)
Check interrupt activity function.
void bee_set_short_address(bee_t *ctx, uint8_t *short_address)
Set short address function.
void bee_disable_pll(bee_t *ctx)
Disable PLL function.
uint8_t bee_read_byte_long(bee_t *ctx, uint16_t reg_address)
Read the byte of data from the long register address function.
void bee_set_pan_id(bee_t *ctx, uint8_t *pan_id)
Set PAN ID function.
void bee_write_tx_normal_fifo(bee_t *ctx, uint16_t address_tx_normal_fifo, uint8_t *tx_data)
Write TX normal FIFO function.
void bee_bb_reset(bee_t *ctx)
Baseband reset function.
void bee_hw_wake_up(bee_t *ctx)
Hardware Wake Up function.
void bee_rf_reset(bee_t *ctx)
RF state machine reset function.
uint8_t bee_read_byte_short(bee_t *ctx, uint8_t reg_address)
Read the byte of data from the short register address function.
void bee_set_tx_power(bee_t *ctx, uint8_t tx_power)
Set scale control for Tx power function.
void bee_set_ifs_default(bee_t *ctx)
Set default interframe spacing function.
void bee_nonbeacon_device(bee_t *ctx)
Set nonbeacon device function.
void bee_set_cca_mode(bee_t *ctx, uint8_t cca_mode)
Set CCA mode function.
void bee_hw_reset(bee_t *ctx)
Hardware reset function.
void bee_flush_rx_fifo_pointer(bee_t *ctx)
Set flush RX FIFO pointer function.
void bee_enable_interrupt(bee_t *ctx)
Enable interrupt function.
void bee_mac_reset(bee_t *ctx)
MAC reset function.
void bee_set_long_address(bee_t *ctx, uint8_t *long_address)
Set long address function.
void bee_nonbeacon_init(bee_t *ctx)
Initialization nonbeacon module function.
void bee_disabl_encrypt(bee_t *ctx)
Disable encrypt function.
void bee_enable_immediate_wake_up(bee_t *ctx)
Enable Immediate Wake-up mode function.
void bee_cfg_setup(bee_cfg_t *cfg)
Config Object Initialization function.
void bee_enable_encrypt(bee_t *ctx)
Set enable encrypt function.
void bee_write_byte_long(bee_t *ctx, uint16_t reg_address, uint8_t write_data)
Write the byte of data to the long register address function.
void bee_set_ifs_recomended(bee_t *ctx)
Set interframe spacing function.
void bee_set_channel(bee_t *ctx, uint8_t n_channel)
Set channel function.
err_t bee_init(bee_t *ctx, bee_cfg_t *cfg)
Initialization function.
void bee_set_not_ack(bee_t *ctx)
Set not ACK request function.
void bee_set_frame_format_filter(bee_t *ctx, uint8_t fff_mode)
Set frame format filter function.
void bee_enable_pll(bee_t *ctx)
Enable PLL function.
void bee_nonbeacon_coordinator_device(bee_t *ctx)
Set device as coordinator function.
void bee_start_transmit(bee_t *ctx)
Start transmission function.
uint8_t bee_interrupt(bee_t *ctx)
Get interrupt state function.
void bee_nonbeacon_pan_coordinator_device(bee_t *ctx)
Set device as PAN coordinator function.
void bee_set_rssi_mode(bee_t *ctx, uint8_t rssi_mode)
Set RSSI mode function.
This file contains SPI specific macros, functions, etc.
Click configuration structure definition.
Definition bee.h:245
pin_name_t wa
Definition bee.h:253
spi_master_chip_select_polarity_t cs_polarity
Definition bee.h:260
pin_name_t sck
Definition bee.h:249
spi_master_mode_t spi_mode
Definition bee.h:259
pin_name_t mosi
Definition bee.h:248
uint32_t spi_speed
Definition bee.h:258
pin_name_t int_pin
Definition bee.h:255
pin_name_t miso
Definition bee.h:247
pin_name_t rst
Definition bee.h:254
pin_name_t cs
Definition bee.h:250
Click ctx object definition.
Definition bee.h:227
spi_master_t spi
Definition bee.h:236
digital_out_t wa
Definition bee.h:229
digital_in_t int_pin
Definition bee.h:233
digital_out_t rst
Definition bee.h:230
pin_name_t chip_select
Definition bee.h:237