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

Function RCSwitch_RAW_send

src/modules/rf/rf_send.cpp:579–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579void RCSwitch_RAW_send(int *ptrtransmittimings) {
580 int nTransmitterPin = bruceConfigPins.rfTx;
581 if (bruceConfigPins.rfModule == CC1101_SPI_MODULE) { nTransmitterPin = bruceConfigPins.CC1101_bus.io0; }
582
583 if (!ptrtransmittimings) return;
584
585 bool currentlogiclevel = true;
586 int nRepeatTransmit = 1; // repeats RAW signal twice!
587 // HighLow pulses ;
588
589 for (int nRepeat = 0; nRepeat < nRepeatTransmit; nRepeat++) {
590 unsigned int currenttiming = 0;
591 while (ptrtransmittimings[currenttiming]) { // && currenttiming < RCSWITCH_MAX_CHANGES
592 if (ptrtransmittimings[currenttiming] >= 0) {
593 currentlogiclevel = true;
594 } else {
595 // negative value
596 currentlogiclevel = false;
597 ptrtransmittimings[currenttiming] = (-1) * ptrtransmittimings[currenttiming]; // invert sign
598 }
599
600 digitalWrite(nTransmitterPin, currentlogiclevel ? HIGH : LOW);
601 delayMicroseconds(ptrtransmittimings[currenttiming]);
602
603 /*
604 Serial.print(ptrtransmittimings[currenttiming]);
605 Serial.print("=");
606 Serial.println(currentlogiclevel);
607 */
608
609 currenttiming++;
610 }
611 digitalWrite(nTransmitterPin, LOW);
612 } // end for
613}

Callers 1

sendRfCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected