#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include "usbdrv.h"
#include "oddebug.h"
#include "pwm_channels.h"
#include "usbledfader.h"
#include "channels.h"
Go to the source code of this file.
Functions | |
void | fade_startWaveform (uint8_t ledId, uint8_t waveId, uint8_t waveformId, uint8_t periodDuration, uint8_t repetitionCount) |
Start displaying a certain waveform on a single LED. | |
void | fade_globalData_init (void) |
Fills fade_globalData. | |
uchar | usbFunctionRead (uchar *data, uchar len) |
USB-Data-Handler (device -> host). | |
uchar | usbFunctionWrite (uchar *data, uchar len) |
USB-Data-Handler (host -> device). | |
uchar | usbFunctionSetup (uchar data[8]) |
USB-Setup-Handler. | |
int | main (void) |
Main-function. |
Definition in file main.c.
void fade_globalData_init | ( | void | ) |
Fills fade_globalData.
The state of all LEDs is initialized to off. One signal is displayed on all LEDs to ensure they're working.
Definition at line 134 of file main.c.
References fade_calculateWaveform(), fade_startWaveform(), S_fade_GlobalData::led, S_fade_LedState::wave, S_fade_LedState::waveCurrentId, S_fade_LedState::waveCurrentPosition, S_fade_LedState::waveCurrentRepetition, S_fade_Waveform::waveformDuration, S_fade_Waveform::waveformId, S_fade_Waveform::waveformLength, S_fade_Waveform::waveformRepetition, S_fade_Waveform::waveformUpdateTime, and S_fade_LedState::waveNextUpdate.
Referenced by main(), and usbFunctionSetup().
void fade_startWaveform | ( | uint8_t | ledId, | |
uint8_t | waveId, | |||
uint8_t | waveformId, | |||
uint8_t | periodDuration, | |||
uint8_t | repetitionCount | |||
) |
Start displaying a certain waveform on a single LED.
ledId | ID of the LED that is changed. | |
waveId | ID of the wave that to be set: 0 and 1 are the base waves, 2 is the override wave. | |
waveformId | ID of the Waveform that is to be assigned to the LED. | |
periodDuration | How long should this wave stay on display? Time in seconds/10. | |
repetitionCount | How many times should this wave be repeated while it is on display? |
Definition at line 99 of file main.c.
References fade_calculateWaveform(), S_fade_GlobalData::led, S_fade_LedState::wave, S_fade_LedState::waveCurrentId, S_fade_LedState::waveCurrentPosition, S_fade_LedState::waveCurrentRepetition, S_fade_Waveform::waveformDuration, S_fade_Waveform::waveformId, S_fade_Waveform::waveformLength, S_fade_Waveform::waveformRepetition, S_fade_Waveform::waveformUpdateTime, and S_fade_LedState::waveNextUpdate.
Referenced by fade_globalData_init(), usbFunctionSetup(), and usbFunctionWrite().
int main | ( | void | ) |
Main-function.
Initializes the hardware and starts the main loop of the application.
Definition at line 247 of file main.c.
References fade_globalData_init(), and pwm_Channels_init().
uchar usbFunctionRead | ( | uchar * | data, | |
uchar | len | |||
) |
USB-Data-Handler (device -> host).
Handles data that is to be sent to the host via USB-Interface. In our case the data contains the current settings for the LEDs. This function is called until the returned length is shorter than the buffer (typically 8 bytes).
data | Buffer for the data. | |
len | Length of the buffer. |
uchar usbFunctionSetup | ( | uchar | data[8] | ) |
USB-Setup-Handler.
Handles setup-calls that are received from the USB-Interface.
data | Eight bytes of data. |
Definition at line 203 of file main.c.
References CMD_CLEAR, CMD_ECHO, CMD_GET, CMD_RESET, CMD_SET, fade_globalData_init(), fade_startWaveform(), msgErr, and msgOK.
uchar usbFunctionWrite | ( | uchar * | data, | |
uchar | len | |||
) |
USB-Data-Handler (host -> device).
Handles data that is received from the USB-Interface. In our case the data contains settings for the LEDs.
data | The received data, up to 8 bytes. | |
len | Length of the received data. |
Definition at line 184 of file main.c.
References fade_startWaveform().