Doxygen warnings cleanup

But made sure that any undocumented parts generates a warning
This commit is contained in:
Patrick Fallberg
2015-12-11 00:40:02 +01:00
parent e9971285a5
commit cc544909ce
10 changed files with 89 additions and 252 deletions
+8 -8
View File
@@ -38,7 +38,7 @@ PROJECT_NAME = "MySensors Library & Examples"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = PROJECT_NUMBER = $(PROJECTNUMBER)
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@@ -743,7 +743,7 @@ WARN_LOGFILE =
# spaces. # spaces.
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = libraries/MySensors INPUT = libraries/MySensors Documentation/mainpage.dox
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -763,7 +763,7 @@ INPUT_ENCODING = UTF-8
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, # *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js. # *.qsf, *.as and *.js.
FILE_PATTERNS = FILE_PATTERNS = *.h *.ino
# The RECURSIVE tag can be used to specify whether or not subdirectories should # The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well. # be searched for input files as well.
@@ -811,7 +811,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include # that contain example code fragments that are included (see the \include
# command). # command).
EXAMPLE_PATH = EXAMPLE_PATH = libraries/MySensors/examples libraries/MySensors/drivers/AES
# If the value of the EXAMPLE_PATH tag contains directories, you can use the # If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -831,7 +831,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the # that contain images that are to be included in the documentation (see the
# \image command). # \image command).
IMAGE_PATH = IMAGE_PATH = Documentation/img
# The INPUT_FILTER tag can be used to specify a program that doxygen should # The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program # invoke to filter for each input file. Doxygen will invoke the filter program
@@ -1895,7 +1895,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = NO MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and # the macro expansion is limited to the macros specified with the PREDEFINED and
@@ -1903,7 +1903,7 @@ MACRO_EXPANSION = NO
# The default value is: NO. # The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = NO EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES the includes files in the # If the SEARCH_INCLUDES tag is set to YES the includes files in the
# INCLUDE_PATH will be searched if a #include is found. # INCLUDE_PATH will be searched if a #include is found.
@@ -1935,7 +1935,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator. # recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = PREDEFINED = "DOXYGEN=1"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The # tag can be used to specify a list of macro names that should be expanded. The
+7
View File
@@ -0,0 +1,7 @@
/**
@mainpage MySensors library and examples documentation
@copyright (C) 2013-2015 Sensnology AB
Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
*/
+13 -4
View File
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -17,7 +17,11 @@
* version 2 as published by the Free Software Foundation. * version 2 as published by the Free Software Foundation.
*/ */
/**
* @file MyMessage.h
*
* @brief API and type declarations for MySensors messages
*/
#ifndef MyMessage_h #ifndef MyMessage_h
#define MyMessage_h #define MyMessage_h
@@ -148,12 +152,15 @@ typedef enum {
} mysensor_data; } mysensor_data;
// Type of internal messages (for internal messages) /// @brief Type of internal messages (for internal messages)
typedef enum { typedef enum {
I_BATTERY_LEVEL, I_TIME, I_VERSION, I_ID_REQUEST, I_ID_RESPONSE, I_BATTERY_LEVEL, I_TIME, I_VERSION, I_ID_REQUEST, I_ID_RESPONSE,
I_INCLUSION_MODE, I_CONFIG, I_FIND_PARENT, I_FIND_PARENT_RESPONSE, I_INCLUSION_MODE, I_CONFIG, I_FIND_PARENT, I_FIND_PARENT_RESPONSE,
I_LOG_MESSAGE, I_CHILDREN, I_SKETCH_NAME, I_SKETCH_VERSION, I_LOG_MESSAGE, I_CHILDREN, I_SKETCH_NAME, I_SKETCH_VERSION,
I_REBOOT, I_GATEWAY_READY, I_REQUEST_SIGNING, I_GET_NONCE, I_GET_NONCE_RESPONSE, I_REBOOT, I_GATEWAY_READY,
I_REQUEST_SIGNING, /*!< Indicates senter require signed messages (bool param) */
I_GET_NONCE, /*!< Request for a nonce */
I_GET_NONCE_RESPONSE, /*!< Payload is nonce data */
I_HEARTBEAT, I_PRESENTATION, I_DISCOVER, I_DISCOVER_RESPONSE I_HEARTBEAT, I_PRESENTATION, I_DISCOVER, I_DISCOVER_RESPONSE
} mysensor_internal; } mysensor_internal;
@@ -224,6 +231,7 @@ typedef enum {
#define miGetPayloadType() BF_GET(command_ack_payload, 5, 3) #define miGetPayloadType() BF_GET(command_ack_payload, 5, 3)
#if !DOXYGEN
#ifdef __cplusplus #ifdef __cplusplus
class MyMessage class MyMessage
{ {
@@ -323,5 +331,6 @@ struct
uint8_t array[HEADER_SIZE + MAX_PAYLOAD + 1]; uint8_t array[HEADER_SIZE + MAX_PAYLOAD + 1];
} __attribute__((packed)) MyMessage; } __attribute__((packed)) MyMessage;
#endif #endif
#endif
#endif #endif
+1 -1
View File
@@ -154,7 +154,7 @@ ControllerConfig getConfig();
* of writes the EEPROM can handle (~100 000 cycles on ATMega328). * of writes the EEPROM can handle (~100 000 cycles on ATMega328).
* *
* @param pos The position to store value in (0-255) * @param pos The position to store value in (0-255)
* @param Value to store in position * @param value to store in position
*/ */
void saveState(uint8_t pos, uint8_t value); void saveState(uint8_t pos, uint8_t value);
+19 -19
View File
@@ -80,15 +80,15 @@ class AES
void copy_n_bytes (byte * AESt, byte * src, byte n) ; void copy_n_bytes (byte * AESt, byte * src, byte n) ;
/** Encrypt a single block of 16 bytes . /** Encrypt a single block of 16 bytes .
* @param plain[N_BLOCK] Array of the plaintext. * @param plain Array of the plaintext.
* @param cipher[N_BLOCK] Array of the ciphertext. * @param cipher Array of the ciphertext.
* @note The N_BLOCK is defined in AES_config.h as, * @note The N_BLOCK is defined in AES_config.h as,
* @code #define N_ROW 4 * @code #define N_ROW 4
* #define N_COL 4 * #define N_COL 4
* #define N_BLOCK (N_ROW * N_COL) * #define N_BLOCK (N_ROW * N_COL)
* @endcode * @endcode
* Changed to that will change the Block_size. * Changed to that will change the Block_size.
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte encrypt (byte plain [N_BLOCK], byte cipher [N_BLOCK]) ; byte encrypt (byte plain [N_BLOCK], byte cipher [N_BLOCK]) ;
@@ -98,8 +98,8 @@ class AES
* @param *plain Pointer, points to the plaintex. * @param *plain Pointer, points to the plaintex.
* @param *cipher Pointer, points to the ciphertext that will be created. * @param *cipher Pointer, points to the ciphertext that will be created.
* @param n_block integer, indicated the number of blocks to be ciphered. * @param n_block integer, indicated the number of blocks to be ciphered.
* @param iv[N_BLOCK] byte Array that holds the IV (initialization vector). * @param iv byte Array that holds the IV (initialization vector).
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte cbc_encrypt (byte * plain, byte * cipher, int n_block, byte iv [N_BLOCK]) ; byte cbc_encrypt (byte * plain, byte * cipher, int n_block, byte iv [N_BLOCK]) ;
@@ -109,22 +109,22 @@ class AES
* @param *plain Pointer, points to the plaintex. * @param *plain Pointer, points to the plaintex.
* @param *cipher Pointer, points to the ciphertext that will be created. * @param *cipher Pointer, points to the ciphertext that will be created.
* @param n_block integer, indicated the number of blocks to be ciphered. * @param n_block integer, indicated the number of blocks to be ciphered.
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte cbc_encrypt (byte * plain, byte * cipher, int n_block) ; byte cbc_encrypt (byte * plain, byte * cipher, int n_block) ;
/** Decrypt a single block of 16 bytes /** Decrypt a single block of 16 bytes
* @param cipher[N_BLOCK] Array of the ciphertext. * @param cipher Array of the ciphertext.
* @param plain[N_BLOCK] Array of the plaintext. * @param plain Array of the plaintext.
* @note The N_BLOCK is defined in AES_config.h as, * @note The N_BLOCK is defined in AES_config.h as,
* @code #define N_ROW 4 * @code #define N_ROW 4
* #define N_COL 4 * #define N_COL 4
* #define N_BLOCK (N_ROW * N_COL) * #define N_BLOCK (N_ROW * N_COL)
* @endcode * @endcode
* Changed to that will change the Block_size. * Changed to that will change the Block_size.
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte decrypt (byte cipher [N_BLOCK], byte plain [N_BLOCK]) ; byte decrypt (byte cipher [N_BLOCK], byte plain [N_BLOCK]) ;
@@ -134,8 +134,8 @@ class AES
* @param *cipher Pointer, points to the ciphertext that will be created. * @param *cipher Pointer, points to the ciphertext that will be created.
* @param *plain Pointer, points to the plaintex. * @param *plain Pointer, points to the plaintex.
* @param n_block integer, indicated the number of blocks to be ciphered. * @param n_block integer, indicated the number of blocks to be ciphered.
* @param iv[N_BLOCK] byte Array that holds the IV (initialization vector). * @param iv byte Array that holds the IV (initialization vector).
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte cbc_decrypt (byte * cipher, byte * plain, int n_block, byte iv [N_BLOCK]) ; byte cbc_decrypt (byte * cipher, byte * plain, int n_block, byte iv [N_BLOCK]) ;
@@ -145,7 +145,7 @@ class AES
* @param *cipher Pointer, points to the ciphertext that will be created. * @param *cipher Pointer, points to the ciphertext that will be created.
* @param *plain Pointer, points to the plaintex. * @param *plain Pointer, points to the plaintex.
* @param n_block integer, indicated the number of blocks to be ciphered. * @param n_block integer, indicated the number of blocks to be ciphered.
* @Return 0 if SUCCESS or -1 if FAILURE * @return 0 if SUCCESS or -1 if FAILURE
* *
*/ */
byte cbc_decrypt (byte * cipher, byte * plain, int n_block) ; byte cbc_decrypt (byte * cipher, byte * plain, int n_block) ;
@@ -246,7 +246,7 @@ class AES
* @param *cipher pointer to the ciphertext * @param *cipher pointer to the ciphertext
* @param *key pointer to the key that will be used. * @param *key pointer to the key that will be used.
* @param bits bits of the encryption/decrpytion * @param bits bits of the encryption/decrpytion
* @param ivl[N_BLOCK] the initialization vector IV that will be used for encryption. * @param ivl the initialization vector IV that will be used for encryption.
* @note The key will be stored in class variable. * @note The key will be stored in class variable.
*/ */
void do_aes_encrypt(byte *plain,int size_p,byte *cipher,byte *key, int bits, byte ivl [N_BLOCK]); void do_aes_encrypt(byte *plain,int size_p,byte *cipher,byte *key, int bits, byte ivl [N_BLOCK]);
@@ -269,7 +269,7 @@ class AES
* @param *plain pointer to the plaintext * @param *plain pointer to the plaintext
* @param *key pointer to the key that will be used. * @param *key pointer to the key that will be used.
* @param bits bits of the encryption/decrpytion * @param bits bits of the encryption/decrpytion
* @param ivl[N_BLOCK] the initialization vector IV that will be used for decryption. * @param ivl the initialization vector IV that will be used for decryption.
* @note The key will be stored in class variable. * @note The key will be stored in class variable.
*/ */
void do_aes_decrypt(byte *cipher,int size_c,byte *plain,byte *key, int bits, byte ivl [N_BLOCK]); void do_aes_decrypt(byte *cipher,int size_c,byte *plain,byte *key, int bits, byte ivl [N_BLOCK]);
@@ -312,7 +312,7 @@ class AES
#endif #endif
/** /**
* @example aes.ino * @example aes.pde
* <b>For Arduino</b><br> * <b>For Arduino</b><br>
* <b>Updated: spaniakos 2015 </b><br> * <b>Updated: spaniakos 2015 </b><br>
* *
@@ -330,7 +330,7 @@ class AES
*/ */
/** /**
* @example test_vectors.ino * @example test_vectors.pde
* <b>For Arduino</b><br> * <b>For Arduino</b><br>
* <b>Updated: spaniakos 2015 </b><br> * <b>Updated: spaniakos 2015 </b><br>
* *
@@ -348,7 +348,7 @@ class AES
*/ */
/** /**
* @mainpage AES library for Arduino and Raspberry pi. * @defgroup aeslib AES library for Arduino and Raspberry pi
* *
* @section Goals design Goals * @section Goals design Goals
* *
@@ -384,13 +384,13 @@ class AES
* make<br /><br /> * make<br /><br />
* <b>What to do after changes to a sketch</b><br /><br /> * <b>What to do after changes to a sketch</b><br /><br />
* cd examples_Rpi<br /> * cd examples_Rpi<br />
* make <sketch><br /><br /> * make \<sketch\><br /><br />
* or <br /> * or <br />
* make clean<br /> * make clean<br />
* make<br /><br /><br /> * make<br /><br /><br />
* <b>How to start a sketch</b><br /><br /> * <b>How to start a sketch</b><br /><br />
* cd examples_Rpi<br /> * cd examples_Rpi<br />
* sudo ./<sketch><br /><br /> * sudo ./\<sketch\><br /><br />
* *
* @section News News * @section News News
* *
@@ -30,6 +30,8 @@
#include <avr/io.h> #include <avr/io.h>
#include <util/atomic.h> #include <util/atomic.h>
#include <Arduino.h> #include <Arduino.h>
/** @brief Helper macro for complex inline attributes */
#define ALWAYS_INLINE inline __attribute__((always_inline))
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* @class pin_map_t * @class pin_map_t
@@ -399,8 +401,7 @@ void badPinNumber(void)
/** Check for valid pin number /** Check for valid pin number
* @param[in] pin Number of pin to be checked. * @param[in] pin Number of pin to be checked.
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void badPinCheck(uint8_t pin) {
void badPinCheck(uint8_t pin) {
if (!__builtin_constant_p(pin) || pin >= digitalPinCount) { if (!__builtin_constant_p(pin) || pin >= digitalPinCount) {
badPinNumber(); badPinNumber();
} }
@@ -411,8 +412,7 @@ void badPinCheck(uint8_t pin) {
* @param[in] bit bit number to write * @param[in] bit bit number to write
* @param[in] level value for bit * @param[in] level value for bit
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
uint8_t oldSREG; uint8_t oldSREG;
if (address > (uint8_t*)0X5F) { if (address > (uint8_t*)0X5F) {
oldSREG = SREG; oldSREG = SREG;
@@ -432,8 +432,7 @@ void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
* @param[in] pin Arduino pin number * @param[in] pin Arduino pin number
* @return value read * @return value read
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE bool fastDigitalRead(uint8_t pin) {
bool fastDigitalRead(uint8_t pin) {
badPinCheck(pin); badPinCheck(pin);
return (*pinMap[pin].pin >> pinMap[pin].bit) & 1; return (*pinMap[pin].pin >> pinMap[pin].bit) & 1;
} }
@@ -444,8 +443,7 @@ bool fastDigitalRead(uint8_t pin) {
* If the pin is in output mode toggle the pin level. * If the pin is in output mode toggle the pin level.
* If the pin is in input mode toggle the state of the 20K pullup. * If the pin is in input mode toggle the state of the 20K pullup.
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void fastDigitalToggle(uint8_t pin) {
void fastDigitalToggle(uint8_t pin) {
badPinCheck(pin); badPinCheck(pin);
if (pinMap[pin].pin > (uint8_t*)0X5F) { if (pinMap[pin].pin > (uint8_t*)0X5F) {
// must write bit to high address port // must write bit to high address port
@@ -460,8 +458,7 @@ void fastDigitalToggle(uint8_t pin) {
* @param[in] pin Arduino pin number * @param[in] pin Arduino pin number
* @param[in] level value to write * @param[in] level value to write
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void fastDigitalWrite(uint8_t pin, bool level) {
void fastDigitalWrite(uint8_t pin, bool level) {
badPinCheck(pin); badPinCheck(pin);
fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, level); fastBitWriteSafe(pinMap[pin].port, pinMap[pin].bit, level);
} }
@@ -472,8 +469,7 @@ void fastDigitalWrite(uint8_t pin, bool level) {
* *
* fastPinMode does not enable or disable the 20K pullup for input mode. * fastPinMode does not enable or disable the 20K pullup for input mode.
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void fastPinMode(uint8_t pin, bool mode) {
void fastPinMode(uint8_t pin, bool mode) {
badPinCheck(pin); badPinCheck(pin);
fastBitWriteSafe(pinMap[pin].ddr, pinMap[pin].bit, mode); fastBitWriteSafe(pinMap[pin].ddr, pinMap[pin].bit, mode);
} }
@@ -484,8 +480,7 @@ void fastPinMode(uint8_t pin, bool mode) {
* @param[in] level If mode is output, set level high/low. * @param[in] level If mode is output, set level high/low.
* If mode is input, enable or disable the pin's 20K pullup. * If mode is input, enable or disable the pin's 20K pullup.
*/ */
static inline __attribute__((always_inline)) static ALWAYS_INLINE void fastPinConfig(uint8_t pin, bool mode, bool level) {
void fastPinConfig(uint8_t pin, bool mode, bool level) {
fastPinMode(pin, mode); fastPinMode(pin, mode);
fastDigitalWrite(pin, level); fastDigitalWrite(pin, level);
} }
@@ -540,22 +535,19 @@ class DigitalPin {
* @param[in] level If mode is output, set level high/low. * @param[in] level If mode is output, set level high/low.
* If mode is input, enable or disable the pin's 20K pullup. * If mode is input, enable or disable the pin's 20K pullup.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void config(bool mode, bool level) {
void config(bool mode, bool level) {
fastPinConfig(PinNumber, mode, level); fastPinConfig(PinNumber, mode, level);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* Set pin level high if output mode or enable 20K pullup if input mode. * Set pin level high if output mode or enable 20K pullup if input mode.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void high() {write(true);}
void high() {write(true);}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* Set pin level low if output mode or disable 20K pullup if input mode. * Set pin level low if output mode or disable 20K pullup if input mode.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void low() {write(false);}
void low() {write(false);}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** /**
* Set pin mode * Set pin mode
@@ -563,14 +555,12 @@ class DigitalPin {
* *
* mode() does not enable or disable the 20K pullup for input mode. * mode() does not enable or disable the 20K pullup for input mode.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void mode(bool pinMode) {
void mode(bool pinMode) {
fastPinMode(PinNumber, pinMode); fastPinMode(PinNumber, pinMode);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** @return Pin's level */ /** @return Pin's level */
inline __attribute__((always_inline)) ALWAYS_INLINE bool read() const {
bool read() const {
return fastDigitalRead(PinNumber); return fastDigitalRead(PinNumber);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -579,8 +569,7 @@ class DigitalPin {
* If the pin is in output mode toggle the pin's level. * If the pin is in output mode toggle the pin's level.
* If the pin is in input mode toggle the state of the 20K pullup. * If the pin is in input mode toggle the state of the 20K pullup.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void toggle() {
void toggle() {
fastDigitalToggle(PinNumber); fastDigitalToggle(PinNumber);
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@@ -588,8 +577,7 @@ class DigitalPin {
* @param[in] value If true set the pin's level high else set the * @param[in] value If true set the pin's level high else set the
* pin's level low. * pin's level low.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void write(bool value) {
void write(bool value) {
fastDigitalWrite(PinNumber, value); fastDigitalWrite(PinNumber, value);
} }
}; };
@@ -29,6 +29,8 @@
#define PinIO_h #define PinIO_h
#include <util/atomic.h> #include <util/atomic.h>
#include <avr/io.h> #include <avr/io.h>
/** @brief Helper macro for complex inline attributes */
#define ALWAYS_INLINE inline __attribute__((always_inline))
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* @class PinIO * @class PinIO
@@ -43,16 +45,14 @@ class PinIO {
void config(bool mode, bool data); void config(bool mode, bool data);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** @return Pin's level */ /** @return Pin's level */
inline __attribute__((always_inline)) ALWAYS_INLINE bool read() {return *pinReg_ & bit_;}
bool read() {return *pinReg_ & bit_;}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
/** toggle a pin /** toggle a pin
* *
* If the pin is in output mode toggle the pin's level. * If the pin is in output mode toggle the pin's level.
* If the pin is in input mode toggle the state of the 20K pullup. * If the pin is in input mode toggle the state of the 20K pullup.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void toggle() {*pinReg_ = bit_;}
void toggle() {*pinReg_ = bit_;}
//============================================================================ //============================================================================
/** /**
* Set pin high if output mode or enable 20K pullup if input mode. * Set pin high if output mode or enable 20K pullup if input mode.
@@ -60,16 +60,14 @@ class PinIO {
* This function must be called with interrupts disabled. * This function must be called with interrupts disabled.
* This function will not change the interrupt state. * This function will not change the interrupt state.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void highI() {writeI(1);}
void highI() {writeI(1);}
/** /**
* Set pin low if output mode or disable 20K pullup if input mode. * Set pin low if output mode or disable 20K pullup if input mode.
* *
* This function must be called with interrupts disabled. * This function must be called with interrupts disabled.
* This function will not change the interrupt state. * This function will not change the interrupt state.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void lowI() {writeI(0);}
void lowI() {writeI(0);}
/** /**
* Set pin mode * Set pin mode
* @param[in] mode if true set output mode else input mode. * @param[in] mode if true set output mode else input mode.
@@ -79,8 +77,7 @@ class PinIO {
* This function must be called with interrupts disabled. * This function must be called with interrupts disabled.
* This function will not change the interrupt state. * This function will not change the interrupt state.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void modeI(bool mode) {
void modeI(bool mode) {
volatile uint8_t* ddrReg = pinReg_ + 1; volatile uint8_t* ddrReg = pinReg_ + 1;
*ddrReg = mode ? *ddrReg | bit_ : *ddrReg & mask_; *ddrReg = mode ? *ddrReg | bit_ : *ddrReg & mask_;
} }
@@ -92,8 +89,7 @@ class PinIO {
* This function must be called with interrupts disabled. * This function must be called with interrupts disabled.
* This function will not change the interrupt state. * This function will not change the interrupt state.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void writeI(bool level) {
void writeI(bool level) {
*portReg_ = level ? *portReg_ | bit_ : *portReg_ & mask_; *portReg_ = level ? *portReg_ | bit_ : *portReg_ & mask_;
} }
//============================================================================ //============================================================================
@@ -103,16 +99,14 @@ class PinIO {
* This function will enable interrupts. This function should not be * This function will enable interrupts. This function should not be
* called in an ISR or where interrupts are disabled. * called in an ISR or where interrupts are disabled.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void high() {ATOMIC_BLOCK(ATOMIC_FORCEON) {highI();}}
void high() {ATOMIC_BLOCK(ATOMIC_FORCEON) {highI();}}
/** /**
* Set pin level low if output mode or disable 20K pullup if input mode. * Set pin level low if output mode or disable 20K pullup if input mode.
* *
* This function will enable interrupts. This function should not be * This function will enable interrupts. This function should not be
* called in an ISR or where interrupts are disabled. * called in an ISR or where interrupts are disabled.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void low() {ATOMIC_BLOCK(ATOMIC_FORCEON) {lowI();}}
void low() {ATOMIC_BLOCK(ATOMIC_FORCEON) {lowI();}}
/** /**
* Set pin mode * Set pin mode
* @param[in] pinMode if true set output mode else input mode. * @param[in] pinMode if true set output mode else input mode.
@@ -122,8 +116,7 @@ class PinIO {
* This function will enable interrupts. This function should not be * This function will enable interrupts. This function should not be
* called in an ISR or where interrupts are disabled. * called in an ISR or where interrupts are disabled.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void mode(bool pinMode) {ATOMIC_BLOCK(ATOMIC_FORCEON) {modeI(pinMode);}}
void mode(bool pinMode) {ATOMIC_BLOCK(ATOMIC_FORCEON) {modeI(pinMode);}}
/** Write pin. /** Write pin.
* *
* @param[in] level If output mode set pin high if true else low. * @param[in] level If output mode set pin high if true else low.
@@ -132,8 +125,7 @@ class PinIO {
* This function will enable interrupts. This function should not be * This function will enable interrupts. This function should not be
* called in an ISR or where interrupts are disabled. * called in an ISR or where interrupts are disabled.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void write(bool level) {ATOMIC_BLOCK(ATOMIC_FORCEON) {writeI(level);}}
void write(bool level) {ATOMIC_BLOCK(ATOMIC_FORCEON) {writeI(level);}}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
private: private:
uint8_t bit_; uint8_t bit_;
@@ -60,8 +60,7 @@ class SoftSPI {
/** Soft SPI receive byte. /** Soft SPI receive byte.
* @return Data byte received. * @return Data byte received.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE uint8_t receive() {
uint8_t receive() {
uint8_t data = 0; uint8_t data = 0;
receiveBit(7, &data); receiveBit(7, &data);
receiveBit(6, &data); receiveBit(6, &data);
@@ -77,8 +76,7 @@ class SoftSPI {
/** Soft SPI send byte. /** Soft SPI send byte.
* @param[in] data Data byte to send. * @param[in] data Data byte to send.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE void send(uint8_t data) {
void send(uint8_t data) {
sendBit(7, data); sendBit(7, data);
sendBit(6, data); sendBit(6, data);
sendBit(5, data); sendBit(5, data);
@@ -93,8 +91,7 @@ class SoftSPI {
* @param[in] txData Data byte to send. * @param[in] txData Data byte to send.
* @return Data byte received. * @return Data byte received.
*/ */
inline __attribute__((always_inline)) ALWAYS_INLINE uint8_t transfer(uint8_t txData) {
uint8_t transfer(uint8_t txData) {
uint8_t rxData = 0; uint8_t rxData = 0;
transferBit(7, &rxData, txData); transferBit(7, &rxData, txData);
transferBit(6, &rxData, txData); transferBit(6, &rxData, txData);
@@ -109,12 +106,9 @@ class SoftSPI {
private: private:
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline __attribute__((always_inline)) ALWAYS_INLINE bool MODE_CPHA(uint8_t mode) {return (mode & 1) != 0;}
bool MODE_CPHA(uint8_t mode) {return (mode & 1) != 0;} ALWAYS_INLINE bool MODE_CPOL(uint8_t mode) {return (mode & 2) != 0;}
inline __attribute__((always_inline)) ALWAYS_INLINE void receiveBit(uint8_t bit, uint8_t* data) {
bool MODE_CPOL(uint8_t mode) {return (mode & 2) != 0;}
inline __attribute__((always_inline))
void receiveBit(uint8_t bit, uint8_t* data) {
if (MODE_CPHA(Mode)) { if (MODE_CPHA(Mode)) {
fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); fastDigitalWrite(SckPin, !MODE_CPOL(Mode));
} }
@@ -128,8 +122,7 @@ class SoftSPI {
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline __attribute__((always_inline)) ALWAYS_INLINE void sendBit(uint8_t bit, uint8_t data) {
void sendBit(uint8_t bit, uint8_t data) {
if (MODE_CPHA(Mode)) { if (MODE_CPHA(Mode)) {
fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); fastDigitalWrite(SckPin, !MODE_CPOL(Mode));
} }
@@ -143,8 +136,7 @@ class SoftSPI {
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline __attribute__((always_inline)) ALWAYS_INLINE void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) {
void transferBit(uint8_t bit, uint8_t* rxData, uint8_t txData) {
if (MODE_CPHA(Mode)) { if (MODE_CPHA(Mode)) {
fastDigitalWrite(SckPin, !MODE_CPOL(Mode)); fastDigitalWrite(SckPin, !MODE_CPOL(Mode));
} }
+2 -153
View File
@@ -753,7 +753,7 @@ public:
void disableCRC( void ) ; void disableCRC( void ) ;
/** /**
* Enable error detection by un-commenting #define FAILURE_HANDLING in RF24_config.h * Enable error detection by un-commenting \#define FAILURE_HANDLING in RF24_config.h
* If a failure has been detected, it usually indicates a hardware issue. By default the library * If a failure has been detected, it usually indicates a hardware issue. By default the library
* will cease operation when a failure is detected. * will cease operation when a failure is detected.
* This should allow advanced users to detect and resolve intermittent hardware issues. * This should allow advanced users to detect and resolve intermittent hardware issues.
@@ -999,158 +999,7 @@ private:
}; };
/** /**
* @example GettingStarted.ino * @defgroup rf24 Optimized High Speed Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
* <b>Updated: TMRh20 2014 </b><br>
*
* This is an example of how to use the RF24 class to communicate on a basic level. Write this sketch to two
* different nodes. Put one of the nodes into 'transmit' mode by connecting with the serial monitor and <br>
* sending a 'T'. The ping node sends the current time to the pong node, which responds by sending the value
* back. The ping node can then see how long the whole cycle took. <br>
* @note For a more efficient call-response scenario see the GettingStarted_CallResponse.ino example.
* @note When switching between sketches, the radio may need to be powered down to clear settings that are not "un-set" otherwise
*/
/**
* @example GettingStarted_CallResponse.ino
* <b>New: TMRh20 2014</b><br>
*
* 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. <br>
* 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 <br>
* primary transmitter if wanting to initiate communication instead of respond to a commmunication.
*/
/**
* @example Transfer.ino
* <b>New: TMRh20 </b><br>
* This example demonstrates half-rate transfer using the FIFO buffers<br>
*
* It is an example of how to use the RF24 class. Write this sketch to two
* different nodes. Put one of the nodes into 'transmit' mode by connecting <br>
* with the serial monitor and sending a 'T'. The data transfer will begin,
* with the receiver displaying the payload count. (32Byte Payloads) <br>
*/
/**
* @example TransferTimeouts.ino
* <b>New: TMRh20 </b><br>
* This example demonstrates the use of and extended timeout period and
* auto-retries/auto-reUse to increase reliability in noisy or low signal scenarios. <br>
*
* Write this sketch to two different nodes. Put one of the nodes into 'transmit'
* mode by connecting with the serial monitor and sending a 'T'. The data <br>
* transfer will begin, with the receiver displaying the payload count and the
* data transfer rate.
*/
/**
* @example starping.pde
*
* This sketch is a more complex example of using the RF24 library for Arduino.
* Deploy this on up to six nodes. Set one as the 'pong receiver' by tying the
* role_pin low, and the others will be 'ping transmit' units. The ping units
* unit will send out the value of millis() once a second. The pong unit will
* respond back with a copy of the value. Each ping unit can get that response
* back, and determine how long the whole cycle took.
*
* This example requires a bit more complexity to determine which unit is which.
* The pong receiver is identified by having its role_pin tied to ground.
* The ping senders are further differentiated by a byte in eeprom.
*/
/**
* @example pingpair_ack.ino
* <b>Update: TMRh20</b><br>
* 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.<br>
* 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 if wanting<br>
* to initiate communication instead of respond to a commmunication.
*/
/**
* @example pingpair_irq.ino
* <b>Update: TMRh20</b><br>
* This is an example of how to user interrupts to interact with the radio, and a demonstration
* of how to use them to sleep when receiving, and not miss any payloads.<br>
* The pingpair_sleepy example expands on sleep functionality with a timed sleep option for the transmitter.
* Sleep functionality is built directly into my fork of the RF24Network library<br>
*/
/**
* @example pingpair_sleepy.ino
* <b>Update: TMRh20</b><br>
* This is an example of how to use the RF24 class to create a battery-
* efficient system. It is just like the GettingStarted_CallResponse example, but the<br>
* ping node powers down the radio and sleeps the MCU after every
* ping/pong cycle, and the receiver sleeps between payloads. <br>
*/
/**
* @example rf24ping85.ino
* <b>New: Contributed by https://github.com/tong67</b><br>
* This is an example of how to use the RF24 class to communicate with ATtiny85 and other node. <br>
*/
/**
* @example timingSearch3pin.ino
* <b>New: Contributed by https://github.com/tong67</b><br>
* This is an example of how to determine the correct timing for ATtiny when using only 3-pins
*/
/**
* @example pingpair_dyn.ino
*
* This is an example of how to use payloads of a varying (dynamic) size.
*/
/**
* @example pingpair_maple.pde
*
* This is an example of how to use the RF24 class on the Maple. For a more
* detailed explanation, see my blog post:
* <a href="http://maniacbug.wordpress.com/2011/12/14/nrf24l01-running-on-maple-3/">nRF24L01+ Running on Maple</a>
*
* It will communicate well to an Arduino-based unit as well, so it's not for only Maple-to-Maple communication.
*
* Write this sketch to two different nodes,
* connect the role_pin to ground on one. The ping node sends the current time to the pong node,
* which responds by sending the value back. The ping node can then see how long the whole cycle
* took.
*/
/**
* @example nordic_fob.pde
*
* This is an example of how to use the RF24 class to receive signals from the
* Sparkfun Nordic FOB. See http://www.sparkfun.com/products/8602 .
* Thanks to Kirk Mower for providing test hardware.
*/
/**
* @example led_remote.pde
*
* This is an example of how to use the RF24 class to control a remote
* bank of LED's using buttons on a remote control.
*
* Every time the buttons change on the remote, the entire state of
* buttons is send to the led board, which displays the state.
*/
/**
* @example scanner.ino
*
* Example to detect interference on the various channels available.
* This is a good diagnostic tool to check whether you're picking a
* good channel for your application.
*
* Inspired by cpixip.
* See http://arduino.cc/forum/index.php/topic,54795.0.html
*/
/**
* @mainpage Optimized High Speed Driver for nRF24L01(+) 2.4GHz Wireless Transceiver
* *
* @section Goals Design Goals * @section Goals Design Goals
* *
@@ -1,4 +1,4 @@
/** /*
* The MySensors Arduino library handles the wireless radio link and protocol * The MySensors Arduino library handles the wireless radio link and protocol
* between your home built sensors/actuators and HA controller of choice. * between your home built sensors/actuators and HA controller of choice.
* The sensors forms a self healing radio network with optional repeaters. Each * The sensors forms a self healing radio network with optional repeaters. Each
@@ -35,8 +35,8 @@
* - response time is less than 30 s * - response time is less than 30 s
* - 3 minute warm up time * - 3 minute warm up time
* datasheet: http://www.futurlec.com/Datasheet/Sensor/MH-Z14.pdf * datasheet: http://www.futurlec.com/Datasheet/Sensor/MH-Z14.pdf
* Contributor: epierre * Contributor: epierre
**/ */
// Enable debug prints to serial monitor // Enable debug prints to serial monitor
#define MY_DEBUG #define MY_DEBUG