From 60699af63f92f43cc4b4b9e3050fcdd2a8468281 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Wed, 10 Apr 2019 15:14:00 -0400 Subject: add opengl fronend, remove sdl frontend, refactor build system --- .../examples/keypad_multiple_keys/autotester.json | 62 +++++++++++++++++++++ .../CEdev/examples/keypad_multiple_keys/makefile | 15 +++++ .../CEdev/examples/keypad_multiple_keys/readme.md | 10 ++++ .../examples/keypad_multiple_keys/screenshot.gif | Bin 0 -> 5495 bytes .../CEdev/examples/keypad_multiple_keys/src/main.c | 60 ++++++++++++++++++++ 5 files changed, 147 insertions(+) create mode 100644 frontends/calculator/CEdev/examples/keypad_multiple_keys/autotester.json create mode 100644 frontends/calculator/CEdev/examples/keypad_multiple_keys/makefile create mode 100644 frontends/calculator/CEdev/examples/keypad_multiple_keys/readme.md create mode 100644 frontends/calculator/CEdev/examples/keypad_multiple_keys/screenshot.gif create mode 100644 frontends/calculator/CEdev/examples/keypad_multiple_keys/src/main.c (limited to 'frontends/calculator/CEdev/examples/keypad_multiple_keys') diff --git a/frontends/calculator/CEdev/examples/keypad_multiple_keys/autotester.json b/frontends/calculator/CEdev/examples/keypad_multiple_keys/autotester.json new file mode 100644 index 0000000..ea6581f --- /dev/null +++ b/frontends/calculator/CEdev/examples/keypad_multiple_keys/autotester.json @@ -0,0 +1,62 @@ +{ + "rom": "84pce_515.rom", + "transfer_files": [ + "bin/DEMO.8xp" + ], + "target": { + "name": "DEMO", + "isASM": true + }, + "sequence": [ + "action|launch", + "delay|500", + "key|down", + "hash|1", + "delay|200", + "key|right", + "hash|2", + "delay|200", + "key|up", + "hash|3", + "delay|200", + "key|left", + "hash|4", + "delay|200", + "key|2nd", + "delay|300", + "hashWait|5" + ], + "hashes": { + "1": { + "description": "The screen shows Down", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "349F4775" ] + }, + "2": { + "description": "The screen shows Right", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "349F4775" ] + }, + "3": { + "description": "The screen shows Up", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "349F4775" ] + }, + "4": { + "description": "The screen shows Left", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "349F4775" ] + }, + "5": { + "description": "Back to the home screen (exit check)", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] + } + } +} + diff --git a/frontends/calculator/CEdev/examples/keypad_multiple_keys/makefile b/frontends/calculator/CEdev/examples/keypad_multiple_keys/makefile new file mode 100644 index 0000000..1f1b36b --- /dev/null +++ b/frontends/calculator/CEdev/examples/keypad_multiple_keys/makefile @@ -0,0 +1,15 @@ +# ---------------------------- +# Set NAME to the program name +# Set ICON to the png icon file name +# Set DESCRIPTION to display within a compatible shell +# Set COMPRESSED to "YES" to create a compressed program +# ---------------------------- + +NAME ?= DEMO +COMPRESSED ?= NO +ICON ?= iconc.png +DESCRIPTION ?= "C SDK Demo" + +# ---------------------------- + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/CEdev/examples/keypad_multiple_keys/readme.md b/frontends/calculator/CEdev/examples/keypad_multiple_keys/readme.md new file mode 100644 index 0000000..170f907 --- /dev/null +++ b/frontends/calculator/CEdev/examples/keypad_multiple_keys/readme.md @@ -0,0 +1,10 @@ +### Keypad Multiple Keys Demo + +This demo shows how to interpret multiple keypresses at the same time + +![Screenshot](screenshot.gif) + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/keypad_multiple_keys/screenshot.gif b/frontends/calculator/CEdev/examples/keypad_multiple_keys/screenshot.gif new file mode 100644 index 0000000..65ca1f8 Binary files /dev/null and b/frontends/calculator/CEdev/examples/keypad_multiple_keys/screenshot.gif differ diff --git a/frontends/calculator/CEdev/examples/keypad_multiple_keys/src/main.c b/frontends/calculator/CEdev/examples/keypad_multiple_keys/src/main.c new file mode 100644 index 0000000..fbe3ffa --- /dev/null +++ b/frontends/calculator/CEdev/examples/keypad_multiple_keys/src/main.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Function prototypes */ +void printText(int8_t xpos, int8_t ypos, const char *text); + +void main(void) { + /* Key variable */ + kb_key_t key; + const char *erase_string = " "; + + /* Clear the homescreen */ + os_ClrHome(); + + /* Loop until 2nd is pressed */ + do { + + /* Update kb_Data */ + kb_Scan(); + + key = kb_Data[7]; + + /* Print the current arrow key input */ + if (key & kb_Down) { + printText(0, 0, "Down"); + } else { + printText(0, 0, erase_string); + } + if (key & kb_Up) { + printText(0, 1, "Up"); + } else { + printText(0, 1, erase_string); + } + if (key & kb_Left) { + printText(0, 2, "Left"); + } else { + printText(0, 2, erase_string); + } + if (key & kb_Right) { + printText(0, 3, "Right"); + } else { + printText(0, 3, erase_string); + } + + } while (kb_Data[1] != kb_2nd); +} + +/* Draw text on the homescreen at the given X/Y location */ +void printText(int8_t xpos, int8_t ypos, const char *text) { + os_SetCursorPos(ypos, xpos); + os_PutStrFull(text); +} -- cgit v1.2.3-101-g0448