Subversion Repositories idreammicro-avr

Compare Revisions

Ignore whitespace Rev 39 → Rev 58

/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);