42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
69#define HALLCURRENT_MAP_MIKROBUS( cfg, mikrobus ) \
70 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
71 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
72 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
73 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
74 cfg.ocd = MIKROBUS( mikrobus, MIKROBUS_INT );
81#define HALLCURRENT_OK 0
82#define HALLCURRENT_ERROR -1
93#define HALLCURRENT_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
94#define HALLCURRENT_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
uint8_t hallcurrent_check_status(hallcurrent_t *ctx)
Check status of read data function.
err_t hallcurrent_init(hallcurrent_t *ctx, hallcurrent_cfg_t *cfg)
Initialization function.
float hallcurrent_read_current(hallcurrent_t *ctx)
Read electric current function.
void hallcurrent_cfg_setup(hallcurrent_cfg_t *cfg)
Config Object Initialization function.
uint8_t hallcurrent_get_ocd_pin(hallcurrent_t *ctx)
Read OCD pin state function.
uint16_t hallcurrent_read_data(hallcurrent_t *ctx)
Generic read 16-bit data function.
This file contains SPI specific macros, functions, etc.
Click configuration structure definition.
Definition hallcurrent.h:120
pin_name_t ocd
Definition hallcurrent.h:128
spi_master_chip_select_polarity_t cs_polarity
Definition hallcurrent.h:133
pin_name_t sck
Definition hallcurrent.h:124
spi_master_mode_t spi_mode
Definition hallcurrent.h:132
pin_name_t mosi
Definition hallcurrent.h:123
uint32_t spi_speed
Definition hallcurrent.h:131
pin_name_t miso
Definition hallcurrent.h:122
pin_name_t cs
Definition hallcurrent.h:125
Click ctx object definition.
Definition hallcurrent.h:107
digital_in_t ocd
Definition hallcurrent.h:108
spi_master_t spi
Definition hallcurrent.h:111
pin_name_t chip_select
Definition hallcurrent.h:112