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" #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 systickTicks = 0; // 1ms tick counter
volatile uint32_t systickRollovers = 0; volatile uint32_t systickRollovers = 0;
void tick_wrapper(void);
/**************************************************************************/ /**************************************************************************/
/*! /*!
@brief Systick interrupt handler @brief Systick interrupt handler
@ -83,14 +80,7 @@ void SysTick_Handler (void)
// Increment rollover counter // Increment rollover counter
if (systickTicks == 0xFFFFFFFF) systickRollovers++; if (systickTicks == 0xFFFFFFFF) systickRollovers++;
#ifdef CFG_SDCARD tick_wrapper();
fatTicks++;
if (fatTicks == 10)
{
fatTicks = 0;
disk_timerproc();
}
#endif
} }
/**************************************************************************/ /**************************************************************************/

View File

@ -3,5 +3,18 @@
/**************************************************************************/ /**************************************************************************/
void module_default(void) { void module_default(void) {
systickInit(10);
return; 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 for a in $* ; do
base=${a%.o} base=${a%.o}
echo "void module_$base(void);" echo "void module_$base(void);"
echo "void tick_$base(void);"
done done
echo echo
@ -14,3 +15,12 @@ for a in $* ; do
done done
echo "}" echo "}"
echo "void tick_wrapper(void){"
for a in $* ; do
base=${a%.o}
grep -q \ tick_$base ${base}.c && echo "tick_$base();"
done
echo "}"