MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / epdRotationToLvgl

Method epdRotationToLvgl

Drivers/EPDiyDisplay/Source/EpdiyDisplay.cpp:406–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406lv_display_rotation_t EpdiyDisplay::epdRotationToLvgl(enum EpdRotation epdRotation) {
407 // Static lookup table for EPD -> LVGL rotation mapping
408 // EPDiy: LANDSCAPE = 0°, PORTRAIT = 90° CW, INVERTED_LANDSCAPE = 180°, INVERTED_PORTRAIT = 270° CW
409 // LVGL: 0 = 0°, 90 = 90° CW, 180 = 180°, 270 = 270° CW
410 static const lv_display_rotation_t rotationMap[] = {
411 LV_DISPLAY_ROTATION_0, // EPD_ROT_LANDSCAPE (0)
412 LV_DISPLAY_ROTATION_270, // EPD_ROT_PORTRAIT (1) - 90° CW in EPD is 270° in LVGL
413 LV_DISPLAY_ROTATION_180, // EPD_ROT_INVERTED_LANDSCAPE (2)
414 LV_DISPLAY_ROTATION_90 // EPD_ROT_INVERTED_PORTRAIT (3) - 270° CW in EPD is 90° in LVGL
415 };
416
417 // Validate input and return mapped value
418 if (epdRotation >= 0 && epdRotation < 4) {
419 return rotationMap[epdRotation];
420 }
421
422 // Default to landscape if invalid
423 return LV_DISPLAY_ROTATION_0;
424}
425
426enum EpdRotation EpdiyDisplay::lvglRotationToEpd(lv_display_rotation_t lvglRotation) {
427 // Static lookup table for LVGL -> EPD rotation mapping

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected