pwm2ch Library  v0.50
Use one or more cogs to send one or multiple PWM signals. Each cog can send up to 2.
Data Structures | Typedefs | Functions
pwm2ch.h File Reference

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.

Data Structures

struct  pwm2ch_st
 

Typedefs

typedef struct pwm2ch_st pwm2ch_t
 
typedef pwm2ch_t pwm2ch
 

Functions

pwm2chpwm2ch_start (unsigned int cycleMicroseconds)
 Start PWM process in another cog. More...
 
void pwm2ch_set (pwm2ch *device, int pin, int channel, int tHigh)
 Set a PWM signal's high time. More...
 
void pwm2ch_stop (pwm2ch *device)
 Shut down pwm2ch process and reclaim cog and I/O pins for other uses. More...
 

Detailed Description

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
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.

Function Documentation

◆ pwm2ch_set()

void pwm2ch_set ( pwm2ch device,
int  pin,
int  channel,
int  tHigh 
)

Set a PWM signal's high time.

Parameters
*deviceThe pwm2ch pointer/process ID returned by pwm2ch_start.
pinThe pin to send the PWM signal.
channel0 or 1.
dacValFor 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
cycleMicrosecondsThe 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
*deviceThe pwm2ch pointer/process ID returned by pwm2ch_start.