From 694fa34315b62651d8be382a6058bb566f75d90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 12 Apr 2019 16:29:20 +0200 Subject: [PATCH] [ion] Keyboard: change keys name to more explicit ones --- apps/apps_container.cpp | 2 +- ion/include/ion/events.h | 248 +++++++++--------- ion/include/ion/keyboard.h | 15 +- .../ion/keyboard/layout_B2/layout_keyboard.h | 20 +- .../ion/keyboard/layout_B3/layout_events.h | 3 +- .../ion/keyboard/layout_B3/layout_keyboard.h | 20 +- ion/src/device/shared/drivers/power.cpp | 4 +- ion/src/device/shared/drivers/wakeup.cpp | 2 +- ion/src/device/shared/usb/calculator.cpp | 2 +- ion/src/simulator/keyboard/fltkkbd.cpp | 2 +- ion/test/events.cpp | 8 +- python/port/port.cpp | 2 +- 12 files changed, 164 insertions(+), 164 deletions(-) diff --git a/apps/apps_container.cpp b/apps/apps_container.cpp index 2c85aa307..6170fafb3 100644 --- a/apps/apps_container.cpp +++ b/apps/apps_container.cpp @@ -91,7 +91,7 @@ AppsContainer::AppsContainer() : bool AppsContainer::poincareCircuitBreaker() { Ion::Keyboard::State state = Ion::Keyboard::scan(); - return state.keyDown(Ion::Keyboard::Key::A6); + return state.keyDown(Ion::Keyboard::Key::Back); } App::Snapshot * AppsContainer::hardwareTestAppSnapshot() { diff --git a/ion/include/ion/events.h b/ion/include/ion/events.h index 868360a41..8d85749ed 100644 --- a/ion/include/ion/events.h +++ b/ion/include/ion/events.h @@ -59,159 +59,161 @@ void updateModifiersFromEvent(Event e); // Plain -constexpr Event Left = Event::PlainKey(Keyboard::Key::A1); -constexpr Event Up = Event::PlainKey(Keyboard::Key::A2); -constexpr Event Down = Event::PlainKey(Keyboard::Key::A3); -constexpr Event Right = Event::PlainKey(Keyboard::Key::A4); -constexpr Event OK = Event::PlainKey(Keyboard::Key::A5); -constexpr Event Back = Event::PlainKey(Keyboard::Key::A6); +constexpr Event Left = Event::PlainKey(Keyboard::Key::Left); +constexpr Event Up = Event::PlainKey(Keyboard::Key::Up); +constexpr Event Down = Event::PlainKey(Keyboard::Key::Down); +constexpr Event Right = Event::PlainKey(Keyboard::Key::Right); +constexpr Event OK = Event::PlainKey(Keyboard::Key::OK); +constexpr Event Back = Event::PlainKey(Keyboard::Key::Back); -constexpr Event Home = Event::PlainKey(Keyboard::Key::B1); -constexpr Event OnOff = Event::PlainKey(Keyboard::PowerKey); +constexpr Event Home = Event::PlainKey(Keyboard::Key::Home); +constexpr Event OnOff = Event::PlainKey(Keyboard::Key::OnOff); -constexpr Event Shift = Event::PlainKey(Keyboard::Key::C1); -constexpr Event Alpha = Event::PlainKey(Keyboard::Key::C2); -constexpr Event XNT = Event::PlainKey(Keyboard::Key::C3); -constexpr Event Var = Event::PlainKey(Keyboard::Key::C4); -constexpr Event Toolbox = Event::PlainKey(Keyboard::Key::C5); -constexpr Event Backspace = Event::PlainKey(Keyboard::Key::C6); +constexpr Event Shift = Event::PlainKey(Keyboard::Key::Shift); +constexpr Event Alpha = Event::PlainKey(Keyboard::Key::Alpha); +constexpr Event XNT = Event::PlainKey(Keyboard::Key::XNT); +constexpr Event Var = Event::PlainKey(Keyboard::Key::Var); +constexpr Event Toolbox = Event::PlainKey(Keyboard::Key::Toolbox); +constexpr Event Backspace = Event::PlainKey(Keyboard::Key::Backspace); -constexpr Event Exp = Event::PlainKey(Keyboard::Key::D1); -constexpr Event Ln = Event::PlainKey(Keyboard::Key::D2); -constexpr Event Log = Event::PlainKey(Keyboard::Key::D3); -constexpr Event Imaginary = Event::PlainKey(Keyboard::Key::D4); -constexpr Event Comma = Event::PlainKey(Keyboard::Key::D5); -constexpr Event Power = Event::PlainKey(Keyboard::Key::D6); +constexpr Event Exp = Event::PlainKey(Keyboard::Key::Exp); +constexpr Event Ln = Event::PlainKey(Keyboard::Key::Ln); +constexpr Event Log = Event::PlainKey(Keyboard::Key::Log); +constexpr Event Imaginary = Event::PlainKey(Keyboard::Key::Imaginary); +constexpr Event Comma = Event::PlainKey(Keyboard::Key::Comma); +constexpr Event Power = Event::PlainKey(Keyboard::Key::Power); -constexpr Event Sine = Event::PlainKey(Keyboard::Key::E1); -constexpr Event Cosine = Event::PlainKey(Keyboard::Key::E2); -constexpr Event Tangent = Event::PlainKey(Keyboard::Key::E3); -constexpr Event Pi = Event::PlainKey(Keyboard::Key::E4); -constexpr Event Sqrt = Event::PlainKey(Keyboard::Key::E5); -constexpr Event Square = Event::PlainKey(Keyboard::Key::E6); +constexpr Event Sine = Event::PlainKey(Keyboard::Key::Sine); +constexpr Event Cosine = Event::PlainKey(Keyboard::Key::Cosine); +constexpr Event Tangent = Event::PlainKey(Keyboard::Key::Tangent); +constexpr Event Pi = Event::PlainKey(Keyboard::Key::Pi); +constexpr Event Sqrt = Event::PlainKey(Keyboard::Key::Sqrt); +constexpr Event Square = Event::PlainKey(Keyboard::Key::Square); -constexpr Event Seven = Event::PlainKey(Keyboard::Key::F1); -constexpr Event Eight = Event::PlainKey(Keyboard::Key::F2); -constexpr Event Nine = Event::PlainKey(Keyboard::Key::F3); -constexpr Event LeftParenthesis = Event::PlainKey(Keyboard::Key::F4); -constexpr Event RightParenthesis = Event::PlainKey(Keyboard::Key::F5); +constexpr Event Seven = Event::PlainKey(Keyboard::Key::Seven); +constexpr Event Eight = Event::PlainKey(Keyboard::Key::Eight); +constexpr Event Nine = Event::PlainKey(Keyboard::Key::Nine); +constexpr Event LeftParenthesis = Event::PlainKey(Keyboard::Key::LeftParenthesis); +constexpr Event RightParenthesis = Event::PlainKey(Keyboard::Key::RightParenthesis); -constexpr Event Four = Event::PlainKey(Keyboard::Key::G1); -constexpr Event Five = Event::PlainKey(Keyboard::Key::G2); -constexpr Event Six = Event::PlainKey(Keyboard::Key::G3); -constexpr Event Multiplication = Event::PlainKey(Keyboard::Key::G4); -constexpr Event Division = Event::PlainKey(Keyboard::Key::G5); +constexpr Event Four = Event::PlainKey(Keyboard::Key::Four); +constexpr Event Five = Event::PlainKey(Keyboard::Key::Five); +constexpr Event Six = Event::PlainKey(Keyboard::Key::Six); +constexpr Event Multiplication = Event::PlainKey(Keyboard::Key::Multiplication); +constexpr Event Division = Event::PlainKey(Keyboard::Key::Division); -constexpr Event One = Event::PlainKey(Keyboard::Key::H1); -constexpr Event Two = Event::PlainKey(Keyboard::Key::H2); -constexpr Event Three = Event::PlainKey(Keyboard::Key::H3); -constexpr Event Plus = Event::PlainKey(Keyboard::Key::H4); -constexpr Event Minus = Event::PlainKey(Keyboard::Key::H5); +constexpr Event One = Event::PlainKey(Keyboard::Key::One); +constexpr Event Two = Event::PlainKey(Keyboard::Key::Two); +constexpr Event Three = Event::PlainKey(Keyboard::Key::Three); +constexpr Event Plus = Event::PlainKey(Keyboard::Key::Plus); +constexpr Event Minus = Event::PlainKey(Keyboard::Key::Minus); -constexpr Event Zero = Event::PlainKey(Keyboard::Key::I1); -constexpr Event Dot = Event::PlainKey(Keyboard::Key::I2); -constexpr Event EE = Event::PlainKey(Keyboard::Key::I3); -constexpr Event Ans = Event::PlainKey(Keyboard::Key::I4); -constexpr Event EXE = Event::PlainKey(Keyboard::Key::I5); +constexpr Event Zero = Event::PlainKey(Keyboard::Key::Zero); +constexpr Event Dot = Event::PlainKey(Keyboard::Key::Dot); +constexpr Event EE = Event::PlainKey(Keyboard::Key::EE); +constexpr Event Ans = Event::PlainKey(Keyboard::Key::Ans); +constexpr Event EXE = Event::PlainKey(Keyboard::Key::EXE); // Shift -constexpr Event ShiftLeft = Event::ShiftKey(Keyboard::Key::A1); -constexpr Event ShiftRight = Event::ShiftKey(Keyboard::Key::A4); +constexpr Event ShiftLeft = Event::ShiftKey(Keyboard::Key::Left); +constexpr Event ShiftRight = Event::ShiftKey(Keyboard::Key::Right); -constexpr Event AlphaLock = Event::ShiftKey(Keyboard::Key::C2); -constexpr Event Cut = Event::ShiftKey(Keyboard::Key::C3); -constexpr Event Copy = Event::ShiftKey(Keyboard::Key::C4); -constexpr Event Paste = Event::ShiftKey(Keyboard::Key::C5); -constexpr Event Clear = Event::ShiftKey(Keyboard::Key::C6); +constexpr Event AlphaLock = Event::ShiftKey(Keyboard::Key::Alpha); +constexpr Event Cut = Event::ShiftKey(Keyboard::Key::XNT); +constexpr Event Copy = Event::ShiftKey(Keyboard::Key::Var); +constexpr Event Paste = Event::ShiftKey(Keyboard::Key::Toolbox); +constexpr Event Clear = Event::ShiftKey(Keyboard::Key::Backspace); -constexpr Event LeftBracket = Event::ShiftKey(Keyboard::Key::D1); -constexpr Event RightBracket = Event::ShiftKey(Keyboard::Key::D2); -constexpr Event LeftBrace = Event::ShiftKey(Keyboard::Key::D3); -constexpr Event RightBrace = Event::ShiftKey(Keyboard::Key::D4); -constexpr Event Underscore = Event::ShiftKey(Keyboard::Key::D5); -constexpr Event Sto = Event::ShiftKey(Keyboard::Key::D6); +constexpr Event LeftBracket = Event::ShiftKey(Keyboard::Key::Exp); +constexpr Event RightBracket = Event::ShiftKey(Keyboard::Key::Ln); +constexpr Event LeftBrace = Event::ShiftKey(Keyboard::Key::Log); +constexpr Event RightBrace = Event::ShiftKey(Keyboard::Key::Imaginary); +constexpr Event Underscore = Event::ShiftKey(Keyboard::Key::Comma); +constexpr Event Sto = Event::ShiftKey(Keyboard::Key::Power); -constexpr Event Arcsine = Event::ShiftKey(Keyboard::Key::E1); -constexpr Event Arccosine = Event::ShiftKey(Keyboard::Key::E2); -constexpr Event Arctangent = Event::ShiftKey(Keyboard::Key::E3); -constexpr Event Equal = Event::ShiftKey(Keyboard::Key::E4); -constexpr Event Lower = Event::ShiftKey(Keyboard::Key::E5); -constexpr Event Greater = Event::ShiftKey(Keyboard::Key::E6); +constexpr Event Arcsine = Event::ShiftKey(Keyboard::Key::Sine); +constexpr Event Arccosine = Event::ShiftKey(Keyboard::Key::Cosine); +constexpr Event Arctangent = Event::ShiftKey(Keyboard::Key::Tangent); +constexpr Event Equal = Event::ShiftKey(Keyboard::Key::Pi); +constexpr Event Lower = Event::ShiftKey(Keyboard::Key::Sqrt); +constexpr Event Greater = Event::ShiftKey(Keyboard::Key::Square); // Alpha -constexpr Event Colon = Event::AlphaKey(Keyboard::Key::C3); -constexpr Event SemiColon = Event::AlphaKey(Keyboard::Key::C4); -constexpr Event DoubleQuotes = Event::AlphaKey(Keyboard::Key::C5); +constexpr Event Colon = Event::AlphaKey(Keyboard::Key::XNT); +constexpr Event SemiColon = Event::AlphaKey(Keyboard::Key::Var); +constexpr Event DoubleQuotes = Event::AlphaKey(Keyboard::Key::Toolbox); -constexpr Event LowerA = Event::AlphaKey(Keyboard::Key::D1); -constexpr Event LowerB = Event::AlphaKey(Keyboard::Key::D2); -constexpr Event LowerC = Event::AlphaKey(Keyboard::Key::D3); -constexpr Event LowerD = Event::AlphaKey(Keyboard::Key::D4); -constexpr Event LowerE = Event::AlphaKey(Keyboard::Key::D5); -constexpr Event LowerF = Event::AlphaKey(Keyboard::Key::D6); +constexpr Event LowerA = Event::AlphaKey(Keyboard::Key::Exp); +constexpr Event LowerB = Event::AlphaKey(Keyboard::Key::Ln); +constexpr Event LowerC = Event::AlphaKey(Keyboard::Key::Log); +constexpr Event LowerD = Event::AlphaKey(Keyboard::Key::Imaginary); +constexpr Event LowerE = Event::AlphaKey(Keyboard::Key::Comma); +constexpr Event LowerF = Event::AlphaKey(Keyboard::Key::Power); -constexpr Event LowerG = Event::AlphaKey(Keyboard::Key::E1); -constexpr Event LowerH = Event::AlphaKey(Keyboard::Key::E2); -constexpr Event LowerI = Event::AlphaKey(Keyboard::Key::E3); -constexpr Event LowerJ = Event::AlphaKey(Keyboard::Key::E4); -constexpr Event LowerK = Event::AlphaKey(Keyboard::Key::E5); -constexpr Event LowerL = Event::AlphaKey(Keyboard::Key::E6); +constexpr Event LowerG = Event::AlphaKey(Keyboard::Key::Sine); +constexpr Event LowerH = Event::AlphaKey(Keyboard::Key::Cosine); +constexpr Event LowerI = Event::AlphaKey(Keyboard::Key::Tangent); +constexpr Event LowerJ = Event::AlphaKey(Keyboard::Key::Pi); +constexpr Event LowerK = Event::AlphaKey(Keyboard::Key::Sqrt); +constexpr Event LowerL = Event::AlphaKey(Keyboard::Key::Square); -constexpr Event LowerM = Event::AlphaKey(Keyboard::Key::F1); -constexpr Event LowerN = Event::AlphaKey(Keyboard::Key::F2); -constexpr Event LowerO = Event::AlphaKey(Keyboard::Key::F3); -constexpr Event LowerP = Event::AlphaKey(Keyboard::Key::F4); -constexpr Event LowerQ = Event::AlphaKey(Keyboard::Key::F5); +constexpr Event LowerM = Event::AlphaKey(Keyboard::Key::Seven); +constexpr Event LowerN = Event::AlphaKey(Keyboard::Key::Eight); +constexpr Event LowerO = Event::AlphaKey(Keyboard::Key::Nine); +constexpr Event LowerP = Event::AlphaKey(Keyboard::Key::LeftParenthesis); +constexpr Event LowerQ = Event::AlphaKey(Keyboard::Key::RightParenthesis); -constexpr Event LowerR = Event::AlphaKey(Keyboard::Key::G1); -constexpr Event LowerS = Event::AlphaKey(Keyboard::Key::G2); -constexpr Event LowerT = Event::AlphaKey(Keyboard::Key::G3); -constexpr Event LowerU = Event::AlphaKey(Keyboard::Key::G4); -constexpr Event LowerV = Event::AlphaKey(Keyboard::Key::G5); +constexpr Event LowerR = Event::AlphaKey(Keyboard::Key::Four); +constexpr Event LowerS = Event::AlphaKey(Keyboard::Key::Five); +constexpr Event LowerT = Event::AlphaKey(Keyboard::Key::Six); +constexpr Event LowerU = Event::AlphaKey(Keyboard::Key::Multiplication); +constexpr Event LowerV = Event::AlphaKey(Keyboard::Key::Division); -constexpr Event LowerW = Event::AlphaKey(Keyboard::Key::H1); -constexpr Event LowerX = Event::AlphaKey(Keyboard::Key::H2); -constexpr Event LowerY = Event::AlphaKey(Keyboard::Key::H3); -constexpr Event LowerZ = Event::AlphaKey(Keyboard::Key::H4); -constexpr Event Space = Event::AlphaKey(Keyboard::Key::H5); +constexpr Event LowerW = Event::AlphaKey(Keyboard::Key::One); +constexpr Event LowerX = Event::AlphaKey(Keyboard::Key::Two); +constexpr Event LowerY = Event::AlphaKey(Keyboard::Key::Three); +constexpr Event LowerZ = Event::AlphaKey(Keyboard::Key::Plus); +constexpr Event Space = Event::AlphaKey(Keyboard::Key::Minus); -constexpr Event Question = Event::AlphaKey(Keyboard::Key::I1); -constexpr Event Exclamation = Event::AlphaKey(Keyboard::Key::I2); +constexpr Event Question = Event::AlphaKey(Keyboard::Key::Zero); +constexpr Event Exclamation = Event::AlphaKey(Keyboard::Key::Dot); // Shift + Alpha -constexpr Event UpperA = Event::ShiftAlphaKey(Keyboard::Key::D1); -constexpr Event UpperB = Event::ShiftAlphaKey(Keyboard::Key::D2); -constexpr Event UpperC = Event::ShiftAlphaKey(Keyboard::Key::D3); -constexpr Event UpperD = Event::ShiftAlphaKey(Keyboard::Key::D4); -constexpr Event UpperE = Event::ShiftAlphaKey(Keyboard::Key::D5); -constexpr Event UpperF = Event::ShiftAlphaKey(Keyboard::Key::D6); +constexpr Event UpperA = Event::ShiftAlphaKey(Keyboard::Key::Exp); +constexpr Event UpperB = Event::ShiftAlphaKey(Keyboard::Key::Ln); +constexpr Event UpperC = Event::ShiftAlphaKey(Keyboard::Key::Log); +constexpr Event UpperD = Event::ShiftAlphaKey(Keyboard::Key::Imaginary); +constexpr Event UpperE = Event::ShiftAlphaKey(Keyboard::Key::Comma); +constexpr Event UpperF = Event::ShiftAlphaKey(Keyboard::Key::Power); -constexpr Event UpperG = Event::ShiftAlphaKey(Keyboard::Key::E1); -constexpr Event UpperH = Event::ShiftAlphaKey(Keyboard::Key::E2); -constexpr Event UpperI = Event::ShiftAlphaKey(Keyboard::Key::E3); -constexpr Event UpperJ = Event::ShiftAlphaKey(Keyboard::Key::E4); -constexpr Event UpperK = Event::ShiftAlphaKey(Keyboard::Key::E5); -constexpr Event UpperL = Event::ShiftAlphaKey(Keyboard::Key::E6); +constexpr Event UpperG = Event::ShiftAlphaKey(Keyboard::Key::Sine); +constexpr Event UpperH = Event::ShiftAlphaKey(Keyboard::Key::Cosine); +constexpr Event UpperI = Event::ShiftAlphaKey(Keyboard::Key::Tangent); +constexpr Event UpperJ = Event::ShiftAlphaKey(Keyboard::Key::Pi); +constexpr Event UpperK = Event::ShiftAlphaKey(Keyboard::Key::Sqrt); +constexpr Event UpperL = Event::ShiftAlphaKey(Keyboard::Key::Square); -constexpr Event UpperM = Event::ShiftAlphaKey(Keyboard::Key::F1); -constexpr Event UpperN = Event::ShiftAlphaKey(Keyboard::Key::F2); -constexpr Event UpperO = Event::ShiftAlphaKey(Keyboard::Key::F3); -constexpr Event UpperP = Event::ShiftAlphaKey(Keyboard::Key::F4); -constexpr Event UpperQ = Event::ShiftAlphaKey(Keyboard::Key::F5); +constexpr Event UpperM = Event::ShiftAlphaKey(Keyboard::Key::Seven); +constexpr Event UpperN = Event::ShiftAlphaKey(Keyboard::Key::Eight); +constexpr Event UpperO = Event::ShiftAlphaKey(Keyboard::Key::Nine); +constexpr Event UpperP = Event::ShiftAlphaKey(Keyboard::Key::LeftParenthesis); +constexpr Event UpperQ = Event::ShiftAlphaKey(Keyboard::Key::RightParenthesis); -constexpr Event UpperR = Event::ShiftAlphaKey(Keyboard::Key::G1); -constexpr Event UpperS = Event::ShiftAlphaKey(Keyboard::Key::G2); -constexpr Event UpperT = Event::ShiftAlphaKey(Keyboard::Key::G3); -constexpr Event UpperU = Event::ShiftAlphaKey(Keyboard::Key::G4); -constexpr Event UpperV = Event::ShiftAlphaKey(Keyboard::Key::G5); +constexpr Event UpperR = Event::ShiftAlphaKey(Keyboard::Key::Four); +constexpr Event UpperS = Event::ShiftAlphaKey(Keyboard::Key::Five); +constexpr Event UpperT = Event::ShiftAlphaKey(Keyboard::Key::Six); +constexpr Event UpperU = Event::ShiftAlphaKey(Keyboard::Key::Multiplication); +constexpr Event UpperV = Event::ShiftAlphaKey(Keyboard::Key::Division); -constexpr Event UpperW = Event::ShiftAlphaKey(Keyboard::Key::H1); -constexpr Event UpperX = Event::ShiftAlphaKey(Keyboard::Key::H2); -constexpr Event UpperY = Event::ShiftAlphaKey(Keyboard::Key::H3); -constexpr Event UpperZ = Event::ShiftAlphaKey(Keyboard::Key::H4); +constexpr Event UpperW = Event::ShiftAlphaKey(Keyboard::Key::One); +constexpr Event UpperX = Event::ShiftAlphaKey(Keyboard::Key::Two); +constexpr Event UpperY = Event::ShiftAlphaKey(Keyboard::Key::Three); +constexpr Event UpperZ = Event::ShiftAlphaKey(Keyboard::Key::Plus); + +// Special constexpr Event None = Event::Special(0); constexpr Event Termination = Event::Special(1); diff --git a/ion/include/ion/keyboard.h b/ion/include/ion/keyboard.h index e45f5fc9d..f2b8042bd 100644 --- a/ion/include/ion/keyboard.h +++ b/ion/include/ion/keyboard.h @@ -12,12 +12,15 @@ namespace Ion { namespace Keyboard { constexpr Key ValidKeys[] = { - Key::A1, Key::A2, Key::A3, Key::A4, Key::A5, Key::A6, Key::B1, PowerKey, - Key::C1, Key::C2, Key::C3, Key::C4, Key::C5, Key::C6, Key::D1, Key::D2, - Key::D3, Key::D4, Key::D5, Key::D6, Key::E1, Key::E2, Key::E3, Key::E4, - Key::E5, Key::E6, Key::F1, Key::F2, Key::F3, Key::F4, Key::F5, Key::G1, - Key::G2, Key::G3, Key::G4, Key::G5, Key::H1, Key::H2, Key::H3, Key::H4, - Key::H5, Key::I1, Key::I2, Key::I3, Key::I4, Key::I5, + Key::Left, Key::Up, Key::Down, Key::Right, Key::OK, Key::Back, + Key::Home, Key::OnOff, + Key::Shift, Key::Alpha, Key::XNT, Key::Var, Key::Toolbox, Key::Backspace, + Key::Exp, Key::Ln, Key::Log, Key::Imaginary, Key::Comma, Key::Power, + Key::Sine, Key::Cosine, Key::Tangent, Key::Pi, Key::Sqrt, Key::Square, + Key::Seven, Key::Eight, Key::Nine, Key::LeftParenthesis, Key::RightParenthesis, + Key::Four, Key::Five, Key::Six, Key::Multiplication, Key::Division, + Key::One, Key::Two, Key::Three, Key::Plus, Key::Minus, + Key::Zero, Key::Dot, Key::EE, Key::Ans, Key::EXE, }; constexpr int NumberOfKeys = 54; diff --git a/ion/include/ion/keyboard/layout_B2/layout_keyboard.h b/ion/include/ion/keyboard/layout_B2/layout_keyboard.h index 7d9491ce4..2b01b4910 100644 --- a/ion/include/ion/keyboard/layout_B2/layout_keyboard.h +++ b/ion/include/ion/keyboard/layout_B2/layout_keyboard.h @@ -5,20 +5,18 @@ namespace Ion { namespace Keyboard { enum class Key : uint8_t { - A1=0, A2=1, A3=2, A4=3, A5=4, A6=5, - B1=6, B2=7, /*B3=8, B4=9, B5=10, B6=11, */ - C1=12, C2=13, C3=14, C4=15, C5=16, C6=17, - D1=18, D2=19, D3=20, D4=21, D5=22, D6=23, - E1=24, E2=25, E3=26, E4=27, E5=28, E6=29, - F1=30, F2=31, F3=32, F4=33, F5=34, // F6=35, - G1=36, G2=37, G3=38, G4=39, G5=40, // G6=41, - H1=42, H2=43, H3=44, H4=45, H5=46, // H6=47, - I1=48, I2=49, I3=50, I4=51, I5=52, // I6=53, + Left=0, Up=1, Down=2, Right=3, OK=4, Back=5, + Home=6, OnOff=7, /*B3= 8, B4=9, B5=10, B6=11, */ + Shift=12,Alpha=13, XNT=14, Var=15, Toolbox=16, Backspace=17, + Exp=18, Ln=19, Log=20, Imaginary=21, Comma=22, Power=23, + Sine=24, Cosine=25,Tangent=26,Pi=27, Sqrt=28, Square=29, + Seven=30,Eight=31, Nine=32, LeftParenthesis=33,RightParenthesis=34,// F6=35, + Four=36, Five=37, Six=38, Multiplication=39, Division=40, // G6=41, + One=42, Two=43, Three=44, Plus=45, Minus=46, // H6=47, + Zero=48, Dot=49, EE=50, Ans=51, EXE=52, // I6=53, None = 54 }; -constexpr Key PowerKey = Key::B2; - } } diff --git a/ion/include/ion/keyboard/layout_B3/layout_events.h b/ion/include/ion/keyboard/layout_B3/layout_events.h index a537a1761..7746f52cd 100644 --- a/ion/include/ion/keyboard/layout_B3/layout_events.h +++ b/ion/include/ion/keyboard/layout_B3/layout_events.h @@ -7,9 +7,8 @@ namespace Ion { namespace Events { -static constexpr EventD static_assert('\x11' == UCodePointEmpty, "Unicode error"); -static constexpr EventData s_dataForPlainEventRowB[] = { +static constexpr EventData s_dataForEvent[4*Event::PageSize] = { // Plain TL(), TL(), TL(), TL(), TL(), TL(), TL(), U(), TL(), U(), U(), U(), diff --git a/ion/include/ion/keyboard/layout_B3/layout_keyboard.h b/ion/include/ion/keyboard/layout_B3/layout_keyboard.h index 3fad69c41..ab4467698 100644 --- a/ion/include/ion/keyboard/layout_B3/layout_keyboard.h +++ b/ion/include/ion/keyboard/layout_B3/layout_keyboard.h @@ -5,20 +5,18 @@ namespace Ion { namespace Keyboard { enum class Key : uint8_t { - A1=0, A2=1, A3=2, A4=3, A5=4, A6=5, - B1=6, /*B2=7,*/ B3=8, /*B4=9, B5=10, B6=11, */ - C1=12, C2=13, C3=14, C4=15, C5=16, C6=17, - D1=18, D2=19, D3=20, D4=21, D5=22, D6=23, - E1=24, E2=25, E3=26, E4=27, E5=28, E6=29, - F1=30, F2=31, F3=32, F4=33, F5=34, // F6=35, - G1=36, G2=37, G3=38, G4=39, G5=40, // G6=41, - H1=42, H2=43, H3=44, H4=45, H5=46, // H6=47, - I1=48, I2=49, I3=50, I4=51, I5=52, // I6=53, + Left=0, Up=1, Down=2, Right=3, OK=4, Back=5, + Home=6, /*B2=7,*/ OnOff=8, /*B4=9, B5=10, B6=11, */ + Shift=12,Alpha=13, XNT=14, Var=15, Toolbox=16, Backspace=17, + Exp=18, Ln=19, Log=20, Imaginary=21, Comma=22, Power=23, + Sine=24, Cosine=25,Tangent=26,Pi=27, Sqrt=28, Square=29, + Seven=30,Eight=31, Nine=32, LeftParenthesis=33,RightParenthesis=34,// F6=35, + Four=36, Five=37, Six=38, Multiplication=39, Division=40, // G6=41, + One=42, Two=43, Three=44, Plus=45, Minus=46, // H6=47, + Zero=48, Dot=49, EE=50, Ans=51, EXE=52, // I6=53, None = 54 }; -constexpr Key PowerKey = Key::B3; - } } diff --git a/ion/src/device/shared/drivers/power.cpp b/ion/src/device/shared/drivers/power.cpp index b4616e10c..08b7fc107 100644 --- a/ion/src/device/shared/drivers/power.cpp +++ b/ion/src/device/shared/drivers/power.cpp @@ -76,7 +76,7 @@ void waitUntilPowerKeyReleased() { bool isPowerDown = true; while (isPowerDown) { Keyboard::State scan = Keyboard::scan(); - isPowerDown = scan.keyDown(Keyboard::PowerKey); + isPowerDown = scan.keyDown(Keyboard::Key::OnOff); } } @@ -149,7 +149,7 @@ void suspend(bool checkIfPowerKeyReleased) { // Check power key Device::Keyboard::init(); Keyboard::State scan = Keyboard::scan(); - Ion::Keyboard::State OnlyPowerKeyDown = Keyboard::State(Keyboard::PowerKey); + Ion::Keyboard::State OnlyPowerKeyDown = Keyboard::State(Keyboard::Key::OnOff); // Check plugging state Device::USB::initGPIO(); diff --git a/ion/src/device/shared/drivers/wakeup.cpp b/ion/src/device/shared/drivers/wakeup.cpp index b8d045845..b24630c06 100644 --- a/ion/src/device/shared/drivers/wakeup.cpp +++ b/ion/src/device/shared/drivers/wakeup.cpp @@ -44,7 +44,7 @@ void onUSBPlugging() { void onPowerKeyDown() { - Keyboard::Key key = Keyboard::PowerKey; + Keyboard::Key key = Keyboard::Key::OnOff; uint8_t rowPin = Keyboard::Config::RowPins[Keyboard::rowForKey(key)]; Keyboard::Config::RowGPIO.MODER()->setMode(rowPin, GPIO::MODER::Mode::Output); Keyboard::Config::RowGPIO.OTYPER()->setType(rowPin, GPIO::OTYPER::Type::OpenDrain); diff --git a/ion/src/device/shared/usb/calculator.cpp b/ion/src/device/shared/usb/calculator.cpp index 60a63185e..bfeb3970b 100644 --- a/ion/src/device/shared/usb/calculator.cpp +++ b/ion/src/device/shared/usb/calculator.cpp @@ -14,7 +14,7 @@ void Calculator::PollAndReset(bool exitWithKeyboard) { /* Leave DFU mode if the Back key is pressed, the calculator unplugged or the * USB core soft-disconnected. */ - Ion::Keyboard::Key exitKey = Ion::Keyboard::Key::A6; + Ion::Keyboard::Key exitKey = Ion::Keyboard::Key::Back; uint8_t exitKeyRow = Ion::Device::Keyboard::rowForKey(exitKey); uint8_t exitKeyColumn = Ion::Device::Keyboard::columnForKey(exitKey); diff --git a/ion/src/simulator/keyboard/fltkkbd.cpp b/ion/src/simulator/keyboard/fltkkbd.cpp index fa95d5215..2988805f3 100644 --- a/ion/src/simulator/keyboard/fltkkbd.cpp +++ b/ion/src/simulator/keyboard/fltkkbd.cpp @@ -48,7 +48,7 @@ FltkKbd::FltkKbd(int x, int y, int w, int h) : Fl_Group(x, y, w, h) { } static bool shouldRepeatKey(Ion::Keyboard::Key k) { - return k <= Ion::Keyboard::Key::A4 || k == Ion::Keyboard::Key::A6; + return k <= Ion::Keyboard::Key::Right || k == Ion::Keyboard::Key::Back; } void FltkKbd::initButtons(int x, int y, int w, int h) { diff --git a/ion/test/events.cpp b/ion/test/events.cpp index 80d339dad..d7082936c 100644 --- a/ion/test/events.cpp +++ b/ion/test/events.cpp @@ -15,8 +15,8 @@ QUIZ_CASE(ion_events_from_keyboard) { } // Test some fallbacks - quiz_assert(Event(Key::I5, false, false) == EXE); - quiz_assert(Event(Key::I5, true, false) == EXE); - quiz_assert(Event(Key::I5, false, true) == EXE); - quiz_assert(Event(Key::I5, true, true) == EXE); + quiz_assert(Event(Key::EXE, false, false) == EXE); + quiz_assert(Event(Key::EXE, true, false) == EXE); + quiz_assert(Event(Key::EXE, false, true) == EXE); + quiz_assert(Event(Key::EXE, true, true) == EXE); } diff --git a/python/port/port.cpp b/python/port/port.cpp index 6f01f26ca..2eb068e18 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -38,7 +38,7 @@ void MicroPython::ExecutionEnvironment::runCode(const char * str) { mp_lexer_t *lex = mp_lexer_new_from_str_len(0, str, strlen(str), false); mp_parse_tree_t pt = mp_parse(lex, MP_PARSE_SINGLE_INPUT); mp_obj_t module_fun = mp_compile(&pt, lex->source_name, MP_EMIT_OPT_NONE, true); - mp_hal_set_interrupt_char((int)Ion::Keyboard::Key::A6); + mp_hal_set_interrupt_char((int)Ion::Keyboard::Key::Back); mp_call_function_0(module_fun); mp_hal_set_interrupt_char(-1); // Disable interrupt nlr_pop();