Interface Widget Help

Serial Interface Help

Interface Window

Help Index

Programming Help

Working with Serial Interface is easy! Please read the steps below for how to use the Serial Interface API.

How to create a Serial Interface Widget Window

Before creating a Serial Interface Widget Window you need to establish a serial communications connection to Omnia Creator first using the ILCore object. ILCore takes care of connecting to Omnia Creator using the fastest possible serial communications speed; that your microcontroller can run the Omnia Creator Interface Library code at so that you don’t have to worry about baud rates anymore.

With Omnia Creator, worrying about baud rates is a thing of the past!

Please note: you need to make sure that your serial port’s baud rate is set to Auto in Omnia Creator for the Omnia Creator Interface Library to work. You can also force your serial port’s baud rate to be another value in Omnia Creator for interfacing with devices that aren’t running the Omnia Creator Interface Library code.

To get started with Serial Interface, first include the Omnia Creator Interface Library in your code (line 1). Then declare the ILCore and ILInterface objects (lines 3 and 4). In your main/setup function initialize communication with Omnia Creator using the core.init() function (line 8). core.init() takes care of setting up serial communications with Omnia Creator for you. Once you’ve initialized ILCore DO NOT USE YOUR NATIVE SERIAL FUNCTIONS ANYMORE! If you need to receive or send characters use ILCore to do it for you. ILCore wraps around your native serial port and supplies its own functions to access your native serial port like read, write, print, println, etc. However, if you still want to write/print to your native serial port, this is okay and will not cause any problems. Any text sent by your microcontroller will be printed to Omnia Creator’s standard serial terminal if you use your native serial write/print functions or ILCore’s write/print functions. But, you need to use the ILCore functions for receiving serial data. Calling your native serial read functions will cause the Omnia Creator Interface Library to lose synchronization with Omnia Creator.

Please note: you can use the ILCore object to open dialog boxes on the computer and get the results. You’re not going to really ever need to type into the serial terminal to command your microcontroller anymore!

Next, after initializing the core object you can clear all the previous Widget Windows from Omnia Creator’s memory by calling core.clearAll() (line 9). Any open Widget Windows should disappear after executing this line of code. If you don’t clear previous Widget Windows from memory you can still keep adding data to them from your microcontroller. However, you’ll need to clear a previous Widget Window from memory if you change the Widget Window’s type when you initialize it in your code. Omnia Creator’s Widget Menu also has a Remove Widget command and a Remove All Widgets command for this purpose. Omnia Creator will print out debug messages when there’s a problem that you need to address.

Finally, you can create the Serial Interface Widget Window by calling interface.init(&core, “Hello World”) (line 11). The first argument to interface.init() is a pointer to the core object. All you need to do is pass it &core always. Passing &core connects the child ILInterface object to parent ILCore object. The second argument to interface.init() is a title string for the Widget Window. You can make this string whatever you want. But, please try to keep it short. If you’d like a docked Widget Window call the initDocked() function instead of the init() function. This will create the Serial Interface Widget Window as a docking window that can dock itself inside of the main Omnia Creator window. Otherwise the init() function will create the Serial Interface Widget as a top level window.

After executing this code a Serial Interface Widget Window should appear!

How to remove objects from a Serial Interface Widget Window

Removing objects from your Serial Interface Widget Window is easy. You can remove a group box, remove all group boxes, or remove all interface boxes.

More and better help coming soon!

After declaring and initializing your serial interface you can add ILInterfaceGroupBox objects to it. Group boxes are containers for actual user interface boxes. Group boxes are appended horizontally inside the serial interface window while interface boxes are appended vertically inside group boxes. You init the group box like all other objects in this library. Pass ILInterface as the parent and give the group box a name. Once you have created a group box you can add interface boxes to it. You declare and init interface boxes the same way as the group box – however, you must pass the group box as the parent to the interface boxes. Interface boxes will be added to the parent group box you pass. You can set the properties on interface boxes you create after they have been initialized.

You can freely update the properties of user interface elements and get their state in real time. Omnia Creator actually generates serial messages and sends them to your microcontroller when buttons are clicked, check boxes are toggled, etc. The interface library will then processes these messages and updates object states on your microcontroller. This makes creating user interfaces really, really, easy. Objects like the line edit can actually transfer strings this way. All objects that update like this have a XXXChanged() function that you can call to see if they have been updated. Then you can read the object’s state using the getXXX() functions. If you want you can subclass objects to get access to the function that is called when the object’s state is updated to handle the change immediately. However, the interface library is not recursive proof so calling any interface library functions in this function will crash the interface library.

You have to either call core.idleLoop() or be calling any function that is sending serial data using the interface library for the microcontroller serial port to be emptied of received data. Incoming packets are not handled by interrupts – you have to poll using idleLoop() if you’re not sending anything. The send functions check the receive buffer on transmit. You don’t need to worry about dropping serial bytes because the interface library has end to end flow control that will stop Omnia Creator from sending messages when your microcontroller can’t accept them. However, the default serial terminal (and serial terminal widget windows) bypass this… but, you shouldn’t be using the default serial terminal and serial terminal widget windows to send commands anymore. Omnia Creator has a host of new tools to command your microcontroller. Just use the terminal windows to receive text.

User Interface Help

You can find information about user interface functions below: