mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
basic docs and sample code improved
This commit is contained in:
parent
f8dd6180b3
commit
1133fb9031
@ -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:
|
In practice, there are pre-configured drivers available for these boards:
|
||||||
- Yellow Board / 2432S024
|
- Yellow Board / 2432S024
|
||||||
|
|
||||||
|
# Guide
|
||||||
|
|
||||||
|
Until there is proper documentation, here are some pointers:
|
||||||
|
- [Sample application](./main/main.c)
|
||||||
|
- [NanoBake](./components/nanobake/)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[GNU General Public License Version 3](LICENSE.md)
|
[GNU General Public License Version 3](LICENSE.md)
|
||||||
|
|||||||
18
main/main.c
18
main/main.c
@ -10,27 +10,27 @@
|
|||||||
|
|
||||||
static const char *TAG = "main";
|
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");
|
ESP_LOGI(TAG, "tap");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void app_main_lvgl(nb_platform_t* platform) {
|
static void prv_main_vgl(nb_platform_t* platform) {
|
||||||
lv_obj_t *scr = lv_scr_act();
|
lv_obj_t* scr = lv_scr_act();
|
||||||
|
|
||||||
lvgl_port_lock(0);
|
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_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_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
|
||||||
lv_label_set_text(label, "Hello, world!");
|
lv_label_set_text(label, "Hello, world!");
|
||||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, -30);
|
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);
|
label = lv_label_create(btn);
|
||||||
lv_label_set_text_static(label, "Button");
|
lv_label_set_text_static(label, "Button");
|
||||||
lv_obj_align(btn, LV_ALIGN_BOTTOM_MID, 0, -30);
|
lv_obj_align(btn, LV_ALIGN_CENTER, 0, 30);
|
||||||
lv_obj_add_event_cb(btn, app_button_cb, LV_EVENT_CLICKED, NULL);
|
lv_obj_add_event_cb(btn, prv_button_callback, LV_EVENT_CLICKED, NULL);
|
||||||
|
|
||||||
lvgl_port_unlock();
|
lvgl_port_unlock();
|
||||||
}
|
}
|
||||||
@ -44,5 +44,5 @@ void app_main(void) {
|
|||||||
static nb_platform_t platform;
|
static nb_platform_t platform;
|
||||||
ESP_ERROR_CHECK(nb_platform_create(platform_config, &platform));
|
ESP_ERROR_CHECK(nb_platform_create(platform_config, &platform));
|
||||||
|
|
||||||
app_main_lvgl(&platform);
|
prv_main_vgl(&platform);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user