ngui: get rid of the ambiguous ui header file

functions declared in ui.h were actually used by ui.c, the opposite of
what such a header is expected to contain. these functions are defined
in zig code and declarations are better off in the same ui.c file.

this is just a quick clean up before porting some C code to zig.
pull/20/head
alex 2 years ago
parent cb229d5a26
commit c73867ea4d
Signed by: x1ddos
GPG Key ID: FDEFB4A63CBD8460

@ -54,7 +54,7 @@ pub fn build(b: *std.build.Builder) void {
ngui.defineCMacroRaw(b.fmt("NM_DISP_VER={}", .{disp_vert})); ngui.defineCMacroRaw(b.fmt("NM_DISP_VER={}", .{disp_vert}));
ngui.defineCMacro("LV_CONF_INCLUDE_SIMPLE", null); ngui.defineCMacro("LV_CONF_INCLUDE_SIMPLE", null);
ngui.defineCMacro("LV_TICK_CUSTOM", "1"); ngui.defineCMacro("LV_TICK_CUSTOM", "1");
ngui.defineCMacro("LV_TICK_CUSTOM_INCLUDE", "\"ui.h\""); ngui.defineCMacro("LV_TICK_CUSTOM_INCLUDE", "\"lv_custom_tick.h\"");
ngui.defineCMacro("LV_TICK_CUSTOM_SYS_TIME_EXPR", "(nm_get_curr_tick())"); ngui.defineCMacro("LV_TICK_CUSTOM_SYS_TIME_EXPR", "(nm_get_curr_tick())");
switch (drv) { switch (drv) {
.sdl2 => { .sdl2 => {

@ -0,0 +1,16 @@
#ifndef NM_UI_H
#define NM_UI_H
/**
* this file exists to satisfy LV_TICK_CUSTOM_INCLUDE.
*/
#include <stdint.h>
/**
* returns elapsed time since program start, in ms.
* rolls over when overflow occurs.
*/
uint32_t nm_get_curr_tick();
#endif

@ -1,12 +1,31 @@
/**
* function declarations with nm_ prefix are typically defined in zig,
* while extern'ed function definitions with nm_ prefix are typically called from zig.
*/
#define _DEFAULT_SOURCE /* needed for usleep() */ #define _DEFAULT_SOURCE /* needed for usleep() */
#include "lvgl/lvgl.h" #include "lvgl/lvgl.h"
#include "ui.h"
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
/**
* initiates system shutdown leading to poweroff.
*/
void nm_sys_shutdown();
/**
* invoken when the UI is switched to the network settings tab.
*/
void nm_tab_settings_active();
/**
* initiate connection to a wifi network with the given SSID and a password.
* connection, if successful, is persisted in wpa_supplicant config.
*/
int nm_wifi_start_connect(const char *ssid, const char *password);
static lv_style_t style_title; static lv_style_t style_title;
static lv_style_t style_text_muted; static lv_style_t style_text_muted;
static lv_style_t style_btn_red; static lv_style_t style_btn_red;

@ -1,28 +0,0 @@
#ifndef NM_UI_H
#define NM_UI_H
#include <stdint.h>
/**
* returns elapsed time since program start, in ms.
* rolls over when overflow occurs.
*/
uint32_t nm_get_curr_tick();
/**
* initiates system shutdown leading to poweroff.
*/
void nm_sys_shutdown();
/**
* invoken when the UI is switched to the network settings tab.
*/
void nm_tab_settings_active();
/**
* initiate connection to a wifi network with the given SSID and a password.
* connection, if successful, is persisted in wpa_supplicant config.
*/
int nm_wifi_start_connect(const char *ssid, const char *password);
#endif