39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
52#include "drv_analog_in.h"
74#define BLETINY_CMD_ATR "ATr"
75#define BLETINY_CMD_ATZ "ATZ"
76#define BLETINY_CMD_GAPDISCONNECT "AT+GAPDISCONNECT"
77#define BLETINY_CMD_ATI "ATI"
78#define BLETINY_CMD_ATRI "ATrI"
79#define BLETINY_CMD_BDADDR "AT+BDADDR"
80#define BLETINY_CMD_RSSI "AT+RSSI"
81#define BLETINY_CMD_CHECK_MEM "AT+MEM=0"
82#define BLETINY_CMD_CLEAR_MEM "AT+MEM=0,"
100#define BLETINY_RSP_OK "OK"
101#define BLETINY_RSP_ERROR "ERROR"
102#define BLETINY_CONNECTED "+CONNECTED"
103#define BLETINY_DISCONNECTED "+DISCONNECTED"
109#define BLETINY_SPI_CFG_SPEED_2MHZ 0
110#define BLETINY_SPI_CFG_SPEED_4MHZ 1
111#define BLETINY_SPI_CFG_SPEED_8MHZ 2
112#define BLETINY_SPI_CFG_MODE0 0
113#define BLETINY_SPI_CFG_MODE1 1
114#define BLETINY_SPI_CFG_MODE2 2
115#define BLETINY_SPI_CFG_MODE3 3
121#define BLETINY_I2C_CFG_SPEED_100KHZ 100
122#define BLETINY_I2C_CFG_SPEED_400KHZ 400
123#define BLETINY_I2C_CFG_REG_LEN_1BYTE 8
124#define BLETINY_I2C_CFG_REG_LEN_1BYTES 16
131#define DRV_BUFFER_SIZE 500
149#define BLETINY_MAP_MIKROBUS( cfg, mikrobus ) \
150 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
151 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
152 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
bletiny_return_value_t
BLE TINY Click return value data.
Definition bletiny.h:202
@ BLETINY_ERROR_TIMEOUT
Definition bletiny.h:205
@ BLETINY_ERROR
Definition bletiny.h:204
@ BLETINY_ERROR_UNKNOWN
Definition bletiny.h:207
@ BLETINY_ERROR_RETURN
Definition bletiny.h:206
@ BLETINY_OK
Definition bletiny.h:203
#define DRV_BUFFER_SIZE
BLE TINY driver buffer size.
Definition bletiny.h:131
err_t bletiny_i2c_read(bletiny_t *ctx, uint8_t slave_address, uint16_t reg, uint8_t *data_buf, uint8_t len)
Send command to read data from slave device via I2C communication.
err_t bletiny_init(bletiny_t *ctx, bletiny_cfg_t *cfg)
BLE TINY initialization function.
err_t bletiny_spi_write_then_read(bletiny_t *ctx, uint8_t *data_write, uint8_t write_len, char *data_read, uint8_t read_len)
Send command to write data to and then read data from slave device via SPI communication.
err_t bletiny_generic_read(bletiny_t *ctx, char *data_buf, uint16_t max_len)
BLE TINY data reading function.
err_t bletiny_spi_read(bletiny_t *ctx, char *data_buf, uint8_t len)
Send command to read data from slave device via SPI communication.
err_t bletiny_default_cfg(bletiny_t *ctx)
BLE TINY default configuration function.
err_t bletiny_generic_write(bletiny_t *ctx, char *data_buf, uint16_t len)
BLE TINY data writing function.
void bletiny_spi_config(bletiny_t *ctx, uint8_t speed, uint8_t mode)
Configure Click board for SPI master communication.
err_t bletiny_i2c_write(bletiny_t *ctx, uint8_t slave_address, uint16_t reg, uint8_t reg_data)
Send command to write data to reg address of slave device via I2C communication.
err_t bletiny_spi_write(bletiny_t *ctx, char *data_buf, uint8_t len)
Send command to write data to slave device via SPI communication.
void bletiny_send_cmd(bletiny_t *ctx, char *cmd)
Send command function.
void bletiny_cfg_setup(bletiny_cfg_t *cfg)
BLE TINY configuration object setup function.
void bletiny_i2c_config(bletiny_t *ctx, uint8_t speed, uint8_t reg_len)
Configure Click board for I2C master communication.
BLE TINY Click configuration object.
Definition bletiny.h:180
uint32_t baud_rate
Definition bletiny.h:189
bool uart_blocking
Definition bletiny.h:190
uart_data_bits_t data_bit
Definition bletiny.h:191
pin_name_t tx_pin
Definition bletiny.h:183
pin_name_t rx_pin
Definition bletiny.h:182
uart_stop_bits_t stop_bit
Definition bletiny.h:193
uart_parity_t parity_bit
Definition bletiny.h:192
pin_name_t rst
Definition bletiny.h:186
BLE TINY Click context object.
Definition bletiny.h:162
uart_t uart
Definition bletiny.h:167
digital_out_t rst
Definition bletiny.h:164