Split RFControl constructor into public and private versions
Private constructor only used for Pixel, which is friend class of RFControl
This commit is contained in:
parent
4588669cd2
commit
877f47a64d
|
|
@ -13,6 +13,8 @@
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
class RFControl {
|
class RFControl {
|
||||||
|
friend class Pixel;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rmt_config_t *config=NULL;
|
rmt_config_t *config=NULL;
|
||||||
vector<uint32_t> data;
|
vector<uint32_t> data;
|
||||||
|
|
@ -20,8 +22,10 @@ class RFControl {
|
||||||
boolean refClock;
|
boolean refClock;
|
||||||
static uint8_t nChannels;
|
static uint8_t nChannels;
|
||||||
|
|
||||||
|
RFControl(uint8_t pin, boolean refClock, boolean installDriver); // private constructor (only used by Pixel class)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RFControl(uint8_t pin, boolean refClock=true, boolean installDriver=true); // creates transmitter on pin, using 1-MHz Ref Tick clock
|
RFControl(uint8_t pin, boolean refClock=true):RFControl(pin,refClock,true){}; // public constructor to create transmitter on pin, using 1-MHz Ref Tick clock or 80-MHz APB clock
|
||||||
|
|
||||||
void start(uint32_t *data, int nData, uint8_t nCycles=1, uint8_t tickTime=1); // starts transmission of pulses from specified data pointer, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
void start(uint32_t *data, int nData, uint8_t nCycles=1, uint8_t tickTime=1); // starts transmission of pulses from specified data pointer, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
||||||
void start(uint8_t nCycles=1, uint8_t tickTime=1); // starts transmission of pulses from internal data structure, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
void start(uint8_t nCycles=1, uint8_t tickTime=1); // starts transmission of pulses from internal data structure, repeated for numCycles, where each tick in pulse is tickTime microseconds long
|
||||||
|
|
@ -32,7 +36,7 @@ class RFControl {
|
||||||
void enableCarrier(uint32_t freq, float duty=0.5); // enables carrier wave if freq>0, else disables carrier wave; duty is a fraction from 0-1
|
void enableCarrier(uint32_t freq, float duty=0.5); // enables carrier wave if freq>0, else disables carrier wave; duty is a fraction from 0-1
|
||||||
void disableCarrier(){enableCarrier(0);} // disables carrier wave
|
void disableCarrier(){enableCarrier(0);} // disables carrier wave
|
||||||
|
|
||||||
int getPin(){return(config?config->gpio_num:-1);} // returns the pin number
|
int getPin(){return(config?config->gpio_num:-1);} // returns the pin number, or -1 if no channel defined
|
||||||
rmt_channel_t getChannel(){return(config?config->channel:RMT_CHANNEL_0);} // returns channel, or channel_0 is no channel defined
|
rmt_channel_t getChannel(){return(config?config->channel:RMT_CHANNEL_0);} // returns channel, or channel_0 is no channel defined
|
||||||
|
|
||||||
operator bool(){ // override boolean operator to return true/false if creation succeeded/failed
|
operator bool(){ // override boolean operator to return true/false if creation succeeded/failed
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue