Functions for up to 2 channels per cog of PWM signals. More than one cog may be launched, so for example, if 5 signals are desired, use 3 cogs for up to 6 channels.  
More...
#include "simpletools.h"
Go to the source code of this file.
Functions for up to 2 channels per cog of PWM signals. More than one cog may be launched, so for example, if 5 signals are desired, use 3 cogs for up to 6 channels. 
- Author
 - Andy Lindsay
 
- Copyright
 - Copyright (C) Parallax, Inc. 2018. All Rights MIT Licensed.
 
- Version
 - 0.5
 
- Help Improve this Library
 - Please submit bug reports, suggestions, and improvements to this code to edito.nosp@m.r@pa.nosp@m.ralla.nosp@m.x.co.nosp@m.m. 
 
 
◆ pwm2ch_set()
      
        
          | void pwm2ch_set  | 
          ( | 
          pwm2ch *  | 
          device,  | 
        
        
           | 
           | 
          int  | 
          pin,  | 
        
        
           | 
           | 
          int  | 
          channel,  | 
        
        
           | 
           | 
          int  | 
          tHigh  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Set a PWM signal's high time. 
- Parameters
 - 
  
    | *device | The pwm2ch pointer/process ID returned by pwm2ch_start. | 
    | pin | The pin to send the PWM signal. | 
    | channel | 0 or 1. | 
    | dacVal | For PWM, use 0 to cycleMicroseconds. To shut down a channel and set the I/O pin to input, use -1.  | 
  
   
 
 
◆ pwm2ch_start()
      
        
          | pwm2ch* pwm2ch_start  | 
          ( | 
          unsigned int  | 
          cycleMicroseconds | ) | 
           | 
        
      
 
Start PWM process in another cog. 
- Parameters
 - 
  
    | cycleMicroseconds | The number of microseconds each cycle lasts. | 
  
   
- Returns
 - *device A pointer that should be stored in a pwm2ch *variable and used as a process ID in other pwm2ch_... function calls. 
 
 
 
◆ pwm2ch_stop()
      
        
          | void pwm2ch_stop  | 
          ( | 
          pwm2ch *  | 
          device | ) | 
           | 
        
      
 
Shut down pwm2ch process and reclaim cog and I/O pins for other uses. 
- Parameters
 - 
  
    | *device | The pwm2ch pointer/process ID returned by pwm2ch_start.  |