Enable systick (10ms) by default and allow modules to be called from systick

Also add VoltageCheck once per sec by default
This commit is contained in:
Stefan `Sec` Zehl 2011-06-13 23:19:18 +02:00
parent 2dfe80221a
commit 93a5e2696b
3 changed files with 27 additions and 14 deletions

View File

@ -63,14 +63,11 @@
#include "systick.h"
#ifdef CFG_SDCARD
#include "drivers/fatfs/diskio.h"
volatile uint32_t fatTicks = 0;
#endif
volatile uint32_t systickTicks = 0; // 1ms tick counter
volatile uint32_t systickRollovers = 0;
void tick_wrapper(void);
/**************************************************************************/
/*!
@brief Systick interrupt handler
@ -83,14 +80,7 @@ void SysTick_Handler (void)
// Increment rollover counter
if (systickTicks == 0xFFFFFFFF) systickRollovers++;
#ifdef CFG_SDCARD
fatTicks++;
if (fatTicks == 10)
{
fatTicks = 0;
disk_timerproc();
}
#endif
tick_wrapper();
}
/**************************************************************************/

View File

@ -3,5 +3,18 @@
/**************************************************************************/
void module_default(void) {
systickInit(10);
return;
}
};
// every 10 ms
void tick_default(void) {
static int ctr;
ctr++;
if(ctr>100){
VoltageCheck();
ctr=0;
};
return;
};

View File

@ -3,6 +3,7 @@
for a in $* ; do
base=${a%.o}
echo "void module_$base(void);"
echo "void tick_$base(void);"
done
echo
@ -14,3 +15,12 @@ for a in $* ; do
done
echo "}"
echo "void tick_wrapper(void){"
for a in $* ; do
base=${a%.o}
grep -q \ tick_$base ${base}.c && echo "tick_$base();"
done
echo "}"