OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include "loader.h" | 26 #include "loader.h" |
27 | 27 |
28 #if defined(WITH_LIB_CONSOLE) | 28 #if defined(WITH_LIB_CONSOLE) |
29 #include <lib/console.h> | 29 #include <lib/console.h> |
30 #else | 30 #else |
31 #error "dartino app needs a console" | 31 #error "dartino app needs a console" |
32 #endif | 32 #endif |
33 | 33 |
34 void SensorsInit(void); | 34 void SensorsInit(void); |
35 | 35 |
36 int change_led_status(int, int); | |
37 | |
36 enum { | 38 enum { |
37 MODE_RUN, | 39 MODE_RUN, |
38 MODE_BURN | 40 MODE_BURN |
39 } dartino_mode; | 41 } dartino_mode; |
40 | 42 |
41 | 43 |
42 //////////////// Dart FFI setup /////////////////////////////////////////////// | 44 //////////////// Dart FFI setup /////////////////////////////////////////////// |
43 | 45 |
44 __WEAK status_t display_get_info(struct display_info *info) { | 46 __WEAK status_t display_get_info(struct display_info *info) { |
45 return ERR_NOT_FOUND; | 47 return ERR_NOT_FOUND; |
(...skipping 25 matching lines...) Expand all Loading... | |
71 DARTINO_EXPORT_TABLE_ENTRY("gfx_width", GetWidth) | 73 DARTINO_EXPORT_TABLE_ENTRY("gfx_width", GetWidth) |
72 DARTINO_EXPORT_TABLE_ENTRY("gfx_height", GetHeight) | 74 DARTINO_EXPORT_TABLE_ENTRY("gfx_height", GetHeight) |
73 DARTINO_EXPORT_TABLE_ENTRY("gfx_destroy", gfx_surface_destroy) | 75 DARTINO_EXPORT_TABLE_ENTRY("gfx_destroy", gfx_surface_destroy) |
74 DARTINO_EXPORT_TABLE_ENTRY("gfx_pixel", gfx_putpixel) | 76 DARTINO_EXPORT_TABLE_ENTRY("gfx_pixel", gfx_putpixel) |
75 DARTINO_EXPORT_TABLE_ENTRY("gfx_line", gfx_line) | 77 DARTINO_EXPORT_TABLE_ENTRY("gfx_line", gfx_line) |
76 DARTINO_EXPORT_TABLE_ENTRY("gfx_clear", gfx_clear) | 78 DARTINO_EXPORT_TABLE_ENTRY("gfx_clear", gfx_clear) |
77 DARTINO_EXPORT_TABLE_ENTRY("gfx_flush", gfx_flush) | 79 DARTINO_EXPORT_TABLE_ENTRY("gfx_flush", gfx_flush) |
78 DARTINO_EXPORT_TABLE_ENTRY("port_open", port_open) | 80 DARTINO_EXPORT_TABLE_ENTRY("port_open", port_open) |
79 DARTINO_EXPORT_TABLE_ENTRY("port_close", port_open) | 81 DARTINO_EXPORT_TABLE_ENTRY("port_close", port_open) |
80 DARTINO_EXPORT_TABLE_ENTRY("port_read", port_read) | 82 DARTINO_EXPORT_TABLE_ENTRY("port_read", port_read) |
83 DARTINO_EXPORT_TABLE_ENTRY("led_toggle", change_led_status) | |
Søren Gjesse
2016/02/09 09:16:01
Why is is called led_toggle when exported? Wouldn'
herhut
2016/02/09 10:10:15
Because it is so long and these turn into strings
| |
81 DARTINO_EXPORT_TABLE_END | 84 DARTINO_EXPORT_TABLE_END |
82 | 85 |
83 //////////////// Port debug /////////////////////////////////////////////////// | 86 //////////////// Port debug /////////////////////////////////////////////////// |
84 | 87 |
85 static void DumpPacket(const port_result_t* result) { | 88 static void DumpPacket(const port_result_t* result) { |
86 const port_packet_t* p = &result->packet; | 89 const port_packet_t* p = &result->packet; |
87 printf("[%02x %02x %02x %02x %02x %02x %02x %02x]\n", | 90 printf("[%02x %02x %02x %02x %02x %02x %02x %02x]\n", |
88 p->value[0], p->value[1], p->value[2], p->value[3], | 91 p->value[0], p->value[1], p->value[2], p->value[3], |
89 p->value[4], p->value[5], p->value[6], p->value[7]); | 92 p->value[4], p->value[5], p->value[6], p->value[7]); |
90 } | 93 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 .init = ServicesInit, | 178 .init = ServicesInit, |
176 .entry = NULL, | 179 .entry = NULL, |
177 .flags = 0, | 180 .flags = 0, |
178 APP_END | 181 APP_END |
179 | 182 |
180 STATIC_COMMAND_START | 183 STATIC_COMMAND_START |
181 STATIC_COMMAND("dartino", "dartino vm via tftp", &DartinoRunner) | 184 STATIC_COMMAND("dartino", "dartino vm via tftp", &DartinoRunner) |
182 STATIC_COMMAND_END(dartinorunner); | 185 STATIC_COMMAND_END(dartinorunner); |
183 | 186 |
184 // vim: set expandtab ts=2 sw=2: | 187 // vim: set expandtab ts=2 sw=2: |
OLD | NEW |