diff --git a/Doxyfile b/Doxyfile index a77c991ec..189342224 100644 --- a/Doxyfile +++ b/Doxyfile @@ -438,7 +438,7 @@ EXTRACT_PACKAGE = NO # included in the documentation. # The default value is: NO. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined # locally in source files will be included in the documentation. If set to NO, @@ -770,7 +770,7 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = ./ \ - ./arch/BBB + ./arch/Template # 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 @@ -831,13 +831,14 @@ FILE_PATTERNS = *.c \ *.ucf \ *.qsf \ *.as \ - *.js + *.js \ + Makefile # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. # The default value is: NO. -RECURSIVE = YES +RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a @@ -864,7 +865,8 @@ EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = bcm2835* \ readme* \ - runtest* + runtest* \ + tests* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the diff --git a/RF24.h b/RF24.h index 0f01e2060..af24e8403 100644 --- a/RF24.h +++ b/RF24.h @@ -1810,14 +1810,14 @@ s * * |--------------------|------------------------------------------------------------------------------| * | RF24_arch_config.h | Basic Arduino/AVR compatibility, includes for remaining support files, etc | * | includes.h | Linux only. Defines specific platform, include correct RF24_arch_config file | - * | spi.h | Provides standardized SPI ( spi.transfer() ) methods | + * | spi.h | Provides standardized SPI ( transfer() ) methods | * | gpio.h | Provides standardized GPIO ( digitalWrite() ) methods | * | compatibility.h | Provides standardized timing (millis(), delay()) methods | * | your_custom_file.h | Provides access to custom drivers for spi,gpio, etc | * *
* Examples are provided via the included hardware support templates in **RF24/arch**
- * See **RF24/arch/BBB** for a general Linux template. + * See the modules page for examples of class declarations * *
* @section Device_Detection Device Detection diff --git a/arch/Template/RF24_arch_config.h b/arch/Template/RF24_arch_config.h new file mode 100644 index 000000000..f63420118 --- /dev/null +++ b/arch/Template/RF24_arch_config.h @@ -0,0 +1,84 @@ + +/* + Copyright (C) 2011 J. Coliz + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + version 2 as published by the Free Software Foundation. + + */ + + /** + * @file RF24_arch_config.h + * General defines and includes for RF24/Linux + */ + + /** + * Example of RF24_arch_config.h for RF24 portability + * + * @defgroup Porting_General Porting: General + * + * + * @{ + */ + + +#ifndef __ARCH_CONFIG_H__ +#define __ARCH_CONFIG_H__ + +#define RF24_LINUX + +#include +#include "spi.h" +#include "gpio.h" +#include "compatibility.h" +#include +#include +#include +#include +#include + +#define _BV(x) (1<<(x)) +#define _SPI spi + +#undef SERIAL_DEBUG +#ifdef SERIAL_DEBUG +#define IF_SERIAL_DEBUG(x) ({x;}) +#else +#define IF_SERIAL_DEBUG(x) +#endif + +// Avoid spurious warnings +#if 1 +#if ! defined( NATIVE ) && defined( ARDUINO ) +#undef PROGMEM +#define PROGMEM __attribute__(( section(".progmem.data") )) +#undef PSTR +#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) +#endif +#endif + +typedef uint16_t prog_uint16_t; +#define PSTR(x) (x) +#define printf_P printf +#define strlen_P strlen +#define PROGMEM +#define pgm_read_word(p) (*(p)) +#define PRIPSTR "%s" +#define pgm_read_byte(p) (*(p)) + +// Function, constant map as a result of migrating from Arduino +#define LOW GPIO::OUTPUT_LOW +#define HIGH GPIO::OUTPUT_HIGH +#define INPUT GPIO::DIRECTION_IN +#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 delayMicroseconds(usec) __usleep(usec) +#define millis() __millis() + +#endif // __ARCH_CONFIG_H__ + + +/*@}*/ diff --git a/arch/Template/compatibility.h b/arch/Template/compatibility.h new file mode 100644 index 000000000..34b6a2af2 --- /dev/null +++ b/arch/Template/compatibility.h @@ -0,0 +1,44 @@ +/* + * File: compatiblity.h + * Author: purinda + * + * Created on 24 June 2012, 3:08 PM + */ + + /** + * @file compatibility.h + * Class declaration for SPI helper files + */ + + /** + * Example of compatibility.h class declaration for timing functions portability + * + * @defgroup Porting_Timing Porting: Timing + * + * + * @{ + */ + +#ifndef COMPATIBLITY_H +#define COMPATIBLITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +void __msleep(int milisec); +void __usleep(int milisec); +void __start_timer(); +long __millis(); + +#ifdef __cplusplus +} +#endif + +#endif /* COMPATIBLITY_H */ + +/*@}*/ \ No newline at end of file diff --git a/arch/Template/gpio.h b/arch/Template/gpio.h new file mode 100644 index 000000000..9b39b68a5 --- /dev/null +++ b/arch/Template/gpio.h @@ -0,0 +1,59 @@ + + +/** + * @file gpio.h + * Class declaration for SPI helper files + */ + + /** + * Example of gpio.h class declaration for GPIO portability + * + * @defgroup Porting_GPIO Porting: GPIO + * + * + * @{ + */ +#ifndef H +#define H + +#include + +//class GPIO { +public: + /* Constants */ + static const int DIRECTION_OUT = 1; + static const int DIRECTION_IN = 0; + + static const int OUTPUT_HIGH = 1; + static const int OUTPUT_LOW = 0; + + GPIO(); + + /** + * Similar to Arduino pinMode(pin,mode); + * @param port + * @param DDR + */ + static void open(int port, int DDR); + /** + * + * @param port + */ + static void close(int port); + /** + * Similar to Arduino digitalRead(pin); + * @param port + * @param value + */ + static int read(int port); + /** + * Similar to Arduino digitalWrite(pin,state); + * @param port + * @param value + */ + static void write(int port,int value); + + virtual ~GPIO(); +}; + +/*@}*/ \ No newline at end of file diff --git a/arch/Template/includes.h b/arch/Template/includes.h new file mode 100644 index 000000000..262cea00a --- /dev/null +++ b/arch/Template/includes.h @@ -0,0 +1,31 @@ + + /** + * @file includes.h + * Configuration defines for RF24/Linux + */ + + /** + * Example of includes.h for RF24 Linux portability + * + * @defgroup Porting_Includes Porting: Includes + * + * + * @{ + */ + +#ifndef __RF24_INCLUDES_H__ +#define __RF24_INCLUDES_H__ + + /** + * Define a specific platform for this configuration + */ + #define RF24_BBB + + /** + * Load the correct configuration for this platform + */ + #include "BBB/RF24_arch_config.h" + +#endif + +/*@}*/ \ No newline at end of file diff --git a/arch/Template/spi.h b/arch/Template/spi.h new file mode 100644 index 000000000..00d5744eb --- /dev/null +++ b/arch/Template/spi.h @@ -0,0 +1,81 @@ + +/** + * @file spi.h + * Class declaration for SPI helper files + */ + + /** + * Example of spi.h class declaration for SPI portability + * + * @defgroup Porting_SPI Porting: SPI + * + * + * @{ + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +//class SPI { +public: + +/** + * SPI constructor + */ + SPI(); + + /** + * Start SPI + */ + void begin(int busNo); + + /** + * Transfer a single byte + * @param tx_ Byte to send + * @return Data returned via spi + */ + uint8_t transfer(uint8_t tx_); + + /** + * Transfer a buffer of data + * @param tbuf Transmit buffer + * @param rbuf Receive buffer + * @param len Length of the data + */ + void transfernb(char* tbuf, char* rbuf, uint32_t len); + + /** + * Transfer a buffer of data without an rx buffer + * @param buf Pointer to a buffer of data + * @param len Length of the data + */ + void transfern(char* buf, uint32_t len); + + virtual ~SPI(); + +private: + + /** Default SPI device */ + string device; + /** SPI Mode set */ + uint8_t mode; + /** word size*/ + uint8_t bits; + /** Set SPI speed*/ + uint32_t speed; + int fd; + + void init(); +}; + + +/*@}*/ \ No newline at end of file