Run a high speed pulse width modulation (PWM) class that can output up to two channels of duty cycled PWM at a single frequency.  
 More...
#include <pwm2.h>
 | 
| void  | Start (void) | 
|   | Start a PWM driver in a new cog.  More...
  | 
|   | 
| void  | Stop (void) | 
|   | Stop the PWM driver (if running)  More...
  | 
|   | 
| void  | SetPinX (const int pinX) | 
|   | Set a pin to PWM out on.  More...
  | 
|   | 
| void  | SetPinY (const int pinY) | 
|   | Set a pin to PWM out on.  More...
  | 
|   | 
| void  | SetDutyX (const int percent) | 
|   | Output a square wave with specified duty cycle.  More...
  | 
|   | 
| void  | SetDutyY (const int percent) | 
|   | Output a square wave with specified duty cycle.  More...
  | 
|   | 
| void  | SetFrequency (const int frequency) | 
|   | Set the frequency to output channel X and Y on.  More...
  | 
|   | 
Run a high speed pulse width modulation (PWM) class that can output up to two channels of duty cycled PWM at a single frequency. 
The two channels are channel X and channel Y.
Requires a cog to operate. No external hardware is required beyond whatever you are PWM'ing.
You can use this class to PWM H bridges, LEDs, audio, etc.
- Todo:
 - (SRLM): figure out the maximum frequency (as a function of clock speed)
 
Copyright (c) 2013 Kenneth Bedolla (libpr.nosp@m.opel.nosp@m.ler@k.nosp@m.enne.nosp@m.thbed.nosp@m.olla.nosp@m..com) 
 
  
  
      
        
          | void PWM2::SetDutyX  | 
          ( | 
          const int  | 
          percent) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Output a square wave with specified duty cycle. 
- Parameters
 - 
  
    | percent | The duty [0..100] to PWM. 0 is off, 100 is full on.  | 
  
   
 
 
  
  
      
        
          | void PWM2::SetDutyY  | 
          ( | 
          const int  | 
          percent) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Output a square wave with specified duty cycle. 
You can change this during operation.
- Parameters
 - 
  
    | percent | The duty [0..100] to PWM. 0 is off, 100 is full on.  | 
  
   
 
 
  
  
      
        
          | void PWM2::SetFrequency  | 
          ( | 
          const int  | 
          frequency) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Set the frequency to output channel X and Y on. 
- Todo:
 - (SRLM): SetFrequency doesn't seem to actually change the frequency (at least once the cog is started...)
 
- Parameters
 - 
  
    | frequency | The frequency in Hz, [0..40000??]  | 
  
   
 
 
  
  
      
        
          | void PWM2::SetPinX  | 
          ( | 
          const int  | 
          pinX) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Set a pin to PWM out on. 
You can change this during operation.
- Parameters
 - 
  
    | pinX | The I/O pin [0..31] to set the X channel on.  | 
  
   
 
 
  
  
      
        
          | void PWM2::SetPinY  | 
          ( | 
          const int  | 
          pinY) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Set a pin to PWM out on. 
You can change this during operation.
- Parameters
 - 
  
    | pinY | The I/O pin [0..31] to set the Y channel on.  | 
  
   
 
 
  
  
      
        
          | void PWM2::Start  | 
          ( | 
          void  | 
          ) |  | 
           | 
         
       
   | 
  
inline   | 
  
 
Start a PWM driver in a new cog. 
 
 
Stop the PWM driver (if running) 
 
 
The documentation for this class was generated from the following file: