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 CANFD_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
69 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
70 cfg.stb = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.wke = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
73 cfg.err = MIKROBUS( mikrobus, MIKROBUS_INT )
80#define CANFD_RETVAL uint8_t
83#define CANFD_INIT_ERROR 0xFF
90#define CANFD_PIN_STATE_ENABLE 0x01
91#define CANFD_PIN_STATE_DISABLE 0x00
92#define CANFD_NULL 0x00
99#define CANFD_OPERATING_MODE_NORMAL 0
100#define CANFD_OPERATING_MODE_RECEIVE 1
101#define CANFD_OPERATING_MODE_STAND_BY 2
102#define CANFD_OPERATING_MODE_SLEEP 3
109#define DRV_RX_BUFFER_SIZE 500
#define DRV_RX_BUFFER_SIZE
Definition canfd.h:109
#define CANFD_RETVAL
Definition canfd.h:80
void canfd_cfg_setup(canfd_cfg_t *cfg)
Config Object Initialization function.
void canfd_set_stand_by_stb_pin(canfd_t *ctx, uint8_t stb_state)
Set STB ( RST ) pin state.
void canfd_generic_write(canfd_t *ctx, char *data_buf, uint16_t len)
Generic write function.
void canfd_set_stb_pin(canfd_t *ctx, uint8_t state)
Set RST ( reset ) pin state.
uint8_t canfd_get_err_pin(canfd_t *ctx)
Set ERR ( INT ) pin state.
CANFD_RETVAL canfd_init(canfd_t *ctx, canfd_cfg_t *cfg)
Initialization function.
void canfd_set_operating_mode(canfd_t *ctx, uint8_t op_mode)
Operation mode.
void canfd_set_wke_pin(canfd_t *ctx, uint8_t state)
Set WKE ( wake-up ) pin state.
void canfd_set_mode_en_pin(canfd_t *ctx, uint8_t en_state)
Set EN ( CS ) pin state.
int32_t canfd_generic_read(canfd_t *ctx, char *data_buf, uint16_t max_len)
Generic read function.
uint8_t canfd_error_t
Error type.
Definition canfd.h:172
Click configuration structure definition.
Definition canfd.h:146
uint32_t baud_rate
Definition canfd.h:161
bool uart_blocking
Definition canfd.h:162
pin_name_t err
Definition canfd.h:157
uart_data_bits_t data_bit
Definition canfd.h:163
pin_name_t wke
Definition canfd.h:156
pin_name_t tx_pin
Definition canfd.h:150
pin_name_t rx_pin
Definition canfd.h:149
uart_stop_bits_t stop_bit
Definition canfd.h:165
pin_name_t en
Definition canfd.h:155
uart_parity_t parity_bit
Definition canfd.h:164
pin_name_t stb
Definition canfd.h:154
Click ctx object definition.
Definition canfd.h:122
digital_out_t stb
Definition canfd.h:125
digital_in_t wke
Definition canfd.h:130
uart_t uart
Definition canfd.h:135
digital_out_t en
Definition canfd.h:126
digital_in_t err
Definition canfd.h:131