35#ifndef MONARCHADAPTER_H
36#define MONARCHADAPTER_H
42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
66#define MONARCHADAPTER_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
68 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
69 cfg.rng = MIKROBUS( mikrobus, MIKROBUS_AN ); \
70 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
79#define MONARCHADAPTER_RETVAL uint8_t
81#define MONARCHADAPTER_OK 0x00
82#define MONARCHADAPTER_INIT_ERROR 0xFF
89#define DRV_RX_BUFFER_SIZE 600
90#define DRV_TX_BUFFER_SIZE 100
#define DRV_RX_BUFFER_SIZE
Definition monarchadapter.h:89
#define DRV_TX_BUFFER_SIZE
Definition monarchadapter.h:90
#define MONARCHADAPTER_RETVAL
Definition monarchadapter.h:79
void monarchadapter_cfg_setup(monarchadapter_cfg_t *cfg)
Config Object Initialization function.
void monarchadapter_send_command(monarchadapter_t *ctx, char *command)
Function for send command.
uint8_t monarchadapter_get_int_pin(monarchadapter_t *ctx)
Get INT pin state.
void monarchadapter_set_rts_pin(monarchadapter_t *ctx, uint8_t state)
Set RTS ( cs ) pin state.
MONARCHADAPTER_RETVAL monarchadapter_init(monarchadapter_t *ctx, monarchadapter_cfg_t *cfg)
Initialization function.
uint8_t monarchadapter_get_rng_pin(monarchadapter_t *ctx)
Get RNG ( an ) pin state.
void monarchadapter_generic_write(monarchadapter_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void monarchadapter_power_on(monarchadapter_t *ctx)
Monarch Adapter power on.
void monarchadapter_set_rst_pin(monarchadapter_t *ctx, uint8_t state)
Set RST ( reset ) pin state.
int32_t monarchadapter_generic_read(monarchadapter_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
uint8_t monarchadapter_error_t
Error type.
Definition monarchadapter.h:153
Click configuration structure definition.
Definition monarchadapter.h:127
pin_name_t rts
Definition monarchadapter.h:137
uint32_t baud_rate
Definition monarchadapter.h:142
bool uart_blocking
Definition monarchadapter.h:143
uart_data_bits_t data_bit
Definition monarchadapter.h:144
pin_name_t tx_pin
Definition monarchadapter.h:131
pin_name_t rng
Definition monarchadapter.h:135
pin_name_t rx_pin
Definition monarchadapter.h:130
uart_stop_bits_t stop_bit
Definition monarchadapter.h:146
pin_name_t int_pin
Definition monarchadapter.h:138
uart_parity_t parity_bit
Definition monarchadapter.h:145
pin_name_t rst
Definition monarchadapter.h:136
Click ctx object definition.
Definition monarchadapter.h:103
digital_in_t rng
Definition monarchadapter.h:111
digital_out_t rts
Definition monarchadapter.h:107
uart_t uart
Definition monarchadapter.h:116
digital_in_t int_pin
Definition monarchadapter.h:112
digital_out_t rst
Definition monarchadapter.h:106