Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Var 1 #15

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions blue-app-helloworld/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
# limitations under the License.
#*******************************************************************************


TARGET_ID = 0x31100002 #Nano S

ifeq ($(BOLOS_SDK),)
$(error BOLOS_SDK is not set)
endif
Expand Down Expand Up @@ -45,7 +48,7 @@ DEFINES += CX_COMPLIANCE_141

ifneq ($(BOLOS_ENV),)
$(info BOLOS_ENV=$(BOLOS_ENV))
CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/
CLANGPATH := /usr/bin/
GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/
else
$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH)
Expand All @@ -57,7 +60,7 @@ ifeq ($(GCCPATH),)
$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH)
endif

CC := $(CLANGPATH)clang
CC := $(CLANGPATH)clang-4.0
CFLAGS += -O3 -Os

AS := $(GCCPATH)arm-none-eabi-gcc
Expand Down
48 changes: 30 additions & 18 deletions blue-app-helloworld/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

unsigned char G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B];

static const bagl_element_t *io_seproxyhal_touch_exit(const bagl_element_t *e);
static bagl_element_t *io_seproxyhal_touch_exit(bagl_element_t *e);

ux_state_t ux;

// ********************************************************************************
// Ledger Blue specific UI
// ********************************************************************************

static const bagl_element_t bagl_ui_sample_blue[] = {
bagl_element_t bagl_ui_sample_blue[] = {
// {
// {type, userid, x, y, width, height, stroke, radius, fill, fgcolor,
// bgcolor, font_id, icon_id},
Expand Down Expand Up @@ -98,19 +97,22 @@ bagl_ui_sample_blue_button(unsigned int button_mask,
// ********************************************************************************
// Ledger Nano S specific UI
// ********************************************************************************
struct temporary {
bagl_component_t component;

char *text;
unsigned char touch_area_brim;
int overfgcolor;
int overbgcolor;
bagl_element_callback_t tap;
bagl_element_callback_t out;
bagl_element_callback_t over;
};

char*name="Hello1";

temporary tmp[] =

static const bagl_element_t bagl_ui_sample_nanos[] = {
// {
// {type, userid, x, y, width, height, stroke, radius, fill, fgcolor,
// bgcolor, font_id, icon_id},
// text,
// touch_area_brim,
// overfgcolor,
// overbgcolor,
// tap,
// out,
// over,
// },
{
{BAGL_RECTANGLE, 0x00, 0, 0, 128, 32, 0, 0, BAGL_FILL, 0x000000,
0xFFFFFF, 0, 0},
Expand All @@ -125,7 +127,7 @@ static const bagl_element_t bagl_ui_sample_nanos[] = {
{
{BAGL_LABELINE, 0x01, 0, 12, 128, 32, 0, 0, 0, 0xFFFFFF, 0x000000,
BAGL_FONT_OPEN_SANS_REGULAR_11px | BAGL_FONT_ALIGNMENT_CENTER, 0},
"Hello World",
name,
0,
0,
0,
Expand Down Expand Up @@ -157,18 +159,28 @@ static const bagl_element_t bagl_ui_sample_nanos[] = {
},
};


static unsigned int
bagl_ui_sample_nanos_button(unsigned int button_mask,
unsigned int button_mask_counter) {
switch (button_mask) {
case BUTTON_EVT_RELEASED | BUTTON_LEFT : // EXIT
name="Hello2";

case BUTTON_EVT_RELEASED | BUTTON_RIGHT: // EXIT
name="Hello3";

UX_REDISPLAY();
break;

case BUTTON_EVT_RELEASED | BUTTON_LEFT | BUTTON_RIGHT: // EXIT
io_seproxyhal_touch_exit(NULL);
break;
}
return 0;
}

static const bagl_element_t *io_seproxyhal_touch_exit(const bagl_element_t *e) {
static bagl_element_t *io_seproxyhal_touch_exit(bagl_element_t *e) {
// Go back to the dashboard
os_sched_exit(0);
return NULL;
Expand Down Expand Up @@ -205,7 +217,7 @@ static void ui_idle(void) {
SEPROXYHAL_TAG_SESSION_START_EVENT_FEATURE_SCREEN_BIG) {
UX_DISPLAY(bagl_ui_sample_blue, NULL);
} else {
UX_DISPLAY(bagl_ui_sample_nanos, NULL);
UX_DISPLAY(tmp, NULL);
}
}

Expand Down