コード例 #1
0
ファイル: Max7219.cs プロジェクト: Gravicode/TinyCLR.Drivers
        public Max7219(string SpiControllerName, int csPin, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)

        {
            var cs = GHIElectronics.TinyCLR.Devices.Gpio.GpioController.GetDefault().
                     OpenPin(csPin);

            // : this(SpiDevice, device.CreateDigitalOutputPort(csPin), deviceCount, 1, maxMode)
            Setup(SpiControllerName, cs, deviceCount, 1, maxMode);
        }
コード例 #2
0
ファイル: Max7219.cs プロジェクト: zerofeel/Meadow.Foundation
 /// <summary>
 /// Standard initialization routine.
 /// </summary>
 void Initialize(Max7219Type maxMode)
 {
     SetRegister(Register.DecodeMode, (byte)((maxMode == Max7219Type.Character)? 0xFF:0)); // use matrix(0) or digits
     SetRegister(Register.ScanLimit, 7);                                                   //show all 8 digits
     SetRegister(Register.DisplayTest, 0);                                                 // no display test
     SetRegister(Register.ShutDown, 1);                                                    // not shutdown mode
     SetBrightness(4);                                                                     //intensity, range: 0..15
     Clear();
 }
コード例 #3
0
ファイル: Max7219.cs プロジェクト: zerofeel/Meadow.Foundation
 public void SetMode(Max7219Type maxMode)
 {
     SetRegister(Register.DecodeMode, (byte)((maxMode == Max7219Type.Character) ? 0xFF : 0)); // use matrix(0) or digits
 }
コード例 #4
0
ファイル: Max7219.cs プロジェクト: zerofeel/Meadow.Foundation
 public Max7219(IIODevice device, ISpiBus spiBus, IPin csPin, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)
     : this(spiBus, device.CreateDigitalOutputPort(csPin), deviceCount, 1, maxMode)
 {
 }
コード例 #5
0
ファイル: Max7219.cs プロジェクト: zerofeel/Meadow.Foundation
        public Max7219(ISpiBus spiBus, IDigitalOutputPort csPort, int deviceRows, int deviceColumns, Max7219Type maxMode = Max7219Type.Display)
        {
            spi            = (SpiBus)spiBus;
            chipSelectPort = csPort;

            max7219 = new SpiPeripheral(spiBus, csPort);

            DeviceRows    = deviceRows;
            DeviceColumns = deviceColumns;

            _buffer      = new byte[DeviceCount, NumDigits];
            _writeBuffer = new byte[2 * DeviceCount];
            _readBuffer  = new byte[2 * DeviceCount];

            Initialize(maxMode);
        }
コード例 #6
0
ファイル: Max7219.cs プロジェクト: zerofeel/Meadow.Foundation
 public Max7219(ISpiBus spiBus, IDigitalOutputPort csPort, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)
     : this(spiBus, csPort, 8, 1, maxMode)
 {
 }
コード例 #7
0
ファイル: Max7219.cs プロジェクト: Gravicode/TinyCLR.Drivers
        void Setup(string SpiControllerName, GpioPin csPort, int deviceRows, int deviceColumns, Max7219Type maxMode = Max7219Type.Display)
        {
            var settings = new SpiConnectionSettings()
            {
                ChipSelectType = SpiChipSelectType.Gpio,
                ChipSelectLine = csPort,
                Mode           = SpiMode.Mode1,
                ClockFrequency = 4_000_000,
            };

            var controller = SpiController.FromName(SpiControllerName);

            max7219        = controller.GetDevice(settings);
            chipSelectPort = csPort;

            DeviceRows    = deviceRows;
            DeviceColumns = deviceColumns;

            _buffer      = new byte[DeviceCount, NumDigits];
            _writeBuffer = new byte[2 * DeviceCount];
            _readBuffer  = new byte[2 * DeviceCount];

            Initialize(maxMode);
        }
コード例 #8
0
ファイル: Max7219.cs プロジェクト: Gravicode/TinyCLR.Drivers
 public Max7219(string SpiControllerName, GpioPin csPort, int deviceRows, int deviceColumns, Max7219Type maxMode = Max7219Type.Display)
 {
     Setup(SpiControllerName, csPort, deviceRows, deviceColumns, maxMode);
 }
コード例 #9
0
ファイル: Max7219.cs プロジェクト: Gravicode/TinyCLR.Drivers
 public Max7219(string SpiControllerName, GpioPin csPort, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)
     : this(SpiControllerName, csPort, 8, 1, maxMode)
 {
 }
コード例 #10
0
        public Max7219(ISpiBus spiBus, IDigitalOutputPort csPort, int deviceCount = 1, Max7219Type maxMode = Max7219Type.Display)
        {
            max7219 = new SpiPeripheral(spiBus, csPort);

            DeviceCount = deviceCount;

            _buffer      = new byte[DeviceCount, NumDigits];
            _writeBuffer = new byte[2 * DeviceCount];

            Initialize(maxMode);
        }