MCPcopy Create free account
hub / github.com/BruceDevices/firmware / RCSwitch_RAW_Bit_send

Function RCSwitch_RAW_Bit_send

src/modules/rf/rf_send.cpp:544–577  ·  view source on GitHub ↗

ported from https://github.com/sui77/rc-switch/blob/3a536a172ab752f3c7a58d831c5075ca24fd920b/RCSwitch.cpp

Source from the content-addressed store, hash-verified

542
543// ported from https://github.com/sui77/rc-switch/blob/3a536a172ab752f3c7a58d831c5075ca24fd920b/RCSwitch.cpp
544void RCSwitch_RAW_Bit_send(RfCodes data) {
545 int nTransmitterPin = bruceConfigPins.rfTx;
546 if (bruceConfigPins.rfModule == CC1101_SPI_MODULE) { nTransmitterPin = bruceConfigPins.CC1101_bus.io0; }
547
548 if (data.data == "") return;
549 bool currentlogiclevel = false;
550 int nRepeatTransmit = 1;
551 for (int nRepeat = 0; nRepeat < nRepeatTransmit; nRepeat++) {
552 int currentBit = data.data.length();
553 while (currentBit >= 0) { // Starts from the end of the string until the max number of bits to send
554 char c = data.data[currentBit];
555 if (c == '1') {
556 currentlogiclevel = true;
557 } else if (c == '0') {
558 currentlogiclevel = false;
559 } else {
560 Serial.println("Invalid data");
561 currentBit--;
562 continue;
563 // return;
564 }
565
566 digitalWrite(nTransmitterPin, currentlogiclevel ? HIGH : LOW);
567 delayMicroseconds(data.te);
568
569 // Serial.print(currentBit);
570 // Serial.print("=");
571 // Serial.println(currentlogiclevel);
572
573 currentBit--;
574 }
575 digitalWrite(nTransmitterPin, LOW);
576 }
577}
578
579void RCSwitch_RAW_send(int *ptrtransmittimings) {
580 int nTransmitterPin = bruceConfigPins.rfTx;

Callers 1

sendRfCommandFunction · 0.85

Calls 1

printlnMethod · 0.45

Tested by

no test coverage detected