/// <summary>
        /// Restarts the device with additional options specified, then updates all properties.
        /// </summary>
        /// <param name="options">
        /// Optional mode 1 parameters to add to the final restart sequence. A logical OR is applied to this value and
        /// the standard <see cref="NxpPca9685Mode1Bits.Restart"/>, <see cref="NxpPca9685Mode1Bits.ExternalClock"/> and
        /// <see cref="NxpPca9685Mode1Bits.AutoIncrement"/> bits.
        /// </param>
        public virtual void Restart(NxpPca9685Mode1Bits options)
        {
            // Configure according to external clock presence
            var externalClock = ClockIsExternal;
            var delay         = TimeSpan.FromTicks(Convert.ToInt64(Math.Round(TimeSpan.TicksPerMillisecond * 0.5)));

            // Send I2C restart sequence...

            // Write first sleep
            var sleep = (byte)NxpPca9685Mode1Bits.Sleep;

            Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, sleep);

            // Write sleep again with external clock option (when present)
            if (externalClock)
            {
                sleep |= (byte)(NxpPca9685Mode1Bits.ExternalClock);
                Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, sleep);
            }
            else
            {
                // At least 500 nanoseconds sleep required using internal clock
                Task.Delay(delay).Wait();
            }

            // Write reset with external clock option and any additional options
            var restart = (byte)(NxpPca9685Mode1Bits.Restart | NxpPca9685Mode1Bits.AutoIncrement);

            if (externalClock)
            {
                restart |= (byte)NxpPca9685Mode1Bits.ExternalClock;
            }
            restart |= (byte)options;
            Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, restart);

            // At least 500 nanoseconds delay to allow oscillator to start
            Task.Delay(delay).Wait();

            // Update all properties
            ReadAll();
        }
 /// <summary>
 /// Restarts the device with additional options specified, then updates all properties.
 /// </summary>
 /// <param name="options">
 /// Optional mode 1 parameters to add to the final restart sequence. A logical OR is applied to this value and
 /// the standard <see cref="NxpPca9685Mode1Bits.Restart"/>, <see cref="NxpPca9685Mode1Bits.ExternalClock"/>,
 /// <see cref="NxpPca9685Mode1Bits.AutoIncrement"/> and <see cref="NxpPca9685Mode1Bits.AllCall"/> bits.
 /// </param>
 public override void Restart(NxpPca9685Mode1Bits options)
 {
     base.Restart(options | NxpPca9685Mode1Bits.AllCall);
 }
 /// <summary>
 /// Restarts the device with additional options specified, then updates all properties.
 /// </summary>
 /// <param name="options">
 /// Optional mode 1 parameters to add to the final restart sequence. A logical OR is applied to this value and
 /// the standard <see cref="NxpPca9685Mode1Bits.Restart"/>, <see cref="NxpPca9685Mode1Bits.ExternalClock"/>,
 /// <see cref="NxpPca9685Mode1Bits.AutoIncrement"/> and <see cref="NxpPca9685Mode1Bits.AllCall"/> bits.
 /// </param>
 public override void Restart(NxpPca9685Mode1Bits options)
 {
     base.Restart(options | NxpPca9685Mode1Bits.AllCall);
 }
        /// <summary>
        /// Restarts the device with additional options specified, then updates all properties.
        /// </summary>
        /// <param name="options">
        /// Optional mode 1 parameters to add to the final restart sequence. A logical OR is applied to this value and
        /// the standard <see cref="NxpPca9685Mode1Bits.Restart"/>, <see cref="NxpPca9685Mode1Bits.ExternalClock"/> and
        /// <see cref="NxpPca9685Mode1Bits.AutoIncrement"/> bits.
        /// </param>
        public virtual void Restart(NxpPca9685Mode1Bits options)
        {
            // Configure according to external clock presence
            var externalClock = ClockIsExternal;
            var delay = TimeSpan.FromTicks(Convert.ToInt64(Math.Round(TimeSpan.TicksPerMillisecond * 0.5)));

            // Send I2C restart sequence...

            // Write first sleep
            var sleep = (byte)NxpPca9685Mode1Bits.Sleep;
            Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, sleep);

            // Write sleep again with external clock option (when present)
            if (externalClock)
            {
                sleep |= (byte)(NxpPca9685Mode1Bits.ExternalClock);
                Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, sleep);
            }
            else
            {
                // At least 500 nanoseconds sleep required using internal clock
                Task.Delay(delay).Wait();
            }

            // Write reset with external clock option and any additional options
            var restart = (byte)(NxpPca9685Mode1Bits.Restart | NxpPca9685Mode1Bits.AutoIncrement);
            if (externalClock)
                restart |= (byte)NxpPca9685Mode1Bits.ExternalClock;
            restart |= (byte)options;
            Hardware.WriteJoinByte((byte)NxpPca9685Register.Mode1, restart);

            // At least 500 nanoseconds delay to allow oscillator to start
            Task.Delay(delay).Wait();

            // Update all properties
            ReadAll();
        }