MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / sendRC5ext

Method sendRC5ext

src/ir_RC5_RC6.hpp:914–976  ·  view source on GitHub ↗

* Deprecated, use sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) instead */

Source from the content-addressed store, hash-verified

912 * Deprecated, use sendRC5(uint8_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, bool aEnableAutomaticToggle) instead
913 */
914void IRsend::sendRC5ext(uint8_t addr, uint8_t cmd, bool toggle) {
915// Set IR carrier frequency
916 enableIROut (RC5_RC6_KHZ);
917
918 uint8_t addressBits = 5;
919 uint8_t commandBits = 7;
920// unsigned long nbits = addressBits + commandBits;
921
922// Start
923 mark(RC5_UNIT);
924
925// Bit #6 of the command part, but inverted!
926 uint8_t cmdBit6 = (1UL << (commandBits - 1)) & cmd;
927 if (cmdBit6) {
928 // Inverted (1 -> 0 = mark-to-space)
929 mark(RC5_UNIT);
930 space(RC5_UNIT);
931 } else {
932 space(RC5_UNIT);
933 mark(RC5_UNIT);
934 }
935 commandBits--;
936
937// Toggle bit
938 static int toggleBit = 1;
939 if (toggle) {
940 // invert static toggle bit
941 if (toggleBit == 0) {
942 toggleBit = 1;
943 } else {
944 toggleBit = 0;
945 }
946 }
947 if (toggleBit) {
948 space(RC5_UNIT);
949 mark(RC5_UNIT);
950 } else {
951 mark(RC5_UNIT);
952 space(RC5_UNIT);
953 }
954
955// Address
956 for (uint_fast8_t mask = 1UL << (addressBits - 1); mask; mask >>= 1) {
957 if (addr & mask) {
958 space(RC5_UNIT); // 1 is space, then mark
959 mark(RC5_UNIT);
960 } else {
961 mark(RC5_UNIT);
962 space(RC5_UNIT);
963 }
964 }
965
966// Command
967 for (uint_fast8_t mask = 1UL << (commandBits - 1); mask; mask >>= 1) {
968 if (cmd & mask) {
969 space(RC5_UNIT); // 1 is space, then mark
970 mark(RC5_UNIT);
971 } else {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected