You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](screenshot-documentations/screenshot-documentation-icon-of-application.png)
@@ -15,6 +17,8 @@ Installing is rather easy:
15
17
2. This Release page is not-yet ready, on this project, use [this folder instead](https://perso.crans.org/besson/publis/Numworks-apps/), and [this direct link](https://perso.crans.org/besson/publis/Numworks-apps/javascript.nwa) ;
16
18
3. Head to [my.numworks.com/apps](https://my.numworks.com/apps) to send the `nwa` file on your calculator (on Google Chrome browser). On [this page](https://my.numworks.com/python/lilian-besson-1/javascript) you will be able to also send a default example of a JavaScript file (a tiny test script), and you can edit it yourself later on, on your calculator!
17
19
20
+
----
21
+
18
22
## How to use the app
19
23
20
24
Just launch the app, and it will read and execute your script `javascript.py`!
@@ -42,42 +46,84 @@ To rebuild the two `espruino_embedded.c` and `espruino_embedded.h` files from Es
42
46
BOARD=EMBED RELEASE=1 V=1 make
43
47
```
44
48
49
+
Then remove these lines from the `espruino_embedded.c` file:
50
+
51
+
```c
52
+
typedefunsignedchar __u_char;
53
+
typedefunsignedshortint __u_short;
54
+
...
55
+
typedef__intmax_tintmax_t;
56
+
typedef__uintmax_tuintmax_t;
57
+
```
58
+
59
+
Copy the files you obtained to the `./src/javascript/` folder on this project (they are included, you shouldn't have to do this, unless you want to help me developping this!).
60
+
45
61
----
46
62
47
63
## Documentation of the `Eadk` module accessible in JavaScript on the NumWorks
48
64
49
65
Here is a short documentation for each function that I've ported from their interface in [`eadk.h`](https://github.com/numworks/epsilon/blob/master/eadk/include/eadk/eadk.h) to a working version in JavaScript.
50
66
51
-
### Eadk predefined colors
67
+
### ✅? Eadk predefined colors
52
68
`Eadk.color_black`, `Eadk.color_white`, `Eadk.color_red`, `Eadk.color_green`, `Eadk.color_blue` are the five predefined colors.
53
69
54
-
### Screen width and height
70
+
### ✅? Screen width and height
55
71
`Eadk.SCREEN_WIDTH` and `Eadk.SCREEN_HEIGHT` are the screen's width and height, respectively.
56
72
57
73
### ✅ Controlling the screen's brightness
58
74
#### ✅ `int Eadk.backlight_brightness()`
59
75
60
76
Returns the screen's brightness, it's a 8 bits integer (`uint8_t` in C), ranging between 0 (min brightness, screen almost shut down) to 240 (for max brightness).
TODO: I still haven't been able to define this one correctly, due to the `char* text` that I don't know how to declare in JSON (in the JSON to C process used by `jswrap_` to generate the corresponding C code).
102
+
103
+
### Timing
104
+
105
+
#### ✅? `void Eadk.timing_usleep(uint32_t us)`
106
+
107
+
Sleep for `us` micro-seconds
108
+
109
+
#### ✅? `void Eadk.timing_msleep(uint32_t ms)`
110
+
111
+
Sleep for `ms` micro-seconds
112
+
113
+
#### ❌ `uint64_t Eadk.timing_millis()`
114
+
115
+
Time since boot of the machine? Not clear. FIXME:
116
+
117
+
### Miscellanious
118
+
119
+
#### ❌ `bool Eadk.usb_is_plugged()`
120
+
121
+
Indicates whether the USB is plugging.
122
+
123
+
#### ✅? `uint32_t Eadk.random()`
124
+
125
+
Returns an almost truly random number, generated from the hardware RNG (a uint32_t, unsigned 32 bits integer).
126
+
81
127
82
128
### How to add new functions to Espruino JavaScript's `Eadk` module?
0 commit comments