Make our systick interval a #define

This commit is contained in:
Stefan `Sec` Zehl 2011-07-27 00:25:24 +02:00
parent 139e61f827
commit 2da811bf61
3 changed files with 12 additions and 8 deletions

View File

@ -95,7 +95,7 @@ int lcdInitConfig(){
void main_default(void) { void main_default(void) {
systickInit(10); systickInit(SYSTICKSPEED);
if(getInputRaw()==BTN_ENTER){ if(getInputRaw()==BTN_ENTER){
ISPandReset(); ISPandReset();
@ -118,7 +118,7 @@ void tick_default(void) {
static int ctr; static int ctr;
ctr++; ctr++;
incTimer(); incTimer();
if(ctr>100){ if(ctr>1000/SYSTICKSPEED){
if(!adcMutex){ if(!adcMutex){
VoltageCheck(); VoltageCheck();
LightCheck(); LightCheck();
@ -133,7 +133,7 @@ void tick_default(void) {
else else
backlightSetBrightness(0); backlightSetBrightness(0);
if(ctr%5==0){ if(ctr%(50/SYSTICKSPEED)==0){
if(GetVoltage()<3600 if(GetVoltage()<3600
#ifdef SAFE #ifdef SAFE
@ -142,7 +142,7 @@ void tick_default(void) {
){ ){
IOCON_PIO1_11 = 0x0; IOCON_PIO1_11 = 0x0;
gpioSetDir(RB_LED3, gpioDirection_Output); gpioSetDir(RB_LED3, gpioDirection_Output);
if( (ctr/5)%10 == 1 ) if( (ctr/(50/SYSTICKSPEED))%10 == 1 )
gpioSetValue (RB_LED3, 1); gpioSetValue (RB_LED3, 1);
else else
gpioSetValue (RB_LED3, 0); gpioSetValue (RB_LED3, 0);
@ -151,3 +151,4 @@ void tick_default(void) {
return; return;
}; };

View File

@ -182,5 +182,7 @@ void handleMenu(const struct MENU *the_menu);
#include "basic/idle.h" #include "basic/idle.h"
#define SYSTICKSPEED 10
#endif #endif

View File

@ -22,7 +22,7 @@ void work_queue(void){
#ifdef __arm__ #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else #else
delayms(10); delayms(SYSTICKSPEED);
#endif #endif
return; return;
}; };
@ -36,13 +36,13 @@ void work_queue(void){
}; };
void delayms_queue(uint32_t ms){ void delayms_queue(uint32_t ms){
int end=_timectr+ms/10; int end=_timectr+ms/SYSTICKSPEED;
do { do {
if (the_queue.qstart == the_queue.qend){ if (the_queue.qstart == the_queue.qend){
#ifdef __arm__ #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else #else
delayms(10); delayms(SYSTICKSPEED);
#endif #endif
}else{ }else{
work_queue(); work_queue();
@ -51,12 +51,13 @@ void delayms_queue(uint32_t ms){
}; };
void delayms_power(uint32_t ms){ void delayms_power(uint32_t ms){
ms/=SYSTICKSPEED;
ms+=_timectr; ms+=_timectr;
do { do {
#ifdef __arm__ #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else #else
delayms(10); delayms(SYSTICKSPEED);
#endif #endif
} while (ms >_timectr); } while (ms >_timectr);
}; };