Subversion Repositories idreammicro-avr

Compare Revisions

Ignore whitespace Rev 57 → Rev 58

/trunk/libraries/ds1307/demo/ds1307__demo.c
1,6 → 1,6
/**************************************************************************//**
* \brief DS1307 RTC library - Demonstration program
* \author Copyright (C) 2011 Julien Le Sech - www.idreammicro.com
* \author Copyright (C) 2009 Julien Le Sech - www.idreammicro.com
* \version 1.0
* \date 20090501
*
21,7 → 21,7
******************************************************************************/
 
/**************************************************************************//**
* \file demo_ds1307.c
* \file ds1307__demo.c
******************************************************************************/
 
/******************************************************************************
/trunk/libraries/ds1307/src/ds1307.c
40,8 → 40,7
* Private macros.
******************************************************************************/
 
#define DS1307__ADDRESS 0x68
#define DS1307__SLAVE_ADDRESS (DS1307__ADDRESS << 1)
#define DS1307__ADDRESS 0xD0
 
#define DS1307__REGISTER_ADDRESS__SECONDS 0x00
#define DS1307__REGISTER_ADDRESS__MINUTES 0x01
92,12 → 91,12
assert(NULL != p_hour_mode);
 
twi__start();
twi__send_slaw(DS1307__SLAVE_ADDRESS);
twi__send_slaw(DS1307__ADDRESS);
twi__send_data(DS1307__REGISTER_ADDRESS__SECONDS);
twi__stop();
 
twi__start();
twi__send_slar(DS1307__SLAVE_ADDRESS);
twi__send_slar(DS1307__ADDRESS);
uint8_t seconds = 0;
twi__receive_data_ack(&seconds);
uint8_t minutes = 0;
139,7 → 138,7
assert(NULL != p_time);
 
twi__start();
twi__send_slaw(DS1307__SLAVE_ADDRESS);
twi__send_slaw(DS1307__ADDRESS);
twi__send_data(DS1307__REGISTER_ADDRESS__SECONDS);
 
uint8_t seconds = ((p_time->seconds / 10) << 4) + (p_time->seconds % 10);
179,12 → 178,12
assert(NULL != p_date);
 
twi__start();
twi__send_slaw(DS1307__SLAVE_ADDRESS);
twi__send_slaw(DS1307__ADDRESS);
twi__send_data(DS1307__REGISTER_ADDRESS__DAY);
twi__stop();
 
twi__start();
twi__send_slar(DS1307__SLAVE_ADDRESS);
twi__send_slar(DS1307__ADDRESS);
 
uint8_t day = 0;
twi__receive_data_ack(&day);
219,7 → 218,7
assert(NULL != p_date);
 
twi__start();
twi__send_slaw(DS1307__SLAVE_ADDRESS);
twi__send_slaw(DS1307__ADDRESS);
twi__send_data(DS1307__REGISTER_ADDRESS__DAY);
 
uint8_t date = ((p_date->date / 10) << 4) + (p_date->date % 10);