diff options
| author | 2019-04-10 15:14:00 -0400 | |
|---|---|---|
| committer | 2019-04-10 15:14:00 -0400 | |
| commit | 60699af63f92f43cc4b4b9e3050fcdd2a8468281 (patch) | |
| tree | 20a18af2774daa43ae7f4352dd032a24f7e06075 /frontends/calculator/CEdev/examples/keypad_multiple_keys | |
| parent | 4527bc20241068731c62101d0467d416119ec0c4 (diff) | |
| download | cetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.tar.gz cetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.tar.bz2 cetris-60699af63f92f43cc4b4b9e3050fcdd2a8468281.zip | |
add opengl fronend, remove sdl frontend, refactor build system
Diffstat (limited to 'frontends/calculator/CEdev/examples/keypad_multiple_keys')
5 files changed, 147 insertions, 0 deletions
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 + + + +--- + +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 Binary files differnew file mode 100644 index 0000000..65ca1f8 --- /dev/null +++ b/frontends/calculator/CEdev/examples/keypad_multiple_keys/screenshot.gif 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 <stdbool.h> +#include <stddef.h> +#include <stdint.h> +#include <tice.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <keypadc.h> + +/* 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); +} |