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 BARGRAPH2_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 ); \
72 cfg.mr = MIKROBUS( mikrobus, MIKROBUS_RST ); \
73 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM )
80#define BARGRAPH2_RETVAL uint8_t
82#define BARGRAPH2_OK 0x00
83#define BARGRAPH2_INIT_ERROR 0xFF
90#define BARGRAPH2_POWER_ON 1
91#define BARGRAPH2_POWER_OFF 0
98#define BARGRAPH2_LED_SEG_0 0x00
99#define BARGRAPH2_LED_SEG_1 0x01
100#define BARGRAPH2_LED_SEG_2 0x02
101#define BARGRAPH2_LED_SEG_3 0x04
102#define BARGRAPH2_LED_SEG_4 0x08
103#define BARGRAPH2_LED_SEG_5 0x10
104#define BARGRAPH2_LED_SEG_6 0x20
105#define BARGRAPH2_LED_SEG_7 0x40
106#define BARGRAPH2_LED_SEG_8 0x80
#define BARGRAPH2_RETVAL
Definition bargraph2.h:80
void bargraph2_lights_out(bargraph2_t *ctx)
Lights out function.
BARGRAPH2_RETVAL bargraph2_init(bargraph2_t *ctx, bargraph2_cfg_t *cfg)
Initialization function.
void bargraph2_default_cfg(bargraph2_t *ctx)
Click Default Configuration function.
void bargraph2_leds_yellow(bargraph2_t *ctx, int start_index, int end_index)
LEDs red function.
void bargraph2_cfg_setup(bargraph2_cfg_t *cfg)
Config Object Initialization function.
void bargraph2_generic_transfer(bargraph2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
void bargraph2_led_red(bargraph2_t *ctx, uint8_t index)
LED red function.
void barpgraph2_power(bargraph2_t *ctx, uint8_t power_on_off)
Lights out function.
void bargraph2_reset(bargraph2_t *ctx)
Reset function.
void bargraph2_led_green(bargraph2_t *ctx, uint8_t index)
LED green function.
void bargraph2_leds_red(bargraph2_t *ctx, int start_index, int end_index)
LEDs red function.
void bargraph2_leds_green(bargraph2_t *ctx, int start_index, int end_index)
LEDs green function.
void bargraph2_write_byte(bargraph2_t *ctx, uint8_t input_data)
Write byte function.
void bargraph2_led_yellow(bargraph2_t *ctx, uint8_t index)
LED yellow function.
Click configuration structure definition.
Definition bargraph2.h:139
spi_master_chip_select_polarity_t cs_polarity
Definition bargraph2.h:156
pin_name_t mr
Definition bargraph2.h:149
pin_name_t sck
Definition bargraph2.h:144
spi_master_mode_t spi_mode
Definition bargraph2.h:155
pin_name_t mosi
Definition bargraph2.h:143
uint32_t spi_speed
Definition bargraph2.h:154
pin_name_t pwm
Definition bargraph2.h:150
pin_name_t miso
Definition bargraph2.h:142
pin_name_t cs
Definition bargraph2.h:145
Click ctx object definition.
Definition bargraph2.h:120
digital_out_t cs
Definition bargraph2.h:121
spi_master_t spi
Definition bargraph2.h:130
digital_out_t pwm
Definition bargraph2.h:126
digital_out_t mr
Definition bargraph2.h:125
pin_name_t chip_select
Definition bargraph2.h:131