SingingCat 0
application
|
Files | |
file | user_app_info.h |
user application interface | |
Data Structures | |
struct | sc_firmware_api |
these are the callbacks available. the firmware "api". provided to the app on startup More... | |
struct | userapp_info |
this must be implemented by the userapp, stored in flash at the beginning of the file (offset 0) More... | |
Typedefs | |
typedef struct sc_firmware_api | _sc_firmware_api |
these are the callbacks available. the firmware "api". provided to the app on startup | |
typedef struct userapp_info | _userapp_info_t |
this must be implemented by the userapp, stored in flash at the beginning of the file (offset 0) | |
typedef void(* | cpkt_callback) (struct command *com, struct command *reply) |
typedef void(* | irq_callback) (void) |
typedef int | MCULIB_HANDLE |
typedef void(* | pin_irq_callback) (int pin) |
typedef void(* | serial_recv_callback) (int port, uint8_t b) |
Variables | |
uint32_t | api_version |
int(* | atoi )(const char *s) |
void * | base |
uint32_t | build_timestamp |
uint32_t | checksum |
void(* | com_add_arg )(struct command *com, const char *format,...) |
add an argument to the command using a format strings (see printf) More... | |
int(* | com_add_binary_arg )(struct command *com, const int len, const uint8_t *buf) |
add an argument to a command with an arbitrary length returns 0 if ok, otherwise errorcode More... | |
void(* | com_add_varg )(struct command *com, const char *format, va_list args) |
add an argument to the command using vargs More... | |
struct command *(* | com_alloc )() |
allocate a new command (for sending out) More... | |
int(* | com_deliver_command )(struct command *com, cpkt_callback) |
queue a command for sending. This is asynchronous, transmission will be retried and re-routed as necessary. Do not modify the command buffer until it has been sent successfully. Use the callback to track progress More... | |
void(* | com_free )(struct command *com) |
free a command More... | |
const char *(* | com_get_arg )(const struct command *com, int index) |
extract an argument from a command by index. Note: The returned string is guaranted to be NUL-terminated, but the argument might itself contain NUL bytes. Use com_get_arg_size() to get the length of the returned argument unless you can guarantee the argument does not contain NUL-Bytes More... | |
int(* | com_get_arg_size )(const struct command *com, int index) |
get size (in bytes) of an argument by index More... | |
struct command *(* | com_get_data_reply )(struct command *com) |
allocate command suitable for sending as reply More... | |
const char *(* | com_get_named_arg )(struct command *com, const char *name) |
extract an argument from a command by name (assuming argument is of the form key=value) More... | |
int(* | com_get_named_arg_uint16 )(struct command *com, const char *name, uint16_t *result) |
0 == ok, otherwise error. if OK, value will be stored in "result" More... | |
int(* | com_get_named_arg_uint32 )(struct command *com, const char *name, uint32_t *result) |
0 == ok, otherwise error. if OK, value will be stored in "result" More... | |
int(* | com_send_command )(struct command *com) |
int(* | com_send_reply_with_args )(struct command *com, uint8_t flags, const char *format,...) |
send a reply together with arguments More... | |
void(* | debugf )(const char *format,...) |
print a message on console/usb (only) More... | |
void * | end_marker |
int(* | get_config_flag )(int flag) |
get a userconfig flag (0..n) More... | |
int(* | hijack_esp32_usart )(void(*receive_hook)(uint8_t received)) |
hijack the esp32 serial port More... | |
void(* | hijack_esp32_usart_stop )(void) |
hijack the esp32 serial port More... | |
int(* | hijack_usb_acm )(void(*receive_hook)(uint8_t *received, int size)) |
"hijack" the usb port. this means the firmware will neither send bytes through the port nor process inbound bytes from it. instead it will send them to the userapp inbound bytes will be send to the receive_hook returns 0 if successful More... | |
void(* | led_blink )(int colour, int brightness, int on, int off) |
set the led to a certain colour or blink. to set a solid colour set off==0 More... | |
uint32_t | length |
uint32_t | magic |
int(* | mcu_set_speed )(int MCULIBHANDLE, int speed) |
change cpu speed - sometimes we need to be guaranteed to be fast. speed [1==very fast ... 10 == very slow] returns 0 if ok, otherwise errorcode More... | |
int(* | mculib_adc_enable )(MCULIB_HANDLE handle, int pin) |
int(* | mculib_adc_get_resolution )(MCULIB_HANDLE handle, int pin) |
int(* | mculib_adc_read )(MCULIB_HANDLE handle, int pin, int *result) |
int(* | mculib_adc_read_once )(MCULIB_HANDLE handle, int pin, int *result) |
long(* | mculib_get_seconds_since_boot )(void) |
get number of seconds elapsed since boot or power-up this counter is usually ever-increasing and roughly 1sec. More... | |
uint8_t(* | mculib_has_time_passed )(int secs_to_wait, long *ctr) |
int(* | mculib_pin_get )(MCULIB_HANDLE handle, int pinnum) |
get current pin level (high or low) this is a bit funny: 0 or 1 indicate the pin level. anything else is an error More... | |
int(* | mculib_pin_in )(MCULIB_HANDLE handle, int pinnum, int speed, int mode) |
configure and enable an IO-Pin as input note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn callback is optional. if non-null an IRQ will be enabled on this pin More... | |
int(* | mculib_pin_in_callback )(MCULIB_HANDLE handle, pin_irq_callback pic) |
set a callback to be called whenever a pin irq is triggered More... | |
int(* | mculib_pin_out )(MCULIB_HANDLE handle, int pinnum, int speed) |
configure and enable an IO-Pin as output note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn More... | |
int(* | mculib_pin_out_opendrain )(MCULIB_HANDLE handle, int pinnum, int speed) |
configure and enable an IO-Pin as output note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn More... | |
int(* | mculib_pin_release )(MCULIB_HANDLE handle, int pinnum) |
deconfigure a pin (MCULIB_HANDLE handle,used for a different purpose) More... | |
int(* | mculib_pin_set )(MCULIB_HANDLE handle, int pinnum, int highlow) |
set IOPin to high or low More... | |
int(* | mculib_serialport_disable )(MCULIB_HANDLE handle, int portnum) |
int(* | mculib_serialport_enable )(MCULIB_HANDLE handle, int portnum, int baudrate) |
configure a serial port with specified parameters num == 1..n (depending on mcu) baudrate == ... 8N1 no flow control Port #3 is a good choice (PB10:TX, PB11:RX) More... | |
int(* | mculib_serialport_write_char )(MCULIB_HANDLE handle, int portnum, uint8_t b) |
write to serial port More... | |
int(* | mculib_serialport_write_string )(MCULIB_HANDLE handle, int port, const char *txt) |
write a string to serial port More... | |
int(* | mculib_spi_disable )(MCULIB_HANDLE handle, int portnum) |
disable the spi port More... | |
int(* | mculib_spi_master_enable3 )(MCULIB_HANDLE handle, int portnum, uint8_t wide, uint8_t clkpol, uint8_t cpha, uint8_t dir, uint32_t baud_in_khz) |
enable a spi port as master and set clkpol, cpha and width (wide=0 8bit, wide=1 16bit)(dir == 0=RW,1=RO,2=WO) More... | |
int(* | mculib_spi_read16_only )(MCULIB_HANDLE handle, int portnum, uint16_t *read) |
there are weird devices, like tli4970, which aren't really spi. they basically start sending as soon as CS is on More... | |
int(* | mculib_spi_send_dma )(MCULIB_HANDLE handle, int portno, void *data, uint32_t size, uint32_t flags) |
int(* | mculib_spi_speed )(MCULIB_HANDLE handle, int portnum, long khz) |
set the spi speed (after it's open and running) returns new speed or 0 if failure More... | |
int(* | mculib_spi_write_and_read )(MCULIB_HANDLE handle, int portnum, const uint16_t write, uint16_t *read) |
write a byte and read from spi if a transmission is already in progress it waits. this writes and waits for a complete transmission. then it reads and waits for a complete transmission. So it's somewhat slower than just writing note: If the spi is in 8bit mode, this will ONLY transmit and read 8 Bit! More... | |
int(* | mculib_spi_write_only )(MCULIB_HANDLE handle, int portnum, const uint16_t write) |
write a byte, discard the read if a transmission is already in progress wait until transmission is done. this writes a byte to spi. It does not wait for completion, but returns immediately. More... | |
int(* | mculib_timer_attach_pin_pwm )(MCULIB_HANDLE handle, int timer, int pin) |
int(* | mculib_timer_disable )(MCULIB_HANDLE handle, int timer) |
int(* | mculib_timer_enable_simple )(MCULIB_HANDLE handle, int timer, int freq, irq_callback callback) |
int(* | mculib_timer_set_pwm )(MCULIB_HANDLE handle, int timer, int pin, uint16_t dutycycle) |
void *(* | memset )(void *buf, int c, size_t n) |
int(* | on_command_received )(struct command *com) |
this is called for each command we receive More... | |
void(* | on_new_node )(struct hostroute *host) |
called when and if a new node is detected. this may be used, to, for example detect a route to the cloud More... | |
uint32_t | pad2 |
void(* | pin_pwm )(int MCULIBHANDLE, int pin, uint32_t newstate, int flags) |
pwm a pin (mosfets, and some other pins as well) More... | |
void(* | printf )(const char *format,...) |
print a message on console and possibly forward to server into logfile as well (uses radio - expensive operation) More... | |
int(* | proto_buf_to_struct )(void *buf, int bufsize, void *iter, void *out) |
decode a buffer containing a serialised proto into a struct More... | |
void(* | proto_release )(void *buf) |
release a proto struct More... | |
int(* | proto_struct_to_buf )(void *buf, int bufsize, void *iter, void *in) |
encode a struct to a buffer. returns number of bytes written. (-1 for error) More... | |
uint32_t | repoid |
void(* | reset_module )(void) |
reset the module (this does not return); More... | |
void(* | reset_userapp )(void) |
reset the userapp More... | |
int(* | send_via_usb_acm )(uint8_t *buf, int size) |
once a usb_acm is "hijacked", the userapp can send bytes through the usb_acm port with this function - returns 0 if successful More... | |
struct sensorruntime *(* | sensor_get_runtime_by_index )(int idx) |
get a specific sensor runtime by index. index is a local (to this module) index More... | |
int(* | sensor_register )(struct sensordev *sensor) |
register a new sensor. returns 0 if ok More... | |
int(* | snprintf )(char *buf, size_t size, const char *format,...) |
int(* | start )(int MCULIBHANDLE, struct sc_firmware_api *api) |
guaranteed to be called by the firmware before any other functions More... | |
void(* | stop )() |
last thing to be called. no more userloops or irqs afterwards More... | |
int(* | strcmp )(const char *c1, const char *c2) |
size_t(* | strlen )(const char *txt) |
char *(* | strncpy )(char *dst, const char *src, size_t size) |
void(* | time_bcd_to_timestruct )(uint32_t bcd_time, uint32_t bcd_date, struct sctime *out) |
convert BCDTime and BCDDate to timestruct More... | |
int(* | time_get_diff )(struct sctime *time1, struct sctime *time2) |
calculate seconds between two time structs More... | |
int(* | time_get_localtime_as_struct )(struct sctime *time) |
get the current time as time struct (return 0 if ok, otherwise error) More... | |
int(* | timer_softirq )(uint32_t hertz, uint32_t opaque, void(*callback)(uint32_t)) |
a very simple, not-very-accurate softirq callback. May be called multiple times returns 0 if ok, otherwise error More... | |
int(* | unhandled_call1 )() |
safety call, terminates the app More... | |
int(* | unhandled_call2 )() |
safety call, terminates the app More... | |
int(* | unhandled_call3 )() |
safety call, terminates the app More... | |
int(* | unhandled_call4 )() |
safety call, terminates the app More... | |
int(* | unhandled_call5 )() |
safety call, terminates the app More... | |
int(* | unhandled_call6 )() |
safety call, terminates the app More... | |
int(* | unhandled_call7 )() |
safety call, terminates the app More... | |
int(* | unhandled_call8 )() |
safety call, terminates the app More... | |
void(* | user_loop )() |
this is called frequently, but with no timing guarantees. essentially, it's called in the "idle-loop" of the mcu More... | |
int(* | user_serialport_callback )(MCULIB_HANDLE handle, int portnum, serial_recv_callback cb) |
set callback for serialport receive irq More... | |
int(* | userconfig_copy )(uint8_t *buf, uint16_t bufsize, uint16_t *actual_size) |
this copies the userconfig into a ram buffer, IF the version has been updated and IF the destination buffer is large enough. actual_size (if NOT NULL) will contain the actual size of bytes once this completes without an error RETURN VALUE: 0==ok, anything else is an error (same version is not an error) More... | |
uint32_t(* | userconfig_size )() |
the userconfig: this is a little unstructured piece of flash set aside for configuration of userapps. note that this is updated at any time. If the userapp reads flash from interrupts the flash might change between invokations. if that is a problem the app should copy the contents into ram from the userloop. More... | |
uint32_t(* | userconfig_version )() |
each time the config is updated, the version is incremented. in other words, unless the version is changed, the data remains the same More... | |
int(* | userconfig_write )(uint8_t *buf, uint32_t size) |
this saves a buf as "userconfig" RETURN VALUE: 0==ok, anything else is an error (same version is not an error) More... | |
int | version |
uint32_t | version |
int(* | vsnprintf )(char *buf, size_t size, const char *format, va_list args) |
Definition at line 25 of file user_app_info.h.
typedef void(* irq_callback) (void) |
Definition at line 23 of file user_app_info.h.
typedef int MCULIB_HANDLE |
Definition at line 21 of file user_app_info.h.
typedef void(* pin_irq_callback) (int pin) |
Definition at line 22 of file user_app_info.h.
typedef void(* serial_recv_callback) (int port, uint8_t b) |
Definition at line 24 of file user_app_info.h.
uint32_t api_version |
Definition at line 401 of file user_app_info.h.
int(* atoi) (const char *s) |
Definition at line 198 of file user_app_info.h.
void* base |
Definition at line 404 of file user_app_info.h.
uint32_t build_timestamp |
Definition at line 406 of file user_app_info.h.
uint32_t checksum |
Definition at line 397 of file user_app_info.h.
void(* com_add_arg) (struct command *com, const char *format,...) |
add an argument to the command using a format strings (see printf)
Definition at line 160 of file user_app_info.h.
int(* com_add_binary_arg) (struct command *com, const int len, const uint8_t *buf) |
add an argument to a command with an arbitrary length returns 0 if ok, otherwise errorcode
Definition at line 309 of file user_app_info.h.
void(* com_add_varg) (struct command *com, const char *format, va_list args) |
add an argument to the command using vargs
Definition at line 164 of file user_app_info.h.
struct command *(* com_alloc) () |
allocate a new command (for sending out)
Definition at line 164 of file user_app_info.h.
int(* com_deliver_command) (struct command *com, cpkt_callback) |
queue a command for sending. This is asynchronous, transmission will be retried and re-routed as necessary. Do not modify the command buffer until it has been sent successfully. Use the callback to track progress
Definition at line 180 of file user_app_info.h.
void(* com_free) (struct command *com) |
free a command
Definition at line 266 of file user_app_info.h.
const char *(* com_get_arg) (const struct command *com, int index) |
extract an argument from a command by index. Note: The returned string is guaranted to be NUL-terminated, but the argument might itself contain NUL bytes. Use com_get_arg_size() to get the length of the returned argument unless you can guarantee the argument does not contain NUL-Bytes
Definition at line 152 of file user_app_info.h.
int(* com_get_arg_size) (const struct command *com, int index) |
get size (in bytes) of an argument by index
Definition at line 156 of file user_app_info.h.
allocate command suitable for sending as reply
Definition at line 164 of file user_app_info.h.
const char *(* com_get_named_arg) (struct command *com, const char *name) |
extract an argument from a command by name (assuming argument is of the form key=value)
Definition at line 146 of file user_app_info.h.
int(* com_get_named_arg_uint16) (struct command *com, const char *name, uint16_t *result) |
0 == ok, otherwise error. if OK, value will be stored in "result"
Definition at line 232 of file user_app_info.h.
int(* com_get_named_arg_uint32) (struct command *com, const char *name, uint32_t *result) |
0 == ok, otherwise error. if OK, value will be stored in "result"
Definition at line 228 of file user_app_info.h.
int(* com_send_command) (struct command *com) |
one-shot send of a command (no redelivery attempted). command must be freed after this function returns.
Definition at line 216 of file user_app_info.h.
int(* com_send_reply_with_args) (struct command *com, uint8_t flags, const char *format,...) |
send a reply together with arguments
Definition at line 176 of file user_app_info.h.
void(* debugf) (const char *format,...) |
print a message on console/usb (only)
Definition at line 32 of file user_app_info.h.
void* end_marker |
Definition at line 436 of file user_app_info.h.
int(* get_config_flag) (int flag) |
get a userconfig flag (0..n)
Definition at line 212 of file user_app_info.h.
int(* hijack_esp32_usart) (void(*receive_hook)(uint8_t received)) |
hijack the esp32 serial port
Definition at line 333 of file user_app_info.h.
void(* hijack_esp32_usart_stop) (void) |
hijack the esp32 serial port
Definition at line 345 of file user_app_info.h.
int(* hijack_usb_acm) (void(*receive_hook)(uint8_t *received, int size)) |
"hijack" the usb port. this means the firmware will neither send bytes through the port nor process inbound bytes from it. instead it will send them to the userapp inbound bytes will be send to the receive_hook returns 0 if successful
Definition at line 324 of file user_app_info.h.
void(* led_blink) (int colour, int brightness, int on, int off) |
set the led to a certain colour or blink. to set a solid colour set off==0
Definition at line 205 of file user_app_info.h.
uint32_t length |
Definition at line 395 of file user_app_info.h.
uint32_t magic |
Definition at line 393 of file user_app_info.h.
int(* mcu_set_speed) (int MCULIBHANDLE, int speed) |
change cpu speed - sometimes we need to be guaranteed to be fast. speed [1==very fast ... 10 == very slow] returns 0 if ok, otherwise errorcode
Definition at line 316 of file user_app_info.h.
int(* mculib_adc_enable) (MCULIB_HANDLE handle, int pin) |
Definition at line 138 of file user_app_info.h.
int(* mculib_adc_get_resolution) (MCULIB_HANDLE handle, int pin) |
Definition at line 137 of file user_app_info.h.
int(* mculib_adc_read) (MCULIB_HANDLE handle, int pin, int *result) |
Definition at line 139 of file user_app_info.h.
int(* mculib_adc_read_once) (MCULIB_HANDLE handle, int pin, int *result) |
Definition at line 136 of file user_app_info.h.
long(* mculib_get_seconds_since_boot) (void) |
get number of seconds elapsed since boot or power-up this counter is usually ever-increasing and roughly 1sec.
Definition at line 94 of file user_app_info.h.
uint8_t(* mculib_has_time_passed) (int secs_to_wait, long *ctr) |
Definition at line 89 of file user_app_info.h.
int(* mculib_pin_get) (MCULIB_HANDLE handle, int pinnum) |
get current pin level (high or low) this is a bit funny: 0 or 1 indicate the pin level. anything else is an error
Definition at line 84 of file user_app_info.h.
int(* mculib_pin_in) (MCULIB_HANDLE handle, int pinnum, int speed, int mode) |
configure and enable an IO-Pin as input note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn callback is optional. if non-null an IRQ will be enabled on this pin
Definition at line 67 of file user_app_info.h.
int(* mculib_pin_in_callback) (MCULIB_HANDLE handle, pin_irq_callback pic) |
set a callback to be called whenever a pin irq is triggered
Definition at line 71 of file user_app_info.h.
int(* mculib_pin_out) (MCULIB_HANDLE handle, int pinnum, int speed) |
configure and enable an IO-Pin as output note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn
Definition at line 56 of file user_app_info.h.
int(* mculib_pin_out_opendrain) (MCULIB_HANDLE handle, int pinnum, int speed) |
configure and enable an IO-Pin as output note: pinnum are sequential 0-99 are PAnn, 100-199 are PBnn, 200-299 are PCnn
Definition at line 61 of file user_app_info.h.
int(* mculib_pin_release) (MCULIB_HANDLE handle, int pinnum) |
deconfigure a pin (MCULIB_HANDLE handle,used for a different purpose)
Definition at line 79 of file user_app_info.h.
int(* mculib_pin_set) (MCULIB_HANDLE handle, int pinnum, int highlow) |
set IOPin to high or low
Definition at line 75 of file user_app_info.h.
int(* mculib_serialport_disable) (MCULIB_HANDLE handle, int portnum) |
Definition at line 43 of file user_app_info.h.
int(* mculib_serialport_enable) (MCULIB_HANDLE handle, int portnum, int baudrate) |
configure a serial port with specified parameters num == 1..n (depending on mcu) baudrate == ... 8N1 no flow control Port #3 is a good choice (PB10:TX, PB11:RX)
Definition at line 42 of file user_app_info.h.
int(* mculib_serialport_write_char) (MCULIB_HANDLE handle, int portnum, uint8_t b) |
write to serial port
Definition at line 51 of file user_app_info.h.
int(* mculib_serialport_write_string) (MCULIB_HANDLE handle, int port, const char *txt) |
write a string to serial port
Definition at line 88 of file user_app_info.h.
int(* mculib_spi_disable) (MCULIB_HANDLE handle, int portnum) |
disable the spi port
Definition at line 98 of file user_app_info.h.
int(* mculib_spi_master_enable3) (MCULIB_HANDLE handle, int portnum, uint8_t wide, uint8_t clkpol, uint8_t cpha, uint8_t dir, uint32_t baud_in_khz) |
enable a spi port as master and set clkpol, cpha and width (wide=0 8bit, wide=1 16bit)(dir == 0=RW,1=RO,2=WO)
Definition at line 107 of file user_app_info.h.
int(* mculib_spi_read16_only) (MCULIB_HANDLE handle, int portnum, uint16_t *read) |
there are weird devices, like tli4970, which aren't really spi. they basically start sending as soon as CS is on
Definition at line 124 of file user_app_info.h.
int(* mculib_spi_send_dma) (MCULIB_HANDLE handle, int portno, void *data, uint32_t size, uint32_t flags) |
Definition at line 221 of file user_app_info.h.
int(* mculib_spi_speed) (MCULIB_HANDLE handle, int portnum, long khz) |
set the spi speed (after it's open and running) returns new speed or 0 if failure
Definition at line 103 of file user_app_info.h.
int(* mculib_spi_write_and_read) (MCULIB_HANDLE handle, int portnum, const uint16_t write, uint16_t *read) |
write a byte and read from spi if a transmission is already in progress it waits. this writes and waits for a complete transmission. then it reads and waits for a complete transmission. So it's somewhat slower than just writing note: If the spi is in 8bit mode, this will ONLY transmit and read 8 Bit!
Definition at line 114 of file user_app_info.h.
int(* mculib_spi_write_only) (MCULIB_HANDLE handle, int portnum, const uint16_t write) |
write a byte, discard the read if a transmission is already in progress wait until transmission is done. this writes a byte to spi. It does not wait for completion, but returns immediately.
Definition at line 120 of file user_app_info.h.
int(* mculib_timer_attach_pin_pwm) (MCULIB_HANDLE handle, int timer, int pin) |
Definition at line 130 of file user_app_info.h.
int(* mculib_timer_disable) (MCULIB_HANDLE handle, int timer) |
Definition at line 129 of file user_app_info.h.
int(* mculib_timer_enable_simple) (MCULIB_HANDLE handle, int timer, int freq, irq_callback callback) |
Definition at line 128 of file user_app_info.h.
int(* mculib_timer_set_pwm) (MCULIB_HANDLE handle, int timer, int pin, uint16_t dutycycle) |
Definition at line 131 of file user_app_info.h.
void *(* memset) (void *buf, int c, size_t n) |
Definition at line 196 of file user_app_info.h.
int(* on_command_received) (struct command *com) |
this is called for each command we receive
this is called as soon as a command is received that is destined for us (meaning: it is not called on routed packets). When this is called the packet is not yet ACK'ed to the sender.
int | 0 continue "normal" processing of command |
int | 1 nack the receipt of the command |
int | 2 ack the receipt of the command |
Definition at line 430 of file user_app_info.h.
void(* on_new_node) (struct hostroute *host) |
called when and if a new node is detected. this may be used, to, for example detect a route to the cloud
Definition at line 435 of file user_app_info.h.
uint32_t pad2 |
Definition at line 402 of file user_app_info.h.
void(* pin_pwm) (int MCULIBHANDLE, int pin, uint32_t newstate, int flags) |
pwm a pin (mosfets, and some other pins as well)
Definition at line 286 of file user_app_info.h.
void(* printf) (const char *format,...) |
print a message on console and possibly forward to server into logfile as well (uses radio - expensive operation)
Definition at line 34 of file user_app_info.h.
int(* proto_buf_to_struct) (void *buf, int bufsize, void *iter, void *out) |
decode a buffer containing a serialised proto into a struct
Definition at line 274 of file user_app_info.h.
void(* proto_release) (void *buf) |
release a proto struct
Definition at line 282 of file user_app_info.h.
int(* proto_struct_to_buf) (void *buf, int bufsize, void *iter, void *in) |
encode a struct to a buffer. returns number of bytes written. (-1 for error)
Definition at line 278 of file user_app_info.h.
uint32_t repoid |
Definition at line 408 of file user_app_info.h.
void(* reset_module) (void) |
reset the module (this does not return);
Definition at line 337 of file user_app_info.h.
void(* reset_userapp) (void) |
reset the userapp
Definition at line 341 of file user_app_info.h.
int(* send_via_usb_acm) (uint8_t *buf, int size) |
once a usb_acm is "hijacked", the userapp can send bytes through the usb_acm port with this function - returns 0 if successful
Definition at line 329 of file user_app_info.h.
struct sensorruntime *(* sensor_get_runtime_by_index) (int idx) |
get a specific sensor runtime by index. index is a local (to this module) index
Definition at line 266 of file user_app_info.h.
int(* sensor_register) (struct sensordev *sensor) |
register a new sensor. returns 0 if ok
Definition at line 188 of file user_app_info.h.
int(* snprintf) (char *buf, size_t size, const char *format,...) |
Definition at line 192 of file user_app_info.h.
int(* start) (int MCULIBHANDLE, struct sc_firmware_api *api) |
guaranteed to be called by the firmware before any other functions
Definition at line 410 of file user_app_info.h.
void(* stop) () |
last thing to be called. no more userloops or irqs afterwards
Definition at line 412 of file user_app_info.h.
int(* strcmp) (const char *c1, const char *c2) |
Definition at line 197 of file user_app_info.h.
size_t(* strlen) (const char *txt) |
Definition at line 195 of file user_app_info.h.
char *(* strncpy) (char *dst, const char *src, size_t size) |
Definition at line 194 of file user_app_info.h.
void(* time_bcd_to_timestruct) (uint32_t bcd_time, uint32_t bcd_date, struct sctime *out) |
convert BCDTime and BCDDate to timestruct
Definition at line 303 of file user_app_info.h.
calculate seconds between two time structs
Definition at line 299 of file user_app_info.h.
int(* time_get_localtime_as_struct) (struct sctime *time) |
get the current time as time struct (return 0 if ok, otherwise error)
Definition at line 290 of file user_app_info.h.
int(* timer_softirq) (uint32_t hertz, uint32_t opaque, void(*callback)(uint32_t)) |
a very simple, not-very-accurate softirq callback. May be called multiple times returns 0 if ok, otherwise error
Definition at line 295 of file user_app_info.h.
int(* unhandled_call1) () |
safety call, terminates the app
Definition at line 353 of file user_app_info.h.
int(* unhandled_call2) () |
safety call, terminates the app
Definition at line 357 of file user_app_info.h.
int(* unhandled_call3) () |
safety call, terminates the app
Definition at line 361 of file user_app_info.h.
int(* unhandled_call4) () |
safety call, terminates the app
Definition at line 365 of file user_app_info.h.
int(* unhandled_call5) () |
safety call, terminates the app
Definition at line 369 of file user_app_info.h.
int(* unhandled_call6) () |
safety call, terminates the app
Definition at line 373 of file user_app_info.h.
int(* unhandled_call7) () |
safety call, terminates the app
Definition at line 377 of file user_app_info.h.
int(* unhandled_call8) () |
safety call, terminates the app
Definition at line 381 of file user_app_info.h.
void(* user_loop) () |
this is called frequently, but with no timing guarantees. essentially, it's called in the "idle-loop" of the mcu
Definition at line 417 of file user_app_info.h.
int(* user_serialport_callback) (MCULIB_HANDLE handle, int portnum, serial_recv_callback cb) |
set callback for serialport receive irq
Definition at line 47 of file user_app_info.h.
int(* userconfig_copy) (uint8_t *buf, uint16_t bufsize, uint16_t *actual_size) |
this copies the userconfig into a ram buffer, IF the version has been updated and IF the destination buffer is large enough. actual_size (if NOT NULL) will contain the actual size of bytes once this completes without an error RETURN VALUE: 0==ok, anything else is an error (same version is not an error)
Definition at line 257 of file user_app_info.h.
uint32_t(* userconfig_size) () |
the userconfig: this is a little unstructured piece of flash set aside for configuration of userapps. note that this is updated at any time. If the userapp reads flash from interrupts the flash might change between invokations. if that is a problem the app should copy the contents into ram from the userloop.
return the current size of the userconfig space. 0 means it is invalid, that is "there isn't one"
Definition at line 246 of file user_app_info.h.
uint32_t(* userconfig_version) () |
each time the config is updated, the version is incremented. in other words, unless the version is changed, the data remains the same
Definition at line 251 of file user_app_info.h.
int(* userconfig_write) (uint8_t *buf, uint32_t size) |
this saves a buf as "userconfig" RETURN VALUE: 0==ok, anything else is an error (same version is not an error)
Definition at line 262 of file user_app_info.h.
int version |
Definition at line 30 of file user_app_info.h.
uint32_t version |
Definition at line 399 of file user_app_info.h.
int(* vsnprintf) (char *buf, size_t size, const char *format, va_list args) |
Definition at line 193 of file user_app_info.h.