Brief list of changes:
- Add PWM device unit and hardware PWM drivers for Raspberry Pi
- Add port of WiringPi API including WiringPiI2C, WiringSerial and WiringPiSPI
- Fix ConsoleWindowClearEx() to only reset the cursor position to top left when requested (Affected ConsoleClrEol function)
- Fix ConsoleReadLn to support basic handling of Backspace and Tab keys
- Expand SysBasicEventWaitFor return values to support TEventObject.WaitFor
- Add new SysRandomize() function to allow RandSeed to be initialized with a unique value when calling Randomize()
- Fix extra invalid character at the end of any domain name value obtained via DHCP
- Add implementation of ConsoleWindowScrollLeft() and ConsoleWindowScrollRight() functions
- Add handling of WINDOW_FLAG_AUTO_SCROLL flag in Console unit
- Change Console and Console Window to use a recursive Mutex, remove code to release lock on recursive calls
- Fix handling of certain removable USB drives with no partitions, would not be recognized as a valid drive
- Update Timezone unit with latest world timezone data
- Change VirtualDisk unit to implement correct locking in all functions and remove unnecessary exception handlers
- Add new GPIOAvailable() function in Platform unit with implementation from GPIO unit
- Add new ConsoleWindowResetViewport() and ConsoleWindowResetRect() functions
- Fix ConsoleWindowClear() and ConsoleWindowClearEx() incorrect X2 and Y2 values on character console
- Remove dependancy of Ultibo unit on Console and Font units
- Fix cursor tracking on HD44780 console driver
- Change the VirtualGPIO API in Platform to be in line with the GPIO functions
- Modify PlatformRPi and PlatformRPi2 units to allow Activity LED support if no GPIO driver included
- Add additional CLOCK_ID_* values and correct the translation of some existing ones
As per the standard device model in Ultibo core, the PWM implementation includes a device unit to provide the API and Raspberry Pi specific drivers for each model. The drivers provide access to both PWM channels in the Raspberry Pi and support setting all available parameters including clock frequency, range, mode and duty cycle. While the PWM device does not specifically deal with PWM audio it is possible to generate tones using the PWM device in the Raspberry Pi by setting the correct GPIO pins when configuring the PWM device, a later driver will deal with specific support for audio playback using PWM on the Raspberry Pi.
To use the PWM device API include the PWM unit in your project, the API includes the following functions:
- PWMDeviceStart - Start a PWM device
- PWMDeviceStop - Stop a PWM device
- PWMDeviceWrite - Write a data value (duty cycle) to a PWM device
- PWMDeviceGet/SetGPIO - Get or Set the GPIO pin for a PWM device
- PWMDeviceGet/SetMode - Get or Set the mode for a PWM device
- PWMDeviceGet/SetRange - Get or Set the range (period) for a PWM device
- PWMDeviceGet/SetFrequency - Get or Set the clock frequency for a PWM device
- PWMDeviceGet/SetPolarity - Get or Set the output polarity for a PWM device
- PWMDeviceConfigure - Configure the Duty cycle and output period (in nanoseconds) for a PWM device (This is similar to the Linux API)
- PWMDeviceProperties - Get the properties of a PWM device to determine what features it supports and the current settings
WiringPi API port:
This commit includes a working port of Gordon Hendersons WiringPi library (http://wiringpi.com/), the WiringPi library is designed to provide a subset of the Wiring library used by Arduino and other microcontrollers and has been used in a large number of Raspberry Pi examples. It has also been ported to other languages such as Python, Perl and Ruby, the Ultibo port of WiringPi is intended to allow easy translation of examples by providing the API as closely as possible to the original.
At this stage all of the setup, core, timing, threads, priority, interrupt, shift and Raspberry Pi specific functions are implemented as well as the I2C, serial and SPI library functions. This should be sufficient to allow porting of many existing examples without needing to change function names, pins or parameter values, for full documentation and more information see the WiringPi reference (http://wiringpi.com/reference/) as well as many other online sources of information.
The WiringPi library also includes support of a range of I2C and SPI devices such as I/O expanders, Analog to Digital (and Digital to Analog) converters, real time clocks and LCD displays (http://wiringpi.com/extensions/). If these devices are not yet natively supported in Ultibo core then the Wiring unit will also allow easy porting of these extensions from WiringPi.
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 or watch the Building the RTL video on YouTube.