diff --git a/ion/Makefile b/ion/Makefile index 6efea82b8..c49f13277 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -10,6 +10,8 @@ ifndef ION_KEYBOARD_LAYOUT $(error platform.mak should define ION_KEYBOARD_LAYOUT) endif SFLAGS += -Iion/include/ion/keyboard/$(ION_KEYBOARD_LAYOUT) +SFLAGS += -Iion/include/ion/keyboard/ +ion_src += ion/src/shared/keyboard/$(ION_KEYBOARD_LAYOUT)/layout_events.cpp include ion/src/$(PLATFORM)/Makefile -include ion/test/$(PLATFORM)/Makefile diff --git a/ion/include/ion/keyboard/layout_events.h b/ion/include/ion/keyboard/layout_events.h new file mode 100644 index 000000000..21cdaeed0 --- /dev/null +++ b/ion/include/ion/keyboard/layout_events.h @@ -0,0 +1,24 @@ +#ifndef ION_KEYBOARD_LAYOUT_EVENTS_H +#define ION_KEYBOARD_LAYOUT_EVENTS_H + +#include +#include +#include "event_data.h" + +namespace Ion { +namespace Events { + +extern const EventData s_dataForEvent[4*Event::PageSize]; + +#ifndef NDEBUG +extern const const char * s_nameForEvent[255]; + +inline const char * Event::name() const { + return s_nameForEvent[m_id]; +} +#endif + +} +} + +#endif diff --git a/ion/include/ion/keyboard/layout_B2/layout_events.h b/ion/src/shared/keyboard/layout_B2/layout_events.cpp similarity index 91% rename from ion/include/ion/keyboard/layout_B2/layout_events.h rename to ion/src/shared/keyboard/layout_B2/layout_events.cpp index d0621d3d6..24518533e 100644 --- a/ion/include/ion/keyboard/layout_B2/layout_events.h +++ b/ion/src/shared/keyboard/layout_B2/layout_events.cpp @@ -1,14 +1,10 @@ -#ifndef ION_KEYBOARD_LAYOUT_B2_EVENTS_H -#define ION_KEYBOARD_LAYOUT_B2_EVENTS_H - -#include -#include "../event_data.h" +#include namespace Ion { namespace Events { static_assert('\x11' == UCodePointEmpty, "Unicode error"); -static constexpr EventData s_dataForEvent[4*Event::PageSize] = { +const EventData s_dataForEvent[4 * Event::PageSize] = { // Plain TL(), TL(), TL(), TL(), TL(), TL(), TL(), TL(), U(), U(), U(), U(), @@ -53,7 +49,7 @@ static constexpr EventData s_dataForEvent[4*Event::PageSize] = { #ifndef NDEBUG -static constexpr const char * s_nameForEvent[255] = { +const char * s_nameForEvent[255] = { // Plain "Left", "Up", "Down", "Right", "OK", "Back", "Home", "OnOff", nullptr, nullptr, nullptr, nullptr, @@ -97,13 +93,7 @@ static constexpr const char * s_nameForEvent[255] = { "None", "Termination", nullptr, nullptr, nullptr, nullptr, }; -inline const char * Event::name() const { - return s_nameForEvent[m_id]; -} - #endif } } - -#endif diff --git a/ion/include/ion/keyboard/layout_B3/layout_events.h b/ion/src/shared/keyboard/layout_B3/layout_events.cpp similarity index 91% rename from ion/include/ion/keyboard/layout_B3/layout_events.h rename to ion/src/shared/keyboard/layout_B3/layout_events.cpp index 0bdd59e56..6133c5787 100644 --- a/ion/include/ion/keyboard/layout_B3/layout_events.h +++ b/ion/src/shared/keyboard/layout_B3/layout_events.cpp @@ -1,14 +1,10 @@ -#ifndef ION_KEYBOARD_LAYOUT_B3_EVENTS_H -#define ION_KEYBOARD_LAYOUT_B3_EVENTS_H - -#include -#include "../event_data.h" +#include namespace Ion { namespace Events { static_assert('\x11' == UCodePointEmpty, "Unicode error"); -static constexpr EventData s_dataForEvent[4*Event::PageSize] = { +const EventData s_dataForEvent[4 * Event::PageSize] = { // Plain TL(), TL(), TL(), TL(), TL(), TL(), TL(), U(), TL(), U(), U(), U(), @@ -53,7 +49,7 @@ static constexpr EventData s_dataForEvent[4*Event::PageSize] = { #ifndef NDEBUG -static constexpr const char * s_nameForEvent[255] = { +const char * s_nameForEvent[255] = { // Plain "Left", "Up", "Down", "Right", "OK", "Back", "Home", "nullptr", "OnOff", nullptr, nullptr, nullptr, @@ -97,13 +93,7 @@ static constexpr const char * s_nameForEvent[255] = { "None", "Termination", nullptr, nullptr, nullptr, nullptr, }; -inline const char * Event::name() const { - return s_nameForEvent[m_id]; -} - #endif } } - -#endif