SingingCat 0
application
userapp_vector.c
1#include "user_app_info.h"
2#include "api_version.h"
3int start(int MCULIBHANDLE, struct sc_firmware_api *api);
4void stop();
5void user_loop();
6int on_command_received(struct command *com);
7void on_new_node(struct hostroute *host);
8// return 0 if no error (otherwise error will be logged, userfirmware will not be called again)
9int start_and_init(int MCULIBHANDLE, struct sc_firmware_api *api);
10
11// the linker script includes special instructions to ensure this is at the beginning of the file
12struct userapp_info userapp_vector = {
13 .magic = 0x53435541, // "SCUA"
14 .length = 0,
15 .checksum = 0,
16 .version = 0,
17 .api_version = CNW_API_VERSION,
18 .pad2 = 0,
19 .base = &userapp_vector,
20 .start = &start_and_init,
21 .stop = &stop,
22 .user_loop = &user_loop,
23 .on_command_received = &on_command_received,
24 .on_new_node = &on_new_node,
25 .end_marker = 0,
26};
void on_new_node(struct hostroute *host)
called when and if a new node is detected. this may be used, to, for example to activate when a route...
Definition: userhooks.c:61
int start(int MCULIBHANDLE, struct sc_firmware_api *api)
this is called when the board powers up
Definition: userhooks.c:31
int on_command_received(struct command *com)
this is called for each command we receive
Definition: userhooks.c:53
void user_loop()
this is called frequently, but with no timing guarantees. essentially, it's called in the "idle-loop"...
Definition: userhooks.c:67
void(* stop)()
last thing to be called. no more userloops or irqs afterwards
int(* start)(int MCULIBHANDLE, struct sc_firmware_api *api)
guaranteed to be called by the firmware before any other functions
these are the callbacks available. the firmware "api". provided to the app on startup
Definition: user_app_info.h:29
this must be implemented by the userapp, stored in flash at the beginning of the file (offset 0)
user application interface