Skip to content

Commit

Permalink
Update docs in 'updates' branch
Browse files Browse the repository at this point in the history
- Add Template folder with example class declarations etc
- Add template info to modules section in doxygen
- Update related links etc for doxygen in RF24.h
  • Loading branch information
TMRh20 committed Feb 28, 2015
1 parent c1bb29c commit b320f9e
Show file tree
Hide file tree
Showing 7 changed files with 308 additions and 7 deletions.
12 changes: 7 additions & 5 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions RF24.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
*
* <br>
* Examples are provided via the included hardware support templates in **RF24/arch** <br>
* See **RF24/arch/BBB** for a general Linux template.
* See the <a href="modules.html">modules</a> page for examples of class declarations
*
*<br>
* @section Device_Detection Device Detection
Expand Down
84 changes: 84 additions & 0 deletions arch/Template/RF24_arch_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@

/*
Copyright (C) 2011 J. Coliz <[email protected]>
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 <stddef.h>
#include "spi.h"
#include "gpio.h"
#include "compatibility.h"
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <sys/time.h>

#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__


/*@}*/
44 changes: 44 additions & 0 deletions arch/Template/compatibility.h
Original file line number Diff line number Diff line change
@@ -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 <stddef.h>
#include <time.h>
#include <sys/time.h>

void __msleep(int milisec);
void __usleep(int milisec);
void __start_timer();
long __millis();

#ifdef __cplusplus
}
#endif

#endif /* COMPATIBLITY_H */

/*@}*/
59 changes: 59 additions & 0 deletions arch/Template/gpio.h
Original file line number Diff line number Diff line change
@@ -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 <cstdio>

//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();
};

/*@}*/
31 changes: 31 additions & 0 deletions arch/Template/includes.h
Original file line number Diff line number Diff line change
@@ -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

/*@}*/
81 changes: 81 additions & 0 deletions arch/Template/spi.h
Original file line number Diff line number Diff line change
@@ -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 <string>
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>

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();
};


/*@}*/

0 comments on commit b320f9e

Please sign in to comment.