X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/12abb59b19f09c83647b1b4a6f509de5b0f6cc0e..9cad677ebbd2fc4ea069f98335f8467b16dbb2cb:/Projects/LEDNotifier/LEDNotifier.c diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c index c44ca58da..5b5390024 100644 --- a/Projects/LEDNotifier/LEDNotifier.c +++ b/Projects/LEDNotifier/LEDNotifier.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -78,7 +78,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK) { uint8_t LEDMask = LEDS_ALL_LEDS; - if (++SoftPWM_Count == 0x1F) + if (++SoftPWM_Count == 0b00011111) SoftPWM_Count = 0; if (SoftPWM_Count >= SoftPWM_Channel1_Duty) @@ -107,13 +107,15 @@ int main(void) /* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */ CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream); + + sei(); for (;;) { /* Read in next LED colour command from the host */ uint8_t ColorUpdate = fgetc(&USBSerialStream); - /* Top 3 bits select the LED, bottom three control the brightness */ + /* Top 3 bits select the LED, bottom 5 control the brightness */ uint8_t Channel = (ColorUpdate & 0b11100000); uint8_t Duty = (ColorUpdate & 0b00011111); @@ -122,7 +124,7 @@ int main(void) if (Channel & (1 << 6)) SoftPWM_Channel2_Duty = Duty; - + if (Channel & (1 << 7)) SoftPWM_Channel3_Duty = Duty;