Cleaned up Doxygen warnings in library drivers

This commit is contained in:
Patrick Fallberg
2016-01-19 23:56:27 +01:00
parent 877cac266f
commit 0f55969ace
9 changed files with 191 additions and 175 deletions
@@ -39,34 +39,35 @@
#define ALTSS_BASE_FREQ F_CPU
#endif
/** AltSoftSerial class */
class AltSoftSerial : public Stream
{
public:
AltSoftSerial() { }
~AltSoftSerial() { end(); }
static void begin(uint32_t baud) { init((ALTSS_BASE_FREQ + baud / 2) / baud); }
static void end();
int peek();
int read();
int available();
AltSoftSerial() { } //!< Constructor
~AltSoftSerial() { end(); } //!< Destructor
static void begin(uint32_t baud) { init((ALTSS_BASE_FREQ + baud / 2) / baud); } //!< begin
static void end(); //!< end
int peek(); //!< peek
int read(); //!< read
int available(); //!< available
#if ARDUINO >= 100
size_t write(uint8_t byte) { writeByte(byte); return 1; }
void flush() { flushOutput(); }
size_t write(uint8_t byte) { writeByte(byte); return 1; } //!< write
void flush() { flushOutput(); } //!< flush
#else
void write(uint8_t byte) { writeByte(byte); }
void flush() { flushInput(); }
void write(uint8_t byte) { writeByte(byte); } //!< write
void flush() { flushInput(); } //!< flush
#endif
using Print::write;
static void flushInput();
static void flushOutput();
static void flushInput(); //!< flushInput
static void flushOutput(); //!< flushOutput
// for drop-in compatibility with NewSoftSerial, rxPin & txPin ignored
//AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }
bool listen() { return false; }
bool isListening() { return true; }
bool overflow() { bool r = timing_error; timing_error = false; return r; }
static int library_version() { return 1; }
static void enable_timer0(bool) { }
static bool timing_error;
bool listen() { return false; } //!< listen
bool isListening() { return true; } //!< isListening
bool overflow() { bool r = timing_error; timing_error = false; return r; } //!< overflow
static int library_version() { return 1; } //!< library_version
static void enable_timer0(bool) { } //!< enable_timer0
static bool timing_error; //!< timing_error
private:
static void init(uint32_t cycles_per_bit);
static void writeByte(uint8_t byte);
+51 -50
View File
@@ -72,19 +72,20 @@
#define RF69_BROADCAST_ADDR 255
#define RF69_CSMA_LIMIT_MS 1000
/** RFM69 class */
class RFM69 {
public:
static volatile byte DATA[RF69_MAX_DATA_LEN]; // recv/xmit buf, including hdr & crc bytes
static volatile byte DATALEN;
static volatile byte SENDERID;
static volatile byte TARGETID; //should match _address
static volatile byte PAYLOADLEN;
static volatile byte ACK_REQUESTED;
static volatile byte ACK_RECEIVED; /// Should be polled immediately after sending a packet with ACK request
static volatile int RSSI; //most accurate RSSI during reception (closest to the reception)
static volatile byte _mode; //should be protected?
static volatile byte DATA[RF69_MAX_DATA_LEN]; //!< recv/xmit buf, including hdr & crc bytes
static volatile byte DATALEN; //!< DATALEN
static volatile byte SENDERID; //!< SENDERID
static volatile byte TARGETID; //!< should match _address
static volatile byte PAYLOADLEN; //!< PAYLOADLEN
static volatile byte ACK_REQUESTED; //!< ACK_REQUESTED
static volatile byte ACK_RECEIVED; //!< Should be polled immediately after sending a packet with ACK request
static volatile int RSSI; //!< most accurate RSSI during reception (closest to the reception)
static volatile byte _mode; //!< should be protected?
RFM69(byte slaveSelectPin=RF69_SPI_CS, byte interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, byte interruptNum=RF69_IRQ_NUM) {
RFM69(byte slaveSelectPin=RF69_SPI_CS, byte interruptPin=RF69_IRQ_PIN, bool isRFM69HW=false, byte interruptNum=RF69_IRQ_NUM) { //!< Constructor
_slaveSelectPin = slaveSelectPin;
_interruptPin = interruptPin;
_interruptNum = interruptNum;
@@ -94,52 +95,52 @@ class RFM69 {
_isRFM69HW = isRFM69HW;
}
bool initialize(byte freqBand, byte ID, byte networkID=1);
void setAddress(byte addr);
bool canSend();
void send(byte toAddress, const void* buffer, byte bufferSize, bool requestACK=false);
bool sendWithRetry(byte toAddress, const void* buffer, byte bufferSize, byte retries=2, byte retryWaitTime=40); //40ms roundtrip req for 61byte packets
bool receiveDone();
bool ACKReceived(byte fromNodeID);
bool ACKRequested();
void sendACK(const void* buffer = "", uint8_t bufferSize=0);
void setFrequency(uint32_t FRF);
void encrypt(const char* key);
void setCS(byte newSPISlaveSelect);
int readRSSI(bool forceTrigger=false);
void promiscuous(bool onOff=true);
void setHighPower(bool onOFF=true); //have to call it after initialize for RFM69HW
void setPowerLevel(byte level); //reduce/increase transmit power level
void sleep();
byte readTemperature(byte calFactor=0); //get CMOS temperature (8bit)
void rcCalibration(); //calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy]
bool initialize(byte freqBand, byte ID, byte networkID=1); //!< initialize
void setAddress(byte addr); //!< setAddress
bool canSend(); //!< canSend
void send(byte toAddress, const void* buffer, byte bufferSize, bool requestACK=false); //!< send
bool sendWithRetry(byte toAddress, const void* buffer, byte bufferSize, byte retries=2, byte retryWaitTime=40); //!< sendWithRetry (40ms roundtrip req for 61byte packets)
bool receiveDone(); //!< receiveDone
bool ACKReceived(byte fromNodeID); //!< ACKReceived
bool ACKRequested(); //!< ACKRequested
void sendACK(const void* buffer = "", uint8_t bufferSize=0); //!< sendACK
void setFrequency(uint32_t FRF); //!< setFrequency
void encrypt(const char* key); //!< encrypt
void setCS(byte newSPISlaveSelect); //!< setCS
int readRSSI(bool forceTrigger=false); //!< readRSSI
void promiscuous(bool onOff=true); //!< promiscuous
void setHighPower(bool onOFF=true); //!< setHighPower (have to call it after initialize for RFM69HW)
void setPowerLevel(byte level); //!< setPowerLevel (reduce/increase transmit power level)
void sleep(); //!< sleep
byte readTemperature(byte calFactor=0); //!< readTemperature (get CMOS temperature (8bit))
void rcCalibration(); //!< rcCalibration (calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy])
// allow hacking registers by making these public
byte readReg(byte addr);
void writeReg(byte addr, byte val);
void readAllRegs();
byte readReg(byte addr); //!< readReg
void writeReg(byte addr, byte val); //!< writeReg
void readAllRegs(); //!< readAllRegs
protected:
static void isr0();
void virtual interruptHandler();
void sendFrame(byte toAddress, const void* buffer, byte size, bool requestACK=false, bool sendACK=false);
static void isr0(); //!< isr0
void virtual interruptHandler(); //!< interruptHandler
void sendFrame(byte toAddress, const void* buffer, byte size, bool requestACK=false, bool sendACK=false); //!< sendFrame
static RFM69* selfPointer;
byte _slaveSelectPin;
byte _interruptPin;
byte _interruptNum;
byte _address;
bool _promiscuousMode;
byte _powerLevel;
bool _isRFM69HW;
byte _SPCR;
byte _SPSR;
static RFM69* selfPointer; //!< selfPointer
byte _slaveSelectPin; //!< _slaveSelectPin
byte _interruptPin; //!< _interruptPin
byte _interruptNum; //!< _interruptNum
byte _address; //!< _address
bool _promiscuousMode; //!< _promiscuousMode
byte _powerLevel; //!< _powerLevel
bool _isRFM69HW; //!< _isRFM69HW
byte _SPCR; //!< _SPCR
byte _SPSR; //!< _SPSR
void receiveBegin();
void setMode(byte mode);
void setHighPowerRegs(bool onOff);
void select();
void unselect();
void receiveBegin(); //!< receiveBegin
void setMode(byte mode); //!< setMode
void setHighPowerRegs(bool onOff); //!< setHighPowerRegs
void select(); //!< select
void unselect(); //!< unselect
};
#endif
+25 -24
View File
@@ -87,34 +87,35 @@
// Example for Winbond 4Mbit W25X40CL: 0xEF30 (page 14: http://www.winbond.com/NR/rdonlyres/6E25084C-0BFE-4B25-903D-AE10221A0929/0/W25X40CL.pdf)
#define SPIFLASH_MACREAD 0x4B // read unique ID number (MAC)
/** SPIFlash class */
class SPIFlash {
public:
static uint8_t UNIQUEID[8];
SPIFlash(uint8_t slaveSelectPin, uint16_t jedecID=0);
boolean initialize();
void command(uint8_t cmd, boolean isWrite=false);
uint8_t readStatus();
uint8_t readByte(uint32_t addr);
void readBytes(uint32_t addr, void* buf, uint16_t len);
void writeByte(uint32_t addr, uint8_t byt);
void writeBytes(uint32_t addr, const void* buf, uint16_t len);
boolean busy();
void chipErase();
void blockErase4K(uint32_t address);
void blockErase32K(uint32_t address);
uint16_t readDeviceId();
uint8_t* readUniqueId();
static uint8_t UNIQUEID[8]; //!< Storage for unique identifier
SPIFlash(uint8_t slaveSelectPin, uint16_t jedecID=0); //!< Constructor
boolean initialize(); //!< setup SPI, read device ID etc...
void command(uint8_t cmd, boolean isWrite=false); //!< Send a command to the flash chip, pass TRUE for isWrite when its a write command
uint8_t readStatus(); //!< return the STATUS register
uint8_t readByte(uint32_t addr); //!< read 1 byte from flash memory
void readBytes(uint32_t addr, void* buf, uint16_t len); //!< read unlimited # of bytes
void writeByte(uint32_t addr, uint8_t byt); //!< Write 1 byte to flash memory
void writeBytes(uint32_t addr, const void* buf, uint16_t len); //!< write multiple bytes to flash memory (up to 64K)
boolean busy(); //!< check if the chip is busy erasing/writing
void chipErase(); //!< erase entire flash memory array
void blockErase4K(uint32_t address); //!< erase a 4Kbyte block
void blockErase32K(uint32_t address); //!< erase a 32Kbyte block
uint16_t readDeviceId(); //!< Get the manufacturer and device ID bytes (as a short word)
uint8_t* readUniqueId(); //!< Get the 64 bit unique identifier, stores it in @ref UNIQUEID[8]
void sleep();
void wakeup();
void end();
void sleep(); //!< Put device to sleep
void wakeup(); //!< Wake device
void end(); //!< end
protected:
void select();
void unselect();
uint8_t _slaveSelectPin;
uint16_t _jedecID;
uint8_t _SPCR;
uint8_t _SPSR;
void select(); //!< select
void unselect(); //!< unselect
uint8_t _slaveSelectPin; //!< Slave select pin
uint16_t _jedecID; //!< JEDEC ID
uint8_t _SPCR; //!< SPCR
uint8_t _SPSR; //!< SPSR
#ifdef SPI_HAS_TRANSACTION
SPISettings _settings;
#endif
@@ -64,6 +64,7 @@
#define MQTT_CALLBACK_SIGNATURE void (*callback)(char*,uint8_t*,unsigned int)
/** PubSubClient class */
class PubSubClient {
private:
Client* _client;
@@ -83,44 +84,44 @@ private:
Stream* stream;
int _state;
public:
PubSubClient();
PubSubClient(Client& client);
PubSubClient(IPAddress, uint16_t, Client& client);
PubSubClient(IPAddress, uint16_t, Client& client, Stream&);
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
PubSubClient(uint8_t *, uint16_t, Client& client);
PubSubClient(uint8_t *, uint16_t, Client& client, Stream&);
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
PubSubClient(const char*, uint16_t, Client& client);
PubSubClient(const char*, uint16_t, Client& client, Stream&);
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client);
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&);
PubSubClient(); //!< PubSubClient
PubSubClient(Client& client); //!< PubSubClient
PubSubClient(IPAddress, uint16_t, Client& client); //!< PubSubClient
PubSubClient(IPAddress, uint16_t, Client& client, Stream&); //!< PubSubClient
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); //!< PubSubClient
PubSubClient(IPAddress, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); //!< PubSubClient
PubSubClient(uint8_t *, uint16_t, Client& client); //!< PubSubClient
PubSubClient(uint8_t *, uint16_t, Client& client, Stream&); //!< PubSubClient
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); //!< PubSubClient
PubSubClient(uint8_t *, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); //!< PubSubClient
PubSubClient(const char*, uint16_t, Client& client); //!< PubSubClient
PubSubClient(const char*, uint16_t, Client& client, Stream&); //!< PubSubClient
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client); //!< PubSubClient
PubSubClient(const char*, uint16_t, MQTT_CALLBACK_SIGNATURE,Client& client, Stream&); //!< PubSubClient
PubSubClient& setServer(IPAddress ip, uint16_t port);
PubSubClient& setServer(uint8_t * ip, uint16_t port);
PubSubClient& setServer(const char * domain, uint16_t port);
PubSubClient& setCallback(MQTT_CALLBACK_SIGNATURE);
PubSubClient& setClient(Client& client);
PubSubClient& setStream(Stream& stream);
PubSubClient& setServer(IPAddress ip, uint16_t port); //!< setServer
PubSubClient& setServer(uint8_t * ip, uint16_t port); //!< setServer
PubSubClient& setServer(const char * domain, uint16_t port); //!< setServer
PubSubClient& setCallback(MQTT_CALLBACK_SIGNATURE); //!< setCallback
PubSubClient& setClient(Client& client); //!< setClient
PubSubClient& setStream(Stream& stream); //!< setStream
boolean connect(const char* id);
boolean connect(const char* id, const char* user, const char* pass);
boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage);
void disconnect();
boolean publish(const char* topic, const char* payload);
boolean publish(const char* topic, const char* payload, boolean retained);
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
boolean publish_P(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
boolean subscribe(const char* topic);
boolean subscribe(const char* topic, uint8_t qos);
boolean unsubscribe(const char* topic);
boolean loop();
boolean connected();
int state();
boolean connect(const char* id); //!< connect
boolean connect(const char* id, const char* user, const char* pass); //!< connect
boolean connect(const char* id, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); //!< connect
boolean connect(const char* id, const char* user, const char* pass, const char* willTopic, uint8_t willQos, boolean willRetain, const char* willMessage); //!< connect
void disconnect(); //!< disconnect
boolean publish(const char* topic, const char* payload); //!< publish
boolean publish(const char* topic, const char* payload, boolean retained); //!< publish
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength); //!< publish
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained); //!< publish
boolean publish_P(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained); //!< publish_P
boolean subscribe(const char* topic); //!< subscribe
boolean subscribe(const char* topic, uint8_t qos); //!< subscribe
boolean unsubscribe(const char* topic); //!< unsubscribe
boolean loop(); //!< loop
boolean connected(); //!< connected
int state(); //!< state
};
@@ -3,6 +3,7 @@
#include "Arduino.h"
/** Buffer class */
class Buffer {
private:
uint8_t buffer[1024];
@@ -10,14 +11,14 @@ private:
uint16_t length;
public:
Buffer();
Buffer(uint8_t* buf, size_t size);
Buffer(); //!< Buffer
Buffer(uint8_t* buf, size_t size); //!< Buffer
virtual bool available();
virtual uint8_t next();
virtual void reset();
virtual bool available(); //!< available
virtual uint8_t next(); //!< next
virtual void reset(); //!< reset
virtual void add(uint8_t* buf, size_t size);
virtual void add(uint8_t* buf, size_t size); //!< add
};
#endif
@@ -2,20 +2,21 @@
#define client_h
#include "IPAddress.h"
/** Client class */
class Client {
public:
virtual int connect(IPAddress ip, uint16_t port) =0;
virtual int connect(const char *host, uint16_t port) =0;
virtual size_t write(uint8_t) =0;
virtual size_t write(const uint8_t *buf, size_t size) =0;
virtual int available() = 0;
virtual int read() = 0;
virtual int read(uint8_t *buf, size_t size) = 0;
virtual int peek() = 0;
virtual void flush() = 0;
virtual void stop() = 0;
virtual uint8_t connected() = 0;
virtual operator bool() = 0;
virtual int connect(IPAddress ip, uint16_t port) =0; //!< connect
virtual int connect(const char *host, uint16_t port) =0; //!< connect
virtual size_t write(uint8_t) =0; //!< write
virtual size_t write(const uint8_t *buf, size_t size) =0; //!< write
virtual int available() = 0; //!< available
virtual int read() = 0; //!< read
virtual int read(uint8_t *buf, size_t size) = 0; //!< read
virtual int peek() = 0; //!< peek
virtual void flush() = 0; //!< flush
virtual void stop() = 0; //!< stop
virtual uint8_t connected() = 0; //!< connected
virtual operator bool() = 0; //!< bool operator
};
#endif
@@ -29,6 +29,7 @@
// A class to make it easier to handle and pass around IP addresses
/** IPAddress class */
class IPAddress {
private:
uint8_t _address[4]; // IPv4 address
@@ -40,23 +41,30 @@ private:
public:
// Constructors
IPAddress();
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet);
IPAddress(uint32_t address);
IPAddress(const uint8_t *address);
IPAddress(); //!< IPAddress
IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); //!< IPAddress
IPAddress(uint32_t address); //!< IPAddress
IPAddress(const uint8_t *address); //!< IPAddress
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
// to a four-byte uint8_t array is expected
/** @brief operator overload */
operator uint32_t() { return *((uint32_t*)_address); };
/** @brief operator overload */
bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); };
/** @brief operator overload */
bool operator==(const uint8_t* addr);
// Overloaded index operator to allow getting and setting individual octets of the address
/** @brief operator overload */
uint8_t operator[](int index) const { return _address[index]; };
/** @brief operator overload */
uint8_t& operator[](int index) { return _address[index]; };
// Overloaded copy operators to allow initialisation of IPAddress objects from other types
/** @brief operator overload */
IPAddress& operator=(const uint8_t *address);
/** @brief operator overload */
IPAddress& operator=(uint32_t address);
@@ -7,6 +7,7 @@
#include "Buffer.h"
/** ShimClient class */
class ShimClient : public Client {
private:
Buffer* responseBuffer;
@@ -22,30 +23,30 @@ private:
public:
ShimClient();
virtual int connect(IPAddress ip, uint16_t port);
virtual int connect(const char *host, uint16_t port);
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t *buf, size_t size);
virtual int available();
virtual int read();
virtual int read(uint8_t *buf, size_t size);
virtual int peek();
virtual void flush();
virtual void stop();
virtual uint8_t connected();
virtual operator bool();
virtual int connect(IPAddress ip, uint16_t port); //!< connect
virtual int connect(const char *host, uint16_t port); //!< connect
virtual size_t write(uint8_t); //!< write
virtual size_t write(const uint8_t *buf, size_t size); //!< write
virtual int available(); //!< available
virtual int read(); //!< read
virtual int read(uint8_t *buf, size_t size); //!< read
virtual int peek(); //!< peek
virtual void flush(); //!< flush
virtual void stop(); //!< stop
virtual uint8_t connected(); //!< connected
virtual operator bool(); //!< bool operator
virtual ShimClient* respond(uint8_t *buf, size_t size);
virtual ShimClient* expect(uint8_t *buf, size_t size);
virtual ShimClient* respond(uint8_t *buf, size_t size); //!< respond
virtual ShimClient* expect(uint8_t *buf, size_t size); //!< expect
virtual void expectConnect(IPAddress ip, uint16_t port);
virtual void expectConnect(const char *host, uint16_t port);
virtual void expectConnect(IPAddress ip, uint16_t port); //!< expectConnect
virtual void expectConnect(const char *host, uint16_t port); //!< expectConnect
virtual uint16_t received();
virtual bool error();
virtual uint16_t received(); //!< received
virtual bool error(); //!< error
virtual void setAllowConnect(bool b);
virtual void setConnected(bool b);
virtual void setAllowConnect(bool b); //!< setAllowConnect
virtual void setConnected(bool b); //!< setConnected
};
#endif
@@ -4,6 +4,7 @@
#include "Arduino.h"
#include "Buffer.h"
/** Stream class */
class Stream {
private:
Buffer* expectBuffer;
@@ -12,11 +13,11 @@ private:
public:
Stream();
virtual size_t write(uint8_t);
virtual size_t write(uint8_t); //!< write
virtual bool error();
virtual void expect(uint8_t *buf, size_t size);
virtual uint16_t length();
virtual bool error(); //!< error
virtual void expect(uint8_t *buf, size_t size); //!< expect
virtual uint16_t length(); //!< length
};
#endif