|
1 | 1 | #include "crt_stubs.h" |
2 | 2 | // #include <sys/time.h> // gettimeofday |
3 | 3 | #include <eadk.h> |
4 | | -#include "eadk_lib.h" |
| 4 | +// #include "eadk_lib.h" |
5 | 5 | #include "storage.h" |
6 | 6 | #include "espruino_embedded.h" |
7 | 7 |
|
@@ -33,22 +33,27 @@ void ejs_print(const char *str) { |
33 | 33 | // int main(int argc, char ** argv) { |
34 | 34 | int main() { |
35 | 35 |
|
| 36 | + printf("Embedded Espruino v0.0.1\n"); |
| 37 | + eadk_timing_msleep(1000); |
| 38 | + |
| 39 | + ejs_create(1000); |
| 40 | + struct ejs* ejs[1]; |
| 41 | + ejs[0] = ejs_create_instance(); |
| 42 | + |
| 43 | + printf("Reading from 'javascript.py' file...\n"); |
| 44 | + eadk_timing_msleep(1000); |
| 45 | + |
36 | 46 | // We read "javascript.py" |
37 | 47 | size_t file_len = 0; |
38 | 48 | const char * code_from_file = extapp_fileRead("javascript.py", &file_len); |
39 | 49 |
|
40 | 50 | // DONE: I wasn't able to compile while depending on external data, but it works if reading from a local 'javascript.py' file. |
41 | 51 | // const char * code = eadk_external_data; |
42 | 52 |
|
43 | | - const char * code = (code_from_file == NULL && file_len <= 0) ? "console.log(\"Hi from Lua interpreter! sleep(3s)\")\n// eadk.timing_msleep(3000)" : (code_from_file + 1); |
| 53 | + const char * code = (code_from_file == NULL && file_len <= 0) ? "console.log(\"\\nHi from JavaScript interpreter! sleep(3s)\")\n// eadk.timing_msleep(3000)\ntypeof(NaN)" : (code_from_file + 1); |
44 | 54 |
|
45 | | - ejs_create(1000); |
46 | | - struct ejs* ejs[1]; |
47 | | - ejs[0] = ejs_create_instance(); |
48 | | - // ejs[1] = ejs_create_instance(); |
49 | | - // printf("Embedded Espruino test.\n===========================\nTwo instances.\nType JS and hit enter, or type 'quit' to exit:\n0>"); |
50 | | - // int instanceNumber = 0; |
51 | | - printf("Embedded Espruino v0.0.1\nReading from 'javascript.py' file"); |
| 55 | + printf("Executing code...\n"); |
| 56 | + eadk_timing_msleep(1000); |
52 | 57 |
|
53 | 58 | JsVar *v = ejs_exec(ejs[0], code, false); |
54 | 59 | jsiConsolePrintf("=%v\n", v); |
|
0 commit comments