Some more code size optimizations.

This commit is contained in:
Kai Lauterbach 2011-12-09 23:15:06 +01:00
parent 9aca5cf6f9
commit beb8d0c4e2
4 changed files with 25 additions and 47 deletions

View file

@ -1,8 +1,14 @@
/* CTHN.de MiniLEDCube
*
* Kai Lauterbach (klaute at web dot de)
*
* License: General Public License (GPL v3)
*
*/
#define F_CPU 12000000UL
// Bitshifting
#define set_bit(var, bit) ((var) |= (1 << (bit)))
#define clear_bit(var, bit) ((var) &= (unsigned)~(1 << (bit)))
#define sleep_nop(cnt) for (uint8_t i = 0; i < cnt; i++) { asm volatile("nop"::); }

View file

@ -1,10 +1,11 @@
/*
* Based on the code of the Mini-LED-Cube 1.0
/* CTHN.de MiniLEDCube
*
* Copyright (C) 2009 Paul Wilhelm <paul@mosfetkiller.de>
* http: *mosfetkiller.de/?s=miniledcube
* Kai Lauterbach (klaute at web dot de)
*
* Based on http://mosfetkiller.de/?s=miniledcube
*
* License: General Public License (GPL v3)
*
* Changed by Kai Lauterbach (klaute at web dot de)
*/
#include "main.h"
@ -16,41 +17,12 @@ int main(void)
init();
init_usb();
//uint8_t anim = 0;
// Hauptschleife
//while (1)
for (;;)
{
//wdt_reset(); // we are alive, so don't reset the µC
usbPoll(); // keep connected
// hier pause einfügen
//_delay_ms(1); // beispielsweise 50 ms => muss angepasst werden an usb kommunikation
/*anim++;
if (anim >= 0)
{
if (cube == 0xffffffff)
cube = 0x07007007;
else if (cube == 0x07007007)
cube = 0x00000000;
else if (cube == 0x00000000)
cube = 0xffffffff;
anim = 0;
}*/
/*if (anim >= 40)
{
cube += 1;
if (cube > 0x07ffffff)
cube = 0;
anim = 0;
}*/
}
}
@ -86,7 +58,6 @@ void init()
}
// Interruptvektor von TIMER1
//SIGNAL(SIG_OUTPUT_COMPARE1A) // alte schreibweise
ISR (TIMER1_COMPA_vect)
{

View file

@ -1,11 +1,12 @@
// Mini-LED-Cube 1.0
//
// Copyright (C) 2009 Paul Wilhelm <paul@mosfetkiller.de>
// http://mosfetkiller.de/?s=miniledcube
//
// Changed by Kai Lauterbach (klaute at web dot de)
//
// Externes Quarz, CKDIV8 Disabled
/* CTHN.de MiniLEDCube
*
* Kai Lauterbach (klaute at web dot de)
*
* Based on http://mosfetkiller.de/?s=miniledcube
*
* License: General Public License (GPL v3)
*
*/
#ifndef __main_h__
#define __main_h__

View file

@ -30,8 +30,8 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
cube = (cube & (uint32_t)0xffff0000) |
rq->wValue.bytes[0] +
(rq->wValue.bytes[1] << 8);
} else if ( rq->wIndex.bytes[0] == 1 )
{
//} else if ( rq->wIndex.bytes[0] == 1 )
} else {
cube = (cube & (uint32_t)0x0000ffff) |
((uint32_t)(rq->wValue.bytes[0] +
(rq->wValue.bytes[1] << 8)) << 16);