/// <summary> Prepares the given PWM ports for use. Should only be called from BeagleBone.Initialize(). </summary> static internal void Initialize(bool En0, bool En1, bool En2) { // A1 A2 B1 B2 if (En0) { PWMDevice0 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P9_22, BBBPin.P9_31 }, new BBBPin[] { BBBPin.P9_21, BBBPin.P9_29 }); } if (En1) { PWMDevice1 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P9_14, BBBPin.P8_36 }, new BBBPin[] { BBBPin.P9_16, BBBPin.P8_34 }); } if (En2) { PWMDevice2 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P8_19, BBBPin.P8_45 }, new BBBPin[] { BBBPin.P8_13, BBBPin.P8_46 }); } }
/// <summary> Prepares the given PWM ports for use. Should only be called from <see cref="BeagleBone.Initialize(SystemMode, bool)"/>. </summary> /// <param name="EnableBuses"> Whether to enable each of the PWM devices. </param> internal static void Initialize(bool[] EnableBuses) { if (EnableBuses == null || EnableBuses.Length != 3) { throw new Exception("Invalid enable array given to PWMBBB.Initialize."); } //// A1 A2 B1 B2 if (EnableBuses[0]) { PWMDevice0 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P9_22, BBBPin.P9_31 }, new BBBPin[] { BBBPin.P9_21, BBBPin.P9_29 }); } if (EnableBuses[1]) { PWMDevice1 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P9_14, BBBPin.P8_36 }, new BBBPin[] { BBBPin.P9_16, BBBPin.P8_34 }); } if (EnableBuses[2]) { PWMDevice2 = new PWMDeviceBBB(new BBBPin[] { BBBPin.P8_19, BBBPin.P8_45 }, new BBBPin[] { BBBPin.P8_13, BBBPin.P8_46 }); } }
/// <summary> This should only be initialized from <see cref="PWMDeviceBBB"/>. </summary> /// <param name="Pins"> The two pins that correspond to this output channel. </param> /// <param name="Parent"> The PWM device that this output belongs to. </param> internal PWMOutputBBB(BBBPin[] Pins, PWMDeviceBBB Parent) { this.Pins = Pins; this.Parent = Parent; Initialize(); }