Skip to content

Commit

Permalink
fix "Interrupt requested" & Add Basic Power Consumption Adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
Repeerc committed Aug 17, 2022
1 parent 93892e1 commit 3a3a353
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
8 changes: 4 additions & 4 deletions OSLoader/HAL/Hardware/stmp_clkctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void setHCLKDivider(uint32_t div)

void setCPUDivider(uint32_t div)
{
uint32_t val = BF_RD(CLKCTRL_CPU, DIV_CPU);
INFO("CPU old Div:%lu\n", val);
//uint32_t val = BF_RD(CLKCTRL_CPU, DIV_CPU);
//INFO("CPU old Div:%lu\n", val);
if (!div) {
return;
}
Expand All @@ -38,7 +38,7 @@ void setCPUDivider(uint32_t div)
//while (BF_RD(CLKCTRL_CPU, BUSY_REF_CPU));
BF_CLRV(CLKCTRL_CPU, DIV_CPU, BF_RD(CLKCTRL_CPU, DIV_CPU) ^ div);

INFO("CPU new Div:%d\n", BF_RD(CLKCTRL_CPU, DIV_CPU));
//INFO("CPU new Div:%d\n", BF_RD(CLKCTRL_CPU, DIV_CPU));
}

void setCPUFracDivider(uint32_t div) {
Expand Down Expand Up @@ -87,7 +87,7 @@ void portCLKCtrlInit(void) {
setCPU_HFreqDomain(true);

setHCLKDivider(2);
setCPUFracDivider(24);
setCPUFracDivider(27);

enableUSBClock(true);
}
Expand Down
6 changes: 5 additions & 1 deletion OSLoader/HAL/mtd_up.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "SystemConfig.h"
#include "FreeRTOS.h"

#include "board_up.h"

#include "mtd_up.h"
#include "nand.h"
#include "../debug.h"
Expand Down Expand Up @@ -65,6 +67,8 @@ void MTD_Task()

if(xQueueReceive(MTD_Operates_Queue, &curOpa, portMAX_DELAY) == pdTRUE)
{
setCPUDivider(12);

retry_cnt = 5;
retry:

Expand Down Expand Up @@ -242,7 +246,7 @@ void MTD_Task()
}

//xEventGroupSetBits(MTDLockEventGroup , (1 << curOpa.BLock));

setCPUDivider(2);
}

}
Expand Down
4 changes: 2 additions & 2 deletions OSLoader/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,8 @@ static bool transScr = false;
void vMainThread(void *pvParameters) {

// vTaskDelay(pdMS_TO_TICKS(100));
setHCLKDivider(2);
setCPUDivider(1);
setCPUDivider(2);
setHCLKDivider(1);

// portLRADCEnable(1, 7);
// MTD_EraseAllBLock();
Expand Down
7 changes: 7 additions & 0 deletions System/kcasporing_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ int vGL_Initialize() {
return 0;
}

extern volatile bool interrupted ;
extern volatile bool ctrl_c ;

bool vGL_chkEsc()
{
uint32_t keys, key, kpress;
Expand All @@ -365,6 +368,8 @@ bool vGL_chkEsc()
kpress = keys >> 16;
if((key == KEY_ON) && kpress)
{
ctrl_c = true;
interrupted = true;
return true;
}
return false;
Expand All @@ -382,6 +387,8 @@ bool vGL_getkey(int *keyid)
key = keys & 0xFFFF;
kpress = keys >> 16;




}while((last_key == key) && (last_press == kpress));

Expand Down

0 comments on commit 3a3a353

Please sign in to comment.