borg_hw_lolshield: framerate can be adjusted in the menu, now

This commit is contained in:
Christian Kroll 2014-05-29 10:50:33 +02:00
parent e97eeecc0a
commit 43dac0a8c6
5 changed files with 16 additions and 4 deletions

View File

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
# #
USER_TIMER0_FOR_WAIT=1 USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127 BRIGHTNESS=127
FRAMERATE=80
# #
# Features # Features

View File

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
# #
USER_TIMER0_FOR_WAIT=1 USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127 BRIGHTNESS=127
FRAMERATE=80
# #
# Features # Features

View File

@ -21,6 +21,7 @@ BORG_HW=HW_LOLSHIELD
# #
USER_TIMER0_FOR_WAIT=1 USER_TIMER0_FOR_WAIT=1
BRIGHTNESS=127 BRIGHTNESS=127
FRAMERATE=80
# #
# Features # Features

View File

@ -47,11 +47,19 @@
// buffer which holds the currently shown frame // buffer which holds the currently shown frame
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES]; unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
/* adjust frame rate at the menuconfig, this is just a fallback */
#ifndef FRAMERATE
# define FRAMERATE 80
#elif FRAMERATE < 1
# error FRAMERATE must be greater than 0
#endif
// Number of ticks of the prescaled timer per cycle per frame, based on the // Number of ticks of the prescaled timer per cycle per frame, based on the
// CPU clock speed and the desired frame rate. // CPU clock speed and the desired frame rate.
#define FRAMERATE 80UL #define TICKS (F_CPU + 6ul * (FRAMERATE << SLOWSCALERSHIFT)) / \
#define TICKS (F_CPU + 6 * (FRAMERATE << SLOWSCALERSHIFT)) / (12 * (FRAMERATE << SLOWSCALERSHIFT)) (12ul * (FRAMERATE << SLOWSCALERSHIFT))
#define CUTOFF(scaler) ((128 * 12 - 6) * FRAMERATE * scaler) #define CUTOFF(scaler) ((128ul * 12 - 6) * FRAMERATE * scaler##ul)
#if defined (__AVR_ATmega8__) || \ #if defined (__AVR_ATmega8__) || \
defined (__AVR_ATmega48__) || \ defined (__AVR_ATmega48__) || \

View File

@ -4,5 +4,6 @@ comment "lolshield setup"
define_int USER_TIMER0_FOR_WAIT 1 define_int USER_TIMER0_FOR_WAIT 1
uint "Brightness (0-127)" BRIGHTNESS 127 uint "Brightness (0-127)" BRIGHTNESS 127
uint "Framerate (default 80)" FRAMERATE 80
endmenu endmenu