39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define THUNDEREMU_MODE_CLOSE 0
74#define THUNDEREMU_MODE_MID 1
75#define THUNDEREMU_MODE_FAR 2
81#define THUNDEREMU_DAC_MODE_FAST_NORMAL 0x00
82#define THUNDEREMU_DAC_MODE_FAST_PDOWN_1K 0x10
83#define THUNDEREMU_DAC_MODE_FAST_PDOWN_100K 0x20
84#define THUNDEREMU_DAC_MODE_FAST_PDOWN_500K 0x30
85#define THUNDEREMU_DAC_MODE_EEPROM_NORMAL 0x60
86#define THUNDEREMU_DAC_MODE_EEPROM_PDOWN_1K 0x62
87#define THUNDEREMU_DAC_MODE_EEPROM_PDOWN_100K 0x64
88#define THUNDEREMU_DAC_MODE_EEPROM_PDOWN_500K 0x66
94#define THUNDEREMU_DAC_OUT_MIN 0x0000
95#define THUNDEREMU_DAC_OUT_MAX 0x0FFF
102#define THUNDEREMU_DEVICE_ADDRESS_0 0x60
103#define THUNDEREMU_DEVICE_ADDRESS_1 0x61
121#define THUNDEREMU_MAP_MIKROBUS( cfg, mikrobus ) \
122 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
123 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
124 cfg.close = MIKROBUS( mikrobus, MIKROBUS_AN ); \
125 cfg.led = MIKROBUS( mikrobus, MIKROBUS_RST ); \
126 cfg.mid = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
127 cfg.far_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
void thunderemu_cfg_setup(thunderemu_cfg_t *cfg)
Thunder EMU configuration object setup function.
err_t thunderemu_generate_thunder(thunderemu_t *ctx, uint8_t mode)
Thunder EMU generate thunder function.
err_t thunderemu_init(thunderemu_t *ctx, thunderemu_cfg_t *cfg)
Thunder EMU initialization function.
err_t thunderemu_default_cfg(thunderemu_t *ctx)
Thunder EMU default configuration function.
uint8_t thunderemu_get_mid_pin(thunderemu_t *ctx)
Thunder EMU get mid pin function.
void thunderemu_led_disable(thunderemu_t *ctx)
Thunder EMU led disable function.
uint8_t thunderemu_get_far_pin(thunderemu_t *ctx)
Thunder EMU get far pin function.
err_t thunderemu_set_dac_output(thunderemu_t *ctx, uint8_t mode, uint16_t dac_data)
Thunder EMU set dac output function.
void thunderemu_led_enable(thunderemu_t *ctx)
Thunder EMU led enable function.
uint8_t thunderemu_get_close_pin(thunderemu_t *ctx)
Thunder EMU get close pin function.
Thunder EMU Click configuration object.
Definition thunderemu.h:159
pin_name_t led
Definition thunderemu.h:163
uint32_t i2c_speed
Definition thunderemu.h:168
pin_name_t mid
Definition thunderemu.h:165
pin_name_t close
Definition thunderemu.h:164
pin_name_t scl
Definition thunderemu.h:160
pin_name_t sda
Definition thunderemu.h:161
pin_name_t far_pin
Definition thunderemu.h:166
uint8_t i2c_address
Definition thunderemu.h:169
Thunder EMU Click context object.
Definition thunderemu.h:137
digital_in_t mid
Definition thunderemu.h:143
digital_out_t led
Definition thunderemu.h:139
digital_in_t close
Definition thunderemu.h:142
i2c_master_t i2c
Definition thunderemu.h:147
digital_in_t far_pin
Definition thunderemu.h:144
uint8_t slave_address
Definition thunderemu.h:150
thunderemu_return_value_t
Thunder EMU Click return value data.
Definition thunderemu.h:178
@ THUNDEREMU_OK
Definition thunderemu.h:179
@ THUNDEREMU_ERROR
Definition thunderemu.h:180