SingingCat  0
application
Files | Data Structures | Macros | Typedefs | Functions | Variables
Application

Files

file  boot_info.c
 constants is a struct in a special RAM area which is not cleared on reset
 
file  command-handler.c
 main command processor
 
file  command-parser.c
 code to encode/decode commands to a serialized or in-ram format
 
file  constants.c
 constants is a struct in a special RAM area which is not cleared on reset
 
file  decode_esp_packet.c
 packetizes streams from esp including escape/unescape
 
file  fets.c
 code to drive the fets
 
file  flashapp.c
 handling of flash via streams
 
file  forwarding.c
 code to forward to other nodes
 
file  forwarding.h
 definitions of routing table structures
 
file  led.c
 code to make the pretty LED blink
 
file  onewire.c
 code to interface via onewire. (uses bit-banging and timer)
 
file  packetbuffer.c
 packetizes streams of data from radio or wifi
 
file  powersave.c
 code to manage sensors by server
 
file  queue.c
 code to queue outbound commands. this is the "normal" way of sending out commands
 
file  routing.c
 code to discover other nodes
 
file  routing.h
 definitions of routing table structures
 
file  routing_functions.h
 definitions of routing table structures
 
file  sensor.c
 code to call all the sensors in the right frequency, with the correct configuration modify this file if you have new sensors!
 
file  sensor_command.c
 code to manage sensors by server
 
file  streams.c
 handling of streams
 
file  user_app_exe.c
 user application interface
 

Data Structures

struct  espbuf
 
struct  hostroute
 
struct  ledcolour
 
struct  leddef
 
struct  power_state
 
struct  queue_entry
 
struct  sensorconfig
 definition of variable stuff for any one sensor this is seperate from runtime, because a copy will live in flash (cnw: err, no, not with a volatile pointer (*sensor)!!) More...
 
struct  stbuf
 

Macros

#define AT_COMMAND_OK   2
 baudrate [0=9600,1=19200,2=38400,3=57600,4=115200,5=230400,6=460800,7=921600,8=74880]
 
#define AT_COMMAND_TIMEOUT   7
 
#define BROADCAST   0xFFFFFFFF
 
#define CHECK_TI1101_FAILURE   if (ti1101_failed) { ti1101_failure(); return; }
 
#define CHECK_TI1101_FAILURE_S   if (ti1101_failed) { ti1101_failure(); printf("TI1101 failed\r\n"); return; }
 
#define CHECK_TI1101_FAILURE_V   if (ti1101_failed) { ti1101_failure(); return 0; }
 
#define CNWDEBUGCOM(a, ...)   noop()
 
#define COM_QUEUE_SIZE   50
 
#define COMMAND_AGE_BEFORE_GC   120
 maximum amount of time a packet may remain allocated More...
 
#define command_names_size   60
 
#define CRC_SIZE   512
 
#define ESP8266_AFTER_BOOT_DEFAULT_BAUDRATE   9600
 
#define ESPMODE_ISAP   1
 
#define HOSTROUTE_ENTRIES   40
 
#define isNewStyleEnabled   (sensors_enabled & (1 << 1))
 
#define isOldStyleEnabled   (sensors_enabled & (1 << 0))
 
#define isProbing   (sensors_enabled & (1 << 2))
 
#define LED_TIMER_FREQUENCY   130
 
#define MAX_ROUTE_AGE_SECONDS   600
 any route that has not been used or seen for longer than this is subject to removal (the garbage collector)
 
#define MAX_SECS_BEFORE_DELAYED_START   10
 
#define MAX_SECS_BEFORE_SCHEDULED_WAKEUP   300
 
#define MAX_SECS_BETWEEN_LOOP_SAMPLES   5
 
#define MAX_SECS_BETWEEN_RADIO_BROADCASTS   300
 
#define MAX_SECS_BETWEEN_STOP_WARNING   10
 
#define MAX_SECS_BETWEEN_WIFI_DETECT   600
 how often to check if a wifichip is attached
 
#define MCULIB_USERAPP_HANDLE   7
 
#define MEMAREA_SIZE   4096
 
#define ONEWIRE_INTERVAL   600
 
#define SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT   600
 if we fail to log in to [ssid], we fallback to 'singingcat'. If so, how often shall we retry to connect to [ssid] More...
 
#define SECONDS_BEFORE_ESP_FAIL   30
 if esp8266 fails to provide a valid ip after this time: reinitialise
 
#define SECONDS_BEFORE_ESP_RESET_FAIL   30
 after reset, how long before failure detection starts
 
#define SECS_AFTER_LASTCOM_BEFORE_POWERSAFE   3
 
#define SECS_AFTER_WAKE_BEFORE_POWERSAFE   10
 
#define SECS_BETWEEN_CLOUD_PROBES   300
 how often to probe the cloud connection More...
 
#define SECS_UNTIL_CONNECTION_DEAD   (SECS_BETWEEN_CLOUD_PROBES * 4)
 if we don't receive an answer for this long (in seconds) assume connection is dead
 
#define SENSOR_FLAG_ACTIVATED   4
 
#define SENSOR_FLAG_DETECTED   2
 
#define SENSOR_FLAG_ENABLED   0
 
#define SENSOR_FLAG_ISDUE   1
 
#define SENSOR_FLAG_PROBED   3
 
#define SENSOR_TIMER   4
 timer to use
 
#define SENSOR_TIMER_FREQUENCY   1000
 frequency our timer runs on
 
#define TI1101_BURST   0x40
 
#define TI1101_READ   0x80
 

Typedefs

typedef struct espbuf _espbuf
 
typedef struct hostroute _hostroute
 
typedef struct ledcolour _ledcolour
 
typedef struct leddef _leddef
 
typedef struct power_state _power_state
 
typedef struct queue_entry _queue_entry
 
typedef struct sensorconfig _sensorconfig
 definition of variable stuff for any one sensor this is seperate from runtime, because a copy will live in flash (cnw: err, no, not with a volatile pointer (*sensor)!!)
 
typedef struct stbuf _stbuf
 

Functions

int _command_add_encoded_arg (struct command *com, byte *buf)
 
long adr_create_new_node_id ()
 
int adr_isvalid (long a)
 
int all_sensors_probed ()
 
struct commandalloc_command ()
 allocate a free command More...
 
struct commandalloc_command_with_minfree (int minfree)
 
struct streamalloc_stream ()
 find a free stream struct, alloc an fd and return struct
 
int app_main (void)
 
void app_main_no_return () __attribute__((noreturn))
 
int ascii_commandstring_to_num (const byte *buf, int size, int *const newpos)
 match a string to a command num. More...
 
void bridge_packet (struct command *com)
 
void calc_power_mode ()
 
void cat_send_local_instruction (const PACKET_TYPE type, const uint8_t *buf, const int len)
 send a packet to the esp8266 wifi chip More...
 
void check_close (struct stream *stream)
 check if closing flash ist set and we received all the data up to close packet if, flush and close stream
 
void check_strobe ()
 
void clear_outbound_queue ()
 clear the outbound queue any commands within the queue are silently discarded
 
void close_stream (int fd, int reason)
 
void command_add_arg (struct command *com, const char *format,...)
 adds an arg to a partially initialised command structure
 
int command_add_binary_arg (struct command *com, const int len, const byte *srcbuf)
 adds a binary parameter to command returns 0 if ok otherwise errorcode
 
void command_add_varg (struct command *com, const char *format, va_list args)
 adds a varg list of parameters to a command
 
byte command_calc_checksum (struct command *com)
 
int command_decode_ascii (struct command *com, const byte *buf, int size)
 
int command_decode_binary (struct command *com, const byte *buf, int size)
 
int command_encode_ascii (struct command *com, int bufsize, char *buf)
 encode a command to an ascii blob properly surrounded by '{' and '}' and escaped returns length if ok or <0 if error
 
const char * command_get_name (int num)
 given a command number returns its name
 
char * command_get_source_name (byte sourcedev)
 returns a human readable text identifying a source device
 
void command_init (struct command *com)
 initialize a command structure with default values
 
struct commandcommand_parse (const byte *buf, int size)
 
void command_print (struct command *com)
 prints a command in human readable format to serial console
 
void command_start ()
 initialization for command parser
 
void console_add_byte (uint8_t b)
 
uint16_t console_get_byte ()
 
int console_get_line (char *outbuf, int outbufsize)
 
void console_reset ()
 
struct constsconstants ()
 
int constants_init ()
 
void constants_validate ()
 
int count_open_streams ()
 count number of open streams
 
void create_new_node_id ()
 
void dac_timer ()
 
const char * decisionname (int decision)
 
void decode_esp_packet_init ()
 
const char * decode_marcstate (int state)
 
int deliver_command (struct command *com, pkt_callback cb)
 deliver a command to a module More...
 
void enter_esp_passthrough_mode ()
 
void error_com (void *com)
 
void esp8266_add_ap (const char *ssid, const char *pw)
 add an ap to the list of known ap
 
int esp8266_add_byte (byte b)
 feed this with one byte at a time More...
 
void esp8266_bridge ()
 bridge debug serialport and esp8266 (e.g. "wifidebug")
 
void esp8266_cloud_connection_failed ()
 called if the cloud connection failed
 
void esp8266_cloud_loop ()
 called from esp8266 event loop if we are connected
 
void esp8266_decoder_print_info ()
 
void esp8266_disable ()
 disable the esp8266 (switch it off)
 
void esp8266_dodebug (const char *paras)
 
void esp8266_enable ()
 enable the esp8266 (switch it on)
 
void esp8266_event_loop ()
 
byte * esp8266_get_buf ()
 get the buffer
 
struct ipv4addressesp8266_get_current_ip ()
 return last ip (null if none) More...
 
int esp8266_get_firmware_version ()
 
long esp8266_get_invalid_commands ()
 
int esp8266_get_operational_baudrate ()
 
long esp8266_get_time_of_last_ip ()
 
long esp8266_get_valid_commands ()
 
void esp8266_got_packet (const byte *buf, int size)
 
int esp8266_is_accespoint ()
 returns !=0 if we are currently an accesspoint
 
int esp8266_is_enabled ()
 
byte esp8266_is_in_packet ()
 returns 1 if currently parsing a packet More...
 
void esp8266_ota ()
 tell the esp to do an OTA
 
int esp8266_packet_size ()
 returns 0 if no packet is in buf, otherwise returns size of packet in bytes
 
void esp8266_read_byte_from_serialport (int val)
 this is called directly from the usart IRQ. be quick. and do not use printf()
 
void esp8266_reset ()
 reset state machine and esp8266
 
void esp8266_reset_buf ()
 reset buf, e.g. after packet was processed More...
 
void esp8266_reset_command_validity_ctrs ()
 
void esp8266_send_config ()
 
void esp8266_send_instructions ()
 send our nodeid and other goodies to the esp8266 chip
 
void esp8266_set_operational_baudrate (int baudrate)
 
char * esp8266_status_string ()
 returns a human readable status string of the wifi connection
 
void esp8266_test ()
 
void esp8266_wifi_scan (struct command *com)
 
void esp8266_wififlash_bridge (void)
 set esp8266 to flash mode, sync and then bridge ("startflash")
 
void esp_cloud_activate ()
 activate the cloud. More...
 
void esp_cloud_answered (struct command *com, struct command *reply)
 called on command timeout or reply
 
const char * esp_cloud_connect_state_string ()
 
void esp_cloud_deactivate ()
 
const char * esp_cloud_get_desired_server ()
 returns server we want to connect to
 
void esp_cloud_init ()
 this resets the cloud state
 
byte esp_cloud_is_activated ()
 return 1 if cloud connection is activated
 
int esp_cloud_is_connected ()
 
void esp_cloud_state_update (int code, int data)
 whenever the esp chip sends us an update about the cloud state this gets called by the event handler for the esp8266 (not in irq)
 
void esp_empty_ringbuffer ()
 empties the ringbuffer. More...
 
const char * esp_get_last_pw ()
 
const char * esp_get_last_ssid ()
 
int esp_get_mac (char *buf, int bufsize)
 get the esp8266 mac address. More...
 
void esp_info ()
 
void esp_init ()
 call this ONCE before calling anything else More...
 
int esp_read_mac ()
 
void factory_default (struct command *com)
 set the module back to factory default
 
void fade_led_repeat (LED_USAGE_TYPE lut, int *fadearray)
 will fade to each value in the array (end array with 0xFFFFFFFF) will repeat endlessly
 
void fets_init ()
 
void fets_loop ()
 
void fets_set_com (struct command *com)
 
void flagstostr (char *buf, int flags)
 given a pointer to a buffer and command flags, it will fill the buffer with a human readable text describing the flags
 
int flash_app_close (int fd, int reason)
 
int flash_app_consumer (int unused_fd, byte *b, int size)
 called by stream whenever we got sufficient bytes (and only on full blocks!)
 
int flash_app_init (void *base, uint32_t flags)
 
void flash_debug ()
 
int flash_write (byte *b, void *adr, int size)
 unlock, erase, write, lock
 
void flashcom (struct command *com)
 set up a flash connection, associate with stream, called by command-handler for command "flash-app"
 
void flush (struct stream *stream)
 send remaining data to consumer (might be < packetsize!)
 
int forward_packet (struct command *com)
 a command is forwarded to target based on our hostroutes More...
 
void forward_radio (struct command *com)
 
void free_command (struct command *com)
 free a command More...
 
void free_commands (int index)
 free commands by index (-1 for all)
 
const char * get_arg (const struct command *com, int index)
 given an argument by index[0..n], will return a pointer to the bytearray (excluding the fieldtype) this is compatibility only, use get_arg_new() instead the argument may contain NUL bytes - use get_arg_size() to determine its length
 
int get_arg_int_array (const struct command *com, const int index, int *result, const int arraysize)
 given a command and argument index, will attempt to parse the arg as array and return it array syntax is currently semi-comma delimited hex values returns the number of values parsed deprecated - use field arrays instead
 
const byte * get_arg_new (const struct command *com, int index)
 given an argument by index[0..n], will returns a pointer to it. This will include the fieldnumber and fieldtype the argument may contain NUL bytes - use get_arg_size() to determine its length
 
int get_arg_size (const struct command *com, int index)
 given an argument by index [0..n], will returns the size of the value in bytes. for a string/array it is the size of the array. for a uint8_t it is 1 and for uint16_t it is 2...
 
int get_arg_size_inmem (const struct command *com, int index)
 given an argument by index [0..n], will returns the number in bytes this argument takes up in memory. for a string/array it is the fieldnum(1 byte) + fieldtype(1 byte) + arraylen(1 byte) + size of the array + nul-terminator(1byte) for a uint8_t it is 3 (fieldnum+fieldtype+1bytevalue) for a uint16_t it is 4 (fieldnum+fieldtype+2bytevalue)
 
void get_config_flags (struct command *com)
 get config flags
 
struct commandget_data_reply (struct command *com)
 allocates and initializes a packet to be send as "data" to the command typically you'd add some data to it and pass it to send_command(). after send_command() you'll need to free it
 
int get_esp8266_usart_mode ()
 
int get_esp_reboot_ctr ()
 
byte get_hops_to_server ()
 how many hops to the server? More...
 
struct mpmget_mpm ()
 
long get_my_node_id ()
 get the id of my node More...
 
int get_outbound_command_count_important ()
 return number of commands to be delivered (apart from announce/noop)
 
byte get_routing_debug ()
 
struct sensorruntimeget_runtime (int idx)
 
struct userapp_infoget_user_app ()
 
void getcloudtoken (struct command *com)
 get the opaque cloud token
 
void getpubkey (struct command *com)
 request the public key of this module More...
 
byte got_new_packet (struct command *com, uint8_t signal_indicator)
 stack received a new packet (signal indicator is a 0-255 byte value, interface specific) More...
 
void init_command_handler ()
 resets the command handler More...
 
int internal_ti1101_init (struct network_context *onctx)
 
int invoke_on_command_received (struct command *com)
 
void invoke_on_new_node (struct hostroute *host)
 
void invoke_start (int MCULIBHANDLE)
 
void invoke_stop ()
 
void invoke_user_loop ()
 
void iplog (const char *format,...)
 log something to a remote node
 
void irq_metric_counter (int pin)
 
int is_command_valid (struct command *com)
 
int is_device_online (int device)
 return 1 if the specified device is online and routing
 
int is_last_ip_valid ()
 return true if IP is set and valid
 
int is_packet_for_us (struct command *com)
 check if a command needs to be routed More...
 
int is_stack (void *adr)
 
void led_blink (LED_USAGE_TYPE lut, int colour, int brightness, int on, int off)
 will keep blinking until told otherwise will repeat endlessly.
 
void led_blink_flags (LED_USAGE_TYPE lut, uint32_t colour, uint8_t brightness, int on, int off, uint32_t flags)
 
void led_flash (LED_USAGE_TYPE lut, int colour, int duration)
 will flash led once
 
void led_indicate (LED_INDICATOR a)
 
void led_init ()
 
void led_loop ()
 
void led_off (LED_USAGE_TYPE lut)
 
void led_print_status ()
 
void led_set_machine_managed ()
 
void led_set_user_managed ()
 
void led_set_wifi_managed ()
 
void list_modules (struct command *com)
 we received a list-modules command
 
void logging_event_loop ()
 sends current buffer and empties it
 
void logging_init ()
 initialise logging. logging is disabled after calling this function
 
void logging_off ()
 disable logging and logging processing. guarantees that no buffers are used for logging
 
void logging_on ()
 enable logging and logging processing. buffers are used for logging
 
void logging_set_node (long nodeid)
 log to a given node. Usually this would be an app or a server
 
void micro_strobe (struct command *com)
 do a nano strobe More...
 
void mpm_free (void *mem)
 
void * mpm_reserve (int bytes)
 
void multi_mem_init ()
 called very early on, even before printf works
 
const char * namedarg (struct command *com, const char *name)
 get a named arg (key-value pair) or NULL
 
int namedarg_uint16 (struct command *com, const char *name, uint16_t *value)
 get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code
 
int namedarg_uint32 (struct command *com, const char *name, uint32_t *value)
 get a named arg (key-value pair), parsed as integer. result in "value". if return value == 0 , it was parsed, otherwise error code
 
void node_to_str (long l, char *buf)
 
int onewire_init (byte idx)
 
int onewire_reading_size (byte idx)
 
int onewire_run (byte idx, byte *error)
 
void packet_buf_init (const int num)
 initialize (reset, clear) a given buffer More...
 
byte * packet_getbuf (const int num)
 get pointer to the contents of the buffer More...
 
int packet_getbytesinbuf (const int num)
 count bytes in the buffer More...
 
void packet_init ()
 initialize (reset, clear) all buffers More...
 
int packet_isvalid (const int num)
 initialize (reset, clear) a given buffer More...
 
void packet_mark_valid (const int num)
 mark this buffer as containing a valid packet More...
 
int packet_put_byte (const int num, const byte b)
 add a byte to a buffer More...
 
void pin_pwm (MCULIB_HANDLE handle, int pin, uint32_t state, int flags)
 
void power_main_loop ()
 
int power_set_connectivity (struct power_state *ps, int turnon)
 
void pretty_node_to_str (long l, char *buf)
 
void print_boot_info ()
 print startup information
 
void print_esp_core_info ()
 
void print_node_id (long l)
 
void print_outbound_queue ()
 
void print_pkt_state_update (int subsystem, int code, uint8_t d1, uint8_t d2)
 
void print_program_status ()
 
void print_pwm_state ()
 
void print_stream_info ()
 print summary of current streams to console
 
void printHelp ()
 
void process_command (struct command *com)
 command is parsed, now execute it More...
 
void process_command_queue ()
 this gets called when we got some cpu cycles spare we then send out commands and timeout other commands and so on
 
int process_queue_reply (struct command *ack)
 process a reply More...
 
void process_strobe_command (struct command *com)
 
void process_terminal_input ()
 
int query_onewire (struct onewire_hwdef *hw, byte *error)
 
void queue_init ()
 
int received_radio_get_config (struct command *com)
 called when we received radio_get_config command sends back an answer with the current radio config
 
int received_radio_set_config (struct command *com)
 called when we received radio_set_config command modified the current radio config
 
void remove_stale_routes ()
 "old" routes are being removed this is the route garbage collector
 
void request_route (long nodeid)
 send an arp request (equivalent)
 
int routing_count_nodes ()
 determine number of nodes known More...
 
void routing_error (struct command *com, int errorcode)
 
void routing_event_loop ()
 
struct hostrouterouting_find_empty_slot ()
 finds an empty slot in our routing entry list
 
struct hostrouterouting_find_host (const long nodeid)
 find route to host or NULL if none known
 
struct hostrouterouting_find_route (const long nodeid, const byte sourcedev)
 find specific hostroute to target or NULL if none known special case, if we ask for a route to server, we get any intermediary routes which announce themselves to have a connection a server
 
struct hostrouterouting_get_node_by_index (const int index)
 finds a nodeid by index. [0...n] More...
 
void routing_init ()
 called when we power-up More...
 
void routing_print_table ()
 print routing table
 
void routing_request_reply (const struct command *com)
 we call this when we receive a reply to a routing request this adds or updates a new route
 
void sc_fancy_allocator_init ()
 
void sc_free (void *ptr)
 
void * sc_realloc (void *ptr, size_t size)
 
int send_command (struct command *com)
 send a command to another module (or broadcast) More...
 
int send_command_fw_info (struct command *com, int err)
 send a reply to a command More...
 
int send_command_one_arg (int command, long target, const byte *arg1, int arg1len)
 helper function to quickly and easily send a command somewhere return 0 if ok, else errorcode
 
int send_command_quietly (struct command *com)
 
int send_command_reply (struct command *com, byte flags)
 send a reply to a command More...
 
int send_command_reply_with_args (struct command *com, byte flags, const char *format,...)
 send a reply to a command More...
 
int send_data (struct command *com, const char *format,...)
 send the format string as data in response to command "com" More...
 
void send_routing_update_now ()
 
int send_user_app_status ()
 
void sensor_activation (struct sensorruntime *sr, int activation)
 
void sensor_com_config (struct command *com)
 
void sensor_com_list (struct command *com)
 
void sensor_deregister (struct sensordev *sensor)
 
void sensor_info ()
 
int sensor_loop ()
 called periodically. this will either query sensors when they are due or will set the isdue flag for them to be picked up during IRQ returns true if new sensor data needs to be sent
 
void sensor_probe ()
 
struct sensordevsensor_register (struct sensordev *sensor)
 register a sensor, e.g. from userhook. The sensordev struct is COPIED, so it may be reused by the caller. the RETURN value is a pointer to the new sensordev, or NULL More...
 
void sensor_run_str (const char *str)
 
int sensor_submit_request (const long nodeid, int idx, const int readmillis, const int submitsec, const int max_values)
 
int sensor_update_config (const long nodeid, int idx, const int readmillis, const int submitsec, const int max_values)
 
void sensors_init ()
 initialize sensors, runtime, config, powerup each sensor in turn etc..
 
uint8_t sensors_inited ()
 
void sensors_newstyle ()
 enable new-style sensors (and disable old)
 
void sensors_off ()
 disable sensors
 
void serialirq (int port, byte b) __attribute__((no_instrument_function))
 
void set_config_flag (struct command *com)
 set a single config flag
 
void set_esp8266_debug (byte b)
 
void set_esp8266_usart_mode (int i)
 
void set_forward_debug (byte b)
 
void set_in_app (uint8_t a)
 
void set_logging (struct command *com)
 
void set_new_node_id (char *nodetxt)
 
int set_power_mode (int state)
 
void set_routing_debug (byte b)
 
void setcloudtoken (struct command *com)
 set a token to connect to the cloud More...
 
void setdac (struct command *com)
 
void setpin (struct command *com)
 
void start_strobe (int relay, int ton, int toff, int repeat)
 
void start_wifi_scan ()
 
int stream_associate (int fd, const struct consumerinfo *ci, byte *buf, int bufsize, int packetsize)
 associate a stream with a consumer. return 0 if ok otherwise errorcode
 
void stream_disable ()
 disable all stream handling
 
void stream_enable ()
 enable all stream handling (default)
 
void stream_init ()
 
void stream_loop ()
 called periodically, checks for stale streams and/or hung ones
 
void streamdata (struct command *com)
 called when we receive a stream data packet TODO: this is a really simplistic, memory-consumption optimized algorithm. it currently discards packets which are out-of-order and keeps requesting the next packet in order. Possible optimisations: More...
 
void streamsetup (struct command *com)
 called when we receive a stream setup packet
 
int ti1101_compare_config ()
 check the config against the values in flash More...
 
int ti1101_cssns ()
 
void ti1101_disable ()
 
void ti1101_disable_irq (struct network_context *ctx)
 
void ti1101_enable_irq ()
 
void ti1101_event_loop_locked ()
 
void ti1101_failure ()
 
void ti1101_forward_radio (long node)
 forward all radio packets to this node mostly useful to debug and decode and sniff 3rd party protocols like door openers, thermostats etc...
 
byte ti1101_get_last_irq_error ()
 if we throw an error in the irq we cannot print it directly. save it and return it here. the irq_error is cleared by reading from it. More...
 
int ti1101_irqpin ()
 
int ti1101_is_enabled ()
 
int ti1101_lock ()
 lock, return 1 if ok, otherwise it is an error
 
int ti1101_loop (struct network_context *ctx)
 this is called in the main thread periodically
 
int ti1101_off ()
 diable processing of ti1101 commands More...
 
void ti1101_on ()
 enable processing of radio More...
 
void ti1101_print_config ()
 
void ti1101_print_status ()
 
byte ti1101_read_byte ()
 
int ti1101_read_version ()
 
void ti1101_receive_loop ()
 
void ti1101_rx ()
 
void ti1101_set_debug (byte b)
 set debug mode of ti1101
 
int ti1101_spiport ()
 
int ti1101_transmit (struct network_context *nctx, const byte *data, uint16_t num_bytes)
 
int ti1101_tx ()
 
void ti1101_unlock ()
 
int update_all_runtimes ()
 update runtimes (recalculate buffer positions). return 0 if ok (5 otherwise)
 
int user_app_checksum_valid ()
 
void user_app_control (struct command *com)
 
void user_app_disable ()
 
void user_app_enable ()
 
void user_app_exe_init ()
 
int user_app_executable ()
 
int user_app_info (struct command *com)
 
int user_app_is_enabled ()
 
int user_app_is_valid ()
 
void user_app_reset_state ()
 
int userapp_checksum_valid (void *baseadr)
 
void wifi_info (struct command *com)
 get some information about our currentwifi connection
 
void wifi_new_creds (char *buf)
 
void wifi_send_data (const PACKET_TYPE type, const byte *buf, const int len)
 send a command via wifi More...
 
void wifi_update_completed ()
 
void wifi_update_progress (const uint8_t *buf)
 
void wifi_update_started ()
 
void wireless_callback_state_change (int newstate, int oldstate)
 
int write_char_to_console (char b)
 
int write_serial_char (int port, char b)
 
int write_serial_line (int port, const char *txt)
 
int write_serial_string (int port, const char *txt)
 

Variables

char _estack
 
char _Minimum_Stack_Size
 
int ack_ctr
 
uint32_t acm_byte_received
 
int attemptctr
 
const char * BAUD_CHANGE_INDICATOR = "NEW BAUDRATE: ["
 
uint8_t brightness
 
byte buf [260]
 
byte buf [300]
 
struct espbuf bufs [7]
 
pkt_callback callback
 
uint32_t colour
 
struct commandcommand
 
const char *const command_names []
 
struct ringbuffer console_ringbuffer
 
uint8_t device
 
struct ringbuffer esp_ringbuffer
 
char esptmpbuf [128]
 
struct leddef extled = { .pins = { 7, 110, 111 }, .timers = { 2, 1, 1 } }
 
int fd
 
const struct consumerinfo flashconsumerinfo = { &flash_app_consumer, &flash_app_close }
 
struct hal_workspace hal
 
uint8_t hops_to_server
 
long host
 
uint8_t hosttype
 see https://www.singingcat.net?linkid=routing
 
struct leddef intled = { .pins = { 106, 107, 108 }, .timers = { 3, 3, 3 } }
 
long last_attempt
 
struct ipv4address lastip
 
long lastseen
 
byte lora_on
 
struct ledcolour machinecolour
 
int max_values
 
long nexthop
 here the nodeif of the intermediary hop (the proxy)
 
uint32_t off
 
uint32_t on
 
int order
 
struct cnw_packetbuf packetbuffer1
 
uint32_t permaramadr
 
uint8_t pin
 
int pins [3]
 
struct power_state prev_state
 
uint8_t pwm
 
volatile uint32_t * r_adr = (volatile uint32_t *)0x40020810
 
char rbuf [10]
 
int readmillis
 
char sbuf [10]
 
const struct sensordevsensor
 
struct sensordev sensors []
 list of sensors... More...
 
uint8_t signal_indicator
 
int size
 
int size
 
uint32_t speed
 
const char * statetable []
 
struct stream streams [2]
 mgmt for streams (the more ram, the more simultanous streams we can handle
 
int submitsecs
 
long target
 
uint32_t target_pwm
 
char tbuf [10]
 
volatile byte ti1101_in_read_loop = 0
 
volatile byte ti1101_locked = 0
 
byte ti1101_on
 
int timers [3]
 
int tn
 
void * UMM_MALLOC_CFG_HEAP_ADDR
 
uint32_t UMM_MALLOC_CFG_HEAP_SIZE
 
struct ledcolour usercolour
 
uint32_t value
 
byte wifi_on
 
long wifi_state_since = 0
 
long wifi_state_since
 
volatile uint32_t * wr_adr = (volatile uint32_t *)0x40020814
 

Detailed Description

Macro Definition Documentation

◆ COMMAND_AGE_BEFORE_GC

#define COMMAND_AGE_BEFORE_GC   120

maximum amount of time a packet may remain allocated

  • any packet that was allocated longer than this amount of seconds ago is liable to be removed by the command allocator if it needs to satisfy new requests. theory goes that there should never be a command outstanding for a long time. either it goes through to the recipient within a few seconds or it does not. Saying that, we set it fairly high (default: 2 minutes) so to allow for some leeway it is mostly intented to copy better if developers create memory leaks

Definition at line 77 of file queue.c.

◆ SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT

#define SECONDS_BEFORE_ATTEMPTING_TO_RECONNECT   600

if we fail to log in to [ssid], we fallback to 'singingcat'. If so, how often shall we retry to connect to [ssid]

Do not make this too short - it is annoying if devices attempt to configure it and get kicked out because we attempt to reconnect to a non-existing accesspoint

Definition at line 77 of file esp8266.c.

◆ SECS_BETWEEN_CLOUD_PROBES

#define SECS_BETWEEN_CLOUD_PROBES   300

how often to probe the cloud connection

Note: make sure it's less than route garbage collector (routing.c)

Definition at line 43 of file esp8266_cloud.c.

Typedef Documentation

◆ _espbuf

typedef struct espbuf _espbuf

}garbageend and you get: PKT_TYPE{a,1,00000001,19F05795,19F05795,1,3,noop} Explanation:

  1. The outer brackets have been stripped
  2. the inner brackets have been unescaped.
  3. the not-in-package ("garbage*") has been ignored.

Note to developers: esp8266_add_byte is called from within the serial interrupt, please take great care when modifying this code to avoid race-conditions. The order of instructions is crucial and delicate! Keep each path short!

◆ _hostroute

typedef struct hostroute _hostroute

information about a single host

Function Documentation

◆ alloc_command()

struct command* alloc_command ( )

allocate a free command

  • this must be freed with free_command
Return values
longmy node id

Definition at line 171 of file queue.c.

Referenced by get_config_flags(), get_data_reply(), getcloudtoken(), list_modules(), received_radio_get_config(), request_route(), send_command_fw_info(), send_command_one_arg(), send_command_reply(), send_command_reply_with_args(), and wifi_info().

◆ app_main()

int app_main ( void  )

start of app after system reset

Definition at line 814 of file main.c.

◆ ascii_commandstring_to_num()

int ascii_commandstring_to_num ( const byte *  buf,
int  size,
int *const  newpos 
)

match a string to a command num.

command string must be terminated by 0 or '}' or ',' upon return the int variable pointed to by newpos will point to the first character which is not part of the command name. (usually 0, '}' or ',')

Definition at line 208 of file command-parser.c.

◆ cat_send_local_instruction()

void cat_send_local_instruction ( const PACKET_TYPE  type,
const uint8_t *  buf,
const int  len 
)

send a packet to the esp8266 wifi chip

type is, for example, INSTRUCTION_DOWNLOAD_UPDATE or INSTRUCTION_RECONNECT_CLOUD

Definition at line 1277 of file esp8266.c.

◆ decode_esp_packet_init()

void decode_esp_packet_init ( )

reset decode to "factory defaults"

Definition at line 50 of file decode_esp_packet.c.

◆ deliver_command()

int deliver_command ( struct command com,
pkt_callback  cb 
)

deliver a command to a module

  • this sends the command to a module using send_command. the command will not be sent immediately but queued. this will deliver the command several times until we receive an ACK from the receiver. the packet buffer becomes the responsibility of this function. do not free the buf after calling this or there will be dragons. The buf will be freed by the dequeuing mechanism. it returns 0 if the delivery request has been accepted or an errorcode if for some reason the delivery cannot begin. the callback might be NULL if you just want best-effort delivery but no notification.

it is entirely possible that the callback will be called multiple times, for example at broadcasts

the callback will be called either way, even if no answer is received.

Definition at line 649 of file queue.c.

Referenced by get_config_flags(), getcloudtoken(), send_command_fw_info(), send_command_one_arg(), send_command_reply(), and send_command_reply_with_args().

◆ esp8266_add_byte()

int esp8266_add_byte ( byte  b)

feed this with one byte at a time

will return number of bytes in buf if a complete packet was processed returns 0 otherwise

Definition at line 97 of file decode_esp_packet.c.

◆ esp8266_get_current_ip()

struct ipv4address* esp8266_get_current_ip ( )

return last ip (null if none)

Definition at line 1164 of file esp8266.c.

Referenced by wifi_info().

◆ esp8266_got_packet()

void esp8266_got_packet ( const byte *  buf,
int  size 
)
                    packet from esp received ********************************

1) bytes are added to esp8266_add_byte in "decode_esp" from the IRQ (see esp8266_read_byte_from_serialport). 2) the main loop periodically checks if "decode_esp" reports a full packet, if so, it calls this this must be enclosed in '{}' buf -> PKT_COMMAND|PKT_IP_UDPATE or so

Definition at line 1006 of file esp8266.c.

◆ esp8266_is_in_packet()

byte esp8266_is_in_packet ( )

returns 1 if currently parsing a packet

specifically: if it is within PKT_START and PKT_END byte

Definition at line 234 of file decode_esp_packet.c.

◆ esp8266_reset_buf()

void esp8266_reset_buf ( )

reset buf, e.g. after packet was processed

This is more complicated than just resetting the pointers: we might have gathered extra bytes in-between detecting first command, processing it and calling reset_buf. So there might be extra bytes we now need to keep. This must be done in a way that does not interfere with IRQs from the serialport

what we do is this:

  1. if there's no extra bytes in the buf, we simple reset all pointers. end. otherwise:
  1. we copy the extra bytes to the beginning of the buf
  2. we reset the bytesinbuf-ptr, so that IRQ writes to new position
  3. we check if in-between 1&2 we received extra bytes, if so we copy them now

there is still a small racecondition though: If we receive one or more bytes after 1, including an end-of-packet, before we do 2, we miss those bytes. we detect a packet with odd data. we got to fix that in get_buf(); (TODO)

Definition at line 197 of file decode_esp_packet.c.

◆ esp8266_test()

void esp8266_test ( )

run a low-level test, such as reset / flash mode etc..

Definition at line 245 of file esp8266.c.

◆ esp_cloud_activate()

void esp_cloud_activate ( )

activate the cloud.

if the cloud is activated, we maintain a connection. if not we track the esp8266 IP connections, but do not initiate a command via server. This is set/maintained by the esp8266.c state. not a user function!

Definition at line 130 of file esp8266_cloud.c.

◆ esp_empty_ringbuffer()

void esp_empty_ringbuffer ( )

empties the ringbuffer.

  • the race-condition comes for free. unavoidable with the esp8266

Definition at line 581 of file esp8266.c.

◆ esp_get_mac()

int esp_get_mac ( char *  buf,
int  bufsize 
)

get the esp8266 mac address.

return 0 on success

Definition at line 910 of file esp8266.c.

◆ esp_init()

void esp_init ( )

call this ONCE before calling anything else

Definition at line 865 of file esp8266.c.

◆ esp_read_mac()

int esp_read_mac ( )

this actually READS the mac from the esp8266 (sync/flash stuff)

Definition at line 927 of file esp8266.c.

◆ forward_packet()

int forward_packet ( struct command com)

a command is forwarded to target based on our hostroutes

returns 0 if successfull, otherwise errorcode

Definition at line 31 of file forwarding.c.

References command::flags, and hostroute::host.

◆ free_command()

void free_command ( struct command com)

free a command

  • Return values
    longmy node id

Definition at line 198 of file queue.c.

Referenced by list_modules(), request_route(), and send_data().

◆ get_hops_to_server()

byte get_hops_to_server ( )

how many hops to the server?

0=no route, 1 = direct connection, 2=one intermediary etc..

Definition at line 526 of file routing.c.

Referenced by routing_print_table().

◆ get_my_node_id()

long get_my_node_id ( )

get the id of my node

  • Return values
    longmy node id

Definition at line 237 of file command-handler.c.

◆ getpubkey()

void getpubkey ( struct command com)

request the public key of this module

Definition at line 416 of file command-handler.c.

References command::com, and send_command_reply().

◆ got_new_packet()

byte got_new_packet ( struct command com,
uint8_t  signal_indicator 
)

stack received a new packet (signal indicator is a 0-255 byte value, interface specific)

return: 0==packet was discarded 1==packet was forwarded 2==packet was bridged 3==packet was processed locally (via process_command())

Definition at line 111 of file routing.c.

◆ init_command_handler()

void init_command_handler ( )

resets the command handler

this must be called at least once when the firmware boots.

Definition at line 76 of file command-handler.c.

◆ is_packet_for_us()

int is_packet_for_us ( struct command com)

check if a command needs to be routed

we deal with all the stuff for the packet from here, unless it is a packet we should process. we return 1 if (and only if) the packet needs processing locally

Definition at line 119 of file command-handler.c.

Referenced by process_command().

◆ micro_strobe()

void micro_strobe ( struct command com)

do a nano strobe

Definition at line 196 of file command-handler.c.

References get_arg().

◆ mpm_free()

void mpm_free ( void *  mem)

unreserve bytes

Definition at line 48 of file multiram.c.

◆ mpm_reserve()

void* mpm_reserve ( int  bytes)

we reserve bytes from the command buffer (or other dynamic places) free it with mpm_free! (not yet implemented)

Definition at line 38 of file multiram.c.

◆ packet_buf_init()

void packet_buf_init ( const int  num)

initialize (reset, clear) a given buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_CC1101)
Return values
none

Definition at line 37 of file packetbuffer.c.

Referenced by packet_init().

◆ packet_getbuf()

byte* packet_getbuf ( const int  num)

get pointer to the contents of the buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
byte*get pointer to the buffer of bytes (all bytes, not just payload)!)

Definition at line 143 of file packetbuffer.c.

◆ packet_getbytesinbuf()

int packet_getbytesinbuf ( const int  num)

count bytes in the buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
intreturn the number of bytes in the packet

Definition at line 158 of file packetbuffer.c.

◆ packet_init()

void packet_init ( )

initialize (reset, clear) all buffers

Parameters
none
Return values
none

Definition at line 52 of file packetbuffer.c.

References packet_buf_init().

◆ packet_isvalid()

int packet_isvalid ( const int  num)

initialize (reset, clear) a given buffer

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
nonereturns 1 if there's a valid packet

Definition at line 125 of file packetbuffer.c.

◆ packet_mark_valid()

void packet_mark_valid ( const int  num)

mark this buffer as containing a valid packet

Parameters
thenumber of the buffer (e.g. PACKETBUFFER_ESP8266)
Return values
none

Definition at line 108 of file packetbuffer.c.

◆ packet_put_byte()

int packet_put_byte ( const int  num,
const byte  b 
)

add a byte to a buffer

Parameters
numthe number of the buffer (e.g. PACKETBUFFER_ESP8266)
bthe byte to add
Return values
thenew length of buffer (or <0 on error)

add a byte to the buffer returns NEW length of buf or <0 on error (e.g. overflow)

Definition at line 78 of file packetbuffer.c.

◆ print_pkt_state_update()

void print_pkt_state_update ( int  subsystem,
int  code,
uint8_t  d1,
uint8_t  d2 
)

print an esp8266 update packet in human readable format

Definition at line 1128 of file esp8266.c.

References esp_cloud_state_update().

◆ process_command()

void process_command ( struct command com)

command is parsed, now execute it

we call the router to update it (since we received a packet we might have just learned of the existence of another cat) then we branch out into any user supplied functions

Definition at line 716 of file command-handler.c.

References command::argctr, command::com, command_print(), command::flags, get_arg(), command::index, is_packet_for_us(), process_queue_reply(), and routing_request_reply().

◆ process_queue_reply()

int process_queue_reply ( struct command ack)

process a reply

  • upon receipt of a reply (flag ACK set), call this. this will call the callback and remove it from the queue and free the command. it will return >0 if it has successfully processed the packet 0 if it doesn't know anything about this packet <0 if it should have processed the packet but failed to do so (retry?)

there is an internal mechanism used by send_reply & friends: if the command in the queue already has the ACK flag set, then it will be sent out and freed but no further notification and/or processing will take place.

Definition at line 324 of file queue.c.

Referenced by process_command().

◆ routing_count_nodes()

int routing_count_nodes ( )

determine number of nodes known

Return values
intnumber of nodes known to us excluding ourselves

Definition at line 203 of file routing.c.

Referenced by list_modules().

◆ routing_get_node_by_index()

struct hostroute * routing_get_node_by_index ( const int  index)

finds a nodeid by index. [0...n]

Return values
hoststructureof this node. NULL if none at this index

Definition at line 219 of file routing.c.

Referenced by list_modules().

◆ routing_init()

void routing_init ( )

called when we power-up

power-up initialisation

Definition at line 57 of file routing.c.

◆ send_command()

int send_command ( struct command com)

send a command to another module (or broadcast)

  • this sends out a command. the sender must be filled in correctly and, if required, the forwarding host. if the sourcedev is 0, it will find the best route (via radio or wifi), otherwise, if the sourcedev specifies a technology, it will use that technology this is a one-shot attempt. no redelivery will be attempted and no feedback is available whether or not it arrived at the destination. the packet buffer remains under the responsibility of the caller. especially CALLER MUST FREE COMMAND AFTER THIS FUNCTION RETURNS unless you really know what you're doing please use deliver_command instead

this is synchronous and a one-shot attempt return: 0 ok, >0 on permanent errors, <0 on temporary errors

Definition at line 372 of file queue.c.

Referenced by list_modules(), request_route(), and send_data().

◆ send_command_fw_info()

int send_command_fw_info ( struct command com,
int  err 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 531 of file queue.c.

References alloc_command(), command::com, command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

◆ send_command_reply()

int send_command_reply ( struct command com,
byte  flags 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 560 of file queue.c.

References alloc_command(), command::com, command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

Referenced by getpubkey(), list_modules(), set_config_flag(), and setcloudtoken().

◆ send_command_reply_with_args()

int send_command_reply_with_args ( struct command com,
byte  flags,
const char *  format,
  ... 
)

send a reply to a command

  • send the reply (replycom) to the sender. It will send the reply back via the same device it has received the command on. the reply will be a new command, with NO parameters! return the result of deliver command

Definition at line 586 of file queue.c.

References alloc_command(), command::com, command_add_varg(), command_init(), command::connid, deliver_command(), command::encoding, command::flags, command::index, command::sourcedev, and command::target.

◆ send_data()

int send_data ( struct command com,
const char *  format,
  ... 
)

send the format string as data in response to command "com"

return 0 if ok, otherwise error code

Definition at line 292 of file queue.c.

References command::com, command_add_varg(), free_command(), get_data_reply(), and send_command().

◆ sensor_register()

struct sensordev* sensor_register ( struct sensordev sensor)

register a sensor, e.g. from userhook. The sensordev struct is COPIED, so it may be reused by the caller. the RETURN value is a pointer to the new sensordev, or NULL

register a new sensor. returns 0 if ok

Definition at line 608 of file sensor.c.

References sensors, sensors_init(), and sensors_off().

◆ setcloudtoken()

void setcloudtoken ( struct command com)

set a token to connect to the cloud

  • once a token is set the module will maintain a connection to the cloud servers.

Definition at line 253 of file command-handler.c.

References command::argctr, esp8266_send_instructions(), get_arg(), and send_command_reply().

◆ streamdata()

void streamdata ( struct command com)

called when we receive a stream data packet TODO: this is a really simplistic, memory-consumption optimized algorithm. it currently discards packets which are out-of-order and keeps requesting the next packet in order. Possible optimisations:

  1. use ram buffers to buffer correctly received packets
  2. increase payload of packets (limited to 250 bytes currently)

Definition at line 422 of file streams.c.

◆ ti1101_compare_config()

int ti1101_compare_config ( )

check the config against the values in flash

  • Returns
    0 if ok, 1 if not. (it is not an error if values are different, but it is if they are all 0) it is an error if more values are different than correct

Definition at line 335 of file ti1101.c.

◆ ti1101_get_last_irq_error()

byte ti1101_get_last_irq_error ( )

if we throw an error in the irq we cannot print it directly. save it and return it here. the irq_error is cleared by reading from it.

Definition at line 695 of file ti1101.c.

◆ ti1101_off()

int ti1101_off ( )

diable processing of ti1101 commands

the radio remains fully operational but any IRQs for in/outbound data are effectively a noop this can (and is) used to temporarily and quickly disable the radio without the need to reinitialise the peripheral when re-enabling it return: 1 if it was enabled previously, 0 if it was not

Definition at line 629 of file ti1101.c.

◆ ti1101_on()

void ti1101_on ( )

enable processing of radio

this does not reconfigure the ti1101, but it does start processing again

Definition at line 650 of file ti1101.c.

◆ wifi_send_data()

void wifi_send_data ( const PACKET_TYPE  type,
const byte *  buf,
const int  len 
)

send a command via wifi

Definition at line 603 of file esp8266.c.

Variable Documentation

◆ ack_ctr

int ack_ctr
extern

the ack_ctr for pings

◆ attemptctr

int attemptctr

command to send

Definition at line 56 of file queue.c.

◆ callback

pkt_callback callback

how many times did we try already?

Definition at line 57 of file queue.c.

◆ host

long host

the hosts nodeid this route refers to

Definition at line 21 of file routing.h.

Referenced by forward_packet(), list_modules(), routing_print_table(), and routing_request_reply().

◆ last_attempt

long last_attempt

the optional callback on delivery result

Definition at line 58 of file queue.c.

◆ lastseen

long lastseen

seconds since boot since we last saw this (for expiry of entries)

Definition at line 22 of file routing.h.

◆ sensors

struct sensordev sensors[]
Initial value:
= {
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow1:ds18b20", "temp", "celsius", "centi", 207 },
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow2:ds18b20", "temp", "celsius", "centi", 211 },
{ 0, &onewire_init, NULL, &onewire_reading_size, &onewire_run, NULL, "ow3:ds18b20", "temp", "celsius", "centi", 212 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
{ 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 },
}

list of sensors...

Definition at line 1 of file sensor.c.

Referenced by sensor_register().

◆ statetable

const char* statetable[]
Initial value:
= {
"SLEEP",
"IDLE",
"XOFF",
"VCOON_MC",
"REGON_MC",
"MANCAL",
"VCOON",
"REGON",
"STARTCAL",
"BWBOOST",
"FS_LOCK",
"IFADCON",
"ENDCAL",
"RX",
"RX_END",
"RX_RST",
"TXRX_SWITCH",
"RXFIFO_OVERFLOW",
"FSTXON",
"TX",
"TX_END",
"RXTX_SWITCH",
"TXFIFO_UNDERFLOW",
NULL
}

Definition at line 42 of file ti1101.c.