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_i2c_master.h"
67#define TIMER_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
69 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
70 cfg.evt = MIKROBUS( mikrobus, MIKROBUS_RST ); \
71 cfg.alm = MIKROBUS( mikrobus, MIKROBUS_INT )
78#define TIMER_RETVAL uint8_t
81#define TIMER_INIT_ERROR 0xFF
88#define TIMER_I2C_ADDR 0x6B
95#define TIMER_REG_CONFIG 0x00
96#define TIMER_REG_ALARM 0x01
97#define TIMER_REG_ELAPSED 0x05
98#define TIMER_REG_EVT_CNTR 0x09
99#define TIMER_REG_EEPROM 0x0B
100#define TIMER_REG_RESET 0x1D
101#define TIMER_REG_WRITE_DISABLE 0x1E
102#define TIMER_REG_WRITE_MEM_DISABLE 0x1F
109#define TIMER_ECMSB_BIT 0x01
110#define TIMER_AP_BIT 0x02
111#define TIMER_RE_BIT 0x04
112#define TIMER_AOS_BIT 0x08
113#define TIMER_WMDF_BIT 0x10
114#define TIMER_WDF_BIT 0x20
115#define TIMER_AF_BIT 0x40
122#define TIMER_EEPROM_SIZE 10
338void timer_get_time (
timer_t *ctx, uint16_t *time_days, uint8_t *time_hours, uint8_t *time_minutes, uint8_t *time_seconds );
#define TIMER_RETVAL
Definition timer.h:78
void timer_set_alarm_seconds(timer_t *ctx, uint32_t alarm_seconds)
Set alarm seconds function.
uint8_t timer_check_interrupt(timer_t *ctx)
Check interrupt function.
void timer_set_etc_data(timer_t *ctx, uint32_t etc_value)
Set elapsed time counter (ETC) data function.
TIMER_RETVAL timer_init(timer_t *ctx, timer_cfg_t *cfg)
Initialization function.
void timer_enable_write(timer_t *ctx)
Enable write data function.
void timer_cfg_setup(timer_cfg_t *cfg)
Config Object Initialization function.
void timer_set_etc_seconds(timer_t *ctx, uint32_t etc_seconds)
Set elapsed time counter (ETC) seconds function.
uint32_t timer_get_etc_seconds(timer_t *ctx)
Get elapsed time counter (ETC) seconds function.
void timer_set_ec_data(timer_t *ctx, uint16_t ec_value)
Set elapsed time counter (EC) data function.
uint32_t timer_get_etc_data(timer_t *ctx)
Get elapsed time counter (ETC) data function.
uint8_t timer_get_alarm_flag(timer_t *ctx)
Get alarm flag function.
void timer_set_ec_seconds(timer_t *ctx, uint16_t ec_seconds)
Set elapsed time counter (EC) seconds function.
void timer_generic_read(timer_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
void timer_generic_write(timer_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void timer_get_time(timer_t *ctx, uint16_t *time_days, uint8_t *time_hours, uint8_t *time_minutes, uint8_t *time_seconds)
Set elapsed time counter (ETC) time function.
uint32_t timer_get_alarm_seconds(timer_t *ctx)
Get alarm seconds function.
uint8_t timer_check_write_disable(timer_t *ctx)
Check write disable ( write protection ) function.
uint8_t timer_read_byte_eeprom(timer_t *ctx, uint8_t location)
Read the byte of data from the EEPROM memory function.
void timer_get_alarm_time(timer_t *ctx, uint16_t *time_days, uint8_t *time_hours, uint8_t *time_minutes, uint8_t *time_seconds)
Get alarm time.
uint16_t timer_get_ec_seconds(timer_t *ctx)
Get elapsed time counter (EC) seconds function.
void timer_set_alarm_data(timer_t *ctx, uint32_t a_data)
Set alarm data function.
void timer_reset_enable(timer_t *ctx)
Set enable reset function.
void timer_soft_reset(timer_t *ctx)
Soft reset function.
uint16_t timer_get_ec_data(timer_t *ctx)
Get event counter (EC) data function.
void timer_alarm_output_select(timer_t *ctx)
Set alarm output select function.
void timer_hw_reset(timer_t *ctx)
Hardwere reset function.
void timer_disable_write(timer_t *ctx)
Disable write data ( write protection ) function.
uint8_t timer_get_configuration(timer_t *ctx)
Get configuration data function.
void timer_write_byte_eeprom(timer_t *ctx, uint8_t location, uint8_t write_data)
Write data from the EEPROM memory function.
void timer_read_eeprom(timer_t *ctx)
Read data from the EEPROM memory function.
void timer_set_alarm_polarity(timer_t *ctx)
Set alarm polarity function.
uint32_t timer_get_alarm_data(timer_t *ctx)
Get alarm data function.
Click configuration structure definition.
Definition timer.h:159
uint32_t i2c_speed
Definition timer.h:172
pin_name_t evt
Definition timer.h:167
pin_name_t scl
Definition timer.h:162
pin_name_t sda
Definition timer.h:163
pin_name_t alm
Definition timer.h:168
uint8_t i2c_address
Definition timer.h:173
Click ctx object definition.
Definition timer.h:136
digital_out_t evt
Definition timer.h:139
digital_in_t alm
Definition timer.h:143
i2c_master_t i2c
Definition timer.h:147
uint8_t slave_address
Definition timer.h:151