#include <stdlib.h>
#include "pwm_channels.h"
#include "pwm_timer.h"
#include "config_pwm_timer_impl.h"
#include "message_queue.h"
Go to the source code of this file.
Data Structures | |
struct | S_pwm_Channels_ChannelBrightness |
Structure to contain the state of one channel. More... | |
Typedefs | |
typedef S_pwm_Channels_ChannelBrightness | pwm_Channels_ChannelBrightness |
Structure to contain the state of one channel. | |
Functions | |
void | pwm_Channels_init (void) |
Initialize channels. | |
void | pwm_Channels_cleanup (void) |
Clean up channels. | |
pwm_Timer_Cycles | pwm_Channels_BrightnessToCycles (pwm_Channels_Brightness brightness) |
Calculate number of cycles from a brightness. | |
int | pwm_Channels_CompareChannels (const void *cmp1, const void *cmp2) |
Compare the number of cycles in two channels. | |
void | pwm_Channels_show (pwm_Channels channels) |
Writes the current pattern to the message-queue. |
Definition in file pwm_channels.c.
typedef struct S_pwm_Channels_ChannelBrightness pwm_Channels_ChannelBrightness |
Structure to contain the state of one channel.
pwm_Timer_Cycles pwm_Channels_BrightnessToCycles | ( | pwm_Channels_Brightness | brightness | ) |
Calculate number of cycles from a brightness.
brightness | The brightness. |
Definition at line 81 of file pwm_channels.c.
Referenced by pwm_Channels_show().
void pwm_Channels_cleanup | ( | void | ) |
Clean up channels.
Basically, the PWM-timer gets cleaned.
Definition at line 33 of file pwm_channels.c.
References pwm_Timer_cleanup().
int pwm_Channels_CompareChannels | ( | const void * | cmp1, | |
const void * | cmp2 | |||
) |
Compare the number of cycles in two channels.
This is needed for the qsort-call in pwm_Channels_show().
cmp1 | First channel. | |
cmp2 | Second channel. |
Definition at line 93 of file pwm_channels.c.
Referenced by pwm_Channels_show().
void pwm_Channels_init | ( | void | ) |
Initialize channels.
Basically, only the PWM-timer is started.
Definition at line 26 of file pwm_channels.c.
References pwm_Timer_init().
Referenced by main().
void pwm_Channels_show | ( | pwm_Channels | channels | ) |
Writes the current pattern to the message-queue.
The pattern is built from the state of all channels.
channels | Array with the channel-states. |
Definition at line 102 of file pwm_channels.c.
References S_pwm_Channels::channel, S_pwm_Channels_ChannelBrightness::cycle, messageQueue_write(), pwm_Channels_BrightnessToCycles(), pwm_Channels_CompareChannels(), and pwm_Timer_idle().