diff --git a/README.md b/README.md index 5210448..19cbb85 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Installation instructions: **** 1) The TS4231 is a 3.3V device and must only be used with a 3.3V Arduino board. Failure to do so will damage the TS4231. **** 2) DO NOT add pull-up or pull-down resistors to the D and E signals. **** 3) DO NOT configure the Arduino INPUT ports that connect to the D and E signals with a pull-up or pull-down function. They must be floating. +**** 4) If using a microcontroller than can toggle output pin states faster than approximately 100ns, the TS4231 datasheet must be consulted to verify TS4231 timing parameters are not being violated to assure proper TS4231 operation. 1) First, install the TS4231 Arduino library by following the instructions here: diff --git a/examples/ts4231_config_example/ts4231_config_example.ino b/examples/ts4231_config_example/ts4231_config_example.ino index c106170..575a9c6 100644 --- a/examples/ts4231_config_example/ts4231_config_example.ino +++ b/examples/ts4231_config_example/ts4231_config_example.ino @@ -9,10 +9,15 @@ #define light_timeout 500 //500ms is a placeholder as this number will be system dependent -//IMPORTANT NOTE: If porting the TS4231 library code to a non-Arduino architecture, -//be sure that the INPUT ports assigned to the E and D signals are configured as -//floating inputs with NO pull-up or pull-down function. Using a pull-up or -//pull-down function on the inputs will cause the TS4231 to operate incorrectly. +//IMPORTANT NOTES: +//1) If porting the TS4231 library code to a non-Arduino architecture, +// be sure that the INPUT ports assigned to the E and D signals are configured as +// floating inputs with NO pull-up or pull-down function. Using a pull-up or +// pull-down function on the inputs will cause the TS4231 to operate incorrectly. +//2) If a microcontroller is being used that can change states on the E and D +// outputs faster than approximately 100ns, see the IMPORTANT NOTES section +// in file ts4231.cpp for more information. + #define device1_E_pin your_E_pin //User must replace your_E_pin with their pin number (compile error will occur if no number defined) #define device1_D_pin your_D_pin //User must replace your_D_pin with their pin number (compile error will occur if no number defined) diff --git a/library.properties b/library.properties index 926c4b6..750a7e4 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TS4231 Library -version=1.0.3 +version=1.0.4 author=Triad Semiconductor maintainer=Triad Semiconductor sentence=Triad Semiconductor library for configuring the TS4231 Light to Digital Converter. diff --git a/ts4231.cpp b/ts4231.cpp index 6d3951e..a1e77ce 100644 --- a/ts4231.cpp +++ b/ts4231.cpp @@ -9,10 +9,21 @@ #include "ts4231.h" #include -//IMPORTANT NOTE: If porting the TS4231 library code to a non-Arduino architecture, -//be sure that the INPUT ports assigned to the E and D signals are configured as -//floating inputs with NO pull-up or pull-down function. Using a pull-up or -//pull-down function on the inputs will cause the TS4231 to operate incorrectly. +//IMPORTANT NOTES: +//1) If porting the TS4231 library code to a non-Arduino architecture, +// be sure that the INPUT ports assigned to the E and D signals are configured as +// floating inputs with NO pull-up or pull-down function. Using a pull-up or +// pull-down function on the inputs will cause the TS4231 to operate incorrectly. +//2) The TS4231 library omits delays between E and D signal transitions when going +// from S3_STATE to WATCH_STATE or SLEEP_STATE to WATCH_STATE in function +// goToWatch() for the purpose of transitioning into WATCH_STATE as quickly as +// possible. If a microcontroller is being used that can change states on +// the E and D outputs faster than approximately 100ns, the TS4231 datasheet +// must be consulted to verify timing parameters are not being violated to +// assure proper TS4231 operation. A suitable solution would be to include +// a short delay in function ts_digitalWrite() to allow enough time between +// output pin signal changes to meet the TS4231 timing parameters as stated +// in the datasheet. See the ts_digitalWrite() function for more information. TS4231::TS4231(int device_E_pin, int device_D_pin) { configured = false; @@ -39,6 +50,10 @@ uint8_t TS4231::ts_digitalRead(int pin) { void TS4231::ts_digitalWrite(int pin, uint8_t write_val) { digitalWrite(pin, write_val); +//A short delay function can be inserted here to extend the time between writes to +//the E and D outputs if TS4231 timing parameters are being violated. Consult +//the TS4231 datasheet for more information on timing parameters. It is recommended +//that any added delay be no longer than approximately 1us. } unsigned long TS4231::ts_millis() {