/// <summary> /// Sets the Date and Time on the DS1307. /// </summary> /// <param name="value">The date and time as a System.DateTime object /// that will be saved on the DS1307.</param> public async Task SetDateAsync(DateTime value) { byte[] writeBuffer = new byte[] { //RTC_ADDRESS, Bcd.FromInt(value.Second), Bcd.FromInt(value.Minute), Bcd.FromInt(value.Hour), Bcd.FromInt((int)value.DayOfWeek), Bcd.FromInt(value.Day), Bcd.FromInt(value.Month), Bcd.FromInt(value.Year >= 2000 ? value.Year - 2000: 0), }; await this.i2c.WriteAsync(RTC_ADDRESS, writeBuffer); }
public Bcd(int value) { _value = Bcd.FromInt(value); }