Beispiel #1
0
        public static void Test()
        {
            DS3232Connection d = new DS3232Connection();
            TimeOscillator t = new TimeOscillator(d);

            bool b = t.Stopped;
        }
Beispiel #2
0
        public SquareOscillator(DS3232Connection d)
        {
            // MASK should be a constant -- how to do this?
            MASK = (byte)(Utility.mask_byte((int)ControlBits.SQW_Freq_Bit_01) | Utility.mask_byte((int)ControlBits.SQW_Freq_Bit_00));

            _ds3232 = d;
            _frequency = GetFrequency();
        }
Beispiel #3
0
        public Thermometer(DS3232Connection d)
        {
            this._ds3232 = d;

            // initialize temp to 0x00
            this._tempMSB = 0x00;
            this._tempLSB = 0x00;
            this._temperature = 0x00;
        }
Beispiel #4
0
        public static void Memory()
        {
            DS3232Connection ds3232 = new DS3232Connection();
            Memory m = new Memory(ds3232);

            // Memory map before
            byte[] dump = m.Dump();

            m.DeleteMemory();

            // Memory map after
            dump = m.Dump();
        }
Beispiel #5
0
 public TimeOscillator(DS3232Connection d)
 {
     this._ds3232 = d;
 }
Beispiel #6
0
        public static void Thermometer()
        {
            DS3232Connection ds3232 = new DS3232Connection();
            Thermometer t = new Thermometer(ds3232);

            while (true)
            {
                Debug.Print(t.Temperature.ToString());
                Thread.Sleep(1000);
                //Thread.Sleep(64000); // Every 64 seconds poll for value
            }
        }
Beispiel #7
0
        public static void SquareWave()
        {
            DS3232Connection ds3232 = new DS3232Connection();
            SquareOscillator sqw = new SquareOscillator(ds3232);

            InputPort i = new InputPort(Pins.GPIO_PIN_D0, false, Port.ResistorMode.PullUp);
            OutputPort o = new OutputPort(Pins.ONBOARD_LED, false);

            sqw.EnableOnBattery();
            sqw.SetFrequency((int)SQWFrequencyCode.SQW_1_Hz);
            sqw.Start();

            int times = 0;

            while (times < 500)
            {
                o.Write(i.Read());
                Thread.Sleep(10);
                times++;
            }

            sqw.Stop();
            sqw.DisableOnBattery();
            o.Write(false);
        }
Beispiel #8
0
 public Memory(DS3232Connection d)
 {
     this._ds3232 = d;
 }
Beispiel #9
0
 public Oscillator32KHz(DS3232Connection d)
 {
     this._ds3232 = d;
 }
Beispiel #10
0
 public Clock(DS3232Connection d)
 {
     this._ds3232 = d;
 }