CypherCon Badge 3.0 Documentation

TYMKRS's Documentation for the CypherCon Badge 3.0

Basic Badge Operation

On the back side of the badge, near the edge, there are two softkeys.
The button labeled "Click to Power On" turns the badge on. The button labeled "Click to go / Hold to power off" is used to select apps, or turn the badge off.

When first powered on, the badge needs to initialize and will display "NOPRES" as a reminder to not press buttons until initialization is complete. When the badge is initialized and ready for use, the display will show "DONE", and then the default idle message will begin scrolling.

While the badge is in idle, you can start an app by pressing the app select softkey. The display will show "APPSEL", and you can select each of the apps by pressing the touchpad. When selecting an app, if the app is installed, it will be listed in the display. If the selected app is not installed, the display will show a row of bars. When the app is selected, you can press the # touchpad key to run the app, or you can press the app select softkey again to cancel app selection.

Each of the apps has an interface that is detailed in the individual app documentation. In general, the # touchpad key will activate, the * touchpad key will erase/clear, and the app select softkey will exit the app and return the badge to idle.

 


autodt - Automatic Range dialing with Term Logging

Description
AUTODT scans the network for carriers, logging each dialed number as carrier detected, or no carrier.

Operation
When the AUTODT app is started, an edit buffer is presented for entering the starting telephone number. When the dial command is given, AUTODT will dial the given number, determine if a carrier is on the other end, hang up, and then cycle to the next sequential phone number. AUTODT will only dial over the range of digits given in the edit buffer. For example, a three digit starting number will only cycle through three digit numbers before wrapping. The carrier status if a given phone number is logged in the terminal, and the touchpad lights will flash if a carrier is detected.

Touchpad

In Dialer Mode:
0-9 enters a telephone number digit.
* Backspace
# Starts autodialing
Softkey Hangs up the phone and exits the app.


blinken - Blinken Lights RGB LED Animation Controller

Description
BLINKEN is an editor/device combo used to control the RGB lights. Up to four particles can be programmed to move abount the badge, coloring the lights.

Operation
When the BLINKEN app is started, particle 0 is loaded into the edit buffer. The particles move about the badge in realtime. Storing copies the edit buffer over the specified particle slot. The RGB lights have several layers of brightness, and each particle has a simple oscillator that applies positive and/or negative brightness to the LED per pass.

Touchpad

0 moves to the next particle slot, and loads that particle into the edit buffer.
9 moves to the previous particle slot, and loads that particle into the edit buffer.
1 cycles through color modes (RGB)
2 cycles through the LED locations for the particle to start at
3 cycles through velocity, the number of positions the particle moves per step
4 cycles through velocity delay, how long before particle moves (in ~50ms increments), ie. the duration between velocity "steps"
5 cycles through waveforms that the particle applies, see Waveforms, below
6 cycles through lfo delay, how long before the waveform progresses (in ~50ms increments).
* clears the edit buffer particle, returning it to default state.
# stores the edit buffer back into the particle slot, causing it to activate.
Softkey exits the BLINKEN app.

Waveforms

OFF - Particle is deactivated, it does not move or color LEDs.
LOW - Particle only removes color (stuck LOW).
HIGH - Particle only adds color (stuck HIGH).
SQUARE - Particle oscillates in a square wave, alternately adding and subtracting color. Phase swaps every LFO Delay.
TRIANGLE - Particle oscillates in a triangle wave. The particle will add color at the peak, remove color at the trough, and do neither in the middle. The wave progresses through each phase state every LFO Delay.
SAW - Particle oscillates in a saw wave. The particle will subtract color at the trough, add color at the peak, and do neither in the middle. The wave progresses through each phase state every LFO Delay.

TBAS Supplement
If TBAS uses its IO Mode to execute the BLINKEN app interface, the FIFO is treated as a particle, and immediately activated.
The order of parameters is: [Particle #] [Position #] [Color Mask] [Velocity] [Velocity Delay] [LFO Enum] [LFO Delay].
The Color Mask is a binary value (0-7) with one bit per color, and any combination of colors can be present in the mask. 4=RED, 2=GREEN, 1=BLUE
The LFOs enumerations are: 1=LOW, 2=HIGH, 3=SQUARE, 4=TRIANGLE, 5=SAW, Else=OFF
The UI Editor limited Velocity Delay and LFO Delay values for practicality reasons, but TBAS can specify arbitrary delays for these parameters.
NOTE: BLINKEN numerals are binary values.


config - Badge Configuration and Theme Selection

Description
CONFIG manages badge configuration, and selection of preset themes for the RGB lights, ringtone, and default scroll messages.

Operation
When the CONFIG app is started, you can press the touch buttons to change the configuration of the badge.

Touchpad

1 cycles through modem passthrough. If passthrough is enabled, traffic received from the USB terminal is directed to the modem while the badge is not running an app. Otherwise, traffic received from the USB terminal is directed for app/device use (TBAS).
8 cycles through autoping. If autoping is enabled, the badge sends an enquiry byte upon modem carrier detect while the badge is not running an app. Otherwise, no extra bytes are transmitted on connection.

2 cycles through ringtones. This selection determines which score will play when a ring is detected. There are selections available for user programmed ringtones, as well as a TBAS programmed ringtone, and several presets.
3 cycles through blinken themes. This selection chooses from preset particle effects to drive the RGB lights.
4 cycles through scroller themes. The text selected here is displayed on the badge 7 segment display when the badge is idle. There are selections available for user programmed text, as well as TBAS programmed text, and several presets.

# and the Softkey both exit the CONFIG app.


dialer - Dialpad / Speakerphone

Description
DIALER handles incoming and outgoing voice calls.

Operation
The DIALER app has two modes of operation, dialing outgoing numbers, and answering incoming calls.
If there is an incoming call, the badge ringtone will play, and the touchpad lights will flash. The softkey can be used to answer the call and activate the speaker phone. Selecting the softkey again will hang up and exit the app.
If DIALER is started from the AppSelect menu, an edit buffer is presented, and the touchpad can be used to enter a telephone number. The # key will dial the number, and the softkey will hang up and exit the app.

Touchpad

In Dialer Mode:
0-9 enters a telephone number digit.
* Backspace
# Dials the displayed number.
Softkey Hangs up the phone and exits the app.

In Answer Mode:
Softkey Hangs up the phone and exits the app.


scroller - Calculator Text Scroller

Description
SCROLLER is an editor/device combo used to control the 7 Segment display. Several text scrolling effects can be created, such as static text, variable rate crawling, and even pingponging. The 7 Segment display shows various system and status messages during operation, and will display one of the SCROLLER themes while the badge is idle. Besides several presets, there is a theme available to display user specified text, and a theme to display TBAS programmed text.

Operation
When the SCROLLER app is started, an edit buffer is presented on both the 7 Segment Display and the terminal. Text can be entered via the touchpad or the terminal. A touchpad key is availble to turn on pingpong mode, which causes the text to reverse direction when it reaches either end. A touchpad key is available to add white space to the ends of the text, and another touchpad key controls the step rate that text is cycled across the display. A step rate of 0 is a static display, a rate of 1 is a slow crawl, and a rate of 6 steps a full window distance each time causing a swipe effect. The 7 Segment Display character set does not support all characters, you may need to get creative. Characters which are not supported are displayed as blanks.

Touchpad

0 moves the edit cursor right.
9 moves the edit cursor left.
5 cycles the current character upwards through the character set
6 cycles the current character downwards through the character set
4 activates pingpong mode
3 cycles the amount of white space to surround the text when displayed. You can also add white space to the edit buffer manually.
2 cycles the step rate for the text display.
* Backspace if buffer has text; otherwise, reloads the last stored edit buffer.
# Stores the edit buffer into the SCROLLER User theme, and automatically sets this theme as active.
Softkey exits the app

Terminal
Basic editing is provided via the terminal. In addition to text input, the following control keys are available:
^H/Backspace
Delete
^U Clear
^L Refresh
Return as per Touchpad #
^X as per Softkey

TBAS Supplement
If TBAS uses its IO Mode to execute the SCROLLER app interface, the FIFO is treated as text, copied into the TBAS Scroller theme, and the TBAS Scroller theme is automatically set active.


tbas - TBAS Interpreter

Description
TBAS is an interpreter for the TBAS language. TBAS belongs to a class of languages colloquially referred to as Turing Tarpits, for their computational minimalism.

Operation
The TBAS Interpreter is constantly executing, even when another app is running. The TBAS execution environment consists of a program containing single character operators, a data buffer of unsigned 8-bit variables to use as working memory, a global IO Mode, and a separate buffer of unsigned 8-bit variables that can be used as a FIFO or a FILO. Access to the data buffer is restricted to a single pointer, in the style of a 'tape'. The instruction pointer for the source code is referred to as eptr. The data buffer and data pointer are referred to as mcell[] and mptr.

Operators
> Advance mptr to the right one cell. The pointer will not advance beyond the end of the buffer, and it will not wrap.
< Retreat mptr to the left one cell. The pointer will not advance beyond the beginning of the buffer, and it will not wrap.
+ Increment the value in mcell[mptr]. The value will not increase beyond the maximum unsigned 8-bits, and it will not wrap.
- Decrement the value in mcell[mptr]. The value will not decrease beyond the minimum unsigned 8-bits, and it will not wrap.
[] This pair of operators indicates a looping construct. The open bracket evaluates the value of mcell[mptr], and the instructions inside the brackets are executed if the value is non-zero; otherwise, execution resumes after the corresponding close bracket. The close bracket ends the loop, and returns execution to the corresponding open bracket for reevaluation. These operators may be nested.
= Sets the IO Mode to the value of mcell[mptr]. For more about IO Modes, see below.
? Carries out the corresponding IO Mode operation using the current state of the execution environment, which may include the data buffer, data pointer, FIFO, FILO, etc.

IO Modes
The ? operator will trigger the behavior identified below, when the IO Mode is equal to the corresponding value.

0: Serial Console - Decimal Write
TBAS will write the value of mcell[mptr] to the serial console as a decimal value (eg. 123). If the serial console is not connected, this instruction is discarded.

1: Serial Console - Decimal Read
TBAS will read a decimal value from the serial console and store it in mcell[mptr]. Triggering this causes TBAS to stall until data is availabe on the console.

2: Serial Console - ASCII Write
TBAS will write the value of mcell[mptr] to the serial console as an ASCII value (eg. 'A'). If the serial console is not connected, this instruction is discarded.

3: Serial Console - ASCII Read
TBAS will read an ASCII value from the serial console and store it in mcell[mptr]. Triggering this causes TBAS to stall until data is available on the console.

4: Serial Modem - ASCII Write
TBAS will write the value of mcell[mptr] to the serial modem as an ASCII value.

5: Serial modem - ASCII Read
TBAS will read an ASCII value from the serial modem and store it in mcell[mptr]. Triggering this causes TBAS to stall until data is available from the modem.

6: Buffer Program
TBAS will clear the FIFO buffer, and then copy the currently executing TBAS program into the FIFO buffer.

7: Execute Task
TBAS will execute the app corresponding to the value of mcell[mptr], with the contents of the FIFO buffer as its arguments. This operation also clears the FIFO buffer.
# App Format of Arguments
0 TBAS [TBAS Program String...]
1 CONFIG N/A
2 TONEGN [Audio Score String...]
3 BLINKEN [Part#][Position][Color Mask][Vel][Vel Delay][LFO][LFO Delay]
4 SCROLLER [PingPong][Steps][Blanks][Message String...]
5 TBASED [TBAS Program String...]
6 TBASCL [TBAS Program String...]
7 UNUSED N/A
8 WAR DIALER N/A
9 DIALER N/A

8: Buffer Enqueue
TBAS will enqueue the value of mcell[mptr] to the FIFO/FILO buffer. If the buffer is full, this instruction is discarded.

9: Buffer Dequeue - FILO
TBAS will treat the FIFO/FILO buffer as a stack, and pop the last value into mcell[mptr]. If the stack is empty, this instruction stores zero instead.

10: Buffer Dequeue - FIFO
TBAS will treat the FIFO/FILO buffer as a queue, and dequeue the first value into mcell[mptr]. If the queue is empty, this instruction stores zero instead.

11: Buffer Clear
TBAS will clear the FIFO/FILO buffer, returning it to the empty state.

12: Converter - Lower Case ASCII Enumeration
TBAS will convert numeric values (0-25) in mcell[mptr] to lower case ASCII. Values outside of the specified range are unconverted.

13: Converter - Upper Case ASCII Enumeration
TBAS will convert numeric values (0-25) in mcell[mptr] to upper case ASCII. Values outside of the specified range are unconverted.

14: Converter - ASCII Numeral
TBAS will convert numeric values (0-9) in mcell[mptr] to ASCII decimals ('0'-'9'). Values outside of the specified range are unconverted.

15: Converter - TBAS Enumeration
TBAS will map numeric values (0-7) in mcell[mptr] to the TBAS operators (+-<>[]=?). Values outside of the specified range are unconverted.

16: ALU - Add
mcell[mptr] + dequeue(FIFO) -> mcell[mptr]. The value is clamped to unsigned 8-bit and will not wrap.

17: ALU - Sub
mcell[mptr] - dequeue(FIFO) -> mcell[mptr]. The value is clamped to unsigned 8-bit and will not wrap.

18: ALU - Mul
mcell[mptr] * dequeue(FIFO) -> mcell[mptr]. The value is clamped to unsigned 8-bit and will not wrap.

19: ALU - Div
mcell[mptr] / dequeue(FIFO) -> mcell[mptr]. The value is clamped to unsigned 8-bit and will not wrap. If the divisor is zero, the instruction is discarded without action.

20: ALU - Bit And
mcell[mptr] & dequeue(FIFO) -> mcell[mptr].

21: ALU - Bit Or
mcell[mptr] | dequeue(FIFO) -> mcell[mptr].

22: ALU - Logical Not
TBAS will normalize and invert the logical value of mcell[mptr].

23: ALU - Bit Xor
mcell[mptr] ^ dequeue(FIFO) -> mcell[mptr].

24: Meta - Get MPTR
TBAS will store the value of mptr into mcell[mptr]. Note that MPTR can be larger than the 8-bit mcells, in which case you only get the lower 8-bits.

25: Meta - Get EPTR
TBAS will store the value of the (instruction execution pointer + 1) into mcell[mptr]. Note that EPTR can be larger than the 8-bit mcells, in which case you only get the lower 8-bits.

26: Meta - Relative Jump Left
TBAS will decrease the instruction execution pointer by mcell[mptr]. The value is clamped to the length of the source.

27: Meta - Relative Jump Right
TBAS will increase the instruction execution pointer by mcell[mptr]. The value is clamped to the length of the source.

Example Programs

+++[?-] Prints "321" to the serial console.
++=++++++[->++++++++<]>+?+?+? Prints "ABC" to the serial console.
++++++++++++=>?<++=>>++++++++?<<------=>?>?>+++++++=[-]++? Plays "A8" via the ToneGn exec interface

Hello World is left as an exercise for the reader :|


tbascl - TBAS Command Line Editor

Description
TBASCL is an editor for TBAS that uses the command line for editing. The primary goal is to provide a simple mechanism to load tbas programs that have been edited or stored off-badge.

Operation
When the TBASCL app is started, the usb serial terminal displays the currently executing TBAS program for reference, followed by the edit buffer. The edit buffer is also displayed on the 7 segment display. Terminal cursor control is not supported, the cursor is located at the end of the edit buffer.

Keys

^H/Backspace removes the character under the cursor.
^L repaints the display.
^U clears the entire edit buffer.
<CR> commands TBAS to execute the program in the current edit buffer, and exits the TBASCL app.
^X exits the TBASCL app without running the edited program.
All other printable keys are used to fill the edit buffer.

Additionally the HASH touchpad and softkey can be used to run or cancel the editing, in the same manner as TBASED.

TBAS Supplement
If TBAS uses its IO Mode to execute the TBASCL app interface, the FIFO is treated as source code and run. In this way, TBAS can self-load new programs.


tbased - TBAS Touchpad Editor

Description
TBASED is an editor for TBAS that uses the touchpad for editing.

Operation
When the TBASED app is started, the edit buffer is displayed on the 7 segment display, with the cursor identified by a blinking decimal point. Additionally, the usb serial terminal displays the currently executing TBAS program for reference, along with the edit buffer. Although the serial terminal displays editor information, editing must be done with on the badge via the touchpad and softkey.

Keys
0 and 9 are the cursor keys, moving the cursor through the edit buffer.
1 Inserts a '['
2 Inserts a ']'
3 Inserts a '<'
4 Inserts a '>'
5 Inserts a '+'
6 Inserts a '-'
7 Inserts a '='
8 Inserts a '?'
* Backspace. If the buffer is empty, the currently executing TBAS program is reloaded into the edit buffer.
# Commands TBAS to execute the program in the current edit buffer, and exits the TBASED app.
The softkey is used to exit the TBASED app without running the edited program.

TBAS Supplement
If TBAS uses its IO Mode to execute the TBASED app interface, the FIFO is treated as source code and run. In this way, TBAS can self-load new programs.


tonegn - Tone Generator

Description
TONEGN is an editor/device combo used to create scores that generate tones on the internal speaker. This can include musical notes, and various telephony tones. There are three audio channels available for use. Musical notes can be generated on any of the three channels (voice selection), while the telephony tones always use the last two channels. Polyphony can be achieved by assigning different tones to each audio channel. Synchronization is achieved during playback by processing the score until a tone needs to be generated on a non-idle audio channel, at which point the score is suspended until the necessary audio channel is available.

Operation
When the TONEGN app is started, the usb serial terminal displays the most recent TONEGN score for reference, followed by the edit buffer. The edit buffer is also diplayed on the 7 segment display. The cursor is indicated by a blinking decimal point on the 7 segment display.
There are two slots available to save user generated scores to. You can change your ringtone to one of these slots using the Config App.

Touchpad

0 moves the cursor right.
9 moves the cursor left.
8 toggles between save slots, and loads the score from the specified slot.
3 cycles through (T)empo, (O)ctave, (V)oice, (P)hreak, and (])Sync
4 cycles through the musical notes A-G, and (R)est
5 cycles through the numerals 0-9, (>)sharp, and (<)flat.
1 Inserts a blank space. Spaces are ignored during playback, but adding spaces can be useful for formatting, or insert notes into existing scores.
* Backspace. If the edit buffer is empty, the score is loaded from the save slot.
# commands TONEGN to playback the score, and saves the edit buffer.
Softkey exits the TONEGN app.

Keys

^H/<Backspace> removes the character under the cursor.
<Del> removes the character under the cursor.
^L repaints the display.
^U clears the entire edit buffer.
<CR> commands TONEGN to playback the score, and saves the edit buffer.
^X exits the TONEGN app.
All other printable keys are used to fill the edit buffer. Unrecognized characters in the score are ignored during playback.

TONEGN Little Language

Score (TOVP]):
T### (Tempo control) 'T' followed by a number sets the score playback tempo in bpm. Range is 60-170bpm. If the specified bpm is out of range or unrecognized, playback defaults to 120bpm.
O# (Octave control) 'O' followed by a number sets the global octave variable, which controls musical note generation. Range is 0-9. Defaults to 4 (middle C).
V# (Voice selection) 'V' followed by a number selects one of the audio channel for musical note generation. Range is 0-2. Unrecognized channels have no effect. Triggered tones (Phreaking/Telephony) always play on channels 1 and 2, regardless of voice selection.
P## (Phreak) 'P' followed by a number generates one of the telephony tone triggers on channels 1 and 2.
] (Sync) Stalls the all audio channels are idle.

Music (ABCDEFGR)
A-G (Musical notation) any of the musical notes followed by an optional modifier (sharp/flat) and a number generates the given musical note belonging to the global octave variable, for the given duration. The character '>' denotes sharp, whereas '<' denotes flat. The given duration is interpreted as 1 = whole note, 2 = half note, 3 = triplet, 4 = quarter note, 8 = eigth note. Other durations are undefined behavior.
R# (Rest) 'R' followed by a duration silences the audio channel for the given duration. The durations are the same as for musical notation above.

Numeric (0123456789><)
Numerals are used to specify the different values and durations for score and tonegen commands.
> (Sharp) sharps a musical note. Invalid when used with other commands. Can be used more than once. Have fun.
< (Flat) flats a musical note. Invalid when used with other commands. Can be used more than once. Ditto.

Phreak Triggers
00-14 DTMF Operator Tones (1, 2, 3, 4, 5, 6, 7, 8, 9, 0/10, 11/ST3, 12/ST2, KP, KP2, ST)
15-30 DTMF Touch Tones (1, 2, 3, 4, 5, 6, 7, 8, 9, 0, *, #, A, B, C, D)
31 Trunk
32 International Trunk
33 International Trunk (Solo)
34-40 Special Information Tones (ROp, VC, NCp, IC, ROpp, NCpp, IO, Future)
41 Coin (5 cents)
42 Coin (10 cents)
43 Coin (25 cents)

Examples

Score for a single channel song (first 4 bars of Twinkle Twinkle Little Star)
C4C4G4G4A4A4G2F4F4E4E4D4D4C2

Score for a polyphonic C chord
C1V1E1V2G1

Score for DTMF dial tones
P22P20P21P19P17P24P23

TBAS Supplement
If TBAS uses its IO Mode to execute the TONEGN app interface, the FIFO is treated as a score which is saved in a separate TBAS slot. The ringtone theme is automatically changed to the TBAS slot, and the score is immediately played. You can also change your ringtone to use the TBAS save slot at any time via the Config App.
NOTE: TONEGN score numerals are ASCII text.

 

GITHUB

https://github.com/Wireb/badge_bus/wiki