kopia lustrzana https://github.com/piotr022/UV_K5_playground
early-messenger
rodzic
45df2635e0
commit
76b2764e4e
|
@ -12,6 +12,7 @@ target_link_libraries(${NAME}
|
|||
uv_k5_system
|
||||
lcd
|
||||
keyboard
|
||||
radio
|
||||
)
|
||||
|
||||
target_include_directories(${NAME} PUBLIC
|
||||
|
|
|
@ -3,13 +3,15 @@
|
|||
#include "registers.hpp"
|
||||
#include "uv_k5_display.hpp"
|
||||
#include "messenger.hpp"
|
||||
#include <string.h>
|
||||
#include "radio.hpp"
|
||||
|
||||
Hardware::THardware Hw;
|
||||
const System::TOrgFunctions& Fw = System::OrgFunc_01_26;
|
||||
const System::TOrgData& FwData = System::OrgData_01_26;
|
||||
|
||||
CMessenger<System::OrgFunc_01_26, System::OrgData_01_26> Messenger;
|
||||
Radio::CBK4819<System::OrgFunc_01_26> RadioDriver;
|
||||
CMessenger<System::OrgFunc_01_26, System::OrgData_01_26,
|
||||
RadioDriver> Messenger;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -19,10 +21,6 @@ int main()
|
|||
|
||||
void MultiIrq_Handler(unsigned int u32IrqSource)
|
||||
{
|
||||
unsigned int u32Dummy;
|
||||
System::TCortexM0Stacking* pStackedRegs =
|
||||
(System::TCortexM0Stacking*)(((unsigned int*)&u32Dummy) + 1);
|
||||
|
||||
static bool bFirstInit = false;
|
||||
if(!bFirstInit)
|
||||
{
|
||||
|
@ -31,12 +29,11 @@ void MultiIrq_Handler(unsigned int u32IrqSource)
|
|||
bFirstInit = true;
|
||||
}
|
||||
|
||||
bool bPreventWhileKeypadPolling = pStackedRegs->LR > (unsigned int)Fw.PollKeyboard &&
|
||||
pStackedRegs->PC < (unsigned int)Fw.PollKeyboard + 0x100; // i made a mistake and compared PC and LR, but this works fine xD
|
||||
|
||||
static unsigned int u32StupidCounter = 1;
|
||||
if(u32StupidCounter++ > 200 && !bPreventWhileKeypadPolling)
|
||||
if((!(u32StupidCounter++ % 16) && u32StupidCounter > 200))
|
||||
{
|
||||
Messenger.Handle();
|
||||
}
|
||||
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
}
|
|
@ -2,8 +2,12 @@
|
|||
#include "system.hpp"
|
||||
#include "uv_k5_display.hpp"
|
||||
#include "keyboard.hpp"
|
||||
#include "radio.hpp"
|
||||
#include "t9.hpp"
|
||||
|
||||
template <const System::TOrgFunctions &Fw, const System::TOrgData &FwData>
|
||||
template <const System::TOrgFunctions &Fw,
|
||||
const System::TOrgData &FwData,
|
||||
Radio::CBK4819<Fw> &RadioDriver>
|
||||
class CMessenger
|
||||
{
|
||||
public:
|
||||
|
@ -12,9 +16,7 @@ public:
|
|||
Display(DisplayBuff),
|
||||
Keyboard(*this),
|
||||
bDisplayCleared(true),
|
||||
bEnabled(0)
|
||||
{
|
||||
};
|
||||
bEnabled(0){};
|
||||
|
||||
char T9_table[10][4] = {{' ', '\0', '\0', '\0'}, {'\0', '\0', '\0', '\0'}, {'a', 'b', 'c', '\0'}, {'d', 'e', 'f', '\0'}, {'g', 'h', 'i', '\0'}, {'j', 'k', 'l', '\0'}, {'m', 'n', 'o', '\0'}, {'p', 'q', 'r', 's'}, {'t', 'u', 'v', '\0'}, {'w', 'x', 'y', 'z'}};
|
||||
unsigned char numberOfLettersAssignedToKey[10] = {1, 0, 3, 3, 3, 3, 3, 4, 3, 4};
|
||||
|
|
|
@ -32,9 +32,10 @@ extern "C" void MultiIrq_Handler(unsigned int u32IrqSource)
|
|||
RadioDriver.InterruptHandler();
|
||||
|
||||
static unsigned int u32StupidCounter = 1;
|
||||
if ((!(u32StupidCounter++ % 15) && u32StupidCounter > 200))
|
||||
if ((!(u32StupidCounter++ % 16) && u32StupidCounter > 200))
|
||||
{
|
||||
Spectrum.Handle();
|
||||
}
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
|
||||
System::JumpToOrginalVector(u32IrqSource);
|
||||
}
|
Ładowanie…
Reference in New Issue