Example #1
0
        /// <summary>
        /// This command switches the default 63 multiplex mode to any multiplex ratio, ranging from 15 to 127.
        /// The output pads COM0-COM127 will be switched to the corresponding COM signal.
        /// </summary>
        /// <param name="multiplexRatio">Multiplex ratio with a range of 15-127. (defaults to 127)</param>
        public void SetMultiplexRatio(byte multiplexRatio = 127)
        {
            if (!Ssd1351.InRange(multiplexRatio, 0x0F, 0x7F))
            {
                throw new ArgumentException("The multiplex ratio is invalid.", nameof(multiplexRatio));
            }

            SendCommand(Ssd1351Command.SetMultiplexorRatio, multiplexRatio);
        }
Example #2
0
        /// <summary>
        /// This double byte command is used to set the pre-charge voltage level. The precharge
        /// voltage level ranges from 0.20 x Vcc -> 0.60 x Vcc.
        /// </summary>
        /// <param name="prechargeLevel">Pre-charge voltage level with a range of 0-31 that represents 0.20 x Vcc -> 0.60 x Vcc. (defaults to 0.38 x Vcc)</param>
        public void SetPreChargeVoltageLevel(byte prechargeLevel = 0x17)
        {
            if (!Ssd1351.InRange(prechargeLevel, 0x00, 0x1F))
            {
                throw new ArgumentException("The pre-charge voltage level is invalid.", nameof(prechargeLevel));
            }

            SendCommand(Ssd1351Command.SetPrechargeVoltageLevel, prechargeLevel);
        }
Example #3
0
        /// <summary>
        /// This double byte command is to control the segment output current by a scaling factor.
        /// The chip has 16 master control steps, with the factor ranges from 1 [0000b] to 16
        /// [1111b – default]. The smaller the master current value, the dimmer the OLED panel
        /// display is set.   For example, if original segment output current is 160uA at
        /// scale factor = 16, setting scale factor to 8 would reduce the current to 80uA
        /// </summary>
        /// <param name="masterContrast">Master Contrast 0 -> 15.(defaults to 15)</param>
        public void SetMasterContrast(byte masterContrast = 0x0F)
        {
            if (!Ssd1351.InRange(masterContrast, 0x00, 0x0F))
            {
                throw new ArgumentException("The master contrast is invalid.", nameof(masterContrast));
            }

            SendCommand(Ssd1351Command.SetContrastMasterCurrent, masterContrast);
        }
Example #4
0
        /// <summary>
        /// This double byte command is used to set the phase 3 second pre-charge period.  The period of phase 3 is ranged from 1 to 15 DCLK's.
        /// </summary>
        /// <param name="phase3Period">Phase 3 period with a range of 1-15. (defaults to 8 DCLKs)</param>
        public void Set3rdPreChargePeriod(byte phase3Period = 0x08)
        {
            if (!Ssd1351.InRange(phase3Period, 0x01, 0x0F))
            {
                throw new ArgumentException("The phase 3 period is invalid.", nameof(phase3Period));
            }

            SendCommand(Ssd1351Command.SetPrecharge2, phase3Period);
        }
Example #5
0
        /// <summary>
        /// This double byte command sets the length of phase 1 and 2 of segment waveform of the driver.
        /// Phase 1: Set the period from 5 to 31 in the unit of 2 DCLKs.  A larger capacitance of the
        /// OLED pixel may require longer period to discharge the previous data charge completely.
        /// Phase 2 (A[7:4]): Set the period from 3 to 15 in the unit of DCLKs.  A longer period
        /// is needed to charge up a larger capacitance of the OLED pixel to the target voltage.
        /// </summary>
        /// <param name="phase1Period">Phase 1 period with a range of 2-15. (defaults to 2 x 2 DCLKs)</param>
        /// <param name="phase2Period">Phase 2 period with a range of 3-15. (defaults to 8 DCLKs)</param>
        public void SetPreChargePeriods(byte phase1Period = 0x02, byte phase2Period = 0x08)
        {
            if (!Ssd1351.InRange(phase1Period, 0x02, 0x0F))
            {
                throw new ArgumentException("The phase 1 period is invalid.", nameof(phase1Period));
            }

            if (!Ssd1351.InRange(phase2Period, 0x03, 0x0F))
            {
                throw new ArgumentException("The phase 2 period is invalid.", nameof(phase2Period));
            }

            SendCommand(Ssd1351Command.SetPrecharge, (byte)((phase2Period << 4) | phase1Period));
        }