feat(display): Add new peripheral status/display

* Add new API/status to track state of the
  peripheral connection to the central.
* Add new peripheral status widget for displaying
  the current status of the connection to
  the central.
This commit is contained in:
Peter Johanson
2022-04-26 05:00:46 +00:00
committed by Pete Johanson
parent 0a40f922b5
commit 16ab6df18d
10 changed files with 172 additions and 18 deletions

View File

@@ -5,6 +5,7 @@
*/
#include <zmk/display/widgets/output_status.h>
#include <zmk/display/widgets/peripheral_status.h>
#include <zmk/display/widgets/battery_status.h>
#include <zmk/display/widgets/layer_status.h>
#include <zmk/display/widgets/wpm_status.h>
@@ -21,6 +22,10 @@ static struct zmk_widget_battery_status battery_status_widget;
static struct zmk_widget_output_status output_status_widget;
#endif
#if IS_ENABLED(CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS)
static struct zmk_widget_peripheral_status peripheral_status_widget;
#endif
#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
static struct zmk_widget_layer_status layer_status_widget;
#endif
@@ -46,6 +51,12 @@ lv_obj_t *zmk_display_status_screen() {
0);
#endif
#if IS_ENABLED(CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS)
zmk_widget_peripheral_status_init(&peripheral_status_widget, screen);
lv_obj_align(zmk_widget_peripheral_status_obj(&peripheral_status_widget), NULL,
LV_ALIGN_IN_TOP_LEFT, 0, 0);
#endif
#if IS_ENABLED(CONFIG_ZMK_WIDGET_LAYER_STATUS)
zmk_widget_layer_status_init(&layer_status_widget, screen);
lv_obj_set_style_local_text_font(zmk_widget_layer_status_obj(&layer_status_widget),