CRpi
A library for rpi with intefaces to: gpio, pwm, dma
pwmByDma.h
Go to the documentation of this file.
1 #ifndef PWM_BY_DMA_H
2 #define PWM_BY_DMA_H
3 
4 
5 
20 int pwmDma_init(unsigned int pulseDuration_us);
21 
22 unsigned int pwmDma_get_pulseDuration_us();
23 
24 int pwmDma_isChannelInitialized(int channel);
25 
26 int pwmDma_getChannelPeriodUs(int channel);
27 
28 int pwmDma_initChannel_periodInPulses(int channel, unsigned int pulsesPerPeriod);
29 
30 int pwmDma_initChannel(int channel, unsigned int period_us);
31 
32 int pwmDma_freeChannel(int channel);
33 
34 int pwmDma_startChannel(int channel);
35 
36 int pwmDma_stopChannelWaitCycleEnd(int channel);
37 
38 int pwmDma_stopChannel(int channel);
39 
40 int pwmDma_addPulse(int channel, int bcmPort, unsigned int start_us, unsigned int length_us);
41 
42 int pwmDma_printWords(int channel);
43 
44 int pwmDma_printControlBlocks(int channel);
45 
46 int pwmDma_setMSRatio(int channel, int bcmPort, double ratio);
47 
48 int pwmDma_clearPort(int channel, int bcmPort);
49 
50 int pwmDma_addMultiplePulse(int channel, int bcmPort, unsigned int start_us, unsigned int length_us, unsigned int subPeriod_us);
51 
52 
53 
54 
55 #endif
int pwmDma_addMultiplePulse(int channel, int bcmPort, unsigned int start_us, unsigned int length_us, unsigned int subPeriod_us)
Adds multiple pulses to the channel at the specified port. The pulse will be repeated every subPeriod...
Definition: pwmByDma.cpp:631
int pwmDma_init(unsigned int pulseDuration_us)
Initialize: call this before any other function in this file. This sets up the pwm to use it as a tim...
Definition: pwmByDma.cpp:72
unsigned int pwmDma_get_pulseDuration_us()
Returns the duration in microseconds of a single pulse, you can set this duration in pwmDma_init(...
Definition: pwmByDma.cpp:145
int pwmDma_stopChannelWaitCycleEnd(int channel)
Stops channel waiting for the current cycle to finish.
Definition: pwmByDma.cpp:392
int pwmDma_stopChannel(int channel)
Stops channel.
Definition: pwmByDma.cpp:426
int pwmDma_clearPort(int channel, int bcmPort)
Removes any pulse on this port at the specified channel.
Definition: pwmByDma.cpp:519
int pwmDma_freeChannel(int channel)
Frees a channel initialized with pwmDma_initChannel or pwmDma_initChannel_periodInPulses.
Definition: pwmByDma.cpp:344
int pwmDma_isChannelInitialized(int channel)
Tells if a channel is initialized.
Definition: pwmByDma.cpp:157
int pwmDma_getChannelPeriodUs(int channel)
Return the duration in microseconds of a cycle for the specified channel.
Definition: pwmByDma.cpp:173
int pwmDma_printWords(int channel)
For debugging purposes: prints all the set/clear words.
Definition: pwmByDma.cpp:554
int pwmDma_initChannel_periodInPulses(int channel, unsigned int pulsesPerPeriod)
Sets up the channel to output pwm, you can use only a channel at a time.
Definition: pwmByDma.cpp:212
int pwmDma_printControlBlocks(int channel)
For debugging purposes: prints all the control blocks.
Definition: pwmByDma.cpp:581
int pwmDma_startChannel(int channel)
Starts a stopped channel.
Definition: pwmByDma.cpp:371
int pwmDma_initChannel(int channel, unsigned int period_us)
Sets up the channel to output pwm.
Definition: pwmByDma.cpp:329
int pwmDma_addPulse(int channel, int bcmPort, unsigned int start_us, unsigned int length_us)
Sets a pulse on the specified channel and gpio.
Definition: pwmByDma.cpp:450
int pwmDma_setMSRatio(int channel, int bcmPort, double ratio)
Set the port to output a square wave with the specified duty cycle. Will be high for the first ratio*...
Definition: pwmByDma.cpp:609