USER MANUAL RC188x-GPR2019 Radiocrafts AS RIIM User Manual (rev.1.2) Page 6 of 234 How to use ICI, the Event Driven PlatformEverything in ICI is event-driven. It is up to the user application to define the events and the handlers for theseevents.Think of the user application as a list of event handlers — if-this-then-that. If this event occurs, then do that in thishandler.As an example, a simple wireless sensor application could be defined by the following event behaviors. if network state is offline then turn off the LED if network state is joining then blink the LED if network state is online then turn on the LED after powering up, automatically join or rejoin a network every 20 seconds, read data from the sensors on I2C after every sensor reading, send sensor data as CoAP message to a given IP addressOf course, a lot more is possible. Sensors and actuators can be accessed using different interfaces (I2C, ADC,GPIO, SPI, UART..). Periodic or one-shot timer events can be created. Custom actions can be triggered by networkcommands from the root node. Global variables can be used to track internal states. Data can be saved to non-volatile memory to preserve them across power resets. Algorithms can be implemented to process or filter data.Underneath, ICI silently takes care of the security and reliability of the network, any over-the-air updates, and thepowerful real-time operating system (RTOS) that schedules the events.The user code is is composed of RIIM_SETUP() and a list of event handlers. RIIM_SETUP() is the only functionthat must be implemented, and it is called from the application framwork when the node starts up. From withinRIIM_SETUP(), you can define events and register handlers for these events — e.g. when you receive amessage, or when a timer expires.You can also chain events based on other events by defining an event within another event handler. For example,you can start a timer when a GPIO edge triggers.