35#ifndef MAGNETICLINEAR_H
36#define MAGNETICLINEAR_H
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"
67#define MAGNETICLINEAR_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS );
78#define MAGNETICLINEAR_RETVAL uint8_t
80#define MAGNETICLINEAR_OK 0x00
81#define MAGNETICLINEAR_INIT_ERROR 0xFF
#define MAGNETICLINEAR_RETVAL
Definition magneticlinear.h:78
void magneticlinear_cfg_setup(magneticlinear_cfg_t *cfg)
Config Object Initialization function.
uint16_t magneticlinear_read_data(magneticlinear_t *ctx)
Read data function.
void magneticlinear_generic_transfer(magneticlinear_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
MAGNETICLINEAR_RETVAL magneticlinear_init(magneticlinear_t *ctx, magneticlinear_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition magneticlinear.h:113
spi_master_chip_select_polarity_t cs_polarity
Definition magneticlinear.h:125
pin_name_t sck
Definition magneticlinear.h:118
spi_master_mode_t spi_mode
Definition magneticlinear.h:124
pin_name_t mosi
Definition magneticlinear.h:117
uint32_t spi_speed
Definition magneticlinear.h:123
pin_name_t miso
Definition magneticlinear.h:116
pin_name_t cs
Definition magneticlinear.h:119
Click ctx object definition.
Definition magneticlinear.h:95
digital_out_t cs
Definition magneticlinear.h:96
spi_master_t spi
Definition magneticlinear.h:100
uint16_t data_new
Definition magneticlinear.h:104
int16_t magnetic_counter
Definition magneticlinear.h:103
uint16_t data_old
Definition magneticlinear.h:105
pin_name_t chip_select
Definition magneticlinear.h:101