// Note: A constructor summary is auto-generated by the doc builder. /// <summary> /// </summary> /// <remarks>This automatically checks that the socket supports Type P, and reserves the pin. /// An exception will be thrown if there is a problem with these checks.</remarks> /// <param name="socket">The socket that supports pulse width modulation (PWM) output.</param> /// <param name="pin">The pin on the socket that supports PWM.</param> /// <param name="invert">Whether to invert the output voltage.</param> /// <param name="module">The module using this PWM output interface, which can be null if unspecified.</param> public PWMOutput(Socket socket, Socket.Pin pin, bool invert, Module module) { socket.EnsureTypeIsSupported('P', module); socket.ReservePin(pin, module); Cpu.PWMChannel channel = Cpu.PWMChannel.PWM_NONE; switch (pin) { case Socket.Pin.Seven: channel = socket.PWM7; break; case Socket.Pin.Eight: channel = socket.PWM8; break; case Socket.Pin.Nine: channel = socket.PWM9; break; } if (channel == Cpu.PWMChannel.PWM_NONE && socket.PwmOutputIndirector != null) { Interface = socket.PwmOutputIndirector(socket, pin, invert, module); } else { Interface = new NativePwmOutput(socket, pin, invert, module, channel); } }
// Note: A constructor summary is auto-generated by the doc builder. /// <summary> /// </summary> /// <remarks>This automatically checks that the socket supports Type P, and reserves the pin. /// An exception will be thrown if there is a problem with these checks.</remarks> /// <param name="socket">The socket that supports pulse width modulation (PWM) output.</param> /// <param name="pin">The pin on the socket that supports PWM.</param> /// <param name="invert">Whether to invert the output voltage.</param> /// <param name="module">The module using this PWM output interface, which can be null if unspecified.</param> public PWMOutput(Socket socket, Socket.Pin pin, bool invert, Module module) { socket.EnsureTypeIsSupported('P', module); socket.ReservePin(pin, module); Cpu.PWMChannel channel = Cpu.PWMChannel.PWM_NONE; switch (pin) { case Socket.Pin.Seven: channel = socket.PWM7; break; case Socket.Pin.Eight: channel = socket.PWM8; break; case Socket.Pin.Nine: channel = socket.PWM9; break; } if (channel == Cpu.PWMChannel.PWM_NONE && socket.PwmOutputIndirector != null) Interface = socket.PwmOutputIndirector(socket, pin, invert, module); else Interface = new NativePwmOutput(socket, pin, invert, module, channel); }