Wednesday, February 02, 2005

Pop quiz, what does this code do?

DS1307 d = new DS1307(Cpu.Pin.GPIO20_VTU_TIO1A, Cpu.Pin.GPIO21_VTU_TIO2A);
d.SetRTC(new DateTime(2005, 2, 2, 21, 22, 0, 0));
for (int i = 0; i < 10; i++)
{
    DateTime dt = d.ReadRTC();
    Debug.Print(dt.Hour + ":" + dt.Minute + ":" + dt.Second);
    System.Threading.Thread.Sleep(2000);
}

Okay, so it's not too exciting, until you realize that what it calls - an I2C driver - is written in C# as well.  Yes, I've achieved a managed code driver.  Next question - what's it run on?  I'll give you a hint - it's not a Pocket PC.

2/2/2005 10:33:41 PM (Eastern Standard Time, UTC-05:00)  #    Comments [4]  |