firmware/pwm_channels.c File Reference

Manages the values of the displayed channels. More...

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


Detailed Description

Manages the values of the displayed channels.

Author:
Thomas Stegemann
Version:
Id
pwm_channels.c,v 1.2 2006/09/29 22:30:03 rschaten Exp
License: See documentation.

Definition in file pwm_channels.c.


Typedef Documentation

typedef struct S_pwm_Channels_ChannelBrightness pwm_Channels_ChannelBrightness

Structure to contain the state of one channel.


Function Documentation

pwm_Timer_Cycles pwm_Channels_BrightnessToCycles ( pwm_Channels_Brightness  brightness  ) 

Calculate number of cycles from a brightness.

Parameters:
brightness The brightness.
Returns:
The number of cycles.

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

Parameters:
cmp1 First channel.
cmp2 Second channel.
Returns:
A value <0 if cmp1 is smaller than cmp2, 0 if they are of the same length and a value >0 if cmp1 is larger than cmp2.

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.

Parameters:
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().


Generated on Mon Oct 2 19:31:18 2006 for USB-LED-Fader by  doxygen 1.4.7