Latest commits (Ultibo core 1.1.145)

Releases, updates and announcements from the Ultibo team.
User avatar
Site Admin
Posts: 2217
Joined: Sat Dec 19, 2015 3:49 am
Location: Australia

Latest commits (Ultibo core 1.1.145)

Postby Ultibo » Wed May 11, 2016 1:37 am

The latest commits for Ultibo core are now available on GitHub. Changes include GPIO driver, UART (Serial) driver, PL2303 USB to Serial driver and more.

Brief list of changes:

  • Add new Description property to devices and FindByName / FindByDescription functions (Not yet fully implemented in all drivers)
  • Add GPIO device unit and GPIO driver for Raspberry Pi
  • Add UART device unit and UART driver for Raspberry Pi
  • Add USB driver for Prolific PL2303 USB to Serial Converter
  • Add Serial device unit with configurable read and write buffering
  • Add Serial logging device to allow logging over any serial device
  • Update Platform ActivityLED and PowerLED functions to use GPIO device, you can now control the Red LED on Raspberry Pi (A+, B+ and 2B only)
  • Change default log level in all subsystems to DEBUG, debug logging will NOT be output unless the matching define in GlobalDefines is also set
  • Other minor fixes and additions

GPIO driver:

The GPIO implementation includes the GPIO device unit to provide the API and a Raspberry Pi specific GPIO driver to interface with the hardware. All functionality of the Raspberry Pi GPIO is supported including function select, pull up/down, interrupts and edge or level triggered events.

The full API is accessible by including the GPIO unit in your project, there is also a simplified API in the Platform unit which interfaces with the default GPIO device (in most cases there will only be one).

Functions available in the Platform unit include:

  • GPIOInputGet - Read the current level of a pin
  • GPIOOutputSet - Set the level of a pin to high or low
  • GPIOPullGet - Read the pull up/down state of a pin (Not supported by the Raspberry Pi GPIO chip)
  • GPIOPullSelect - Set the pull up/down state of a pin
  • GPIOFunctionGet - Read the current function of a pin (eg in, out or an alternate function)
  • GPIOFunctionSelect - Set the function of a pin
  • GPIOInputWait - Wait for the current level of a pin to change
  • GPIOInputEvent - Register a callback to be called when the level of a pin changes
See the comments in the header of each function for details of the required parameters, all pin numbers refer to the pins as per the chip documentation (ie pin numbers are not translated). For predefined constants for GPIO pins, levels, functions and pull up/down states see the GlobalConst unit.

UART / Serial driver:

As per the convention for other devices, the UART implementation includes a UART device unit which provides an API and a driver specific to the Raspberry Pi. The driver currently implements the ARM PL011 UART in the Broadcom chip, the second mini UART is not yet supported.

Each UART device is also represented as a Serial device which allows a choice of API for different needs. Including the UART unit provides the UART API which performs direct reads and writes to the underlying device, including the Serial unit instead provides the Serial API which includes buffered reads and writes and supports non blocking access.

The Platform unit contains a set of wrapper functions to access the default serial device with the following:

  • SerialAvailable - Determine if a serial device (UART or otherwise) is available
  • SerialOpen - Open the default serial device with the baud rate and settings specified
  • SerialClose - Close the default serial device
  • SerialRead - Read a number of bytes from the default serial device
  • SerialWrite - Write a number of bytes to the default serial device
See the comments in the header of each function for details of the required parameters, both the UART and Serial units provide additional options. Predefined constants for serial data and stop bits, parity and flow control are provided in the GlobalConst unit. Note that the PL011 UART in the Raspberry Pi has very small transmit and receive buffers (16 bytes each), various speeds have been tested and work correctly however at higher speeds it is quite easy to overrun the small receive buffer without some form of flow control.

Prolific PL2303 USB to Serial driver:

This driver supports USB to Serial converters based on the Prolific PL2303 chip, any device supported by the Linux or Windows drivers should also work with this driver. To add support for these devices in your project simply include the PL2303 unit and the driver will automatically register with the USB core, when a supported device is connected it will appear as a serial device and be usable via the serial API.

The serial logging device can be enabled and configured from the command line or using the GlobalConfig parameters SERIAL_REGISTER_LOGGING, SERIAL_LOGGING_DEFAULT and SERIAL_LOGGING_PARAMETERS, see the comments in that unit for more information.

For details of how to apply the latest source to your Ultibo core installation and rebuild your run time library see the wiki page Building from Source. | Make something amazing

Return to “Ultibo”

Who is online

Users browsing this forum: No registered users and 1 guest