42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
65#define SCANNER_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
67 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
68 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK )
75#define SCANNER_RETVAL uint8_t
77#define SCANNER_OK 0x00
78#define SCANNER_INIT_ERROR 0xFF
85#define SCANNER_REG_OFFSET_LEFT 0x00
86#define SCANNER_REG_GAIN_LEFT 0x01
87#define SCANNER_REG_OFFSET_CENTER 0x02
88#define SCANNER_REG_GAIN_CENTER 0x03
89#define SCANNER_REG_OFFSET_RIGHT 0x04
90#define SCANNER_REG_GAIN_RIGHT 0x05
91#define SCANNER_REG_MODE 0x1F
98#define SCANNER_CMD_IRESET 0x00
99#define SCANNER_CMD_RESET 0x1B
100#define SCANNER_CMD_STARTINT 0x08
101#define SCANNER_CMD_SAMPLEINT 0x10
102#define SCANNER_CMD_READPIXEL 0x02
103#define SCANNER_CMD_ABORTPIXEL 0x19
104#define SCANNER_CMD_READHOLD 0x12
105#define SCANNER_CMD_READHOLD_START 0x16
106#define SCANNER_CMD_REGWRITE 0x40
107#define SCANNER_CMD_REGREAD 0x60
114#define SCANNER_DATA_SLEEP_MODE 0x10
115#define SCANNER_DATA_NORMAL_MODE 0x00
#define SCANNER_RETVAL
Definition scanner.h:75
void scanner_serial_write_reg(scanner_t *ctx, uint8_t reg_adr, uint8_t write_data)
Write function.
void scanner_set_sdi(scanner_t *ctx, uint8_t sdi_mode)
Set SDI Pin function.
void scanner_startup(scanner_t *ctx)
Start function.
uint8_t scanner_serial_read_reg(scanner_t *ctx, uint8_t reg_adr)
Read function.
void scanner_read_pixel(scanner_t *ctx, uint8_t *pixel_data)
Read pixels.
void scanner_clock(scanner_t *ctx)
Pulse function.
void scanner_cfg_setup(scanner_cfg_t *cfg)
Config Object Initialization function.
void scanner_serial_cmd(scanner_t *ctx, uint8_t cmd)
Write function.
uint8_t scanner_get_sdo(scanner_t *ctx)
Get SDO Pin state function.
SCANNER_RETVAL scanner_init(scanner_t *ctx, scanner_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition scanner.h:145
pin_name_t sck
Definition scanner.h:150
pin_name_t mosi
Definition scanner.h:148
pin_name_t miso
Definition scanner.h:149
Click ctx object definition.
Definition scanner.h:129
digital_out_t sck
Definition scanner.h:133
digital_out_t mosi
Definition scanner.h:132
digital_in_t miso
Definition scanner.h:137