@@ -112,7 +112,7 @@ Obsolete in near future, use functions above as those are less error prone.
112112
113113### Constants for mode registers
114114
115- | Name | Value | Description |
115+ | MODE1 names | Value | Description |
116116| :--------------------------| :-------:| :-------------------------------------|
117117| PCA9685_MODE1_RESTART | 0x80 | 0 = disable 1 = enable |
118118| PCA9685_MODE1_EXTCLK | 0x40 | 0 = internal 1 = external |
@@ -123,7 +123,10 @@ Obsolete in near future, use functions above as those are less error prone.
123123| PCA9685_MODE1_SUB3 | 0x02 | 0 = disable 1 = enable |
124124| PCA9685_MODE1_ALLCALL | 0x01 | 0 = disable 1 = enable |
125125| PCA9685_MODE1_NONE | 0x00 | |
126- | ---- | | |
126+
127+
128+ | MODE2 names | Value | Description |
129+ | :--------------------------| :-------:| :-------------------------------------|
127130| PCA9685_MODE2_INVERT | 0x10 | 0 = normal 1 = inverted |
128131| PCA9685_MODE2_STOP | 0x08 | 0 = on STOP 1 = on ACK |
129132| PCA9685_MODE2_TOTEMPOLE | 0x04 | 0 = open drain 1 = totem-pole |
@@ -157,17 +160,23 @@ The signal is divided in 4096 steps, 0..4095.
157160The pulse can begin ** onTime** on any step and it can stop on any step ** offTime** .
158161This allows e.g. to distribute the power over the 16 channels, e.g. the
159162channels do not need to start at the same moment with HIGH.
163+ The values 4096 allows to set the FULL_ON or FULL OFF bit.
160164- ** uint8_t setPWM(uint8_t channel, offTime)** simple PWM that always start on ** onTime = 0** .
161165- ** uint8_t getPWM(uint8_t channel, uint16_t \* onTime, uint16_t \* offTime)**
162166read back the configuration of the channel.
167+ Note the values may include the FULL ON / FULL OFF bit (0x1000).
163168- ** uint8_t allOFF()** switches all PWM channels OFF. ** Experimental** in 0.3.0.
164169To "undo" the allOFF one can call the ** reset()** function and set all
165170PWM channels again.
166- - ** uint8_t write1(channel, mode)** mode = HIGH or LOW, just use the PCA9685 as
167- a digital pin, write 1 bit.
168- This single function replaces the setON() and setOFF() that will become
171+ - ** uint8_t write1(uint8_t channel, uint8_t mode)** mode = HIGH or LOW, just use the PCA9685 as
172+ a digital pin, write 1 bit. Returns PCA9685_OK or error code.
173+ This single write1() function replaces the setON() and setOFF() that will become
169174obsolete in the future.
170175
176+ ** fix #29 experimental**
177+ - ** uint8_t read1(uint8_t channel)** reads the status of the digital pin.
178+ Can return { LOW = 0, HIGH = 1, other = 2 } or an error code.
179+
171180
172181### Frequency
173182
@@ -185,7 +194,7 @@ After changing the frequency, one must set all channels (again),
185194so one should set the frequency in ** setup()**
186195
187196The parameter offset can be used to tune the ** preScaler** to get a frequency
188- closer to the requested value. See ** PCA9685_setFrequency_offset** example.
197+ closer to the requested value. See ** PCA9685_setFrequency_offset.ino ** example.
189198Default the offset = 0. As the ** preScaler** is smaller at higher frequencies
190199higher frequencies are less accurate.
191200Making offset too large can result in very incorrect frequencies.
@@ -205,6 +214,8 @@ When using offset, the **getFrequency(false)** will return the adjusted **preSca
205214| PCA9685_ERR_MODE | 0xFD | Invalid mode
206215| PCA9685_ERR_I2C | 0xFC | I2C communication error
207216
217+ Be sure to check ** lastError()** for possible errors if you want robustness.
218+
208219
209220## SUB CALL and ALL CALL
210221
@@ -233,12 +244,16 @@ Typically there is only one such group but one can configure more of them by app
233244
234245The functions to enable all/sub-addresses are straightforward:
235246
247+ SubCall functions:
248+
236249- ** bool enableSubCall(uint8_t nr)** nr = 1,2,3
237250- ** bool disableSubCall(uint8_t nr)** nr = 1,2,3
238251- ** bool isEnabledSubCall(uint8_t nr)** nr = 1,2,3
239252- ** bool setSubCallAddress(uint8_t nr, uint8_t address)**
240253- ** uint8_t getSubCallAddress(uint8_t nr)**
241254
255+ AllCall functions:
256+
242257- ** bool enableAllCall()**
243258- ** bool disableAllCall()**
244259- ** bool isEnabledAllCall()**
@@ -310,14 +325,16 @@ For further details of the development, see - #10 (PCA9634 repo)
310325- improve error handling
311326 - return values etc.
312327 - documentation.
313- - #defines ==> const int?
328+ - #defines ==> const uint16_t ? (not possible for all defines)
329+
314330
315331#### Could
316332
317333- default values for functions.
318334- unit tests
319335- investigate int vs uint16_t ?
320336 - ** setFrequency(), getFrequency(), \_ freq**
337+ - need for an ** allON()** function?
321338
322339#### Wont
323340
0 commit comments