fixed LED bug, now blinks faster without problems

This commit is contained in:
Georg
2017-11-07 15:15:25 +01:00
parent 28e56ade46
commit 1dc6698915
4 changed files with 16 additions and 2 deletions
+2 -1
View File
@@ -17,11 +17,12 @@ int main(void)
while(1) {
if (SystemTick100ms()) {
LEDTick(); // this has to be the first function called here, since it is time-critical - the functions below may have non-negligible runtimes!
RandomTick();
TerminalTick();
ButtonTick();
LogTick();
LEDTick();
ApplicationTick();
CommandLineTick();
AntennaLevelTick();
+1 -1
View File
@@ -5,7 +5,7 @@
#include "Terminal/CommandLine.h"
#include "System.h"
#define BLINK_PRESCALER 2 /* x LEDTick(); */
#define BLINK_PRESCALER 1 /* x LEDTick(); */
LEDActionEnum LEDGreenAction = LED_NO_ACTION;
LEDActionEnum LEDRedAction = LED_NO_ACTION;
+5
View File
@@ -10,6 +10,7 @@
#include "Common.h"
#include "Settings.h"
#include "LEDHook.h"
#include "System.h"
#define USE_DMA
#define RECV_DMA DMA.CH0
@@ -395,6 +396,8 @@ void MemoryRecall(void)
{
/* Recall memory from permanent flash */
FlashToFRAM((uint32_t) GlobalSettings.ActiveSettingIdx * MEMORY_SIZE_PER_SETTING, MEMORY_SIZE_PER_SETTING);
SystemTickClearFlag();
}
void MemoryStore(void)
@@ -404,6 +407,8 @@ void MemoryStore(void)
LEDHook(LED_MEMORY_CHANGED, LED_OFF);
LEDHook(LED_MEMORY_STORED, LED_PULSE);
SystemTickClearFlag();
}
bool MemoryUploadBlock(void* Buffer, uint32_t BlockAddress, uint16_t ByteCount)
+8
View File
@@ -51,6 +51,14 @@ INLINE bool SystemTick100ms(void)
return false;
}
INLINE void SystemTickClearFlag(void)
{
while(RTC.STATUS & RTC_SYNCBUSY_bm)
;
RTC.INTFLAGS = RTC_COMPIF_bm;
}
INLINE uint16_t SystemGetSysTick(void) {
return SYSTEM_TICK_REGISTER | RTC.CNT;
}