-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default constructor request #539
Comments
How would we go about preventing mis-use of this feature? Example: #define RF24_CE 7
#define RF24_CS 8
RF24 radio();
void setup() {
radio.begin(RF24_CE); // this is a bad scenario; complier will weep
radio.begin(RF24_CS); // this is a bad scenario; compiler will weep
radio.begin(); // this is a bad scenario because we used the blank c'tor above
radio.begin(RF24_CE, RF24_CS); // this is the only proper way to use the suggested feature.
// ...
} Initially I think |
Found |
convert _SPI calls to pointers where applicable typo made BCM driver fail overload begin() and amended docs about begin() fix faulty #ifdef logic doxygen v1.9.1 deprecated COLS_IN_ALPHA_INDEX tag bump version to v1.4.0 exclude only RF24_LINUX apply ptr treatment to Teensy, LittleWire, & Due trigger ArduinoCLI action doxygen action shouldn't create a docs folder no need to specify output dir in doxygen action make my life simpler: use new RF24_SPI_PTR macro trigger ArduinoCLI action forgot about c'tor; fix 2-space indent in begin() abstract SPI::begin() from _init_pins() adjust csn_pin before SPI.begin() on BCM driver conforming whitespace add printf.h fix from @TonioChingon in nRF24#739 rename atxmega.md & add link to supported product add Due to ArduinoCLI action fix teensy support; add PIO CI for teensy [PIO CI] use quoted matrix entries [PIO CI] use single quotes? I hate YML Gimme that badge add MRAA to Linux CI action typo [Linux CI] MRAA install needs special permission try with "sudo bash -c" [Linux CI] MRAA not cross compiling (I think) add example code snippets to Arduino support pg doc typos Due can't use SPI_PTR; delete ATXMEGA/readme.md (use docs/atxmega.md instead) fix nRF24#414; note need mbed example in arduino.md fix printf() only for adafruit/ArduinoCore-SAMD add msg about COMMON_ISSUES to README add estimated mbed example to arduino.md avr/pgmspace.h was added to Due core in 2013 oops, undo my testing change remove useless Due config file nRF24#752 ammend support for SPI_UART in csn() Confirm working 2nd SPI bus on esp8266 nRF24#648 fix indent c-n-p artifact; more indent inconcsistencies comment out theroretical example snippets add pinout img from RF24Audio repo doxygen sux at reading imgs implement nRF24#539 my CnP skills are lacking need to test py wrapper [py_wrap] begin fails to compile [py wrap] oops left the old begin still in there [py wrap] use thin wrapper for begin_w/_pins [pr wrap] try explicit begin(void) boost.py docs suck [py wrap] try using same name for begin(pin, pin) [py wrap] c'tor overload is bad [py wrap] "optional<>" template didn't take [py wrap] unmatched parenthesis advise that teensy doesn't need overloaded begin() docs review
The
RF24
class does not have a default constructor and, in some projects, may force heap allocation when the instance must be created and initialized during runtime. Heap allocation is a bad idea on microcontrollers like Arduino.For example, in my project, I need inicializate an instance of
RF24
with dynamic data during runtime, but because Arduino compatibility, the instance must be allocated in stack.My sugestion is for implementation of a default constructor, and a new
begin
method with paramters of the current constructor.The text was updated successfully, but these errors were encountered: