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

uint32_t DS3231_read(){
    i2c_start_wait(0xD0);
    i2c_write(0x00);
    i2c_stop();

    i2c_start_wait(0xD1);
    uint8_t sec = i2c_readAck();
    uint8_t min = i2c_readAck();
    uint8_t std = i2c_readNak();
    i2c_stop();
    return ((uint32_t)std<<16) | ((uint32_t)min<<8) | sec;
}
