This page briefly summarizes the Arduino libraries that have been ported to Maple. You can use a library from within a sketch by going to Sketch > Import Library... from within the IDE, then choosing the library you want.
Any incompatibilities between the Maple and Arduino versions are noted in the description of the library.
Contents
The Servo library is provided for convenient control of RC servomotors. For more information, see the Servo reference.
Compatibility Note
The Servo class provides a public interface identical to the Arduino version’s documented functionality (as of Arduino 0021), so in most cases, this library will be a drop-in replacement.
However, there are some differences, essentially at the level of implementation details.
The major difference is that while the Arduino implementation drives the servos with “bit-banged” PWM, the Maple implementation uses timers to drive the PWM directly.
Consequently, the Maple implementation only allows Servo instances to attach to pins that support PWM.
To determine if a pin supports PWM (15 Maple pins do), you can either check if “PWM” appears next to its number on the Maple silkscreen, or consult the pwmWrite() documentation.
RC Servos expect a pulse approximately every 20ms. In the Maple implementation, periods are set for entire timers, rather than individual channels. Thus, attach()ing a Servo to a pin can interfere with other pins associated with the same timer[1].
Because of this, we recommend connecting multiple servomotors to pins which share a timer, in order to keep as many timers free for other purposes as possible. Consult the table provided in the timers reference to match up pins and timer channels.
Another difference: although it is not publicly documented to do so, the Arduino implementation of attach() returns the timer channel associated with the newly-attached pin, or 0 on failure (as of Arduino 0021). The Maple implementation returns true on success, and false on failure (and this is its documented behavior).
The LiquidCrystal library allows Maple to control LCD screens. For more information, see the Arduino LiquidCrystal documentation.
Compatibility Note
At this time, no incompatibilities between the Maple and Arduino versions are known. Any observed differences should be considered bugs, and reported on the forums.
We provide a soft (bit-banged) implementation of the Wire I2C library.
Compatibility Note
This implementation is synchronous, and thus supports only a subset of the full Wire interface (however, the functionality which is supported is fully compatible with Arduino). For now, please use the function reference which follows when developing projects using our implementation.
Please note that the current implementation only supports master mode using a bit-banged (software) protocol. Future enhancements will use the hardware i2c peripheral on the stm32 as well as the DMA for performance. Support for slave, smBUS, and multimaster modes are also slated for inclusion in the enhanced Wire port.
Ends a transmission (begun by Wire.beginTransmission(uint8)), and actually sends the bytes queued by calls to Wire.send.
The return value is one of the following status codes:
Requests num_bytes bytes from 7-bit slave address address. Returns the actual number of bytes read. These bytes may subsequently be read one at a time using Wire.receive().
Note: if num_bytes exceeds the size of the transmit/receive buffer (currently 32), it will be truncated to 32.
Footnotes
[1] | The Arduino implementation also captures timer channels in groups as more Servo objects are attached, but the details of which channels have their periods reset when are slightly different. |