Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nbgl for nano apps #482

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: doc

BUILD_DIR := build

# default target is stax
TARGET ?= stax

NBGL_DEFINES_stax := \
HAVE_SE_TOUCH \
NBGL_PAGE \
NBGL_QRCODE

NBGL_DEFINES_nano := \
NBGL_STEP \
NBGL_FLOW

NBGL_DEFINES := $(NBGL_DEFINES_$(TARGET))

export NBGL_DEFINES

doc: | $(BUILD_DIR)
@doxygen doc/Doxyfile
@echo 'HTML doc can be found in '$(BUILD_DIR)/doc/html/index.html

$(BUILD_DIR):
@mkdir -p $@
29 changes: 18 additions & 11 deletions Makefile.glyphs
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,37 @@ endif
GLYPH_DESTC := $(GLYPH_SRC_DIR)/glyphs.c
GLYPH_DESTH := $(GLYPH_SRC_DIR)/glyphs.h

# search icons (glyphs) in glyphs folder of the app first
GLYPH_FILES += $(addprefix glyphs/,$(sort $(notdir $(shell find glyphs/))))

ifdef USE_NBGL
# Not NanoS glyphs files and generation script
# NBGL glyphs files and generation script
#
# search icons (glyphs) in lib_nbgl/glyphs(_nano) folder of the SDK
ifeq ($(TARGET_NAME),TARGET_STAX)
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs/))))
GLYPH_FILES += $(addprefix glyphs/,$(sort $(notdir $(shell find glyphs/))))
GLYPH_OPT :=
else # ($(TARGET_NAME),TARGET_STAX)
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_nbgl/glyphs_nano/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_nbgl/glyphs_nano/))))
#inverse B&W for non Stax
GLYPH_OPT := --reverse
endif # ($(TARGET_NAME),TARGET_STAX)

ifneq (,$(wildcard $(ICONNAME)))
# Do not try to generate app icon glyph, if image does not exist
GLYPH_FILES += $(ICONNAME)
endif
ICON_SCRIPT = $(BOLOS_SDK)/lib_nbgl/tools/icon2glyph.py
#inverse B&W for non Stax
ifneq ($(TARGET_NAME),TARGET_STAX)
GLYPH_OPT := --reverse
else
GLYPH_OPT :=
endif
GENERATE_GLYPHS_CMD = python3 $(ICON_SCRIPT) $(GLYPH_OPT) --glyphcfile $(GLYPH_FILES)
else

else # USE_NBGL

# Nano glyphs files and generation script
GLYPH_FILES += $(addprefix glyphs/,$(sort $(notdir $(shell find glyphs/))))
GLYPH_FILES += $(addprefix $(BOLOS_SDK)/lib_ux/glyphs/,$(sort $(notdir $(shell find $(BOLOS_SDK)/lib_ux/glyphs/))))
GLYPH_OPT :=
ICON_SCRIPT = $(BOLOS_SDK)/icon3.py
GENERATE_GLYPHS_CMD = python3 $(ICON_SCRIPT) --factorize --glyphcfile $(GLYPH_FILES)
endif
endif# USE_NBGL

$(GLYPH_DESTH): $(GLYPH_FILES) $(ICON_SCRIPT)
$(L)echo "[GLYPH] Compiling..."
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ To enable pre-commit in your development environment:
## Documentation
HTML documentation can be generated by typing:

```mkdir -p build && doxygen doc/Doxyfile```
- For Stax:

```make doc TARGET=stax```

- For Nano X or Nano S+:

```make doc TARGET=nano```

from root directory

Expand Down
4 changes: 1 addition & 3 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2229,9 +2229,7 @@ INCLUDE_FILE_PATTERNS =

PREDEFINED = NBGL_KEYBOARD \
NBGL_KEYPAD \
NBGL_PAGE \
NBGL_USE_CASE \
NBGL_QRCODE
$(NBGL_DEFINES)

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
12 changes: 6 additions & 6 deletions doc/mainpage.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@section mainpage_intro Introduction

This documentation describes the different interfaces of Embedded SDK,
for Nano S, Nano X, Nano S+ and Stax applications development.
for \b Nano X, \b Nano S+ and \b Stax applications development.

@section ble_presentation BlueTooth Low-Energy Interface

Expand All @@ -13,10 +13,10 @@ The @subpage ble_mainpage page contains all information necessary to interact wi

The @subpage cxng_mainpage page contains all information necessary to understand Cryptographic Library

@section nbgl_presentation Screen drawing API (Stax only)
@section nbgl_presentation Screen drawing API

The @subpage nbgl_mainpage page contains all information necessary to understand the Graphical Library for
\b Stax applications development.
\b Stax, \b NanoX and \b NanoS+ applications development.

@section nfc_presentation NFC Interface

Expand Down Expand Up @@ -45,12 +45,12 @@ The @subpage u2f_mainpage page contains all information necessary to use the U2F
@subsection ux_nanos_presentation User eXperience on Nanos

The @subpage ux_mainpage page contains all information necessary to user the User eXperience (and partially Graphical Library) for
\b Nanos applications development.
\b Nanos applications development (using \b BAGL).

@subsection ux_stax_presentation User eXperience on Stax
@subsection ux_stax_presentation User eXperience on Applications using \b NBGL

The @subpage ux_stax_mainpage page contains all information necessary to user the User eXperience for
\b Stax applications development.
\b Stax, \b NanoX and \b NanoS+ applications development using \b NBGL (most recent ones).


*/
2 changes: 1 addition & 1 deletion lib_nbgl/doc/mainpage.dox
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef HAVE_SE_TOUCH
/** @page nbgl_mainpage New BOLOS Graphic API
/** @page nbgl_mainpage New BOLOS Graphic API for Stax

@section mainpage_intro Introduction

Expand Down
13 changes: 4 additions & 9 deletions lib_nbgl/doc/mainpage_nanos.dox
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef HAVE_SE_TOUCH
/** @page nbgl_mainpage New BOLOS Graphic API
/** @page nbgl_mainpage New BOLOS Graphic API for Nanos

@section mainpage_intro Introduction

This documentation describes the different interfaces of <b>NBGL</b>, the library that
is targeted to be integrated in Stax product.
is targeted to be integrated in Nano products (Nano X and Nano S+).

<b>NBGL Engine</b> is responsible for constructing screens and handling Touchscreen input.
<b>NBGL Engine</b> is responsible for constructing screens and handling Buttons input.

@section mainpage_overall_archi Overall architecture

<b>NBGL Engine</b> is a library to be integrated in SDK.
It is intended to replace existing BAGL/FLOW Graphical Engine (used on Nanos/Blue products)
It is intended to replace existing BAGL/FLOW Graphical Engine (used on Nano S product)

\image{inline} html NBGLArchi.png "caption" height=600

Expand Down Expand Up @@ -43,16 +43,11 @@ and use \b NBGL Low-Level API
The @subpage nbgl_screens_and_objs page contains all information necessary to understand
how \b NBGL manages the screens stack and the dynamically allocated objects

@section nbgl_touch_api Touchscreen events management
The @subpage nbgl_touchscreen page contains all information necessary to understand
how \b NBGL manages the touchscreen events and how to receive and process these events.

@section nbgl_building Compilation options
In order to reduce the footprint (RAM+Flash), some features are only activated if some building options are defined.

Define | Meaning | Default state
------------- | ------------- | -------------
\b NBGL_PAGE | Activate High-Level API | Active in SDK, not in OS
\b NBGL_USE_CASE | Activate Use Case API | Active in SDK, not in OS
\b NBGL_KEYBOARD | Activate Keyboard object | Active in OS, not in SDK
\b NBGL_KEYPAD | Activate Keypad object | Active in OS, not in SDK
Expand Down
Loading