Update README for recent changes. Remove aliases.
This commit is contained in:
parent
68e062e2e0
commit
ca51937926
62
README.md
62
README.md
|
@ -82,7 +82,65 @@ Each element in the candidate list is compared against the partial condition. If
|
|||
|
||||
would return `( 150 200 )`, as no other elements fit the condition `(< 100 n)`.
|
||||
|
||||
# Pebble-Specific Functions
|
||||
There are several functions to access features of the Pebble itself.
|
||||
Note that due to some over-simplicity of function-handling, all of the following functions expect to receive two arguments, regardless of how many they actually use.
|
||||
|
||||
## Checking the Time
|
||||
There are several functions for fetching invidual elements of the current time
|
||||
- `sec` the current seconds (0-59)
|
||||
- `mnt` the current minutes (0-59)
|
||||
- `hr` the current hour (0-23)
|
||||
- `hrt` the current hour (1-12)
|
||||
|
||||
For example
|
||||
|
||||
`(mnt 0 0)`
|
||||
|
||||
would return 16, if called at 5:16
|
||||
|
||||
## Vibrating
|
||||
`vibe` calls the vibration engine to start, following a given pattern. The pattern should be a list, composed of alternating on/off durations, in milliseconds. For example
|
||||
|
||||
`(vibe (100 200 200 400 200 800) 0)`
|
||||
|
||||
would cause a sort of *Bz. Bzz. Bzzzz. Bzzzzzzzz.* pattern.
|
||||
|
||||
## Window Manipulation
|
||||
Basic Window and TextLayer manipulations are enabled in PebbLisp.
|
||||
|
||||
`cw` creates a blank window that can be manipulated by other functions. Note that `cw` does not itself display the window.
|
||||
|
||||
`pw` is the function responsible for pushing a window onto the stack. For example
|
||||
|
||||
`(def win (cw 0 0)) (pw win 0)`
|
||||
|
||||
Creates and pushes to the screen a blank white window. Note that windows can be exited by tapping the back button. Getting something useful to display requires the use of a TextLayer.
|
||||
|
||||
`atl` adds a text layer to the given window, and displays the given object as text. For example
|
||||
|
||||
`(def tl (atl win "Hello"))`
|
||||
|
||||
Adds a TextLayer to `ww` with the text "Hello", where `ww` is a Window created with `cw`. It also stores a reference to the TextLayer in `tl`, for later updates.
|
||||
|
||||
`utl` changes the text in a given TextLayer. For example
|
||||
|
||||
`(utl tl "Good-bye")`
|
||||
|
||||
changes the text in `tl` to "Good-bye", where `tl` is an existing TextLayer.
|
||||
|
||||
## Subscribing
|
||||
`sub` allows for a given lambda to be repeatedly called at a given time interval. More testing is needed, but it is possible that this lambda needs to be defined beforehand, instead of directly passed to `sub`. The lambda will likely fail if it requires arguments.
|
||||
|
||||
The first argument is the lambda to be called, and the second is an optional argument selecting the frequency of the repetition. If the second argument is any number 1-6, it will repeat every second, minute, hour, day, month, or year, respectively. If the argument is anything else, it will default to repeating every minute.
|
||||
|
||||
Subscribing currently has little use outside of window manipulation, as it's effects are hard to view outside of that environment. As an example
|
||||
|
||||
`(sub upwin 1)`
|
||||
|
||||
would request that `upwin` be run every second, where `upwin` is a lambda that does not rely on arguments.
|
||||
|
||||
# TODO
|
||||
- Call scripts from scripts
|
||||
- Call more pebble functions
|
||||
- Better script calling
|
||||
- Even more pebble functions
|
||||
- Maybe hard-code more built-in functions to ease up on memory use
|
||||
|
|
|
@ -466,8 +466,6 @@ static struct Environment pebbleEnv()
|
|||
addFunc("hrt", &getTwelveHours, &e);
|
||||
addFunc("vibe", &doVibe, &e);
|
||||
addFunc("sub", &subscribe, &e);
|
||||
parseEval("(def win (fn (a) (window a 1)))", &e);
|
||||
parseEval("(def s (fn (a) (sc a 0)))", &e);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue