pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • PebbleOS
  • Mobile App
  • Examples
  • Index 01
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

PebbleOS

  • Overview
  • Start here
    • Getting started guide
    • Playground
  • Development
    • The pbl CLI
    • Build system
    • Samples
      • Kernel
      • Subsystems
      • Drivers
      • Third-party
      • Rust
      • Benchmarks
    • Emulator and simulator
    • Testing
    • Debugging
    • Conventions
  • System
    • Architecture overview
    • Kernel
    • Subsystems
    • Drivers
    • Services
    • Libraries
    • Third-party
    • Application SDK
  • Hardware
    • Boards
    • Programmers
  • Community
    • Contribution Guidelines
  • Reference
    • Reference
    • Kconfig options

LVGL: Keypad and encoder

This sample runs the keypad and encoder demo that comes with LVGL: tabs of widgets that are used without a pointer. Up and Down move the focus, Select clicks or edits the focused widget and Back leaves it.

Unlike most samples it does not end.

Run:

pbl samples samples/third_party/lvgl/keypad_encoder

Boards:

every board

Sources

src/main.c
#include <stdio.h>

#include <pbl/kernel/delay.h>

#include <demos/lv_demos.h>
#include <pbl_lvgl.h>

int main(void) {
  int ret;

  ret = pbl_lvgl_init();
  if (ret != 0) {
    fprintf(stderr, "lvgl: init failed (%d)\n", ret);
    return ret;
  }

  /* The demos come with LVGL, each enabled by its CONFIG_LV_USE_DEMO_* option. */
  lv_demo_keypad_encoder();

  printf("lvgl: keypad and encoder on %dx%d\n",
         (int)lv_display_get_horizontal_resolution(pbl_lvgl_get_display()),
         (int)lv_display_get_vertical_resolution(pbl_lvgl_get_display()));

  while (true) {
    pbl_sleep_ms(lv_timer_handler());
  }
}

Output

lvgl: keypad and encoder on \d+x\d+

Generated from PebbleOS 4bbc630fa. This page is maintained in the pebbleos repository: docs/samples/third_party/lvgl/keypad_encoder.md.

Overview

  • Sources
  • Output