39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define OBDII_CMD_FIRMWARE_VERSION "ATI"
74#define OBDII_CMD_DISABLE_ECHO "ATE0"
75#define OBDII_CMD_ENABLE_ECHO "ATE1"
76#define OBDII_CMD_AUTO_PROTOCOL "ATSP0"
77#define OBDII_CMD_SPACES_OFF "ATS0"
78#define OBDII_CMD_RESET_DEFAULT "ATD"
79#define OBDII_CMD_RESET_DEVICE "ATZ"
80#define OBDII_CMD_GET_CURRENT_RPM "010C"
81#define OBDII_CMD_GET_CURRENT_SPEED "010D"
87#define OBDII_RSP_OK "OK"
88#define OBDII_RSP_UNKNOWN_CMD "ERROR"
89#define OBDII_RSP_PROMPT ">"
90#define OBDII_RSP_CURRENT_RPM "410C"
91#define OBDII_RSP_CURRENT_SPEED "410D"
98#define OBDII_TX_DRV_BUFFER_SIZE 100
99#define OBDII_RX_DRV_BUFFER_SIZE 300
117#define OBDII_MAP_MIKROBUS( cfg, mikrobus ) \
118 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
119 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
120 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
121 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
#define OBDII_TX_DRV_BUFFER_SIZE
OBDII driver buffer size.
Definition obdii.h:98
#define OBDII_RX_DRV_BUFFER_SIZE
Definition obdii.h:99
err_t obdii_generic_write(obdii_t *ctx, uint8_t *data_in, uint16_t len)
OBDII data writing function.
void obdii_set_rst_pin(obdii_t *ctx, uint8_t state)
OBDII set rst pin function.
void obdii_cfg_setup(obdii_cfg_t *cfg)
OBDII configuration object setup function.
uint8_t obdii_get_int_pin(obdii_t *ctx)
OBDII get int pin function.
void obdii_reset_device(obdii_t *ctx)
OBDII reset device function.
void obdii_send_command(obdii_t *ctx, uint8_t *cmd)
OBDII send command function.
err_t obdii_generic_read(obdii_t *ctx, uint8_t *data_out, uint16_t len)
OBDII data reading function.
err_t obdii_init(obdii_t *ctx, obdii_cfg_t *cfg)
OBDII initialization function.
obdii_return_value_t
OBDII Click return value data.
Definition obdii.h:175
@ OBDII_ERROR
Definition obdii.h:177
@ OBDII_ERROR_TIMEOUT
Definition obdii.h:178
@ OBDII_OK
Definition obdii.h:176
OBDII Click configuration object.
Definition obdii.h:152
uint32_t baud_rate
Definition obdii.h:162
bool uart_blocking
Definition obdii.h:163
uart_data_bits_t data_bit
Definition obdii.h:164
pin_name_t tx_pin
Definition obdii.h:155
pin_name_t rx_pin
Definition obdii.h:154
uart_stop_bits_t stop_bit
Definition obdii.h:166
pin_name_t int_pin
Definition obdii.h:159
uart_parity_t parity_bit
Definition obdii.h:165
pin_name_t rst
Definition obdii.h:158
OBDII Click context object.
Definition obdii.h:131
uart_t uart
Definition obdii.h:139
digital_in_t int_pin
Definition obdii.h:136
digital_out_t rst
Definition obdii.h:133