#include "i2c.h"
#include "DS3231.h"
#include "pinout.h"
#include <avr/io.h>



void DS3231_init(void){
	//i2c_start(DS3231_ADDRESS);
}



int DS3231_seconds(void){
	
	char ret = i2c_start(DS3231_ADDRESS+I2C_WRITE);
	/*
	USART_Transmit_String(" Return ");
	//putchar(ret);
	USART_Transmit_String("\n");
	*/
/*
	if(ret){ //failed
		  PORTB |= STATUS_LED_B;
		  i2c_stop();
	}else{
		// issuing start condition ok, device accessible 
         i2c_write(0x05);                       // write address = 5
         i2c_write(0x75);                       // ret=0 -> Ok, ret=1 -> no ACK 
         i2c_stop(); 
        
		 i2c_start_wait(DS3231_ADDRESS+I2C_WRITE);     // set device address and write mode
         i2c_write(REG_SECONDS);                       // write address = 5
         i2c_rep_start(DS3231_ADDRESS+I2C_READ);       // set device address and read mode
         ret = i2c_readNak();                          // read one byte
         i2c_stop();
	}
	
	return ret;
	*/
}
