timer 2.0.0.0
Public function

Functions

void timer_cfg_setup (timer_cfg_t *cfg)
 Config Object Initialization function.
 
TIMER_RETVAL timer_init (timer_t *ctx, timer_cfg_t *cfg)
 Initialization function.
 
void timer_generic_write (timer_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void timer_generic_read (timer_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void timer_hw_reset (timer_t *ctx)
 Hardwere reset function.
 
void timer_read_eeprom (timer_t *ctx)
 Read data from the EEPROM memory function.
 
void timer_write_byte_eeprom (timer_t *ctx, uint8_t location, uint8_t write_data)
 Write data from the EEPROM memory function.
 
uint8_t timer_read_byte_eeprom (timer_t *ctx, uint8_t location)
 Read the byte of data from the EEPROM memory function.
 
uint8_t timer_get_configuration (timer_t *ctx)
 Get configuration data function.
 
uint32_t timer_get_etc_data (timer_t *ctx)
 Get elapsed time counter (ETC) data function.
 
void timer_set_etc_data (timer_t *ctx, uint32_t etc_value)
 Set elapsed time counter (ETC) data function.
 
uint32_t timer_get_etc_seconds (timer_t *ctx)
 Get elapsed time counter (ETC) seconds 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.
 
void timer_set_etc_seconds (timer_t *ctx, uint32_t etc_seconds)
 Set elapsed time counter (ETC) seconds function.
 
uint16_t timer_get_ec_data (timer_t *ctx)
 Get event counter (EC) data function.
 
void timer_set_ec_data (timer_t *ctx, uint16_t ec_value)
 Set elapsed time counter (EC) data function.
 
uint16_t timer_get_ec_seconds (timer_t *ctx)
 Get elapsed time counter (EC) seconds function.
 
void timer_set_ec_seconds (timer_t *ctx, uint16_t ec_seconds)
 Set elapsed time counter (EC) seconds function.
 
uint32_t timer_get_alarm_data (timer_t *ctx)
 Get alarm data function.
 
void timer_set_alarm_data (timer_t *ctx, uint32_t a_data)
 Set alarm data function.
 
uint32_t timer_get_alarm_seconds (timer_t *ctx)
 Get alarm seconds 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.
 
void timer_set_alarm_seconds (timer_t *ctx, uint32_t alarm_seconds)
 Set alarm seconds function.
 
uint8_t timer_check_write_disable (timer_t *ctx)
 Check write disable ( write protection ) function.
 
void timer_disable_write (timer_t *ctx)
 Disable write data ( write protection ) function.
 
void timer_enable_write (timer_t *ctx)
 Enable write data function.
 
void timer_alarm_output_select (timer_t *ctx)
 Set alarm output select function.
 
void timer_reset_enable (timer_t *ctx)
 Set enable reset function.
 
void timer_set_alarm_polarity (timer_t *ctx)
 Set alarm polarity function.
 
uint8_t timer_get_alarm_flag (timer_t *ctx)
 Get alarm flag function.
 
void timer_soft_reset (timer_t *ctx)
 Soft reset function.
 
uint8_t timer_check_interrupt (timer_t *ctx)
 Check interrupt function.
 

Detailed Description

Function Documentation

◆ timer_alarm_output_select()

void timer_alarm_output_select ( timer_t * ctx)

Set alarm output select function.

Parameters
ctxClick object.

@description Function set alarm output select by set bit 3 to the target 8-bit CONFIG register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_cfg_setup()

void timer_cfg_setup ( timer_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ timer_check_interrupt()

uint8_t timer_check_interrupt ( timer_t * ctx)

Check interrupt function.

Parameters
ctxClick object.
Returns
interrupt state ( state of ALM pin ) 0 : no active; 1 : active;

@description Function checks the interrupt state, state of ALM pin on Timer Click.

◆ timer_check_write_disable()

uint8_t timer_check_write_disable ( timer_t * ctx)

Check write disable ( write protection ) function.

Parameters
ctxClick object.
Returns
write protection status
  • 0 : OFF;
  • 1 : ON;

@description Function check write disable ( write protection ) by read from the target 8-bit CONFIG register address of DS1682 total elapsed time recorder on Timer Click and return status of bit 4.

◆ timer_disable_write()

void timer_disable_write ( timer_t * ctx)

Disable write data ( write protection ) function.

Parameters
ctxClick object.

@description Function disable write data ( write protection ) by write twice value of 0xAA to the target 8-bit WRITE_DISABLE register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_enable_write()

void timer_enable_write ( timer_t * ctx)

Enable write data function.

Parameters
ctxClick object.

@description Function enable write data by write twice value of 0xF0 to the target 8-bit WRITE_DISABLE register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_generic_read()

void timer_generic_read ( timer_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ timer_generic_write()

void timer_generic_write ( timer_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ timer_get_alarm_data()

uint32_t timer_get_alarm_data ( timer_t * ctx)

Get alarm data function.

Parameters
ctxClick object.
Returns
32-bit read alarm data ( quarter seconds )

@description Function read the 32-bit alarm data from the target 8-bit ALARM register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_alarm_flag()

uint8_t timer_get_alarm_flag ( timer_t * ctx)

Get alarm flag function.

Parameters
ctxClick object.
Returns
alarm flag status
  • 0 : no matches;
  • 1 : when the ETC value matches the alarm value;
Note
Once the this bit is set it cannot be clear.

@description Function get alarm flag by read and return status of bit 6 from the target 8-bit CONFIG register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_alarm_seconds()

uint32_t timer_get_alarm_seconds ( timer_t * ctx)

Get alarm seconds function.

Parameters
ctxClick object.
Returns
32-bit read alarm seconds

@description Function read the 32-bit alarm seconds from the target 8-bit ALARM register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_alarm_time()

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.

Parameters
ctxClick object.
time_dayspointer of time days
time_hourspointer of time hours [ 0 h : 23 h ]
time_minutespointer of time minutes [ 0 min : 59 min ]
time_secondspointer of time seconds [ 0 sec : 59 sec ]

@description Function get 16-bit day and 8-bit alarm hours, minutes and seconds.

◆ timer_get_configuration()

uint8_t timer_get_configuration ( timer_t * ctx)

Get configuration data function.

Parameters
ctxClick object.
Returns
8-bit read data

@description Function read the 8-bit configuration data from the target 8-bit configuration register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_ec_data()

uint16_t timer_get_ec_data ( timer_t * ctx)

Get event counter (EC) data function.

Parameters
ctxClick object.
Returns
16-bit read data ( quarter seconds )

@description Function read the 32-bit elapsed time counter (EC) data from the target 8-bit EC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_ec_seconds()

uint16_t timer_get_ec_seconds ( timer_t * ctx)

Get elapsed time counter (EC) seconds function.

Parameters
ctxClick object.
Returns
16-bit read EC seconds

@description Function read the 16-bit elapsed time counter (EC) seconds from the target 8-bit EC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_etc_data()

uint32_t timer_get_etc_data ( timer_t * ctx)

Get elapsed time counter (ETC) data function.

Parameters
ctxClick object.
Returns
32-bit read data ( quarter seconds )

@description Function read the 32-bit elapsed time counter (ETC) data from the target 8-bit ETC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_etc_seconds()

uint32_t timer_get_etc_seconds ( timer_t * ctx)

Get elapsed time counter (ETC) seconds function.

Parameters
ctxClick object.
Returns
32-bit read ETC seconds

@description Function read the 32-bit elapsed time counter (ETC) seconds from the target 8-bit ETC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_get_time()

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.

Parameters
ctxClick object.
time_dayspointer of time days
time_hourspointer of time hours [ 0 h : 23 h ]
time_minutespointer of time minutes [ 0 min : 59 min ]
time_secondspointer of time seconds [ 0 sec : 59 sec ]

@description Function write the 32-bit elapsed time counter (ETC) time to the target 8-bit ETC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_hw_reset()

void timer_hw_reset ( timer_t * ctx)

Hardwere reset function.

Parameters
ctxClick object.

@description Function hardwere reset device by set RST pin on Timer Click.

◆ timer_init()

TIMER_RETVAL timer_init ( timer_t * ctx,
timer_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ timer_read_byte_eeprom()

uint8_t timer_read_byte_eeprom ( timer_t * ctx,
uint8_t location )

Read the byte of data from the EEPROM memory function.

Parameters
ctxClick object.
locationEEPROM location from 1 to 10
Returns
8-bit read data from desired EPPROM location

@description Function read 8-bit data from the target EEPROM memory location of DS1682 total elapsed time recorder on Timer Click.

◆ timer_read_eeprom()

void timer_read_eeprom ( timer_t * ctx)

Read data from the EEPROM memory function.

Parameters
ctxClick object.

@description Function read all data from the EEPROM memory of DS1682 total elapsed time recorder on Timer Click.

◆ timer_reset_enable()

void timer_reset_enable ( timer_t * ctx)

Set enable reset function.

Parameters
ctxClick object.

@description Function set enable reset by set bit 2 to the target 8-bit CONFIG register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_alarm_data()

void timer_set_alarm_data ( timer_t * ctx,
uint32_t a_data )

Set alarm data function.

Parameters
ctxClick object.
a_data32-bit read data ( quarter seconds )

@description Function write the 32-bit alarm data to the target 8-bit ALARM register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_alarm_polarity()

void timer_set_alarm_polarity ( timer_t * ctx)

Set alarm polarity function.

Parameters
ctxClick object.

@description Function set alarm polarity by set bit 1 to the target 8-bit CONFIG register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_alarm_seconds()

void timer_set_alarm_seconds ( timer_t * ctx,
uint32_t alarm_seconds )

Set alarm seconds function.

Parameters
ctxClick object.
alarm_seconds32-bit read data ( quarter seconds )

@description Function write the 32-bit alarm seconds to the target 8-bit ALARM register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_ec_data()

void timer_set_ec_data ( timer_t * ctx,
uint16_t ec_value )

Set elapsed time counter (EC) data function.

Parameters
ctxClick object.
ec_value16-bit read data ( quarter seconds )

@description Function write the 16-bit elapsed time counter (EC) data to the target 8-bit EC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_ec_seconds()

void timer_set_ec_seconds ( timer_t * ctx,
uint16_t ec_seconds )

Set elapsed time counter (EC) seconds function.

Parameters
ctxClick object.
ec_seconds16-bit read data ( quarter seconds )

@description Function write the 16-bit elapsed time counter (EC) seconds to the target 8-bit EC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_etc_data()

void timer_set_etc_data ( timer_t * ctx,
uint32_t etc_value )

Set elapsed time counter (ETC) data function.

Parameters
ctxClick object.
etc_value32-bit read data ( quarter seconds )

@description Function write the 32-bit elapsed time counter (ETC) data to the target 8-bit ETC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_set_etc_seconds()

void timer_set_etc_seconds ( timer_t * ctx,
uint32_t etc_seconds )

Set elapsed time counter (ETC) seconds function.

Parameters
ctxClick object.
etc_seconds32-bit read data ( quarter seconds )

@description Function write the 32-bit elapsed time counter (ETC) seconds to the target 8-bit ETC register address of DS1682 total elapsed time recorder on Timer Click.

◆ timer_soft_reset()

void timer_soft_reset ( timer_t * ctx)

Soft reset function.

Parameters
ctxClick object.

@description Function software reset by set bit 2 to the target 8-bit CONFIG register address and write twice value of 0x55 to the target 8-bit RESET of DS1682 total elapsed time recorder on Timer Click.

◆ timer_write_byte_eeprom()

void timer_write_byte_eeprom ( timer_t * ctx,
uint8_t location,
uint8_t write_data )

Write data from the EEPROM memory function.

Parameters
ctxClick object.
locationEEPROM location from 1 to 10
write_data8-bit data to write

@description Function write data to the target EEPROM memory location of DS1682 total elapsed time recorder on Timer Click.