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 RADAR_CMD_HEADER 0xD9
74#define RADAR_CMD_ID_VERSION 0x00
75#define RADAR_CMD_ID_ACK 0x02
76#define RADAR_CMD_ID_MAX_DETECT_RANGE 0x03
77#define RADAR_CMD_ID_SENSITIVITY 0x04
78#define RADAR_CMD_ID_DETECT_OUT 0x05
79#define RADAR_CMD_ID_DETECT_IN_EVT 0x06
80#define RADAR_CMD_ID_DETECT_OUT_EVT 0x07
81#define RADAR_CMD_ID_RESET_CONFIG 0x08
82#define RADAR_CMD_ID_GET_DETECT_STATUS 0x09
83#define RADAR_CMD_ID_DETECT_ENABLE 0x0A
84#define RADAR_CMD_ID_RFCW_MODE 0x0B
85#define RADAR_CMD_ID_CHIP_TEMPERATURE 0x0D
86#define RADAR_CMD_ID_SLEEP_MODE 0x0E
87#define RADAR_CMD_ID_CALIB_MODE 0x0F
88#define RADAR_CMD_ID_CALIB_MSG 0x10
89#define RADAR_CMD_ID_CALIB_MSG_RATE 0x11
90#define RADAR_CMD_ID_MIN_DETECT_RANGE 0x30
91#define RADAR_CMD_ID_MACRO_THRESHOLD 0x31
92#define RADAR_CMD_ID_MICRO_THRESHOLD 0x32
93#define RADAR_CMD_ID_MACRO_VALID 0x33
94#define RADAR_CMD_ID_MICRO_VALID 0x34
95#define RADAR_CMD_ID_DETECT_MODE 0x35
96#define RADAR_CMD_ID_MACRO_DETECT_RANGE 0x36
97#define RADAR_CMD_ID_MACRO_DETECT_DELAY 0x37
98#define RADAR_CMD_ID_CHIRP_PER_FRAME 0x38
99#define RADAR_CMD_ID_UNIQUE_ID 0xF7
105#define RADAR_SET_CMD_FAIL 0x00
106#define RADAR_SET_CMD_SUCCESS 0x01
112#define RADAR_TIMEOUT 1000
118#define RADAR_DEFAULT_MIN_RANGE 0.0
119#define RADAR_DEFAULT_MAX_RANGE 3.0
126#define DRV_BUFFER_SIZE 256
144#define RADAR_MAP_MIKROBUS( cfg, mikrobus ) \
145 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
146 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
147 cfg.gp2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
148 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
149 cfg.gp1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
150 cfg.gp0 = MIKROBUS( mikrobus, MIKROBUS_INT );
#define DRV_BUFFER_SIZE
Radar driver buffer size.
Definition radar.h:126
err_t radar_set_detection_range(radar_t *ctx, float min, float max)
Radar set detection range function.
err_t radar_get_command(radar_t *ctx, uint8_t cmd_id, uint8_t *payload, uint8_t *payload_size)
Radar get command function.
uint8_t radar_get_gpio2_pin(radar_t *ctx)
Radar get gpio 2 pin function.
err_t radar_default_cfg(radar_t *ctx)
Radar default configuration function.
err_t radar_init(radar_t *ctx, radar_cfg_t *cfg)
Radar initialization function.
void radar_enable_device(radar_t *ctx)
Radar enable device function.
void radar_cfg_setup(radar_cfg_t *cfg)
Radar configuration object setup function.
err_t radar_generic_read(radar_t *ctx, uint8_t *data_buf, uint16_t max_len)
Radar data reading function.
err_t radar_get_temperature(radar_t *ctx, float *temperature)
Radar get temperature function.
err_t radar_set_command(radar_t *ctx, uint8_t cmd_id, uint8_t *payload, uint8_t payload_size)
Radar set command function.
void radar_float_mchip_to_ieee(float *f_data)
Radar float ieee to mchip function.
err_t radar_reset_config(radar_t *ctx)
Radar reset config function.
err_t radar_generic_write(radar_t *ctx, uint8_t *data_buf, uint16_t len)
Radar data writing function.
err_t radar_get_event(radar_t *ctx, uint8_t *evt_id, uint8_t *payload, uint8_t *payload_size)
Radar get event function.
void radar_float_ieee_to_mchip(float *f_data)
Radar float ieee to mchip function.
uint8_t radar_get_gpio1_pin(radar_t *ctx)
Radar get gpio 1 pin function.
void radar_disable_device(radar_t *ctx)
Radar disable device function.
uint8_t radar_get_gpio0_pin(radar_t *ctx)
Radar get gpio 0 pin function.
radar_return_value_t
Radar Click return value data.
Definition radar.h:219
@ RADAR_ERROR
Definition radar.h:221
@ RADAR_OK
Definition radar.h:220
Radar Click configuration object.
Definition radar.h:194
uint32_t baud_rate
Definition radar.h:206
pin_name_t gp0
Definition radar.h:203
pin_name_t gp2
Definition radar.h:201
bool uart_blocking
Definition radar.h:207
uart_data_bits_t data_bit
Definition radar.h:208
pin_name_t tx_pin
Definition radar.h:197
pin_name_t rx_pin
Definition radar.h:196
uart_stop_bits_t stop_bit
Definition radar.h:210
pin_name_t gp1
Definition radar.h:202
uart_parity_t parity_bit
Definition radar.h:209
pin_name_t rst
Definition radar.h:200
Radar Click context object.
Definition radar.h:171
digital_in_t gp1
Definition radar.h:177
digital_in_t gp2
Definition radar.h:176
uart_t uart
Definition radar.h:181
digital_in_t gp0
Definition radar.h:178
digital_out_t rst
Definition radar.h:173
Radar Click float bytes type object.
Definition radar.h:160
float f_data
Definition radar.h:162