42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
66#define SPECTRAL_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
68 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
69 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define SPECTRAL_OK 0x00
78#define SPECTRAL_ERROR 0xFF
85#define DRV_RX_BUFFER_SIZE 200
86#define DRV_TX_BUFFER_SIZE 100
#define DRV_RX_BUFFER_SIZE
Definition spectral.h:85
#define DRV_TX_BUFFER_SIZE
Definition spectral.h:86
void spectral_cfg_setup(spectral_cfg_t *cfg)
Config Object Initialization function.
int32_t spectral_uart_read(spectral_t *ctx, uint8_t *data_buf, uint16_t max_len)
Generic read function.
void spectral_uart_write(spectral_t *ctx, uint8_t *data_buf, uint16_t len)
Generic write function.
uint8_t spectral_get_cct_data(uint8_t *rsp)
Read the calibrated CCT value from the sensor.
void spectral_get_xyz_data(uint8_t *rsp, uint8_t *xyzr_data)
Read raw X, Y, and Z data.
uint8_t spectral_get_duv_data(uint8_t *rsp)
Read calibrated Duv for CIE 1976-color gamut.
void spectral_get_data(uint8_t *rsp, uint16_t *c_data)
Read raw X, Y, Z and NIR data as well as two special internal registers D, & C.
void spectral_module_reset(spectral_t *ctx)
Reset module.
uint8_t spectral_get_lux_data(uint8_t *rsp)
Read the calibrated LUX value from the sensor.
void spectral_send_command(spectral_t *ctx, uint8_t *command)
Send Command.
void spectral_get_color_data(uint8_t *rsp, uint8_t *xyz_data)
Read calibrated X, Y, and Z color data.
void spectral_get_xy_small_data(uint8_t *rsp, uint8_t *xy_data)
Read calibrated x and y for CIE 1931 color gamut.
void spectral_get_uv_data(uint8_t *rsp, uint16_t *uv_data)
Read calibrated u�, v� and u, v for CIE 1976 color gamut.
err_t spectral_init(spectral_t *ctx, spectral_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition spectral.h:118
uint32_t baud_rate
Definition spectral.h:128
bool uart_blocking
Definition spectral.h:129
uart_data_bits_t data_bit
Definition spectral.h:130
pin_name_t tx_pin
Definition spectral.h:121
pin_name_t rx_pin
Definition spectral.h:120
uart_stop_bits_t stop_bit
Definition spectral.h:132
pin_name_t int_pin
Definition spectral.h:125
uart_parity_t parity_bit
Definition spectral.h:131
pin_name_t rst
Definition spectral.h:124
Click ctx object definition.
Definition spectral.h:99
uart_t uart
Definition spectral.h:107
digital_in_t int_pin
Definition spectral.h:104
digital_out_t rst
Definition spectral.h:101