write count values in consecutive PWM registers checks if [channel + count - 1 > 15]
| 85 | // write count values in consecutive PWM registers |
| 86 | // checks if [channel + count - 1 > 15] |
| 87 | uint8_t PCA9635::writeN(uint8_t channel, uint8_t* arr, uint8_t count) |
| 88 | { |
| 89 | if (channel + count > _channelCount) |
| 90 | { |
| 91 | _error = PCA9635_ERR_WRITE; |
| 92 | return PCA9635_ERROR; |
| 93 | } |
| 94 | uint8_t base = PCA9635_PWM(channel); |
| 95 | _wire->beginTransmission(_address); |
| 96 | _wire->write(base); |
| 97 | for(uint8_t i = 0; i < count; i++) |
| 98 | { |
| 99 | _wire->write(arr[i]); |
| 100 | } |
| 101 | _error = _wire->endTransmission(); |
| 102 | if (_error != 0) |
| 103 | { |
| 104 | _error = PCA9635_ERR_I2C; |
| 105 | return PCA9635_ERROR; |
| 106 | } |
| 107 | return PCA9635_OK; |
| 108 | } |
| 109 | |
| 110 | |
| 111 | uint8_t PCA9635::writeMode(uint8_t reg, uint8_t value) |