Ejemplo n.º 1
0
        /// <summary>
        /// Reads sleep date from board.
        /// </summary>
        /// <param name="conn"></param>
        /// <returns></returns>
        public static SleepDateTime ReadSleepDate(I2cDeviceConnection conn)
        {
            conn.WriteByte(0x0B);
            var bytes  = conn.Read(3);
            var piDate = new SleepDateTime
                         (
                min: GetByte(bytes[0]).Value,
                hour: GetByte(bytes[1]).Value,
                day: GetByte(bytes[2]).Value
                         );

            return(piDate);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Writes sleep date to board.
 /// </summary>
 /// <param name="conn"></param>
 /// <param name="date"></param>
 public static void WriteSleep(I2cDeviceConnection conn, SleepDateTime date)
 {
     conn.Write(0x0B, GetBcd(date.Min), GetBcd(date.Hour), GetBcd(date.Day));
 }