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
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
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
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.