RF Control Update
Changed arguments for add() method from int to uint8_t. Updated pulse train figure.
This commit is contained in:
parent
b1b4389963
commit
cefc1df399
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
|
@ -31,7 +31,7 @@ RFControl::RFControl(int pin){
|
|||
|
||||
///////////////////
|
||||
|
||||
void RFControl::start(int _numCycles, int tickTime){
|
||||
void RFControl::start(uint8_t _numCycles, uint8_t tickTime){
|
||||
pRMT[pCount]=0; // load end-marker (zero bytes) into RMT memory
|
||||
REG_WRITE(GPIO_ENABLE_W1TS_REG,1<<pin); // enable output on pin
|
||||
numCycles=_numCycles; // set number of cycles to repeat transmission
|
||||
|
|
@ -52,11 +52,11 @@ void RFControl::clear(){
|
|||
void RFControl::add(uint16_t onTime, uint16_t offTime){
|
||||
|
||||
if(pCount==511){ // maximum number of pulses reached (saving one space for end-marker)
|
||||
Serial.println("\n*** ERROR: Can't add more than 511 pulses to RF Control Module\n\n");
|
||||
Serial.print("\n*** ERROR: Can't add more than 511 pulses to RF Control Module\n\n");
|
||||
} else
|
||||
|
||||
if(offTime>32767 || onTime>32767){
|
||||
Serial.println("\n*** ERROR: Request to add RF Control pulse with ON or OFF time exceeds 32767 maximum allowed number of ticks\n\n");
|
||||
Serial.print("\n*** ERROR: Request to add RF Control pulse with ON or OFF time exceeds 32767 maximum allowed number of ticks\n\n");
|
||||
} else {
|
||||
|
||||
pRMT[pCount++]=(offTime<<16)+onTime+(1<<15); // load pulse information into RMT memory and increment pointer
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class RFControl {
|
|||
RFControl(int pin); // creates transmitter on pin
|
||||
static void clear(); // clears transmitter memory
|
||||
static void add(uint16_t onTime, uint16_t offTime); // adds pulse of onTime ticks HIGH followed by offTime ticks LOW
|
||||
void start(int _numCycles, int tickTime=1); // starts transmission of pulses, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
||||
void start(uint8_t _numCycles, uint8_t tickTime=1); // starts transmission of pulses, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue