* @param aCommand VELUX_COMMAND_AUTO_UP or VELUX_COMMAND_AUTO_DOWN or VELUX_COMMAND_STOP * @param aMotorNumber 1, 2, 4 = Motor3, 7 = All * @param aMotorSet 0 = All, 1 to 10 * !!!NO parameter range check here!!! */
| 179 | * !!!NO parameter range check here!!! |
| 180 | */ |
| 181 | void IRsend::sendVelux(uint8_t aCommand, uint8_t aMotorNumber, uint8_t aMotorSet, uint16_t aSecurityCode, |
| 182 | int_fast8_t aNumberOfRepeats) { |
| 183 | // Just in case... |
| 184 | if (aMotorNumber == 3) { |
| 185 | aMotorNumber = 4; // motor numbers are bit position coded |
| 186 | } |
| 187 | |
| 188 | /* |
| 189 | * Compute checksum (only for automatic bit set to 1) |
| 190 | */ |
| 191 | uint8_t tChecksum = 8; // Start checksum for command |
| 192 | if (aCommand == VELUX_COMMAND_AUTO_DOWN) { |
| 193 | tChecksum = 0xD; |
| 194 | } |
| 195 | if (aCommand == VELUX_COMMAND_STOP) { |
| 196 | tChecksum = 2; |
| 197 | } |
| 198 | |
| 199 | uint8_t tXORForMotor = 0; |
| 200 | if (aMotorNumber == 2) { |
| 201 | tXORForMotor = 5; |
| 202 | } |
| 203 | if (aMotorNumber == 4) { |
| 204 | tXORForMotor = 0xF; |
| 205 | } |
| 206 | |
| 207 | tChecksum ^= aMotorSet; |
| 208 | tChecksum ^= tXORForMotor; |
| 209 | |
| 210 | sendVelux( |
| 211 | ((uint32_t) aCommand << 21) | ((uint32_t) aMotorNumber << 18) | (aMotorSet << 14) | ((uint32_t) aSecurityCode << 4) |
| 212 | | tChecksum, aNumberOfRepeats); |
| 213 | } |
| 214 | |
| 215 | void IRsend::sendVelux(uint32_t aData, int_fast8_t aNumberOfRepeats) { |
| 216 | do { |
nothing calls this directly
no outgoing calls
no test coverage detected