28 #ifndef _NANO_ENGINE_CORE_H_ 29 #define _NANO_ENGINE_CORE_H_ 41 #define ENGINE_DEFAULT_FPS (15) 55 BUTTON_NONE = 0B00000000,
56 BUTTON_DOWN = 0B00000001,
57 BUTTON_LEFT = 0B00000010,
58 BUTTON_RIGHT = 0B00000100,
59 BUTTON_UP = 0B00001000,
60 BUTTON_A = 0B00010000,
61 BUTTON_B = 0B00100000,
62 BUTTON_C = 0B01000000,
63 BUTTON_CENTER = 0B10000000,
84 static bool pressed(uint8_t buttons);
100 static bool clicked(uint8_t buttons);
142 static void connectKY40encoder(uint8_t pina_clk, uint8_t pinb_dt, int8_t pinc_sw = -1);
180 static uint8_t s_zkeypadPin;
181 static const uint8_t *s_gpioKeypadPins;
182 static uint8_t s_ky40_clk;
183 static uint8_t s_ky40_dt;
184 static uint8_t s_ky40_sw;
185 static uint8_t zkeypadButtons();
186 static uint8_t arduboyButtons();
187 static uint8_t gpioButtons();
188 #ifndef SDL_EMULATION 189 static uint8_t wioButtons();
191 static uint8_t ky40Buttons();
217 void setFrameRate(uint8_t fps);
258 uint8_t m_cpuLoad = 0;
260 uint32_t m_lastFrameTs = 0;
295 void notify(
const char *str);
300 template <
class C,
class D>
uint8_t getFrameRate()
Returns current frame rate.
void displayBuffer() __attribute__((noinline))
refreshes content on oled display.
Base class for NanoEngine.
Nano Engine Core class, contains generic frame-rate control functions.
void display()
refreshes content on oled display.
NanoEngine(D &display)
Initializes Nano Engine Base object.
Drawing in memory buffer.
void loopCallback(TLoopCallback callback)
Sets user-defined loop callback.
uint16_t m_frameDurationMs
Duration between frames in milliseconds.
void begin()
Initializes internal timestamps, engine state, and switches oled display to required mode (see ssd130...
void displayPopup(const char *msg)
prints popup message over display content prints popup message over display content ...
void refresh()
Marks all tiles for update.
uint8_t m_cpuLoad
Current cpu load in percents.
uint8_t getCpuLoad()
Returns cpu load in percents [0-255].
uint32_t m_lastFrameTs
Last timestamp in milliseconds the frame was updated on oled display.
void beginCore()
Initializes internal timestamps.
This class template is responsible for holding and updating data about areas to be refreshed on LCD d...
uint32_t lcd_millis(void)
returns 32-bit timestamp from system power-up in milliseconds
void notify(const char *str)
shows notification to a user for 1 seconds Shows notification to a user for 1 seconds ...
#define ENGINE_DEFAULT_FPS
Defaut frame rate for all engines.
uint8_t(* TNanoEngineGetButtons)(void)
Type of user-specified keyboard callback.
Tiler helper for graphics processing.
void(* TLoopCallback)(void)
Type of user-specified loop callback.
void lcd_delay(unsigned long ms)
Forces current thread to sleeps for specified number of milliseconds.