From e677d8f42bc01dfb7e2df75b781857ba019d4fed Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sat, 7 Sep 2024 18:26:51 -0700 Subject: [PATCH 1/4] minor readme updates --- examples/old_backups/recipes/readme.md | 9 +++++++-- examples_linux/readme.md | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/old_backups/recipes/readme.md b/examples/old_backups/recipes/readme.md index c22d7a24c..15ea3ff5f 100644 --- a/examples/old_backups/recipes/readme.md +++ b/examples/old_backups/recipes/readme.md @@ -1,2 +1,7 @@ -Note: These recipe examples may have not been maintained with library updates, and are provided as-is for reference purposes. -Warning: These are recipe examples are intended for specific hardware usage. \ No newline at end of file +# Recipes + +> [!note] +> These recipe examples may have not been maintained with library updates, and are provided as-is for reference purposes. + +> [!warning] +> These are recipe examples are intended for specific hardware usage. diff --git a/examples_linux/readme.md b/examples_linux/readme.md index 0fcad99a0..259b40215 100644 --- a/examples_linux/readme.md +++ b/examples_linux/readme.md @@ -1,3 +1,6 @@ -Note: These examples were originally designed for RPi, but should work on any supported Linux platform, with the proper pin configuration. +# Linux examples -See http://nRF24.github.io/RF24 for more information \ No newline at end of file +> [!note] +> These examples were originally designed for RPi, but should work on any supported Linux platform, with the proper pin configuration. + +See http://nRF24.github.io/RF24 for more information From a1498c7d3b284cc0c49ad8c4dbb664f71a969465 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sat, 7 Sep 2024 18:24:58 -0700 Subject: [PATCH 2/4] add cspell config and fix spelling errors --- CMakeLists.txt | 4 +- CONTRIBUTING.md | 4 +- LICENSE | 14 +- RF24.h | 4 +- cmake/PreventInSourceBuilds.cmake | 8 +- cmake/detectCPU.cmake | 2 +- cmake/toolchains/arm64.cmake | 4 +- cmake/toolchains/armhf.cmake | 4 +- cmake/toolchains/i686.cmake | 4 +- cmake/toolchains/x86_64.cmake | 4 +- cspell.config.yaml | 313 +++++++++++++ docs/arduino.md | 8 +- docs/attiny.md | 4 +- docs/atxmega.md | 2 +- docs/cross_compile.md | 6 +- docs/main_page.md | 2 +- docs/pico_sdk.md | 4 +- docs/python_wrapper.md | 2 +- docs/rpi_general.md | 4 +- docs/sphinx/conf.py | 3 - docs/using_cmake.md | 2 +- .../AcknowledgementPayloads.ino | 418 +++++++++--------- examples/GettingStarted/GettingStarted.ino | 2 +- .../ManualAcknowledgements.ino | 4 +- examples/MulticeiverDemo/MulticeiverDemo.ino | 2 +- .../encodeRadioDetails/encodeRadioDetails.ino | 2 +- examples/encodeRadioDetails/print_details.py | 4 +- .../GettingStarted_HandlingFailures.ino | 2 +- .../TransferTimeouts/TransferTimeouts.ino | 4 +- .../old_backups/pingpair_dyn/pingpair_dyn.ino | 2 +- .../timingSearch3pin/timingSearch3pin.ino | 2 +- examples_linux/CMakeLists.txt | 2 +- examples_linux/acknowledgementPayloads.cpp | 2 +- examples_linux/gettingstarted.cpp | 2 +- .../gettingstarted_call_response_int.cpp | 4 +- .../gettingstarted_call_response_int2.cpp | 4 +- .../interrupts/transfer_interrupt.cpp | 2 +- examples_linux/manualAcknowledgements.cpp | 6 +- examples_linux/manual_acknowledgements.py | 4 +- examples_linux/multiceiverDemo.cpp | 2 +- examples_pico/acknowledgementPayloads.cpp | 6 +- examples_pico/defaultPins.h | 2 +- examples_pico/gettingStarted.cpp | 2 +- examples_pico/manualAcknowledgements.cpp | 4 +- examples_pico/multiceiverDemo.cpp | 2 +- utility/ATXMegaD3/RF24_arch_config.h | 2 +- utility/ATXMegaD3/compatibility.c | 4 +- utility/ATXMegaD3/compatibility.h | 2 +- utility/ATXMegaD3/gpio_helper.c | 30 +- utility/ATXMegaD3/gpio_helper.h | 6 +- utility/ATXMegaD3/spi.h | 2 +- utility/MRAA/RF24_arch_config.h | 2 +- utility/MRAA/compatibility.cpp | 6 +- utility/MRAA/compatibility.h | 4 +- utility/MRAA/spi.cpp | 28 +- utility/MRAA/spi.h | 10 +- utility/RPi/spi.cpp | 4 +- utility/RPi/spi.h | 14 +- utility/SPIDEV/RF24_arch_config.h | 2 +- utility/SPIDEV/compatibility.cpp | 6 +- utility/SPIDEV/compatibility.h | 4 +- utility/SPIDEV/spi.cpp | 6 +- utility/SPIDEV/spi.h | 2 +- utility/Template/RF24_arch_config.h | 2 +- utility/Template/compatibility.h | 4 +- utility/Template/spi.h | 6 +- utility/pigpio/RF24_arch_config.h | 2 +- utility/pigpio/compatibility.cpp | 6 +- utility/pigpio/compatibility.h | 4 +- utility/pigpio/spi.cpp | 4 +- utility/pigpio/spi.h | 6 +- utility/rp2/RF24_arch_config.h | 2 +- utility/rp2/spi.cpp | 4 +- utility/rp2/spi.h | 2 +- utility/wiringPi/spi.cpp | 6 +- 75 files changed, 690 insertions(+), 380 deletions(-) create mode 100644 cspell.config.yaml diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e922efd2..50dce9417 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,12 +72,12 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/cmake/detectCPU.cmake) # sets the variable SOC accordingly # auto-detect what driver to use -# auto-detect can be overriden using `cmake .. -D RF24_DRIVER=` +# auto-detect can be overridden using `cmake .. -D RF24_DRIVER=` include(${CMAKE_CURRENT_LIST_DIR}/cmake/AutoConfig_RF24_DRIVER.cmake) #[[ adding the utility sub-directory will 1. set variables RF24_DRIVER, RF24_LINKED_DRIVER, and RF24_DRIVER_SOURCES - 2. copy the approriate /utility/*/includes.h file to the /utility folder + 2. copy the appropriate /utility/*/includes.h file to the /utility folder 3. set additional install rules according to the RF24_DRIVER specified ]] add_subdirectory(utility) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 41f960580..39d102a37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,11 +4,11 @@ These are the current requirements for getting your code included in RF24: - Try your best to follow the rest of the code, if you're unsure then [the NASA C style guide](https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19950022400.pdf) can help as it's closest to the current style. -- Definetly follow [PEP-8](https://www.python.org/dev/peps/pep-0008/) if it's Python code. +- Definitely follow [PEP-8](https://www.python.org/dev/peps/pep-0008/) if it's Python code. - Follow the [Arduino example formatting style](https://docs.arduino.cc/learn/contributions/arduino-writing-style-guide) for Arduino examples -- Add [doxygen-compatible documentation](https://www.doxygen.nl/manual/docblocks.html) to any new functions you add, or update existing documentation if you change behaviour +- Add [doxygen-compatible documentation](https://www.doxygen.nl/manual/docblocks.html) to any new functions you add, or update existing documentation if you change behavior - CMake modules and CMakeLists.txt files should also have a uniform syntax. - Indentation is a mandatory 4 spaces (not a `\t` character). diff --git a/LICENSE b/LICENSE index 23cb79033..9dc3f928f 100644 --- a/LICENSE +++ b/LICENSE @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} - Copyright (C) {year} {fullname} + Copyright (C) {year} {full name} This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -312,22 +312,22 @@ Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + SomeProgram version 69, Copyright (C) year name of author + SomeProgram comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. -The hypothetical commands `show w' and `show c' should show the appropriate +The hypothetical commands `show w` and `show c` should show the appropriate parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be +be called something other than `show w` and `show c`; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. + SomeCompany, Inc., hereby disclaims all copyright interest in the program + 'SomeProgram' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice diff --git a/RF24.h b/RF24.h index 2a8af2319..5971826f5 100644 --- a/RF24.h +++ b/RF24.h @@ -1746,7 +1746,7 @@ class RF24 * * On all devices but Linux and ATTiny, a small delay is added to the CSN toggling function * - * This is intended to minimise the speed of SPI polling due to radio commands + * This is intended to minimize the speed of SPI polling due to radio commands * * If using interrupts or timed requests, this can be set to 0 Default:5 */ @@ -1789,7 +1789,7 @@ class RF24 * @brief Open or close all data pipes. * * This function does not alter the addresses assigned to pipes. It is simply a - * convenience function that allows controling all pipes at once. + * convenience function that allows controlling all pipes at once. * @param isEnabled `true` opens all pipes; `false` closes all pipes. */ void toggleAllPipes(bool isEnabled); diff --git a/cmake/PreventInSourceBuilds.cmake b/cmake/PreventInSourceBuilds.cmake index dc4fd811b..ec288d50d 100644 --- a/cmake/PreventInSourceBuilds.cmake +++ b/cmake/PreventInSourceBuilds.cmake @@ -2,11 +2,11 @@ # This function will prevent in-source builds function(AssureOutOfSourceBuilds) # make sure the user doesn't play dirty with symlinks - get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) - get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + get_filename_component(src_dir "${CMAKE_SOURCE_DIR}" REALPATH) + get_filename_component(bin_dir "${CMAKE_BINARY_DIR}" REALPATH) # disallow in-source builds - if("${srcdir}" STREQUAL "${bindir}") + if("${src_dir}" STREQUAL "${bin_dir}") message("######################################################") message("Warning: in-source builds are disabled") message("Please create a separate build directory and run cmake from there") @@ -15,4 +15,4 @@ function(AssureOutOfSourceBuilds) endif() endfunction() -assureoutofsourcebuilds() +AssureOutOfSourceBuilds() diff --git a/cmake/detectCPU.cmake b/cmake/detectCPU.cmake index cc3236282..d9c5ceef7 100644 --- a/cmake/detectCPU.cmake +++ b/cmake/detectCPU.cmake @@ -58,7 +58,7 @@ endif() message(STATUS "tool name being used: ${tool_name}") -# add compiler flags to optomize builds with arm-linux-gnueabihf-g* compilers +# add compiler flags to optimize builds with arm-linux-gnueabihf-g* compilers if("${tool_name}" STREQUAL "arm-linux-gnueabihf") if("${SOC}" STREQUAL "BCM2835" OR "${SOC}" STREQUAL "BCM2708") add_compile_options(-marm -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard) diff --git a/cmake/toolchains/arm64.cmake b/cmake/toolchains/arm64.cmake index 23e41ca7f..6a3caae77 100644 --- a/cmake/toolchains/arm64.cmake +++ b/cmake/toolchains/arm64.cmake @@ -16,8 +16,8 @@ set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++) # add_compile_options(-I /usr/aarch64-linux-gnu/include) # this may not be best practice #[[ -# CMAKE_STAGING_PREFIX is only useful for transfering a built CMake project to a target machine -set(CMAKE_STAGING_PREFIX /home/devel/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) +# CMAKE_STAGING_PREFIX is only useful for transferring a built CMake project to a target machine +set(CMAKE_STAGING_PREFIX /home/dev/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) CMAKE_FIND_ROOT_PATH is an empty list by default (this list can be modified where applicable) if cross-compiling a dependent lib (like MRAA - which is optional), then diff --git a/cmake/toolchains/armhf.cmake b/cmake/toolchains/armhf.cmake index 488b81a89..e02449fdd 100644 --- a/cmake/toolchains/armhf.cmake +++ b/cmake/toolchains/armhf.cmake @@ -16,8 +16,8 @@ set(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-g++) # add_compile_options(-I /usr/arm-linux-gnueabihf/include) # this may not be best practice #[[ -# CMAKE_STAGING_PREFIX is only useful for transfering a built CMake project to a target machine -set(CMAKE_STAGING_PREFIX /home/devel/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) +# CMAKE_STAGING_PREFIX is only useful for transferring a built CMake project to a target machine +set(CMAKE_STAGING_PREFIX /home/dev/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) CMAKE_FIND_ROOT_PATH is an empty list by default (this list can be modified where applicable) if cross-compiling a dependent lib (like MRAA - which is optional), then diff --git a/cmake/toolchains/i686.cmake b/cmake/toolchains/i686.cmake index f3c42be06..8ce0e25cf 100644 --- a/cmake/toolchains/i686.cmake +++ b/cmake/toolchains/i686.cmake @@ -16,8 +16,8 @@ set(CMAKE_CXX_COMPILER /usr/bin/i686-linux-gnu-g++) # add_compile_options(-I /usr/i686-linux-gnu/include) # this may not be best practice #[[ -# CMAKE_STAGING_PREFIX is only useful for transfering a built CMake project to a target machine -set(CMAKE_STAGING_PREFIX /home/devel/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) +# CMAKE_STAGING_PREFIX is only useful for transferring a built CMake project to a target machine +set(CMAKE_STAGING_PREFIX /home/dev/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) CMAKE_FIND_ROOT_PATH is an empty list by default (this list can be modified where applicable) if cross-compiling a dependent lib (like MRAA - which is optional), then diff --git a/cmake/toolchains/x86_64.cmake b/cmake/toolchains/x86_64.cmake index e4ff737a8..2abb92fe1 100644 --- a/cmake/toolchains/x86_64.cmake +++ b/cmake/toolchains/x86_64.cmake @@ -16,8 +16,8 @@ set(CMAKE_CXX_COMPILER /usr/bin/x86_64-linux-gnux32-g++) # add_compile_options(-I /usr/x86_64-linux-gnux32/include) # this may not be best practice #[[ -# CMAKE_STAGING_PREFIX is only useful for transfering a built CMake project to a target machine -set(CMAKE_STAGING_PREFIX /home/devel/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) +# CMAKE_STAGING_PREFIX is only useful for transferring a built CMake project to a target machine +set(CMAKE_STAGING_PREFIX /home/dev/stage) # use CMAKE_INSTALL_PREFIX instead (see below comments) CMAKE_FIND_ROOT_PATH is an empty list by default (this list can be modified where applicable) if cross-compiling a dependent lib (like MRAA - which is optional), then diff --git a/cspell.config.yaml b/cspell.config.yaml new file mode 100644 index 000000000..ebf65ffaf --- /dev/null +++ b/cspell.config.yaml @@ -0,0 +1,313 @@ +version: "0.2" +language: en +words: + - aarch + - abled + - Achstetter + - ADAFRUIT + - addch + - addstr + - afen + - akatran + - apidoc + - Arduipi + - AREF + - argparser + - armhf + - armv + - Atmel + - atmelavr + - atmelmegaavr + - atmelsam + - ATSAMD + - ATTINY + - attroff + - attron + - ATXMEGA + - ATXMEGAD + - autosectionlabel + - Avamander + - bdist + - berryfied + - blogspot + - bndy + - bootloader + - BPLUS + - bufptr + - bugprone + - bysource + - bytearray + - calcsize + - cbps + - cbreak + - ccache + - ccmake + - cepin + - CFLAGS + - CHIPINFO + - CLANGTIDY + - classname + - CLKSEL + - codecov + - Coliz + - cond + - Configurators + - cpack + - CPHA + - cpixip + - CPPCHECK + - cppreference + - CPUFLAGS + - crclength + - CRCO + - CROSSCOMPILING + - crossunix + - crossunixccompiler + - cspin + - cstdio + - CTRLA + - CTRLB + - datarate + - datasheet + - Datasheets + - DBUILDSWIGNODE + - DCMAKE + - DEFAULTPINS + - deinit + - DIRCLR + - DIRSET + - Disabl + - Doherty + - doxygen + - doxygenfile + - doxygenfunction + - doxygengroup + - doxygenpage + - doxygenvariable + - DPICO + - dpkg + - DSOFT + - DSOFTSPI + - dstroy + - DYNPD + - ENAA + - endforeach + - endfunction + - endparblock + - endverbatim + - endwin + - Engelke + - enumvalue + - espressif + - Fals + - farconada + - fdevopen + - FETCHCONTENT + - fsanitize + - fsel + - fstack + - ftime + - genindex + - gettingstarted + - gnueabihf + - gnux + - GPIO + - gpiochip + - gpiod + - Gunasekara + - Hallard + - HCURR + - HILVLEN + - HLINE + - HMISO + - HMOSI + - HSCLK + - hspi + - Ikpeoha + - imgui + - INPT + - INTCTRL + - INTCTRLA + - Interprocedural + - intersphinx + - iomanip + - ITSYBITSY + - Jannis + - jscrane + - KBPS + - Konde + - kripton + - ldconfig + - ldiaz + - libboost + - libc + - libmaple + - libncurses + - librf + - linaro + - linenos + - literalinclude + - LITTLEWIRE + - LOLVLEN + - lossiness + - LPSTR + - LPWSTR + - lsbmode + - lwiring + - Makefiles + - Maniacbug + - markdownlint + - marm + - MBED + - MBPS + - MCUSR + - MEDLVLEN + - MEGAAVR + - mfloat + - mfpu + - microcontroller + - milisec + - millis + - milliwatts + - MOSI + - MRAA + - MSBFIRST + - MSVC + - mtune + - Multiceiver + - mypy + - nerdralph + - newlib + - nocbreak + - noecho + - nullptr + - Ofast + - OLED + - OUTCLR + - OVFINTLVL + - parblock + - Pastore + - pgmspace + - PICO + - PIGPIO + - PIMORONI + - PINB + - pingpair + - pinout + - pkgs + - PLOS + - PMIC + - PORTA + - PORTB + - PORTC + - PORTD + - Portenta + - PORTF + - postargs + - postinst + - postrm + - POWERUP + - preargs + - premain + - prescalar + - Prescaler + - println + - PRIPSTR + - PROGMEM + - pthread + - purinda + - pypi + - pyproject + - QTPY + - Quigg + - raspi + - REALPATH + - rpmbuild + - RXADDR + - rxbuff + - SAMD + - sccache + - sclk + - seealso + - Seow + - SERCOM + - setuptools + - SOFTSPI + - SOVERSION + - spaniakos + - SPARFUN + - Sparkfun + - Speedz + - SPID + - spidev + - SPIUART + - sprintf + - stanleyseow + - stby + - stddef + - stdlib + - STREQUAL + - strresult + - ststm + - sunxi + - suppr + - SWITCHCAPVCC + - sysroot + - tableofcontents + - TEENSYDUINO + - THINGPLUS + - toctree + - TOLOWER + - transfern + - transfernb + - txbuff + - UART + - undoc + - unexport + - userspace + - uspi + - vect + - venv + - vfpv + - vpfv + - VSPI + - Wcast + - Wconversion + - WDCE + - WDIE + - Wdouble + - WDRF + - wdtcsr + - Wduplicated + - Werror + - Wextra + - Wformat + - WGMODE + - WIRINGPI + - Wlogical + - Wmisleading + - Wnon + - Wnull + - Woverloaded + - Wpedantic + - Wshadow + - Wsign + - Wunused + - Wuseless + - XMEGA + - Yagarto + - zador +ignorePaths: + - .env/** + - .venv/** + - env/** + - venv/** + - "**.clang-tidy" + - "**.clang-format" + - .gitignore + - "**/*.{yml,yaml}" + - utility/RPi/bcm2835.* + - Makefile* + - make.bat + - Doxyfile + - configure diff --git a/docs/arduino.md b/docs/arduino.md index 50d6d0cfb..a1068b4a5 100644 --- a/docs/arduino.md +++ b/docs/arduino.md @@ -89,7 +89,7 @@ SPI_UART SPI Pin Connections: ### Using a specific SPI Bus An alternate SPI bus can be specified using the overloaded `RF24::begin(_SPI*)` method. -This is useful for some boards that offer more than 1 hardware-driven SPI bus or cetain Arduino +This is useful for some boards that offer more than 1 hardware-driven SPI bus or certain Arduino cores that implement a software-driven (AKA bit-banged) SPI bus that does not use the DigitalIO library. @@ -122,7 +122,7 @@ void setup() { // MISO = SD0 // SCLK = CLK // CSN = GPIO0 (labeled D3 on the board) - // **notice we also passed `D3` to the RF24 contructor's csn_pin parameter** + // **notice we also passed `D3` to the RF24 constructor's csn_pin parameter** SPI.begin(); @@ -155,7 +155,7 @@ located in their ArduinoCore repository (along with the SPI library for the ESP3 RF24 radio(2, 0); // the (ce_pin, csn_pin) connected to the radio SPIClass* hspi = nullptr; // we'll instantiate this in the `setup()` function -// by default the HSPI bus predefines the following pins +// by default the HSPI bus pre-defines the following pins // HSPI_MISO = 12 // HSPI_MOSI = 13 // HSPI_SCLK = 14 @@ -244,7 +244,7 @@ void setup() { ``` #### ATSAMD21 example -@see The Suport for secondary SPI bus on ATSAMD21 chips is sparcely documented. However, +@see The Support for secondary SPI bus on ATSAMD21 chips is scarcely documented. However, [Sparkfun has a tutorial about using a second SPI bus](https://learn.sparkfun.com/tutorials/adding-more-sercom-ports-for-samd-boards/adding-an-spi) that often refers to the [ArduinoCore-samd SPI library source code](https://github.com/arduino/ArduinoCore-samd/blob/master/libraries/SPI/SPI.h). This example applies Sparkfun's tutorial toward the RF24 library. diff --git a/docs/attiny.md b/docs/attiny.md index 20b7f0e9e..f04843881 100644 --- a/docs/attiny.md +++ b/docs/attiny.md @@ -2,7 +2,7 @@ @tableofcontents -ATTiny support for this library relys on the SpenceKonde ATTinyCore. Be sure to have added this core to the Arduino Boards Manager with [this install guide](http://highlowtech.org/?p=1695) +ATTiny support for this library relies on the SpenceKonde ATTinyCore. Be sure to have added this core to the Arduino Boards Manager with [this install guide](http://highlowtech.org/?p=1695) See the included rf24ping85 example for pin info and usage @@ -31,7 +31,7 @@ nRF24L01 GND, pin1 --- GND 4| |5 PB0 --- nRF24L01 MISO, pin7 - Circuit idea from [NerdRalph's 3 pin solution](http://nerdralph.blogspot.ca/2014/01/nrf24l01-control-with-3-attiny85-pins.html) - Original RC combination was 1K/100nF. 22K/10nF combination worked better. -- For best settletime delay value in RF24::csn() the timingSearch3pin.ino sketch can be used. +- For best settle-time delay value in `RF24::csn()` the timingSearch3pin.ino sketch can be used. - This configuration is enabled when CE_PIN and CSN_PIN are equal, e.g. both 3 - Because CE is always high the power consumption is higher than for 5 pins solution diff --git a/docs/atxmega.md b/docs/atxmega.md index e0a3efb65..721c08885 100644 --- a/docs/atxmega.md +++ b/docs/atxmega.md @@ -54,4 +54,4 @@ Call the `__start_timer()` to start the millisecond timer. @note The millisecond functionality is based on the TCE0 so don't use these pins as IO. -@note The operating frequency of the uC is 32MHz. If you have a different frequency, change the TCE0 registers appropriatly in function `__start_timer()` in **compatibility.c** file for your frequency. +@note The operating frequency of the uC is 32MHz. If you have a different frequency, change the TCE0 registers appropriately in function `__start_timer()` in **compatibility.c** file for your frequency. diff --git a/docs/cross_compile.md b/docs/cross_compile.md index f30d394bd..2d3fabdf8 100644 --- a/docs/cross_compile.md +++ b/docs/cross_compile.md @@ -14,7 +14,7 @@ RF24 library supports cross-compilation. Advantages of cross-compilation: Following prerequisites need to be assured: -- ssh passwordless access to target machine [Here is a hint](https://linuxconfig.org/passwordless-ssh) +- ssh password-less access to target machine [Here is a hint](https://linuxconfig.org/passwordless-ssh) - sudo of a remote user without password [Here is a hint](http://askubuntu.com/questions/334318/sudoers-file-enable-nopasswd-for-user-all-commands) - cross-compilation toolchain for your target machine; for RPi ```shell @@ -44,7 +44,7 @@ Following prerequisites need to be assured: ```shell make ``` -4. (optional) install library to cross-compilation machine into cross-exvironment - important for compilation of examples +4. (optional) install library to cross-compilation machine into cross-environment - important for compilation of examples ```shell sudo make install ``` @@ -62,7 +62,7 @@ Following prerequisites need to be assured: make upload ``` -## Cross comilation steps for python wrapper +## Cross compilation steps for python wrapper ### Prerequisites diff --git a/docs/main_page.md b/docs/main_page.md index 6da4e811d..197f9fdc2 100644 --- a/docs/main_page.md +++ b/docs/main_page.md @@ -73,7 +73,7 @@ CE and CSN are configurable. | 2 | VCC | 3.3V | pin 8 | pin 1 | regulator 3.3V required | rpi-3v3 | (17) | | 3 | CE | digIO 7 | pin 2 | pin 12 | pin to 3.3V | rpi-gpio22 | (15) | | 4 | CSN | digIO 8 | pin 3 | pin 11 | RESET | rpi-gpio8 | (24) | -| 5 | SCK | digIO 13 | pin 7 | pin 9 | SCK | rpi-sckl | (23) | +| 5 | SCK | digIO 13 | pin 7 | pin 9 | SCK | rpi-sclk | (23) | | 6 | MOSI | digIO 11 | pin 6 | pin 7 | MOSI | rpi-mosi | (19) | | 7 | MISO | digIO 12 | pin 5 | pin 8 | MISO | rpi-miso | (21) | | 8 | IRQ | - | - | - | - | - | - | diff --git a/docs/pico_sdk.md b/docs/pico_sdk.md index 89000c639..6b179271d 100644 --- a/docs/pico_sdk.md +++ b/docs/pico_sdk.md @@ -125,10 +125,10 @@ In order to use the RF24 libraries in your RP2040 based project: Initially (without modification), the SPI bus uses the default pins defined in the Pico SDK repository's [pico-sdk/src/boards/include/boards/\.h files](https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards). However, there may be some boards that do not define the necessary pins to use as defaults. This can -be rememdied using either project source code or build-time configuration. +be remedied using either project source code or build-time configuration. @warning There is no support for software driven SPI on RP2040 based boards at this time. -If someone is so inclined to implement this using the Pico SDK's PIO (Programable Input +If someone is so inclined to implement this using the Pico SDK's PIO (Programmable Input Output) feature, please submit an issue or pull request to the [RF24 repository](http://github.com/nRF24/RF24). diff --git a/docs/python_wrapper.md b/docs/python_wrapper.md index 0b83e92de..cef706131 100644 --- a/docs/python_wrapper.md +++ b/docs/python_wrapper.md @@ -92,7 +92,7 @@ to each library. See the included [\*.py files in the "examples_linux" folder](examples.html) for usage information. 3. Running the Example - The python examples location differ for each RF24* resopitories. + The python examples location differ for each RF24* repositories. - navigate to *examples_linux* directory in the RF24 cloned repository - navigate to *RPi/pyRF24Network/examples* directory in the RF24Network cloned repository - navigate to *examples_RPi* directory in the RF24Mesh cloned repository diff --git a/docs/rpi_general.md b/docs/rpi_general.md index 68b18bcac..eedd921db 100644 --- a/docs/rpi_general.md +++ b/docs/rpi_general.md @@ -79,12 +79,12 @@ See [the Raspberry Pi documentation about the GPIO pins](https://www.raspberrypi | 2 | VCC | rpi-3v3 | (17) | | 3 | CE | rpi-gpio22 | (15) | | 4 | CSN | rpi-gpio8 | (24) | -| 5 | SCK | rpi-sckl | (23) | +| 5 | SCK | rpi-sclk | (23) | | 6 | MOSI | rpi-mosi | (19) | | 7 | MISO | rpi-miso | (21) | | 8 | IRQ | - | - | -## breif history of RF24 library lineage +## brief history of RF24 library lineage Based on the arduino lib from [J. Coliz](maniacbug@ymail.com), the library was berryfied by [Purinda Gunasekara](purinda@gmail.com) diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index c9aa50c45..5e2fb065e 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -97,7 +97,6 @@ # "toc.integrate", # "navigation.sections", "navigation.instant", - # "header.autohide", "navigation.top", # "search.highlight", "search.share", @@ -128,8 +127,6 @@ "repo_url": "https://github.com/nRF24/RF24/", "repo_name": "RF24", "repo_type": "github", - # If False, expand all TOC entries - "globaltoc_collapse": False, } object_description_options = [ diff --git a/docs/using_cmake.md b/docs/using_cmake.md index 94708a9f8..ed2780a17 100644 --- a/docs/using_cmake.md +++ b/docs/using_cmake.md @@ -139,7 +139,7 @@ There is a newer automatic install script that makes use of the CMake approach. ```shell nano gettingstarted.cpp ``` - and edit the pin numbers as directed in the [linux/RPi general documation](rpi_general.md). + and edit the pin numbers as directed in the [linux/RPi general documentation](rpi_general.md). Create a build directory in the examples_linux directory and navigate to it. ```shell mkdir build diff --git a/examples/AcknowledgementPayloads/AcknowledgementPayloads.ino b/examples/AcknowledgementPayloads/AcknowledgementPayloads.ino index 0e511e0e6..f4c7f1785 100644 --- a/examples/AcknowledgementPayloads/AcknowledgementPayloads.ino +++ b/examples/AcknowledgementPayloads/AcknowledgementPayloads.ino @@ -1,209 +1,209 @@ -/* - * See documentation at https://nRF24.github.io/RF24 - * See License information at root directory of this library - * Author: Brendan Doherty (2bndy5) - */ - -/** - * A simple example of sending data from 1 nRF24L01 transceiver to another - * with Acknowledgement (ACK) payloads attached to ACK packets. - * - * This example was written to be used on 2 devices acting as "nodes". - * Use the Serial Monitor to change each node's behavior. - */ -#include -#include "printf.h" -#include "RF24.h" - -#define CE_PIN 7 -#define CSN_PIN 8 -// instantiate an object for the nRF24L01 transceiver -RF24 radio(CE_PIN, CSN_PIN); - -// an identifying device destination -// Let these addresses be used for the pair -uint8_t address[][6] = { "1Node", "2Node" }; -// It is very helpful to think of an address as a path instead of as -// an identifying device destination -// to use different addresses on a pair of radios, we need a variable to - -// uniquely identify which address this radio will use to transmit -bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit - -// Used to control whether this node is sending or receiving -bool role = false; // true = TX role, false = RX role - -// For this example, we'll be using a payload containing -// a string & an integer number that will be incremented -// on every successful transmission. -// Make a data structure to store the entire payload of different datatypes -struct PayloadStruct { - char message[7]; // only using 6 characters for TX & ACK payloads - uint8_t counter; -}; -PayloadStruct payload; - -void setup() { - - Serial.begin(115200); - while (!Serial) { - // some boards need to wait to ensure access to serial over USB - } - - // initialize the transceiver on the SPI bus - if (!radio.begin()) { - Serial.println(F("radio hardware is not responding!!")); - while (1) {} // hold in infinite loop - } - - // print example's introductory prompt - Serial.println(F("RF24/examples/AcknowledgementPayloads")); - - // To set the radioNumber via the Serial monitor on startup - Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); - while (!Serial.available()) { - // wait for user input - } - char input = Serial.parseInt(); - radioNumber = input == 1; - Serial.print(F("radioNumber = ")); - Serial.println((int)radioNumber); - - // role variable is hardcoded to RX behavior, inform the user of this - Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); - - // Set the PA Level low to try preventing power supply related problems - // because these examples are likely run with nodes in close proximity to - // each other. - radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. - - // to use ACK payloads, we need to enable dynamic payload lengths (for all nodes) - radio.enableDynamicPayloads(); // ACK payloads are dynamically sized - - // Acknowledgement packets have no payloads by default. We need to enable - // this feature for all nodes (TX & RX) to use ACK payloads. - radio.enableAckPayload(); - - // set the TX address of the RX node into the TX pipe - radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 - - // set the RX address of the TX node into a RX pipe - radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 - - // additional setup specific to the node's role - if (role) { - // setup the TX payload - - memcpy(payload.message, "Hello ", 6); // set the payload message - radio.stopListening(); // put radio in TX mode - } else { - // setup the ACK payload & load the first response into the FIFO - - memcpy(payload.message, "World ", 6); // set the payload message - // load the payload for the first received transmission on pipe 0 - radio.writeAckPayload(1, &payload, sizeof(payload)); - - radio.startListening(); // put radio in RX mode - } - - // For debugging info - // printf_begin(); // needed only once for printing details - // radio.printDetails(); // (smaller) function that prints raw register values - // radio.printPrettyDetails(); // (larger) function that prints human readable data -} - -void loop() { - - if (role) { - // This device is a TX node - - unsigned long start_timer = micros(); // start the timer - bool report = radio.write(&payload, sizeof(payload)); // transmit & save the report - unsigned long end_timer = micros(); // end the timer - - if (report) { - Serial.print(F("Transmission successful! ")); // payload was delivered - Serial.print(F("Time to transmit = ")); - Serial.print(end_timer - start_timer); // print the timer result - Serial.print(F(" us. Sent: ")); - Serial.print(payload.message); // print the outgoing message - Serial.print(payload.counter); // print the outgoing counter - uint8_t pipe; - if (radio.available(&pipe)) { // is there an ACK payload? grab the pipe number that received it - PayloadStruct received; - radio.read(&received, sizeof(received)); // get incoming ACK payload - Serial.print(F(" Recieved ")); - Serial.print(radio.getDynamicPayloadSize()); // print incoming payload size - Serial.print(F(" bytes on pipe ")); - Serial.print(pipe); // print pipe number that received the ACK - Serial.print(F(": ")); - Serial.print(received.message); // print incoming message - Serial.println(received.counter); // print incoming counter - - // save incoming counter & increment for next outgoing - payload.counter = received.counter + 1; - - } else { - Serial.println(F(" Recieved: an empty ACK packet")); // empty ACK packet received - } - - - } else { - Serial.println(F("Transmission failed or timed out")); // payload was not delivered - } - - // to make this example readable in the serial monitor - delay(1000); // slow transmissions down by 1 second - - } else { - // This device is a RX node - - uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it - uint8_t bytes = radio.getDynamicPayloadSize(); // get the size of the payload - PayloadStruct received; - radio.read(&received, sizeof(received)); // get incoming payload - Serial.print(F("Received ")); - Serial.print(bytes); // print the size of the payload - Serial.print(F(" bytes on pipe ")); - Serial.print(pipe); // print the pipe number - Serial.print(F(": ")); - Serial.print(received.message); // print incoming message - Serial.print(received.counter); // print incoming counter - Serial.print(F(" Sent: ")); - Serial.print(payload.message); // print outgoing message - Serial.println(payload.counter); // print outgoing counter - - // save incoming counter & increment for next outgoing - payload.counter = received.counter + 1; - // load the payload for the first received transmission on pipe 0 - radio.writeAckPayload(1, &payload, sizeof(payload)); - } - } // role - - if (Serial.available()) { - // change the role via the serial monitor - - char c = toupper(Serial.read()); - if (c == 'T' && !role) { - // Become the TX node - - role = true; - Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK")); - - memcpy(payload.message, "Hello ", 6); // change payload message - radio.stopListening(); // this also discards any unused ACK payloads - - } else if (c == 'R' && role) { - // Become the RX node - - role = false; - Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK")); - memcpy(payload.message, "World ", 6); // change payload message - - // load the payload for the first received transmission on pipe 0 - radio.writeAckPayload(1, &payload, sizeof(payload)); - radio.startListening(); - } - } -} // loop +/* + * See documentation at https://nRF24.github.io/RF24 + * See License information at root directory of this library + * Author: Brendan Doherty (2bndy5) + */ + +/** + * A simple example of sending data from 1 nRF24L01 transceiver to another + * with Acknowledgement (ACK) payloads attached to ACK packets. + * + * This example was written to be used on 2 devices acting as "nodes". + * Use the Serial Monitor to change each node's behavior. + */ +#include +#include "printf.h" +#include "RF24.h" + +#define CE_PIN 7 +#define CSN_PIN 8 +// instantiate an object for the nRF24L01 transceiver +RF24 radio(CE_PIN, CSN_PIN); + +// an identifying device destination +// Let these addresses be used for the pair +uint8_t address[][6] = { "1Node", "2Node" }; +// It is very helpful to think of an address as a path instead of as +// an identifying device destination +// to use different addresses on a pair of radios, we need a variable to + +// uniquely identify which address this radio will use to transmit +bool radioNumber = 1; // 0 uses address[0] to transmit, 1 uses address[1] to transmit + +// Used to control whether this node is sending or receiving +bool role = false; // true = TX role, false = RX role + +// For this example, we'll be using a payload containing +// a string & an integer number that will be incremented +// on every successful transmission. +// Make a data structure to store the entire payload of different datatypes +struct PayloadStruct { + char message[7]; // only using 6 characters for TX & ACK payloads + uint8_t counter; +}; +PayloadStruct payload; + +void setup() { + + Serial.begin(115200); + while (!Serial) { + // some boards need to wait to ensure access to serial over USB + } + + // initialize the transceiver on the SPI bus + if (!radio.begin()) { + Serial.println(F("radio hardware is not responding!!")); + while (1) {} // hold in infinite loop + } + + // print example's introductory prompt + Serial.println(F("RF24/examples/AcknowledgementPayloads")); + + // To set the radioNumber via the Serial monitor on startup + Serial.println(F("Which radio is this? Enter '0' or '1'. Defaults to '0'")); + while (!Serial.available()) { + // wait for user input + } + char input = Serial.parseInt(); + radioNumber = input == 1; + Serial.print(F("radioNumber = ")); + Serial.println((int)radioNumber); + + // role variable is hardcoded to RX behavior, inform the user of this + Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); + + // Set the PA Level low to try preventing power supply related problems + // because these examples are likely run with nodes in close proximity to + // each other. + radio.setPALevel(RF24_PA_LOW); // RF24_PA_MAX is default. + + // to use ACK payloads, we need to enable dynamic payload lengths (for all nodes) + radio.enableDynamicPayloads(); // ACK payloads are dynamically sized + + // Acknowledgement packets have no payloads by default. We need to enable + // this feature for all nodes (TX & RX) to use ACK payloads. + radio.enableAckPayload(); + + // set the TX address of the RX node into the TX pipe + radio.openWritingPipe(address[radioNumber]); // always uses pipe 0 + + // set the RX address of the TX node into a RX pipe + radio.openReadingPipe(1, address[!radioNumber]); // using pipe 1 + + // additional setup specific to the node's role + if (role) { + // setup the TX payload + + memcpy(payload.message, "Hello ", 6); // set the payload message + radio.stopListening(); // put radio in TX mode + } else { + // setup the ACK payload & load the first response into the FIFO + + memcpy(payload.message, "World ", 6); // set the payload message + // load the payload for the first received transmission on pipe 0 + radio.writeAckPayload(1, &payload, sizeof(payload)); + + radio.startListening(); // put radio in RX mode + } + + // For debugging info + // printf_begin(); // needed only once for printing details + // radio.printDetails(); // (smaller) function that prints raw register values + // radio.printPrettyDetails(); // (larger) function that prints human readable data +} + +void loop() { + + if (role) { + // This device is a TX node + + unsigned long start_timer = micros(); // start the timer + bool report = radio.write(&payload, sizeof(payload)); // transmit & save the report + unsigned long end_timer = micros(); // end the timer + + if (report) { + Serial.print(F("Transmission successful! ")); // payload was delivered + Serial.print(F("Time to transmit = ")); + Serial.print(end_timer - start_timer); // print the timer result + Serial.print(F(" us. Sent: ")); + Serial.print(payload.message); // print the outgoing message + Serial.print(payload.counter); // print the outgoing counter + uint8_t pipe; + if (radio.available(&pipe)) { // is there an ACK payload? grab the pipe number that received it + PayloadStruct received; + radio.read(&received, sizeof(received)); // get incoming ACK payload + Serial.print(F(" Received ")); + Serial.print(radio.getDynamicPayloadSize()); // print incoming payload size + Serial.print(F(" bytes on pipe ")); + Serial.print(pipe); // print pipe number that received the ACK + Serial.print(F(": ")); + Serial.print(received.message); // print incoming message + Serial.println(received.counter); // print incoming counter + + // save incoming counter & increment for next outgoing + payload.counter = received.counter + 1; + + } else { + Serial.println(F(" Received: an empty ACK packet")); // empty ACK packet received + } + + + } else { + Serial.println(F("Transmission failed or timed out")); // payload was not delivered + } + + // to make this example readable in the serial monitor + delay(1000); // slow transmissions down by 1 second + + } else { + // This device is a RX node + + uint8_t pipe; + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it + uint8_t bytes = radio.getDynamicPayloadSize(); // get the size of the payload + PayloadStruct received; + radio.read(&received, sizeof(received)); // get incoming payload + Serial.print(F("Received ")); + Serial.print(bytes); // print the size of the payload + Serial.print(F(" bytes on pipe ")); + Serial.print(pipe); // print the pipe number + Serial.print(F(": ")); + Serial.print(received.message); // print incoming message + Serial.print(received.counter); // print incoming counter + Serial.print(F(" Sent: ")); + Serial.print(payload.message); // print outgoing message + Serial.println(payload.counter); // print outgoing counter + + // save incoming counter & increment for next outgoing + payload.counter = received.counter + 1; + // load the payload for the first received transmission on pipe 0 + radio.writeAckPayload(1, &payload, sizeof(payload)); + } + } // role + + if (Serial.available()) { + // change the role via the serial monitor + + char c = toupper(Serial.read()); + if (c == 'T' && !role) { + // Become the TX node + + role = true; + Serial.println(F("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK")); + + memcpy(payload.message, "Hello ", 6); // change payload message + radio.stopListening(); // this also discards any unused ACK payloads + + } else if (c == 'R' && role) { + // Become the RX node + + role = false; + Serial.println(F("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK")); + memcpy(payload.message, "World ", 6); // change payload message + + // load the payload for the first received transmission on pipe 0 + radio.writeAckPayload(1, &payload, sizeof(payload)); + radio.startListening(); + } + } +} // loop diff --git a/examples/GettingStarted/GettingStarted.ino b/examples/GettingStarted/GettingStarted.ino index 49d305bc3..4132c1035 100644 --- a/examples/GettingStarted/GettingStarted.ino +++ b/examples/GettingStarted/GettingStarted.ino @@ -121,7 +121,7 @@ void loop() { // This device is a RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO Serial.print(F("Received ")); diff --git a/examples/ManualAcknowledgements/ManualAcknowledgements.ino b/examples/ManualAcknowledgements/ManualAcknowledgements.ino index 90612a8cf..3e8b8fc91 100644 --- a/examples/ManualAcknowledgements/ManualAcknowledgements.ino +++ b/examples/ManualAcknowledgements/ManualAcknowledgements.ino @@ -154,7 +154,7 @@ void loop() { Serial.println(received.counter); // print the incoming payload's counter payload.counter = received.counter; // save incoming counter for next outgoing counter } else { - Serial.println(F(" Recieved no response.")); // no response received + Serial.println(F(" Received no response.")); // no response received } } else { Serial.println(F("Transmission failed or timed out")); // payload was not delivered @@ -167,7 +167,7 @@ void loop() { // This device is a RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it PayloadStruct received; radio.read(&received, sizeof(received)); // get incoming payload payload.counter = received.counter + 1; // increment incoming counter for next outgoing response diff --git a/examples/MulticeiverDemo/MulticeiverDemo.ino b/examples/MulticeiverDemo/MulticeiverDemo.ino index 3c52ffeb4..8cc87335c 100644 --- a/examples/MulticeiverDemo/MulticeiverDemo.ino +++ b/examples/MulticeiverDemo/MulticeiverDemo.ino @@ -126,7 +126,7 @@ void loop() { // This device is the RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO Serial.print(F("Received ")); diff --git a/examples/encodeRadioDetails/encodeRadioDetails.ino b/examples/encodeRadioDetails/encodeRadioDetails.ino index 506739315..6aee593c4 100644 --- a/examples/encodeRadioDetails/encodeRadioDetails.ino +++ b/examples/encodeRadioDetails/encodeRadioDetails.ino @@ -86,7 +86,7 @@ void setup() { Serial.println(F("\"\n***You may need to use 'python3' (without quotes) on Linux")); } // setup -/* Registers correspnding to index of encoded_details array +/* Registers corresponding to index of encoded_details array 0: NRF_CONFIG 1: EN_AA 2: EN_RXADDR diff --git a/examples/encodeRadioDetails/print_details.py b/examples/encodeRadioDetails/print_details.py index 8dee9bf66..2d09e2c9e 100644 --- a/examples/encodeRadioDetails/print_details.py +++ b/examples/encodeRadioDetails/print_details.py @@ -36,14 +36,14 @@ def hex_str_to_bytes(s_in: str) -> bytes: def address_repr(buf, reverse: bool = True, delimit: str = "") -> str: - """Convert a buffer into a hexlified string.""" + """Convert a buffer into a hexadecimal string.""" order = range(len(buf) - 1, -1, -1) if reverse else range(len(buf)) return delimit.join(["%02X" % buf[byte] for byte in order]) # pylint: disable=too-many-locals,too-many-statements def print_details(encoded_buf: bytearray): - """This debuggung function outputs all details about the nRF24L01.""" + """This debugging function outputs all details about the nRF24L01.""" # declare sequences pipes = [bytearray(5)] * 2 + [0] * 4 pl_len = [0] * 6 diff --git a/examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino b/examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino index 09f418223..d05add40f 100644 --- a/examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino +++ b/examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino @@ -31,7 +31,7 @@ CRC Length = 16 bits PA Power = PA_LOW - Users can use this sketch to troubleshoot radio module wiring etc. as it makes the radios hot-swapable + Users can use this sketch to troubleshoot radio module wiring etc. as it makes the radios hot-swappable Updated: 2019 by TMRh20 */ diff --git a/examples/old_backups/TransferTimeouts/TransferTimeouts.ino b/examples/old_backups/TransferTimeouts/TransferTimeouts.ino index 9abb4d369..dbb8d1a21 100644 --- a/examples/old_backups/TransferTimeouts/TransferTimeouts.ino +++ b/examples/old_backups/TransferTimeouts/TransferTimeouts.ino @@ -13,7 +13,7 @@ the auto-retry functionality to any chosen time period, preventing data loss and ensuring the consistency of data. - This sketh demonstrates use of the writeBlocking() functionality, and extends the standard + This sketch demonstrates use of the writeBlocking() functionality, and extends the standard retry functionality of the radio. Payloads will be auto-retried until successful or the extended timeout period is reached. */ @@ -147,7 +147,7 @@ void loop(void) { rxTimer = millis(); // Reset the timeout timer counter++; // Keep a count of received payloads } else if (millis() - rxTimer > timeoutPeriod) { // If no data available, check the timeout period - Serial.println("Transfer Failed"); // If per-payload timeout exceeeded, end the transfer + Serial.println("Transfer Failed"); // If per-payload timeout exceeded, end the transfer transferInProgress = 0; } else if (counter >= payloads) { // If the specified number of payloads is reached, transfer is completed startTime = millis() - startTime; // Calculate the total time spent during transfer diff --git a/examples/old_backups/pingpair_dyn/pingpair_dyn.ino b/examples/old_backups/pingpair_dyn/pingpair_dyn.ino index a27cbd39d..8df9524d2 100644 --- a/examples/old_backups/pingpair_dyn/pingpair_dyn.ino +++ b/examples/old_backups/pingpair_dyn/pingpair_dyn.ino @@ -101,7 +101,7 @@ void loop() { radio.startListening(); // Now, continue listening - unsigned long started_waiting_at = millis(); // Start a timer for measuring timout + unsigned long started_waiting_at = millis(); // Start a timer for measuring timeout bool timeout = false; while (!radio.available() && !timeout) // Wait until we get a response or timeout is reached { diff --git a/examples/rf24_ATTiny/timingSearch3pin/timingSearch3pin.ino b/examples/rf24_ATTiny/timingSearch3pin/timingSearch3pin.ino index c2b79b3a6..5ec62856a 100644 --- a/examples/rf24_ATTiny/timingSearch3pin/timingSearch3pin.ino +++ b/examples/rf24_ATTiny/timingSearch3pin/timingSearch3pin.ino @@ -10,7 +10,7 @@ * macros, defined as RF24_CSN_SETTLE_HIGH_DELAY and RF24_CSN_SETTLE_LOW_DELAY, * in RF24::csn(). * The settle time values used here are 100/20. However, these values depend - * on the actual used RC combiniation and voltage drop by LED. The + * on the actual used RC combination and voltage drop by LED. The * intermediate results are written to TX (PB3, pin 2 -- using Serial). * * For schematic details, see introductory comment block in the diff --git a/examples_linux/CMakeLists.txt b/examples_linux/CMakeLists.txt index d48c1a989..f75d8b771 100644 --- a/examples_linux/CMakeLists.txt +++ b/examples_linux/CMakeLists.txt @@ -18,7 +18,7 @@ add_compile_options(-Ofast -Wall) # passing the compiler a `-pthread` flag doesn include(../cmake/detectCPU.cmake) # sets the variable SOC accordingly # auto-detect what driver to use -# auto-detect can be overriden using `cmake .. -D RF24_DRIVER=` +# auto-detect can be overridden using `cmake .. -D RF24_DRIVER=` include(../cmake/AutoConfig_RF24_DRIVER.cmake) find_library(RF24 rf24 REQUIRED) diff --git a/examples_linux/acknowledgementPayloads.cpp b/examples_linux/acknowledgementPayloads.cpp index 1c784548a..5412160f3 100644 --- a/examples_linux/acknowledgementPayloads.cpp +++ b/examples_linux/acknowledgementPayloads.cpp @@ -199,7 +199,7 @@ void slave() time_t startTimer = time(nullptr); // start a timer while (time(nullptr) - startTimer < 6) { // use 6 second timeout uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getDynamicPayloadSize(); // get the size of the payload PayloadStruct received; radio.read(&received, sizeof(received)); // fetch payload from RX FIFO diff --git a/examples_linux/gettingstarted.cpp b/examples_linux/gettingstarted.cpp index c5916a390..752611f6b 100644 --- a/examples_linux/gettingstarted.cpp +++ b/examples_linux/gettingstarted.cpp @@ -171,7 +171,7 @@ void slave() time_t startTimer = time(nullptr); // start a timer while (time(nullptr) - startTimer < 6) { // use 6 second timeout uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO cout << "Received " << (unsigned int)bytes; // print the size of the payload diff --git a/examples_linux/interrupts/gettingstarted_call_response_int.cpp b/examples_linux/interrupts/gettingstarted_call_response_int.cpp index 1362292c3..09f187a15 100644 --- a/examples_linux/interrupts/gettingstarted_call_response_int.cpp +++ b/examples_linux/interrupts/gettingstarted_call_response_int.cpp @@ -6,10 +6,10 @@ TMRh20 2014 - Updated to work with optimized RF24 Arduino library * Example for efficient call-response using ack-payloads and interrupts * * This example continues to make use of all the normal functionality of the radios including - * the auto-ack and auto-retry features, but allows ack-payloads to be written optionlly as well. + * the auto-ack and auto-retry features, but allows ack-payloads to be written optionally as well. * This allows very fast call-response communication, with the responding radio never having to * switch out of Primary Receiver mode to send back a payload, but having the option to switch to - * primary transmitter if wanting to initiate communication instead of respond to a commmunication. + * primary transmitter if wanting to initiate communication instead of respond to a communication. */ #include diff --git a/examples_linux/interrupts/gettingstarted_call_response_int2.cpp b/examples_linux/interrupts/gettingstarted_call_response_int2.cpp index f7fe2e35d..9f6491837 100644 --- a/examples_linux/interrupts/gettingstarted_call_response_int2.cpp +++ b/examples_linux/interrupts/gettingstarted_call_response_int2.cpp @@ -6,10 +6,10 @@ TMRh20 2014 - Updated to work with optimized RF24 Arduino library * Example for efficient call-response using ack-payloads * * This example continues to make use of all the normal functionality of the radios including - * the auto-ack and auto-retry features, but allows ack-payloads to be written optionlly as well. + * the auto-ack and auto-retry features, but allows ack-payloads to be written optionally as well. * This allows very fast call-response communication, with the responding radio never having to * switch out of Primary Receiver mode to send back a payload, but having the option to switch to - * primary transmitter if wanting to initiate communication instead of respond to a commmunication. + * primary transmitter if wanting to initiate communication instead of respond to a communication. */ #include diff --git a/examples_linux/interrupts/transfer_interrupt.cpp b/examples_linux/interrupts/transfer_interrupt.cpp index b634c6807..a726bac8e 100644 --- a/examples_linux/interrupts/transfer_interrupt.cpp +++ b/examples_linux/interrupts/transfer_interrupt.cpp @@ -8,7 +8,7 @@ TMRh20 2014 /** General Data Transfer Rate Test * This example demonstrates basic data transfer functionality with the - updated library. This example will display the transfer rates acheived using + updated library. This example will display the transfer rates achieved using the slower form of high-speed transfer using blocking-writes. */ diff --git a/examples_linux/manualAcknowledgements.cpp b/examples_linux/manualAcknowledgements.cpp index a10280b15..621093250 100644 --- a/examples_linux/manualAcknowledgements.cpp +++ b/examples_linux/manualAcknowledgements.cpp @@ -181,7 +181,7 @@ void master() cout << (unsigned int)payload.counter; // print outgoing counter PayloadStruct received; radio.read(&received, sizeof(received)); // get incoming payload - cout << " Recieved " << (unsigned int)bytes; // print incoming payload size + cout << " Received " << (unsigned int)bytes; // print incoming payload size cout << " on pipe " << (unsigned int)pipe; // print RX pipe number cout << ": " << received.message; // print the incoming message cout << (unsigned int)received.counter; // print the incoming counter @@ -189,7 +189,7 @@ void master() payload.counter = received.counter; // save incoming counter for next outgoing counter } else { - cout << "Recieved no response." << endl; // no response received + cout << "Received no response." << endl; // no response received } } else { @@ -216,7 +216,7 @@ void slave() time_t startTimer = time(nullptr); // start a timer while (time(nullptr) - startTimer < 6) { // use 6 second timeout uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get size of incoming payload PayloadStruct received; radio.read(&received, sizeof(received)); // get incoming payload diff --git a/examples_linux/manual_acknowledgements.py b/examples_linux/manual_acknowledgements.py index b577281b8..c38824103 100644 --- a/examples_linux/manual_acknowledgements.py +++ b/examples_linux/manual_acknowledgements.py @@ -93,9 +93,9 @@ def master(): print("Transmission failed or timed out") else: radio.startListening() # put radio in RX mode - timout = time.monotonic() * 1000 + 200 # use 200 ms timeout + timeout = time.monotonic() * 1000 + 200 # use 200 ms timeout # declare a variable to save the incoming response - while not radio.available() and time.monotonic() * 1000 < timout: + while not radio.available() and time.monotonic() * 1000 < timeout: pass # wait for incoming payload or timeout radio.stopListening() # put radio in TX mode end_timer = time.monotonic_ns() # end timer diff --git a/examples_linux/multiceiverDemo.cpp b/examples_linux/multiceiverDemo.cpp index 9a405fa88..aa8744736 100644 --- a/examples_linux/multiceiverDemo.cpp +++ b/examples_linux/multiceiverDemo.cpp @@ -232,7 +232,7 @@ void slave() time_t startTimer = time(nullptr); // start a timer while (time(nullptr) - startTimer < 6) { // use 6 second timeout uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO cout << "Received " << (unsigned int)bytes; // print the size of the payload diff --git a/examples_pico/acknowledgementPayloads.cpp b/examples_pico/acknowledgementPayloads.cpp index 66367ac05..599e59ed8 100644 --- a/examples_pico/acknowledgementPayloads.cpp +++ b/examples_pico/acknowledgementPayloads.cpp @@ -135,7 +135,7 @@ void loop() radio.read(&received, sizeof(received)); // get incoming ACK payload // print details about incoming payload - printf(" Recieved %d bytes on pipe %d: %s%d\n", + printf(" Received %d bytes on pipe %d: %s%d\n", radio.getDynamicPayloadSize(), pipe, received.message, @@ -145,7 +145,7 @@ void loop() payload.counter = received.counter + 1; } else { - printf(" Recieved: an empty ACK packet\n"); // empty ACK packet received + printf(" Received: an empty ACK packet\n"); // empty ACK packet received } } else { @@ -159,7 +159,7 @@ void loop() // This device is a RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getDynamicPayloadSize(); // get the size of the payload PayloadStruct received; radio.read(&received, sizeof(received)); // get incoming payload diff --git a/examples_pico/defaultPins.h b/examples_pico/defaultPins.h index 319beed0d..93c8ce3fd 100644 --- a/examples_pico/defaultPins.h +++ b/examples_pico/defaultPins.h @@ -1,4 +1,4 @@ -// pre-chossen pins for different boards +// pre-chosen pins for different boards #ifndef DEFAULTPINS_H #define DEFAULTPINS_H diff --git a/examples_pico/gettingStarted.cpp b/examples_pico/gettingStarted.cpp index 32d83d285..f7dfaacb4 100644 --- a/examples_pico/gettingStarted.cpp +++ b/examples_pico/gettingStarted.cpp @@ -119,7 +119,7 @@ void loop() // This device is a RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO diff --git a/examples_pico/manualAcknowledgements.cpp b/examples_pico/manualAcknowledgements.cpp index bfe2d57f9..c0362a8f4 100644 --- a/examples_pico/manualAcknowledgements.cpp +++ b/examples_pico/manualAcknowledgements.cpp @@ -155,7 +155,7 @@ void loop() payload.counter = received.counter; // save incoming counter for next outgoing counter } else { - printf(" Recieved no response.\n"); // no response received + printf(" Received no response.\n"); // no response received } } else { @@ -169,7 +169,7 @@ void loop() // This device is a RX node uint8_t pipe; - if (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + if (radio.available(&pipe)) { // is there a payload? get the pipe number that received it PayloadStruct received; radio.read(&received, sizeof(received)); // get incoming payload payload.counter = received.counter + 1; // increment incoming counter for next outgoing response diff --git a/examples_pico/multiceiverDemo.cpp b/examples_pico/multiceiverDemo.cpp index 18a7d40f8..a187ab2c9 100644 --- a/examples_pico/multiceiverDemo.cpp +++ b/examples_pico/multiceiverDemo.cpp @@ -127,7 +127,7 @@ void loop() // This device is the RX node uint8_t pipe; - while (radio.available(&pipe)) { // is there a payload? get the pipe number that recieved it + while (radio.available(&pipe)) { // is there a payload? get the pipe number that received it uint8_t bytes = radio.getPayloadSize(); // get the size of the payload radio.read(&payload, bytes); // fetch payload from FIFO diff --git a/utility/ATXMegaD3/RF24_arch_config.h b/utility/ATXMegaD3/RF24_arch_config.h index 96df91740..a93d8c3b7 100644 --- a/utility/ATXMegaD3/RF24_arch_config.h +++ b/utility/ATXMegaD3/RF24_arch_config.h @@ -66,7 +66,7 @@ typedef uint16_t rf24_gpio_pin_t; #define OUTPUT GPIO::DIRECTION_OUT #define digitalWrite(pin, value) GPIO::write(pin, value) #define pinMode(pin, direction) GPIO::open(pin, direction) -#define delay(milisec) __msleep(milisec) +#define delay(millisec) __msleep(millisec) #define delayMicroseconds(usec) __usleep(usec) #define millis() __millis() diff --git a/utility/ATXMegaD3/compatibility.c b/utility/ATXMegaD3/compatibility.c index 4f8437e88..5f51e6bd7 100644 --- a/utility/ATXMegaD3/compatibility.c +++ b/utility/ATXMegaD3/compatibility.c @@ -11,9 +11,9 @@ volatile uint32_t _millis; -void __msleep(int milisec) +void __msleep(int millisec) { - while (milisec-- > 0) { + while (millisec-- > 0) { _delay_ms(1); } } diff --git a/utility/ATXMegaD3/compatibility.h b/utility/ATXMegaD3/compatibility.h index 75b04b2e8..f97ca365a 100644 --- a/utility/ATXMegaD3/compatibility.h +++ b/utility/ATXMegaD3/compatibility.h @@ -18,7 +18,7 @@ extern "C" { //#include //#include -void __msleep(int milisec); +void __msleep(int millisec); void __usleep(int usec); diff --git a/utility/ATXMegaD3/gpio_helper.c b/utility/ATXMegaD3/gpio_helper.c index 7c5a28643..e709ddd75 100644 --- a/utility/ATXMegaD3/gpio_helper.c +++ b/utility/ATXMegaD3/gpio_helper.c @@ -8,35 +8,35 @@ #include "gpio_helper.h" /** - * Get the port corresponding in portnum. Default is PORTC. + * Get the port corresponding in port_num. Default is PORTC. */ -PORT_t* GPIO_getPort(int pinnum, uint8_t* pin_bm) -//PORT_t * GPIO_getPort(int portnum) +PORT_t* GPIO_getPort(int pin_num, uint8_t* pin_bm) +//PORT_t * GPIO_getPort(int port_num) { PORT_t* port = &PORTC; - if ((pinnum >= XMEGA_PORTA_PIN0) && (pinnum <= XMEGA_PORTA_PIN7)) { + if ((pin_num >= XMEGA_PORTA_PIN0) && (pin_num <= XMEGA_PORTA_PIN7)) { port = &PORTA; - *pin_bm = (1 << pinnum); + *pin_bm = (1 << pin_num); } - else if ((pinnum >= XMEGA_PORTB_PIN0) && (pinnum <= XMEGA_PORTB_PIN7)) { + else if ((pin_num >= XMEGA_PORTB_PIN0) && (pin_num <= XMEGA_PORTB_PIN7)) { port = &PORTB; - *pin_bm = (1 << (pinnum - 8)); + *pin_bm = (1 << (pin_num - 8)); } - else if ((pinnum >= XMEGA_PORTC_PIN0) && (pinnum <= XMEGA_PORTC_PIN7)) { + else if ((pin_num >= XMEGA_PORTC_PIN0) && (pin_num <= XMEGA_PORTC_PIN7)) { port = &PORTC; - *pin_bm = (1 << (pinnum - 16)); + *pin_bm = (1 << (pin_num - 16)); } - else if ((pinnum >= XMEGA_PORTD_PIN0) && (pinnum <= XMEGA_PORTD_PIN7)) { + else if ((pin_num >= XMEGA_PORTD_PIN0) && (pin_num <= XMEGA_PORTD_PIN7)) { port = &PORTD; - *pin_bm = (1 << (pinnum - 24)); + *pin_bm = (1 << (pin_num - 24)); } - else if ((pinnum >= XMEGA_PORTE_PIN0) && (pinnum <= XMEGA_PORTE_PIN7)) { + else if ((pin_num >= XMEGA_PORTE_PIN0) && (pin_num <= XMEGA_PORTE_PIN7)) { port = &PORTE; - *pin_bm = (1 << (pinnum - 32)); + *pin_bm = (1 << (pin_num - 32)); } - else if ((pinnum >= XMEGA_PORTF_PIN0) && (pinnum <= XMEGA_PORTF_PIN7)) { + else if ((pin_num >= XMEGA_PORTF_PIN0) && (pin_num <= XMEGA_PORTF_PIN7)) { port = &PORTF; - *pin_bm = (1 << (pinnum - 40)); + *pin_bm = (1 << (pin_num - 40)); } return port; diff --git a/utility/ATXMegaD3/gpio_helper.h b/utility/ATXMegaD3/gpio_helper.h index b41a22af8..8fdbbefd8 100644 --- a/utility/ATXMegaD3/gpio_helper.h +++ b/utility/ATXMegaD3/gpio_helper.h @@ -72,9 +72,9 @@ extern "C" { #define XMEGA_SPI_PORT_C 20 #define XMEGA_SPI_PORT_D 28 -//void GPIO_getPort(int pinnum, PORT_t * port, uint8_t pin); -//void GPIO_getPort(int pinnum, PORT_t * port, uint8_t * pin_bm); -PORT_t* GPIO_getPort(int pinnum, uint8_t* pin_bm); +//void GPIO_getPort(int pin_num, PORT_t * port, uint8_t pin); +//void GPIO_getPort(int pin_num, PORT_t * port, uint8_t * pin_bm); +PORT_t* GPIO_getPort(int pin_num, uint8_t* pin_bm); #ifdef __cplusplus } diff --git a/utility/ATXMegaD3/spi.h b/utility/ATXMegaD3/spi.h index 7bf02164c..5b5648296 100644 --- a/utility/ATXMegaD3/spi.h +++ b/utility/ATXMegaD3/spi.h @@ -39,7 +39,7 @@ class SPI uint8_t transfer(uint8_t tx_); - void transfernb(char* tbuf, char* rbuf, uint32_t len); + void transfernb(char* txBuf, char* rxBuf, uint32_t len); void transfern(char* buf, uint32_t len); diff --git a/utility/MRAA/RF24_arch_config.h b/utility/MRAA/RF24_arch_config.h index a286a4dfa..e0fb193e2 100644 --- a/utility/MRAA/RF24_arch_config.h +++ b/utility/MRAA/RF24_arch_config.h @@ -42,7 +42,7 @@ #ifndef __TIME_H__ // Prophet: Redefine time functions only if precompiled arduino time is not included - #define delay(milisec) __msleep(milisec) + #define delay(millisec) __msleep(millisec) #define delayMicroseconds(usec) __usleep(usec) #define millis() __millis() #endif diff --git a/utility/MRAA/compatibility.cpp b/utility/MRAA/compatibility.cpp index 68f99b319..62c743a6a 100644 --- a/utility/MRAA/compatibility.cpp +++ b/utility/MRAA/compatibility.cpp @@ -2,11 +2,11 @@ #include #include "compatibility.h" -void __msleep(int milisec) +void __msleep(int millisec) { struct timespec req; // = {0}; - req.tv_sec = (time_t)milisec / 1000; - req.tv_nsec = (milisec % 1000) * 1000000L; + req.tv_sec = (time_t)millisec / 1000; + req.tv_nsec = (millisec % 1000) * 1000000L; clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); } diff --git a/utility/MRAA/compatibility.h b/utility/MRAA/compatibility.h index 3658033bf..754864305 100644 --- a/utility/MRAA/compatibility.h +++ b/utility/MRAA/compatibility.h @@ -14,9 +14,9 @@ extern "C" { #include -void __msleep(int milisec); +void __msleep(int millisec); -void __usleep(int milisec); +void __usleep(int microsec); void __start_timer(); diff --git a/utility/MRAA/spi.cpp b/utility/MRAA/spi.cpp index a689576d5..1de132e30 100644 --- a/utility/MRAA/spi.cpp +++ b/utility/MRAA/spi.cpp @@ -4,17 +4,17 @@ SPI::SPI() { - mspi = NULL; + mraa_spi = NULL; } void SPI::begin(int busNo, uint32_t spi_speed) { // init mraa spi bus, it will handle chip select internally. For CS pin wiring user must check SPI details in hardware manual - mspi = new mraa::Spi(busNo); + mraa_spi = new mraa::Spi(busNo); mraa::Result result; - result = mspi->mode(mraa::SPI_MODE0); + result = mraa_spi->mode(mraa::SPI_MODE0); if (result != mraa::Result::SUCCESS) { std::string msg = "[SPI::begin] Could not set bus mode;"; msg += mraa_strresult((mraa_result_t)result); @@ -22,7 +22,7 @@ void SPI::begin(int busNo, uint32_t spi_speed) return; } - result = mspi->bitPerWord(8); + result = mraa_spi->bitPerWord(8); if (result != mraa::Result::SUCCESS) { std::string msg = "[SPI::begin] Could not set bus bits per word;"; msg += mraa_strresult((mraa_result_t)result); @@ -31,7 +31,7 @@ void SPI::begin(int busNo, uint32_t spi_speed) } // Prophet: this will try to set 8MHz, however MRAA will reset to max platform speed and syslog a message of it - result = mspi->frequency(spi_speed); + result = mraa_spi->frequency(spi_speed); if (result != mraa::Result::SUCCESS) { std::string msg = "[SPI::begin] Could not set bus frequency;"; msg += mraa_strresult((mraa_result_t)result); @@ -42,30 +42,30 @@ void SPI::begin(int busNo, uint32_t spi_speed) void SPI::end() { - // Prophet: we should check for existence of mspi before deleting it - if (mspi != NULL) { - delete mspi; + // Prophet: we should check for existence of mraa_spi before deleting it + if (mraa_spi != NULL) { + delete mraa_spi; } } void SPI::setBitOrder(uint8_t bit_order) { - if (mspi != NULL) { - mspi->lsbmode((mraa_boolean_t)bit_order); + if (mraa_spi != NULL) { + mraa_spi->lsbmode((mraa_boolean_t)bit_order); } // Prophet: bit_order } void SPI::setDataMode(uint8_t data_mode) { - if (mspi != NULL) { - mspi->mode((mraa::Spi_Mode)data_mode); + if (mraa_spi != NULL) { + mraa_spi->mode((mraa::Spi_Mode)data_mode); } } void SPI::setClockDivider(uint32_t spi_speed) { - if (mspi != NULL) { - mspi->frequency(spi_speed); + if (mraa_spi != NULL) { + mraa_spi->frequency(spi_speed); } } diff --git a/utility/MRAA/spi.h b/utility/MRAA/spi.h index 3475b3632..453e4851d 100644 --- a/utility/MRAA/spi.h +++ b/utility/MRAA/spi.h @@ -35,11 +35,11 @@ class SPI virtual ~SPI(); - mraa::Spi* mspi; + mraa::Spi* mraa_spi; inline uint8_t transfer(uint8_t _data); - inline void transfernb(char* tbuf, char* rbuf, uint32_t len); + inline void transfernb(char* txBuf, char* rxBuf, uint32_t len); inline void transfern(char* buf, uint32_t len); @@ -62,12 +62,12 @@ class SPI uint8_t SPI::transfer(uint8_t _data) { - return mspi->writeByte(_data); + return mraa_spi->writeByte(_data); } -void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) +void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len) { - mspi->transfer((uint8_t*)tbuf, (uint8_t*)rbuf, len); + mraa_spi->transfer((uint8_t*)txBuf, (uint8_t*)rxBuf, len); } void SPI::transfern(char* buf, uint32_t len) diff --git a/utility/RPi/spi.cpp b/utility/RPi/spi.cpp index 794931e00..6d2843f09 100644 --- a/utility/RPi/spi.cpp +++ b/utility/RPi/spi.cpp @@ -28,8 +28,8 @@ void SPI::beginTransaction(SPISettings settings) } pthread_mutex_lock(&spiMutex); setBitOrder(settings.border); - setDataMode(settings.dmode); - setClockDivider(settings.clck); + setDataMode(settings.dataMode); + setClockDivider(settings.clock); } void SPI::endTransaction() diff --git a/utility/RPi/spi.h b/utility/RPi/spi.h index 895ebe4e8..9b6321b54 100644 --- a/utility/RPi/spi.h +++ b/utility/RPi/spi.h @@ -31,16 +31,16 @@ class SPISettings init(RF24_SPI_SPEED, MSBFIRST, SPI_MODE0); } - uint32_t clck; + uint32_t clock; uint8_t border; - uint8_t dmode; + uint8_t dataMode; private: void init(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) { - clck = clock; + clock = clock; border = bitOrder; - dmode = dataMode; + dataMode = dataMode; } friend class SPIClass; @@ -55,7 +55,7 @@ class SPI inline static uint8_t transfer(uint8_t _data); - inline static void transfernb(char* tbuf, char* rbuf, uint32_t len); + inline static void transfernb(char* txBuf, char* rxBuf, uint32_t len); inline static void transfern(char* buf, uint32_t len); @@ -82,9 +82,9 @@ uint8_t SPI::transfer(uint8_t _data) return data; } -void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) +void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len) { - bcm2835_spi_transfernb(tbuf, rbuf, len); + bcm2835_spi_transfernb(txBuf, rxBuf, len); } void SPI::transfern(char* buf, uint32_t len) diff --git a/utility/SPIDEV/RF24_arch_config.h b/utility/SPIDEV/RF24_arch_config.h index 05fa53bf4..acf994e57 100644 --- a/utility/SPIDEV/RF24_arch_config.h +++ b/utility/SPIDEV/RF24_arch_config.h @@ -58,7 +58,7 @@ typedef uint16_t prog_uint16_t; #define OUTPUT GPIO::DIRECTION_OUT #define digitalWrite(pin, value) GPIO::write(pin, value) #define pinMode(pin, direction) GPIO::open(pin, direction) -#define delay(milisec) __msleep(milisec) +#define delay(millisec) __msleep(millisec) #define delayMicroseconds(usec) __usleep(usec) #define millis() __millis() diff --git a/utility/SPIDEV/compatibility.cpp b/utility/SPIDEV/compatibility.cpp index 14b0b5181..d223e9d30 100644 --- a/utility/SPIDEV/compatibility.cpp +++ b/utility/SPIDEV/compatibility.cpp @@ -10,11 +10,11 @@ long long mtime, seconds, useconds; //static struct timeval start, end; //struct timespec start, end; -void __msleep(int milisec) +void __msleep(int millisec) { struct timespec req; // = {0}; - req.tv_sec = (time_t)milisec / 1000; - req.tv_nsec = (milisec % 1000) * 1000000L; + req.tv_sec = (time_t)millisec / 1000; + req.tv_nsec = (millisec % 1000) * 1000000L; //nanosleep(&req, (struct timespec *)NULL); clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); } diff --git a/utility/SPIDEV/compatibility.h b/utility/SPIDEV/compatibility.h index 6158d0ad2..755fd3668 100644 --- a/utility/SPIDEV/compatibility.h +++ b/utility/SPIDEV/compatibility.h @@ -15,9 +15,9 @@ extern "C" { #include // for uintXX_t types -void __msleep(int milisec); +void __msleep(int millisec); -void __usleep(int milisec); +void __usleep(int microsec); void __start_timer(); diff --git a/utility/SPIDEV/spi.cpp b/utility/SPIDEV/spi.cpp index 4a5ba9034..6266e5068 100644 --- a/utility/SPIDEV/spi.cpp +++ b/utility/SPIDEV/spi.cpp @@ -146,12 +146,12 @@ uint8_t SPI::transfer(uint8_t tx) return rx; } -void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) +void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len) { struct spi_ioc_transfer tr; memset(&tr, 0, sizeof(tr)); - tr.tx_buf = (unsigned long)tbuf; - tr.rx_buf = (unsigned long)rbuf; + tr.tx_buf = (unsigned long)txBuf; + tr.rx_buf = (unsigned long)rxBuf; tr.len = len; tr.speed_hz = _spi_speed; //RF24_SPI_SPEED; tr.delay_usecs = 0; diff --git a/utility/SPIDEV/spi.h b/utility/SPIDEV/spi.h index 8dcc291c3..238577374 100644 --- a/utility/SPIDEV/spi.h +++ b/utility/SPIDEV/spi.h @@ -37,7 +37,7 @@ class SPI uint8_t transfer(uint8_t tx); - void transfernb(char* tbuf, char* rbuf, uint32_t len); + void transfernb(char* txBuf, char* rxBuf, uint32_t len); void transfern(char* buf, uint32_t len); diff --git a/utility/Template/RF24_arch_config.h b/utility/Template/RF24_arch_config.h index 3fb986b3e..2cfd75aad 100644 --- a/utility/Template/RF24_arch_config.h +++ b/utility/Template/RF24_arch_config.h @@ -67,7 +67,7 @@ typedef uint16_t rf24_gpio_pin_t; #define OUTPUT GPIO::DIRECTION_OUT #define digitalWrite(pin, value) GPIO::write(pin, value) #define pinMode(pin, direction) GPIO::open(pin, direction) -#define delay(milisec) __msleep(milisec) +#define delay(millisec) __msleep(millisec) #define delayMicroseconds(usec) __usleep(usec) #define millis() __millis() diff --git a/utility/Template/compatibility.h b/utility/Template/compatibility.h index 2408b073a..49c33e1ed 100644 --- a/utility/Template/compatibility.h +++ b/utility/Template/compatibility.h @@ -19,9 +19,9 @@ extern "C" { #include -void __msleep(int milisec); +void __msleep(int millisec); -void __usleep(int milisec); +void __usleep(int microsec); void __start_timer(); diff --git a/utility/Template/spi.h b/utility/Template/spi.h index 22ac04fef..c4432a340 100644 --- a/utility/Template/spi.h +++ b/utility/Template/spi.h @@ -40,11 +40,11 @@ class SPI /** * Transfer a buffer of data - * @param tbuf Transmit buffer - * @param rbuf Receive buffer + * @param txBuf Transmit buffer + * @param rxBuf Receive buffer * @param len Length of the data */ - void transfernb(char* tbuf, char* rbuf, uint32_t len); + void transfernb(char* txBuf, char* rxBuf, uint32_t len); /** * Transfer a buffer of data without an rx buffer diff --git a/utility/pigpio/RF24_arch_config.h b/utility/pigpio/RF24_arch_config.h index 81a4788d2..3d05c09c4 100644 --- a/utility/pigpio/RF24_arch_config.h +++ b/utility/pigpio/RF24_arch_config.h @@ -64,7 +64,7 @@ typedef uint8_t rf24_gpio_pin_t; #define OUTPUT GPIO::DIRECTION_OUT #define digitalWrite(pin, value) GPIO::write(pin, value) #define pinMode(pin, direction) GPIO::open(pin, direction) -#define delay(milisec) __msleep(milisec) +#define delay(millisec) __msleep(millisec) #define delayMicroseconds(usec) __usleep(usec) #define millis() __millis() diff --git a/utility/pigpio/compatibility.cpp b/utility/pigpio/compatibility.cpp index 65ba305ec..f28cf3dee 100644 --- a/utility/pigpio/compatibility.cpp +++ b/utility/pigpio/compatibility.cpp @@ -6,11 +6,11 @@ long long mtime, seconds, useconds; //static struct timeval start, end; //struct timespec start, end; -void __msleep(int milisec) +void __msleep(int millisec) { struct timespec req; // = {0}; - req.tv_sec = (time_t)milisec / 1000; - req.tv_nsec = (milisec % 1000) * 1000000L; + req.tv_sec = (time_t)millisec / 1000; + req.tv_nsec = (millisec % 1000) * 1000000L; //nanosleep(&req, (struct timespec *)NULL); clock_nanosleep(CLOCK_REALTIME, 0, &req, NULL); } diff --git a/utility/pigpio/compatibility.h b/utility/pigpio/compatibility.h index 25cbd052c..b94c5713f 100644 --- a/utility/pigpio/compatibility.h +++ b/utility/pigpio/compatibility.h @@ -10,9 +10,9 @@ extern "C" { #endif -void __msleep(int milisec); +void __msleep(int millisec); -void __usleep(int milisec); +void __usleep(int microsec); void __start_timer(); diff --git a/utility/pigpio/spi.cpp b/utility/pigpio/spi.cpp index cb9824266..8698a14a0 100644 --- a/utility/pigpio/spi.cpp +++ b/utility/pigpio/spi.cpp @@ -30,9 +30,9 @@ uint8_t SPI::transfer(char tx) return rbuf; } -void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) +void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len) { - spiXfer(spiHandle, tbuf, rbuf, len); + spiXfer(spiHandle, txBuf, rxBuf, len); } SPI::~SPI() diff --git a/utility/pigpio/spi.h b/utility/pigpio/spi.h index 12f8f06ba..9c5fa2ad0 100644 --- a/utility/pigpio/spi.h +++ b/utility/pigpio/spi.h @@ -41,11 +41,11 @@ class SPI /** * Transfer a buffer of data - * @param tbuf Transmit buffer - * @param rbuf Receive buffer + * @param txBuf Transmit buffer + * @param rxBuf Receive buffer * @param len Length of the data */ - void transfernb(char* tbuf, char* rbuf, uint32_t len); + void transfernb(char* txBuf, char* rxBuf, uint32_t len); /** * Transfer a buffer of data without an rx buffer diff --git a/utility/rp2/RF24_arch_config.h b/utility/rp2/RF24_arch_config.h index c5e0b7c3d..d58a752cf 100644 --- a/utility/rp2/RF24_arch_config.h +++ b/utility/rp2/RF24_arch_config.h @@ -55,7 +55,7 @@ typedef uint8_t rf24_gpio_pin_t; #define OUTPUT GPIO::DIRECTION_OUT #define digitalWrite(pin, value) GPIO::write(pin, value) #define pinMode(pin, direction) GPIO::open(pin, direction) -#define delay(milisec) sleep_ms(milisec) +#define delay(millisec) sleep_ms(millisec) #define delayMicroseconds(usec) sleep_us(usec) #define millis() to_ms_since_boot(get_absolute_time()) diff --git a/utility/rp2/spi.cpp b/utility/rp2/spi.cpp index f3e88d0f9..56489b740 100644 --- a/utility/rp2/spi.cpp +++ b/utility/rp2/spi.cpp @@ -24,9 +24,9 @@ uint8_t SPI::transfer(uint8_t tx_) return recv; } -void SPI::transfernb(const uint8_t* tbuf, uint8_t* rbuf, uint32_t len) +void SPI::transfernb(const uint8_t* txBuf, uint8_t* rxBuf, uint32_t len) { - spi_write_read_blocking(_hw_id, tbuf, rbuf, len); + spi_write_read_blocking(_hw_id, txBuf, rxBuf, len); } void SPI::transfern(const uint8_t* buf, uint32_t len) diff --git a/utility/rp2/spi.h b/utility/rp2/spi.h index e6b3f420d..255cfaa30 100644 --- a/utility/rp2/spi.h +++ b/utility/rp2/spi.h @@ -51,7 +51,7 @@ class SPI uint8_t transfer(uint8_t tx_); - void transfernb(const uint8_t* tbuf, uint8_t* rbuf, uint32_t len); + void transfernb(const uint8_t* txBuf, uint8_t* rxBuf, uint32_t len); void transfern(const uint8_t* buf, uint32_t len); diff --git a/utility/wiringPi/spi.cpp b/utility/wiringPi/spi.cpp index 992ae1f24..5c0cd6ef9 100644 --- a/utility/wiringPi/spi.cpp +++ b/utility/wiringPi/spi.cpp @@ -58,11 +58,11 @@ void SPI::transfern(char* buf, uint32_t len) } } -void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) +void SPI::transfernb(char* txBuf, char* rxBuf, uint32_t len) { // using an auxiliary buffer to keep tx and rx different memset(xferBuf, 0, sizeof(xferBuf)); - memcpy(xferBuf, tbuf, len); + memcpy(xferBuf, txBuf, len); if (wiringPiSPIDataRW(channel, xferBuf, len) < 0) { std::string msg = "[SPI::transfernb] Cannot send spi message; "; @@ -70,7 +70,7 @@ void SPI::transfernb(char* tbuf, char* rbuf, uint32_t len) throw SPIException(msg); } - memcpy(rbuf, xferBuf, len); + memcpy(rxBuf, xferBuf, len); } SPI::~SPI() From d1a581c7fcb1862fb77a21faca7e5a5e4fe6c056 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sat, 7 Sep 2024 22:27:08 -0700 Subject: [PATCH 3/4] add CI job to check spelling --- .github/workflows/doxygen.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 9be499d5f..7fc365a93 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -36,6 +36,16 @@ on: workflow_dispatch: jobs: + check-spelling: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 20.x + - uses: actions/checkout@v4 + - name: Install cSpell + run: npm install -g cspell + - run: npx cspell --gitignore --config cspell.config.yaml . build-docs: uses: nRF24/.github/.github/workflows/build_docs.yaml@main with: From 096d5b927970a9a53d41bf5b41034e8e734211d2 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sat, 7 Sep 2024 23:44:30 -0700 Subject: [PATCH 4/4] questionable fixes possibly breaking API --- pyRF24/pyRF24.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyRF24/pyRF24.cpp b/pyRF24/pyRF24.cpp index eb6dc6199..d154a68cb 100644 --- a/pyRF24/pyRF24.cpp +++ b/pyRF24/pyRF24.cpp @@ -285,8 +285,8 @@ BOOST_PYTHON_MODULE(RF24) // ******************** RF24 class ************************** bp::class_("RF24", bp::init((bp::arg("_cepin"), bp::arg("_cspin")))) #if defined(RF24_LINUX) && !defined(MRAA) - .def(bp::init((bp::arg("_cepin"), bp::arg("_cspin"), bp::arg("spispeed")))) - .def(bp::init((bp::arg("spispeed")))) + .def(bp::init((bp::arg("_cepin"), bp::arg("_cspin"), bp::arg("spi_speed")))) + .def(bp::init((bp::arg("spi_speed")))) .def(bp::init<>()) #endif .def("available", (bool(::RF24::*)())(&::RF24::available))