Keys
import "lib/key.nbl";
lib/key.nbl exposes the debounced KeyStatus and KeyReg values.
Key status bits
Constant |
Bit |
Meaning |
|---|---|---|
|
3 |
|
|
2 |
|
|
1 |
|
|
0 |
|
Reading KeyStatus clears JustPress. The *_of(status) helpers test an
already-read value.
Key codes
Physical button |
|
Helper |
|---|---|---|
|
0 |
|
|
1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
Codes 5 through 13 are not mapped by the library. key_name(code) returns a
flash string such as "OPCODE 8" or "UNKNOWN".
Functions
Call |
Returns |
Notes |
|---|---|---|
|
|
Read |
|
|
Read |
|
|
Test |
|
|
Test |
|
|
Test |
|
|
Test |
|
|
Read status and test |
|
|
Read status and test |
|
|
Read status and test |
|
|
Read status and test |
|
|
1 when |
|
|
Return key code 1 |
|
|
Return key code 2 |
|
|
Return key code 3 |
|
|
Return key code 4 |
|
|
Return key code 0 |
|
|
Block until |
|
|
Block for a press, then for its release; return the code |
|
|
Block until |
|
|
Flash string label for a confirmed code |