serial is working
I2C is wrong
First, the initialization was incorrect. The FastClock was initialized before the I2C Manager was initialized
Second: FastClock Functions are missing
No functional change.
VPINs are unsigned integers in the range 0-65535 (although the highest values are special, 65535=VPIN_NONE). Values above 32767 were erroneously being displayed as negative. This has been fixed, which is a pre-requisite for allowing VPINs above 32767 to be used.
FLAGS HAL device added to IODevice.h, which allows use of SET/RESET/<Z>/<T> to set and reset a VPIN state, and to allow <S>/IF/IFNOT/AT/WAITFOR/etc. to monitor the VPIN state.
Also, correct handling of VPINs above 32767 in DIAG calls within IODevice.cpp and IODevice.h.
Filter drivers provide extra functionality above a hardware driver. For example, a hardware driver for a PWM module may just set the PWM ratio, but a separate filter driver could animate motors or servos over time, calling the PWM driver to output the pulses. This would allow the animations to be easily implemented on a different type of PWM module.
The checkNoOverlap() function didn't work correctly in the case where one device has nPins=0. All devices configured after that were rejected, even when no overlap was present.
When testing CS in minimal HAL mode but with mySetup.h and myAutomation.h files present, I experienced freezing of the arduino because the standard pinMode, digitalWrite etc don't validate the pin number passed to them. So I've added checks on the pin number to the configure, write and read functions in the minimal HAL.
Ensure that HAL devices are created before use by moving the call to mySetup into IODevice::begin(). The need for this became evident when it was noted that RMFT (EX-RAIL) interacts with HAL devices during its initialisation, by enabling pull-ups on digital inputs.
Any
If an Arduino pin was used as an input (e.g. by EXRAIL) without previously configuring it, the default pullup wouldn't be set up. Now, on first call to the _read() method the pullup will be enabled.
Remove virtual method hasCallback().
Optimise findDevice() method (used by read, write etc.).
Simplify Sensor handling with regard to IO Devices that support callbacks.
Performance enhancements in IODevice::loop() function.
Improved error handling, device is placed off line if not responding.
Improved error reporting, device shown as offline if not operational (faulty or not present).
When writing to analogue outputs pins, the digital _read() function now returns the 'busy' status of the analogue pin. Consequently, the _isBusy() function becomes superfluous and has been removed. The static IODevice::isBusy() function now calls the object's _read() function instead.
Also, limit in DFPlayer of 3 pins has been removed.
WAITFOR(pin) waits until the corresponding pin is not busy (e.g. has finished moving the servo). SERVO2(pin, value, ms) moves to the nominated position in a time given in milliseconds by ms.
IODevice::writeAnalogue() has an additional optional parameter "duration", specifying the time taken for the animation in units of 100ms (max 3276 seconds, or about 54 minutes).
* Re-enable native I2C driver.
* Minor non-functional changes to native I2C Manager.
* Minor changes to make variable types explicit in comparisons.
* Fix IODevice::loop() to avoid null pointer dereference.
Strange problems with LCD driver tracked down to being caused by a call to p->_loop() when p is NULL.
* Correct sense of comparison in LCN support function Turnout::setClosedStateOnly()
* Remove code (now unused) from LCD driver.
* Add I2C textual error messages.
* Add I2C textual error messages.
* Fix compile error in 4809 I2C driver.
* Remove init function call from SSD1306 driver.
* Add <D SERVO vpin position> command
Allow a PWM servo to be driven to any arbitrary position.
* Enhancements for HAL drivers
Add state change notification for external GPIO module drivers;
Allow drivers to be installed statically by declaration (as an alternative to the 'create' call).
* Create IO_HCSR04.h
HAL driver for HC-SR04 ultrasonic distance sensor (sonar).
* Enable servo commands in NO-HAL mode, but return error.
Avoid compile errors in RMFT.cpp when compiled with basic HAL by including the Turnout::createServo function as a stub that returns NULL.
* Update IO_HCSR04.h
Minor changes
* Change <D SERVO>
Give the <D SERVO> command an optional parameter of the profile. For example, <D SERVO 100 200 3> will slowly move the servo on pin 100 to PWM position corresponding to 200. If omitted, the servo will move immediately (no animation).
* IODevice (HAL) changes
1) Put new devices on the end of the chain instead of the beginning. This will give better performance for devices created first (ArduinoPins and extender GPIO devices, typically).
2) Remove unused functions.
* Update IO_HCSR04.h
Allow thresholds for ON and OFF to be separately configured at creation.
* Update IODevice.cpp
Fix compile error on IO_NO_HAL minimal HAL version.
* Update IO_PCA9685.cpp
Remove unnecessary duplicated call to min() function.
IODevice::read() now returns int, instead of bool. This is consistent with the IODevice::_read() return and also allows for future devices that return a non-boolean value.