35#ifndef SINGLEWIRECAN_H
36#define SINGLEWIRECAN_H
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 SINGLEWIRECAN_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.md0 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.md1 = MIKROBUS( mikrobus, MIKROBUS_CS )
78#define SINGLEWIRECAN_RETVAL uint8_t
80#define SINGLEWIRECAN_OK 0x00
81#define SINGLEWIRECAN_INIT_ERROR 0xFF
88#define SINGLEWIRECAN_OPERATING_MODE_SLEEP 0x00
89#define SINGLEWIRECAN_OPERATING_MODE_HIGH_SPEED 0x01
90#define SINGLEWIRECAN_OPERATING_MODE_HIGH_VOLTAGE_WAKE_UP 0x02
91#define SINGLEWIRECAN_OPERATING_MODE_NORMAL 0x03
98#define SINGLEWIRECAN_PIN_STATE_LOW 0x00
99#define SINGLEWIRECAN_PIN_STATE_HIGH 0x01
106#define SINGLEWIRECAN_END_BUFF 0x00
113#define DRV_RX_BUFFER_SIZE 500
#define DRV_RX_BUFFER_SIZE
Definition singlewirecan.h:113
#define SINGLEWIRECAN_RETVAL
Definition singlewirecan.h:78
int32_t singlewirecan_generic_read(singlewirecan_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
void singlewirecan_cfg_setup(singlewirecan_cfg_t *cfg)
Config Object Initialization function.
void singlewirecan_set_operating_mode(singlewirecan_t *ctx, uint8_t op_mode)
Set operating mode function.
void singlewirecan_generic_write(singlewirecan_t *ctx, char *data_buf, uint16_t len)
Generic write function.
SINGLEWIRECAN_RETVAL singlewirecan_init(singlewirecan_t *ctx, singlewirecan_cfg_t *cfg)
Initialization function.
void singlewirecan_set_md_0_pin_state(singlewirecan_t *ctx, uint8_t rst_state)
Sets MD0 pin state.
void singlewirecan_set_md_1_pin_state(singlewirecan_t *ctx, uint8_t cs_state)
Sets MD1 pin state.
Click configuration structure definition.
Definition singlewirecan.h:145
uint32_t baud_rate
Definition singlewirecan.h:158
pin_name_t md1
Definition singlewirecan.h:154
bool uart_blocking
Definition singlewirecan.h:159
uart_data_bits_t data_bit
Definition singlewirecan.h:160
pin_name_t md0
Definition singlewirecan.h:153
pin_name_t tx_pin
Definition singlewirecan.h:149
pin_name_t rx_pin
Definition singlewirecan.h:148
uart_stop_bits_t stop_bit
Definition singlewirecan.h:162
uart_parity_t parity_bit
Definition singlewirecan.h:161
Click ctx object definition.
Definition singlewirecan.h:126
digital_out_t md0
Definition singlewirecan.h:129
uart_t uart
Definition singlewirecan.h:134
digital_out_t md1
Definition singlewirecan.h:130