diff --git a/README.md b/README.md index bea146cb..cda18ff4 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,12 @@ In theory, all hardware from the [Board Support Packages](https://github.com/esp In practice, there are pre-configured drivers available for these boards: - Yellow Board / 2432S024 +# Guide + +Until there is proper documentation, here are some pointers: +- [Sample application](./main/main.c) +- [NanoBake](./components/nanobake/) + ## License [GNU General Public License Version 3](LICENSE.md) diff --git a/main/main.c b/main/main.c index 267e4a2c..87183856 100644 --- a/main/main.c +++ b/main/main.c @@ -10,27 +10,27 @@ static const char *TAG = "main"; -static void app_button_cb(lv_event_t* e) { +static void prv_button_callback(lv_event_t* event) { ESP_LOGI(TAG, "tap"); } -static void app_main_lvgl(nb_platform_t* platform) { - lv_obj_t *scr = lv_scr_act(); +static void prv_main_vgl(nb_platform_t* platform) { + lv_obj_t* scr = lv_scr_act(); lvgl_port_lock(0); - lv_obj_t *label = lv_label_create(scr); + lv_obj_t* label = lv_label_create(scr); lv_label_set_recolor(label, true); - lv_obj_set_width(label, 240); + lv_obj_set_width(label, (lv_coord_t)platform->display.horizontal_resolution); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(label, "Hello, world!"); lv_obj_align(label, LV_ALIGN_CENTER, 0, -30); - lv_obj_t *btn = lv_btn_create(scr); + lv_obj_t* btn = lv_btn_create(scr); label = lv_label_create(btn); lv_label_set_text_static(label, "Button"); - lv_obj_align(btn, LV_ALIGN_BOTTOM_MID, 0, -30); - lv_obj_add_event_cb(btn, app_button_cb, LV_EVENT_CLICKED, NULL); + lv_obj_align(btn, LV_ALIGN_CENTER, 0, 30); + lv_obj_add_event_cb(btn, prv_button_callback, LV_EVENT_CLICKED, NULL); lvgl_port_unlock(); } @@ -44,5 +44,5 @@ void app_main(void) { static nb_platform_t platform; ESP_ERROR_CHECK(nb_platform_create(platform_config, &platform)); - app_main_lvgl(&platform); + prv_main_vgl(&platform); }