mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
docs: final batch of header files reviewed
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
parent
04edb9be04
commit
1fe9b9eb1d
@ -89,7 +89,7 @@ class AM2315 {
|
||||
AM2315 (int bus, int devAddr=AM2315_I2C_ADDRESS);
|
||||
|
||||
/**
|
||||
* AM2315 object destructor; basicaly, it closes the I2C connection.
|
||||
* AM2315 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~AM2315 ();
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ECS1030 {
|
||||
ECS1030 (uint8_t pinNumber);
|
||||
|
||||
/**
|
||||
* ECS1030 object destructor; basicaly, it closes the GPIO.
|
||||
* ECS1030 object destructor; basically, it closes the GPIO.
|
||||
*/
|
||||
~ECS1030 ();
|
||||
|
||||
|
@ -337,7 +337,7 @@ namespace upm {
|
||||
bool setPowerMode(PM_BITS_T pm);
|
||||
|
||||
/**
|
||||
* Enables one or more of the 3 axes. The arguement is a bitmask
|
||||
* Enables one or more of the 3 axes. The argument is a bitmask
|
||||
* composed of REG1_XEN, REG1_YEN, and/or REG1_ZEN corresponding to
|
||||
* the axes you want enabled.
|
||||
*
|
||||
|
@ -56,21 +56,21 @@ namespace upm {
|
||||
* @web http://www.seeedstudio.com/wiki/Grove_-_NFC_Tag
|
||||
* @con i2c
|
||||
*
|
||||
* @brief C++ API for the M24LR64E based Grove NFC Tag
|
||||
* @brief C++ API for the M24LR64E-based Grove NFC Tag
|
||||
*
|
||||
* The Grove NFC tag is, in essence, an 8KB EEPROM that can be written
|
||||
* to or read from using I2C and NFC equipped devices.
|
||||
* Grove NFC tag is an 8KB electrically erasable programmable read-only memory (EEPROM)
|
||||
* that can be written to or read from using I2C and NFC-equipped devices.
|
||||
*
|
||||
* The USER mode (default) allows read and write access to all 8KB
|
||||
* The user mode (default) allows read and write access to all 8KB
|
||||
* of space, provided the sector security status (SSS) allows it.
|
||||
* The ROOT mode allows modification of the SSS data and other
|
||||
* The root mode allows modification of the SSS data and other
|
||||
* information, provided the proper password is submitted. The
|
||||
* default password for a new tag is 0x00000000. See the data sheet
|
||||
* for much more detailed information.
|
||||
* default password for a new tag is 0x00000000. See the datasheet
|
||||
* for more details.
|
||||
*
|
||||
* The Seeed Studio wiki page for this device includes a link to an
|
||||
* Android application that can be used to also read and write the
|
||||
* device via NFC, as well as set the NFC passwords, which cannot be
|
||||
* The Seeed Studio* wiki page for this device includes a link to an
|
||||
* Android* application that can be used to also read and write the
|
||||
* device via NFC, as well as set NFC passwords, which cannot be
|
||||
* done via I2C.
|
||||
*
|
||||
* @image html m24lr64e.jpg
|
||||
@ -92,12 +92,12 @@ namespace upm {
|
||||
static const unsigned int I2C_WRITE_TIME = 5; // 5ms
|
||||
|
||||
/**
|
||||
* M24LR64E addresses, accessable only in root mode
|
||||
* M24LR64E addresses, accessible only in the root mode
|
||||
*/
|
||||
typedef enum {
|
||||
I2C_PASSWORD_ADDR = 2304,
|
||||
RF_PASSWORD_1_ADDR = 2308, // RF pwds not available in
|
||||
RF_PASSWORD_2_ADDR = 2312, // i2c access modes
|
||||
RF_PASSWORD_2_ADDR = 2312, // I2C access modes
|
||||
RF_PASSWORD_3_ADDR = 2316,
|
||||
DSFID_ADDR = 2320, // 1 byte
|
||||
AFI_ADDR = 2321, // 1 byte
|
||||
@ -110,8 +110,8 @@ namespace upm {
|
||||
} M24LR64E_ADDR_T;
|
||||
|
||||
enum AccessMode {
|
||||
USER_MODE = 0x0, // offer simple read/write access right
|
||||
ROOT_MODE = 0x1 // offer password change access right
|
||||
USER_MODE = 0x0, // offers simple read/write access right
|
||||
ROOT_MODE = 0x1 // offers password change access right
|
||||
};
|
||||
|
||||
enum SectorAccessRight {
|
||||
@ -141,39 +141,39 @@ namespace upm {
|
||||
};
|
||||
|
||||
/**
|
||||
* m24lr64e constructor
|
||||
* M24LR64E constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param mode the access mode (user or root) to use
|
||||
* @param bus I2C bus to use
|
||||
* @param mode Access mode (user or root) to use
|
||||
*/
|
||||
M24LR64E(int bus, AccessMode mode = USER_MODE);
|
||||
|
||||
/**
|
||||
* M24LR64E Destructor
|
||||
* M24LR64E destructor
|
||||
*/
|
||||
~M24LR64E();
|
||||
|
||||
/**
|
||||
* submit an i2c access password
|
||||
* Submits an I2C access password
|
||||
*
|
||||
* @param passwd the 4-byte access password
|
||||
* @param passwd 4-byte access password
|
||||
*/
|
||||
bool submitPasswd(uint32_t passwd);
|
||||
|
||||
/**
|
||||
* write a new i2c password
|
||||
* Writes a new I2C password
|
||||
*
|
||||
* @param passwd the 4-byte access password
|
||||
* @param passwd 4-byte access password
|
||||
*/
|
||||
bool writePasswd(uint32_t passwd);
|
||||
|
||||
/**
|
||||
* Set the protection bit for a sector. Must be in ROOT mode
|
||||
* Sets a protection bit for a sector. Must be in the root mode
|
||||
*
|
||||
* @param sectorNumber the sector whose protection you are modifying
|
||||
* @param protectEnable true if you are enabling protection
|
||||
* @param accessRight the access rights to set
|
||||
* @param passwd the password number to enable, if any
|
||||
* @param sectorNumber Sector whose protection you are modifying
|
||||
* @param protectEnable True if you are enabling protection
|
||||
* @param accessRight Access rights to set
|
||||
* @param passwd Password number to enable, if any
|
||||
*/
|
||||
void sectorProtectConfig(unsigned int sectorNumber,
|
||||
bool protectEnable,
|
||||
@ -181,88 +181,88 @@ namespace upm {
|
||||
SectorSelectPassWd passwd);
|
||||
|
||||
/**
|
||||
* Clear the sector protection bits. Must be in ROOT mode.
|
||||
* Clears sector protection bits. Must be in the root mode.
|
||||
*/
|
||||
void clearSectorProtect(void);
|
||||
|
||||
/**
|
||||
* Set or clear the Sector Security Status Lock bit for a sector.
|
||||
* Must be in ROOT mode.
|
||||
* Sets or clears a sector security status lock bit for a sector.
|
||||
* Must be in the root mode.
|
||||
*
|
||||
* @param sectorNumber the sector who's SSS you want to modify
|
||||
* @param sockEnable true r false to set or clear the bit
|
||||
* @param sectorNumber Sector whose SSS you want to modify
|
||||
* @param sockEnable True to set the bit, false to clear it
|
||||
*/
|
||||
void sectorWriteLockBit(unsigned int sectorNumber,
|
||||
bool sockEnable);
|
||||
|
||||
/**
|
||||
* return the Data Storage Familiy Identifier
|
||||
* Must be in ROOT mode.
|
||||
* Returns a data storage family identifier (DSFID)
|
||||
* Must be in the root mode.
|
||||
*
|
||||
* @return the DSFID
|
||||
* @return DSFID
|
||||
*/
|
||||
uint8_t getDSFID();
|
||||
|
||||
/**
|
||||
* return the Application Family Identifier
|
||||
* Must be in ROOT mode.
|
||||
* Returns an application family identifier (AFI)
|
||||
* Must be in the root mode.
|
||||
*
|
||||
* @return the AFI
|
||||
* @return AFI
|
||||
*/
|
||||
uint8_t getAFI();
|
||||
|
||||
/**
|
||||
* return the Unique ID.
|
||||
* Must be in ROOT mode.
|
||||
* Returns a unique ID.
|
||||
* Must be in the root mode.
|
||||
*
|
||||
* @param buf buffer to hold returned UID. Must be UID_LENGTH bytes.
|
||||
* @param buf Buffer to hold the returned UID. Must be UID_LENGTH bytes.
|
||||
*/
|
||||
void getUID(uint8_t* buf);
|
||||
|
||||
/**
|
||||
* return the memory size
|
||||
* Must be in ROOT mode.
|
||||
* Returns the memory size
|
||||
* Must be in the root mode.
|
||||
*
|
||||
* @return the amount of memory present
|
||||
* @return Amount of memory present
|
||||
*/
|
||||
uint32_t getMemorySize();
|
||||
|
||||
/**
|
||||
* set all memory to 0, if permissions allow
|
||||
* Sets all memory to 0, if permissions allow
|
||||
*/
|
||||
void clearMemory();
|
||||
|
||||
/**
|
||||
* write a byte to EEPROM
|
||||
* Writes a byte to the EEPROM
|
||||
*
|
||||
* @param address address to write to
|
||||
* @param data data to write
|
||||
* @param address Address to write to
|
||||
* @param data Data to write
|
||||
*/
|
||||
void writeByte(unsigned int address, uint8_t data);
|
||||
|
||||
/**
|
||||
* write bytes to EEPROM
|
||||
* Writes bytes to the EEPROM
|
||||
*
|
||||
* @param address address to write to
|
||||
* @param data data to write
|
||||
* @param data length of data buffer
|
||||
* @param address Address to write to
|
||||
* @param data Data to write
|
||||
* @param data Length of the data buffer
|
||||
*/
|
||||
void writeBytes(unsigned int address, uint8_t* buf, unsigned int len);
|
||||
|
||||
/**
|
||||
* read a byte from EEPROM
|
||||
* Reads a byte from the EEPROM
|
||||
*
|
||||
* @param address address to read from
|
||||
* @return data value read
|
||||
* @param address Address to read from
|
||||
* @return data Value read
|
||||
*/
|
||||
uint8_t readByte(unsigned int address);
|
||||
|
||||
/**
|
||||
* read multiple bytes from EEPROM
|
||||
* Reads multiple bytes from the EEPROM
|
||||
*
|
||||
* @param address address to read from
|
||||
* @param buffer buffer to store data
|
||||
* @param len number of bytes to read
|
||||
* @param address Address to read from
|
||||
* @param buffer Buffer to store data
|
||||
* @param len Number of bytes to read
|
||||
*/
|
||||
void readBytes(unsigned int address, uint8_t* buf, unsigned int len);
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MAX31723 temperature sensor library
|
||||
* @brief MAX31723 Temperature Sensor library
|
||||
* @defgroup max31723 libupm-max31723
|
||||
* @ingroup maxim spi temperature
|
||||
*/
|
||||
@ -46,11 +46,11 @@ namespace upm {
|
||||
* @man maxim
|
||||
* @con spi
|
||||
*
|
||||
* @brief API for MAX31723 chip (Temperature Sensor)
|
||||
* @brief API for the MAX31723 Temperature Sensor
|
||||
*
|
||||
* The Maxim Integrated
|
||||
* Maxim Integrated*
|
||||
* [MAX31723](http://datasheets.maximintegrated.com/en/ds/MAX31722-MAX31723.pdf)
|
||||
* is a Low-Voltage 3-Wire/SPI Temperature Sensor controller. This module was
|
||||
* is a low-voltage 3-wire/SPI temperature sensor controller. This module was
|
||||
* tested on the Maxim Integrated [MAX31732PMB1 PMOD
|
||||
* module](http://datasheets.maximintegrated.com/en/ds/MAX31723PMB1.pdf) from
|
||||
* the analog PMOD kit.
|
||||
@ -67,25 +67,25 @@ class MAX31723 {
|
||||
static const uint8_t B_CONT_READING = 0x00;
|
||||
|
||||
/**
|
||||
* Instanciates a MAX31723 object
|
||||
* Instantiates an MAX31723 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr addres of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
*/
|
||||
MAX31723 (int csn);
|
||||
|
||||
/**
|
||||
* MAXDS3231M object destructor, basicaly it close i2c connection.
|
||||
* MAXDS3231M object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MAX31723 ();
|
||||
|
||||
/**
|
||||
* Get on board temperature.
|
||||
* Gets the on-board temperature.
|
||||
*/
|
||||
short getTemperature ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -100,12 +100,12 @@ class MAX31723 {
|
||||
void writeRegister (uint8_t reg, uint8_t data);
|
||||
|
||||
/**
|
||||
* Set chip select pin LOW
|
||||
* Sets the chip select pin to LOW
|
||||
*/
|
||||
mraa_result_t CSOn ();
|
||||
|
||||
/**
|
||||
* Set chip select pin HIGH
|
||||
* Sets the chip select pin to HIGH
|
||||
*/
|
||||
mraa_result_t CSOff ();
|
||||
};
|
||||
|
@ -30,7 +30,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MAX31855 thermocouple library
|
||||
* @brief MAX31855 Thermocouple library
|
||||
* @defgroup max31855 libupm-max31855
|
||||
* @ingroup maxim adafruit spi other
|
||||
*/
|
||||
@ -42,12 +42,12 @@ namespace upm {
|
||||
* @man maxim adafruit
|
||||
* @con spi
|
||||
*
|
||||
* @brief API for MAX31855 Thermocouple Amplifier
|
||||
* @brief API for the MAX31855 Thermocouple Amplifier
|
||||
*
|
||||
* The Maxim Integrated
|
||||
* Maxim Integrated*
|
||||
* [MAX31855](http://datasheets.maximintegrated.com/en/ds/MAX31855.pdf)
|
||||
* is a Cold-Junction Compensated Thermocouple-to-Digital Converter. This
|
||||
* module was * tested on the Maxim Integrated
|
||||
* is a cold-junction compensated thermocouple-to-digital converter. This
|
||||
* module was tested on the Maxim Integrated
|
||||
* [MAX31855PMB1 PMOD module]
|
||||
* (http://datasheets.maximintegrated.com/en/ds/MAX31855PMB1.pdf) from the
|
||||
* analog PMOD kit.
|
||||
@ -58,10 +58,10 @@ namespace upm {
|
||||
class MAX31855 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a MAX31855 object
|
||||
* Instantiates an MAX31855 object
|
||||
*
|
||||
* @param bus The spi bus to use
|
||||
* @param cs The chip select pin
|
||||
* @param bus SPI bus to use
|
||||
* @param cs Chip select pin
|
||||
*/
|
||||
MAX31855(int bus, int cs);
|
||||
|
||||
@ -71,9 +71,9 @@ class MAX31855 {
|
||||
~MAX31855();
|
||||
|
||||
/**
|
||||
* Get the distance from the sensor
|
||||
* Gets the distance from the sensor
|
||||
*
|
||||
* @return value in degrees celcius
|
||||
* @return Value in Celsius
|
||||
*/
|
||||
//! [Interesting]
|
||||
double getTemp();
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define PRXDATA 0x15 // proximity sensor data
|
||||
|
||||
#define ALS_UP_THRESH_HIGH 0x06 // ALS Interrupt Threshold Registers High
|
||||
#define ALS_UP_THRESH_LOW 0x07 // ALS Interrupt Threshold Registers LOW
|
||||
#define ALS_UP_THRESH_LOW 0x07 // ALS Interrupt Threshold Registers Low
|
||||
#define ALS_LO_THRESH_HIGH 0x08 // ALS Interrupt Threshold Registers High
|
||||
#define ALS_LO_THRESH_LOW 0x09 // ALS Interrupt Threshold Registers Low
|
||||
#define TPTR 0x0A // ALS/PROX Threshold Persist Timer Register
|
||||
@ -53,7 +53,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MAX44000 proximity sensor library
|
||||
* @brief MAX44000 Proximity Sensor library
|
||||
* @defgroup max44000 libupm-max44000
|
||||
* @ingroup maxim i2c light
|
||||
*/
|
||||
@ -65,11 +65,11 @@ namespace upm {
|
||||
* @man maxim
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for MAX44000 chip (Ambient and Infrared Proximity Sensor)
|
||||
* @brief API for the MAX44000 Ambient and Infrared Proximity Sensor
|
||||
*
|
||||
* The Maxim Integrated
|
||||
* Maxim Integrated*
|
||||
* [MAX44000](http://datasheets.maximintegrated.com/en/ds/MAX44000.pdf)
|
||||
* is Ambient and Infrared Proximity Sensor. This module was tested on the
|
||||
* is an ambient and infrared proximity sensor. This module was tested on the
|
||||
* Maxim Integrated
|
||||
* [MAX44000PMB1 PMOD module]
|
||||
* (http://datasheets.maximintegrated.com/en/ds/MAX44000PMB1.pdf) from the
|
||||
@ -80,29 +80,29 @@ namespace upm {
|
||||
class MAX44000 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a MAX44000 object
|
||||
* Instantiates an MAX44000 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr addres of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
*/
|
||||
MAX44000 (int bus, int devAddr);
|
||||
|
||||
/**
|
||||
* MAX44000 object destructor, basicaly it close i2c connection.
|
||||
* MAX44000 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MAX44000 ();
|
||||
|
||||
/**
|
||||
* Read the proximity value from the chip (based on ambient data).
|
||||
* Reads the proximity value from the sensor (based on ambient data).
|
||||
*/
|
||||
uint16_t getProximity ();
|
||||
/**
|
||||
* Read the ambient value from the chip (based on ambient data).
|
||||
* Reads the ambient value from the sensor (based on ambient data).
|
||||
*/
|
||||
uint16_t getAmbient ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -110,24 +110,24 @@ class MAX44000 {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read one byte register
|
||||
* Reads a one-byte register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param reg Address of the register
|
||||
*/
|
||||
uint8_t i2cReadReg_8 (int reg);
|
||||
|
||||
/**
|
||||
* Read two bytes register
|
||||
* Reads a two-byte register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param reg Address of the register
|
||||
*/
|
||||
uint16_t i2cReadReg_16 (int reg);
|
||||
|
||||
/**
|
||||
* Write to one byte register
|
||||
* Writes to a one-byte register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param value byte to be written
|
||||
* @param reg Address of the register
|
||||
* @param value Byte to be written
|
||||
*/
|
||||
mraa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MAX5487 digital potentiometer library
|
||||
* @brief MAX5487 Digital Potentiometer library
|
||||
* @defgroup max5487 libupm-max5487
|
||||
* @ingroup maxim spi digipot
|
||||
*/
|
||||
@ -46,12 +46,12 @@ namespace upm {
|
||||
* @man maxim
|
||||
* @con spi
|
||||
*
|
||||
* @brief API for MAX5487 chip (SPI digital potentiometer)
|
||||
* @brief API for the MAX5487 SPI Digital Potentiometer
|
||||
*
|
||||
* The Maxim Integrated
|
||||
* Maxim Integrated*
|
||||
* [MAX5487](http://datasheets.maximintegrated.com/en/ds/MAX5487-MAX5489.pdf)
|
||||
* is a Dual, 256-Tap, Nonvolatile, SPI-Interface, Linear-Taper Digital
|
||||
* Potentiometer. This module was tested on the Maxim Integrated [MAX5487PMB1
|
||||
* is a dual, 256-tap, nonvolatile, SPI, linear-taper digital
|
||||
* potentiometer. This module was tested on the Maxim Integrated [MAX5487PMB1
|
||||
* PMOD module](http://datasheets.maximintegrated.com/en/ds/MAX5487PMB1.pdf)
|
||||
* from the analog PMOD kit.
|
||||
*
|
||||
@ -63,9 +63,9 @@ class MAX5487 {
|
||||
static const uint8_t R_WR_WIPER_B = 0x02;
|
||||
|
||||
/**
|
||||
* Instanciates a MAX5487 object
|
||||
* Instantiates an MAX5487 object
|
||||
*
|
||||
* @param csn to use if any, by default will use ICSP CS (-1)
|
||||
* @param csn CSN to use, if any; by default, ICSP CS (-1) is used
|
||||
*/
|
||||
MAX5487 (int csn = -1);
|
||||
|
||||
@ -75,17 +75,17 @@ class MAX5487 {
|
||||
~MAX5487 ();
|
||||
|
||||
/**
|
||||
* Set wiper for port A.
|
||||
* Sets a wiper for port A.
|
||||
*/
|
||||
void setWiperA (uint8_t wiper);
|
||||
|
||||
/**
|
||||
* Set wiper for port B.
|
||||
* Sets a wiper for port B.
|
||||
*/
|
||||
void setWiperB (uint8_t wiper);
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -97,12 +97,12 @@ class MAX5487 {
|
||||
mraa_gpio_context m_csnPinCtx;
|
||||
|
||||
/**
|
||||
* Set chip select pin LOW
|
||||
* Sets the chip select pin to LOW
|
||||
*/
|
||||
mraa_result_t CSOn ();
|
||||
|
||||
/**
|
||||
* Set chip select pin HIGH
|
||||
* Sets the chip select pin to HIGH
|
||||
*/
|
||||
mraa_result_t CSOff ();
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ struct Time3231 {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief MAXDS3231M proximity sensor library
|
||||
* @brief MAXDS3231M Proximity Sensor library
|
||||
* @defgroup maxds3231m libupm-maxds3231m
|
||||
* @ingroup maxim i2c light
|
||||
*/
|
||||
@ -75,48 +75,48 @@ struct Time3231 {
|
||||
* @man maxim
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for MAXDS3231M chip (I2C Real-Time Clock)
|
||||
* @brief API for the MAXDS3231M I2C Real-Time Clock
|
||||
*
|
||||
* This file defines the API for maxds3231m
|
||||
* This file defines the API for MAXDS3231M
|
||||
*
|
||||
* @snippet maxds3231m.cxx Interesting
|
||||
*/
|
||||
class MAXDS3231M {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a MAXDS3231M object
|
||||
* Instantiates an MAXDS3231M object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr addres of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
*/
|
||||
MAXDS3231M (int bus=0, int devAddr=0x68);
|
||||
|
||||
/**
|
||||
* MAXDS3231M object destructor, basicaly it close i2c connection.
|
||||
* MAXDS3231M object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MAXDS3231M ();
|
||||
|
||||
/**
|
||||
* Set date and time on the chip.
|
||||
* Sets the date and time on the chip.
|
||||
*
|
||||
* @param time staracture
|
||||
* @param time Time structure
|
||||
*/
|
||||
void setDate (Time3231 &time);
|
||||
|
||||
/**
|
||||
* Get date and time located on the chip.
|
||||
* Gets the date and time from the chip.
|
||||
*
|
||||
* @param time staracture
|
||||
* @param time Time structure
|
||||
*/
|
||||
bool getDate (Time3231 &time);
|
||||
|
||||
/**
|
||||
* Get on board temperature.
|
||||
* Gets the on-board temperature.
|
||||
*/
|
||||
uint16_t getTemperature ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief MaxSonar-EZ family of ultrasonic rangers library
|
||||
* @brief MaxSonar-EZ Family of Ultrasonic Rangers library
|
||||
* @defgroup maxsonarez libupm-maxsonarez
|
||||
* @ingroup seeed analog sound
|
||||
*/
|
||||
@ -47,20 +47,20 @@ namespace upm {
|
||||
* @web https://www.sparkfun.com/products/8502
|
||||
* @con analog
|
||||
*
|
||||
* @brief API for the LV-MaxSonar-EZ family of ultrasonic rangers
|
||||
* @brief API for the LV-MaxSonar-EZ Family of Ultrasonic Rangers
|
||||
*
|
||||
* This sensor family returns an analog voltage corresponding to the
|
||||
* distance of an object from the sensor in inches. It has a
|
||||
* resolution of about 9.7 millivolts per inch with a 5.0 AREF. The
|
||||
* differences between the various versions (EZ1, EZ2, etc) are
|
||||
* Sensors of this family return an analog voltage corresponding to the
|
||||
* distance of an object from the sensor in inches. They have a
|
||||
* resolution of about 9.7 millivolts per inch with an analog reference voltage of 5.0 V. The
|
||||
* differences between various versions (EZ1, EZ2, etc.) are
|
||||
* related to the narrowness of the beam angle.
|
||||
*
|
||||
* This class supports these sensors with an analog input only.
|
||||
*
|
||||
* This driver was developed using an LV-MaxSonar-EZ3.
|
||||
* This driver was developed using an LV-MaxSonar-EZ3 ultrasonic ranger.
|
||||
*
|
||||
* @image html maxsonarez.jpg
|
||||
* <br><em>LV-MaxSonar-EZ Ultrasonic Ranger image provided by SparkFun under
|
||||
* <br><em>LV-MaxSonar-EZ Ultrasonic Ranger image provided by SparkFun* under
|
||||
* <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
|
||||
* CC BY-NC-SA-3.0</a>.</em>
|
||||
*
|
||||
@ -71,22 +71,22 @@ namespace upm {
|
||||
public:
|
||||
|
||||
/**
|
||||
* MAXSONAREZ sensor constructor
|
||||
* MAXSONAREZ constructor
|
||||
*
|
||||
* @param pin analog pin to use
|
||||
* @param aref the analog reference voltage, default: 5.0
|
||||
* @param pin Analog pin to use
|
||||
* @param aref Analog reference voltage; default is 5.0 V
|
||||
*/
|
||||
MAXSONAREZ(int pin, float aref=5.0);
|
||||
|
||||
/**
|
||||
* MAXSONAREZ Destructor
|
||||
* MAXSONAREZ destructor
|
||||
*/
|
||||
~MAXSONAREZ();
|
||||
|
||||
/**
|
||||
* get the distance to the object in inches
|
||||
* Gets the distance to the object in inches
|
||||
*
|
||||
* @return the distance to the object in inches
|
||||
* @return Distance to the object in inches
|
||||
*/
|
||||
int inches();
|
||||
|
||||
@ -95,7 +95,7 @@ namespace upm {
|
||||
float m_aref;
|
||||
// ADC resolution
|
||||
int m_aRes;
|
||||
// computed Volts per Inch
|
||||
// computed volts per inch
|
||||
float m_vI;
|
||||
};
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ const uint8_t MHZ16_END = 0x7e;
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief MHZ16 Serial CO2 sensor library
|
||||
* @brief MHZ16 Serial CO2 Sensor library
|
||||
* @defgroup mhz16 libupm-mhz16
|
||||
* @ingroup seeed uart gaseous
|
||||
*/
|
||||
@ -66,8 +66,8 @@ namespace upm {
|
||||
*
|
||||
* This class implements support for the Grove CO2 sensor.
|
||||
*
|
||||
* It's CO2 detection ranges from 0PPM to 2000PPM. It requires a
|
||||
* 2-3 minute warm up time before reporting valid data.
|
||||
* Its CO2 detection range is 0-2,000 ppm. It requires a
|
||||
* 2-3 minute warm-up time before reporting valid data.
|
||||
*
|
||||
* @image html mhz16.jpg
|
||||
* @snippet mhz16.cxx Interesting
|
||||
@ -77,75 +77,75 @@ namespace upm {
|
||||
|
||||
|
||||
/**
|
||||
* MHZ16 module constructor
|
||||
* MHZ16 constructor
|
||||
*
|
||||
* @param uart default uart to use (0 or 1)
|
||||
* @param uart Default UART to use (0 or 1)
|
||||
*/
|
||||
MHZ16(int uart);
|
||||
|
||||
/**
|
||||
* MHZ16 module Destructor
|
||||
* MHZ16 destructor
|
||||
*/
|
||||
~MHZ16();
|
||||
|
||||
/**
|
||||
* Check to see if there is data available for reading
|
||||
* Checks to see if there is data available for reading
|
||||
*
|
||||
* @param millis number of milliseconds to wait, 0 means no wait.
|
||||
* @return true if there is data available to be read
|
||||
* @param millis Number of milliseconds to wait; 0 means no waiting.
|
||||
* @return True if there is data available for reading
|
||||
*/
|
||||
bool dataAvailable(unsigned int millis);
|
||||
|
||||
/**
|
||||
* read any available data into a user-supplied buffer. Note, the
|
||||
* call will block until data is available to be read. Use
|
||||
* Reads any available data in a user-supplied buffer. Note: the
|
||||
* call blocks until data is available to be read. Use
|
||||
* dataAvailable() to determine whether there is data available
|
||||
* beforehand, to avoid blocking.
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes read
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
int readData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* write the data in buffer to the device
|
||||
* Writes the data in the buffer to the device
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes written
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int writeData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* setup the proper tty i/o modes and the baudrate. The default
|
||||
* baud rate is 9600 (B9600).
|
||||
* Sets up proper tty I/O modes and the baud rate. The default
|
||||
* baud rate is 9,600 (B9600).
|
||||
*
|
||||
* @param baud the desired baud rate.
|
||||
* @return true if successful
|
||||
* @param baud Desired baud rate.
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setupTty(speed_t baud=B9600);
|
||||
|
||||
/**
|
||||
* verify the packet header and indicate it's validity
|
||||
* Verifies the packet header and indicates its validity
|
||||
*
|
||||
* @param pkt the packet to check
|
||||
* @return true if valid checksum, false otherwise
|
||||
* @param pkt Packet to check
|
||||
* @return True if the checksum is valid, false otherwise
|
||||
*/
|
||||
bool verifyPacket(unsigned char *pkt);
|
||||
|
||||
/**
|
||||
* Query the sensor and return gas (CO2) concentration and
|
||||
* Queries the sensor and returns gas (CO2) concentration and
|
||||
* temperature data.
|
||||
*
|
||||
* @param gas the returned gas concentration
|
||||
* @param temp the returned temperature in celsius
|
||||
* @return true if successful
|
||||
* @param gas Returned gas concentration
|
||||
* @param temp Returned temperature in Celsius
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getData(int *gas, int *temp);
|
||||
|
||||
/**
|
||||
* Set the zero point of the sensor
|
||||
* Sets the zero point of the sensor
|
||||
*
|
||||
*/
|
||||
void calibrateZeroPoint();
|
||||
|
@ -36,7 +36,7 @@ struct thresholdContext {
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief Analog microphone library
|
||||
* @brief Analog Microphone library
|
||||
* @defgroup mic libupm-mic
|
||||
* @ingroup seeed pwm sound gsk
|
||||
*/
|
||||
@ -51,9 +51,9 @@ namespace upm {
|
||||
* @con pwm
|
||||
* @kit gsk
|
||||
*
|
||||
* @brief API for Microphone
|
||||
* @brief API for the Analog Microphone
|
||||
*
|
||||
* This file defines the Microphone Analog sensor
|
||||
* This file defines the Analog Microphone sensor
|
||||
*
|
||||
* @image html mic.jpg
|
||||
* @snippet mic.cxx Interesting
|
||||
@ -61,43 +61,43 @@ namespace upm {
|
||||
class Microphone {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a Microphone object
|
||||
* Instantiates a Microphone object
|
||||
*
|
||||
* @param micPin pin where microphone is connected
|
||||
* @param micPin Pin where the microphone is connected
|
||||
*/
|
||||
Microphone(int micPin);
|
||||
|
||||
/**
|
||||
* MAX31723 object destructor
|
||||
* Microphone object destructor
|
||||
*/
|
||||
~Microphone();
|
||||
|
||||
/**
|
||||
* Get samples from microphone according to provided window and
|
||||
* Gets samples from the microphone according to the provided window and
|
||||
* number of samples
|
||||
*
|
||||
* @param freqMS time between each sample (in microseconds)
|
||||
* @param numberOfSamples number of sample to sample for this window
|
||||
* @param buffer bufer with sampled data
|
||||
* @param freqMS Time between each sample (in microseconds)
|
||||
* @param numberOfSamples Number of sample to sample for this window
|
||||
* @param buffer Buffer with sampled data
|
||||
*/
|
||||
int getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples, uint16_t * buffer);
|
||||
|
||||
/**
|
||||
* Given sampled buffer this method will return TRUE/FALSE if threshold
|
||||
* was reached
|
||||
* Given the sampled buffer, this method returns TRUE/FALSE if threshold
|
||||
* is reached
|
||||
*
|
||||
* @param ctx threshold context
|
||||
* @param threshold sample threshold
|
||||
* @param buffer buffer with samples
|
||||
* @param len bufer len
|
||||
* @param ctx Threshold context
|
||||
* @param threshold Sample threshold
|
||||
* @param buffer Buffer with samples
|
||||
* @param len Buffer length
|
||||
*/
|
||||
int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, unsigned int len);
|
||||
|
||||
/**
|
||||
*
|
||||
* Print running average of threshold context
|
||||
* Prints a running average of the threshold context
|
||||
*
|
||||
* @param ctx threshold context
|
||||
* @param ctx Threshold context
|
||||
*/
|
||||
void printGraph (thresholdContext* ctx);
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MLX90614 temperature sensor library
|
||||
* @brief MLX90614 Temperature Sensor library
|
||||
* @defgroup mlx90614 libupm-mlx90614
|
||||
* @ingroup generic i2c temperature
|
||||
*/
|
||||
@ -65,7 +65,7 @@ namespace upm {
|
||||
* @man generic
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for MLX90614
|
||||
* @brief API for the MLX90614 Temperature Sensor
|
||||
*
|
||||
* This file defines the MLX90614 interface for libmlx90614
|
||||
*
|
||||
@ -76,39 +76,39 @@ class MLX90614 {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Instanciates a MLX90614 object
|
||||
* Instantiates an MLX90614 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr addres of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
*/
|
||||
MLX90614 (int bus=0, int devAddr=0x5A);
|
||||
|
||||
/**
|
||||
* MLX90614 object destructor, basicaly it close i2c connection.
|
||||
* MLX90614 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MLX90614 ();
|
||||
|
||||
/**
|
||||
* Read object temperature in Fahrenheit
|
||||
* Reads the object temperature in Fahrenheit
|
||||
*/
|
||||
float readObjectTempF(void);
|
||||
|
||||
/**
|
||||
* Read ambient temperature in Fahrenheit
|
||||
* Reads the ambient temperature in Fahrenheit
|
||||
*/
|
||||
float readAmbientTempF(void);
|
||||
/**
|
||||
* Read object temperature in Celsius
|
||||
* Reads the object temperature in Celsius
|
||||
*/
|
||||
float readObjectTempC(void);
|
||||
|
||||
/**
|
||||
* Read ambient temperature in Celsius
|
||||
* Reads the ambient temperature in Celsius
|
||||
*/
|
||||
float readAmbientTempC(void);
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
// Register names according to the datasheet.
|
||||
// Register 0x1C is sometimes called 'PW', and sometimes 'PD'.
|
||||
// The two reserved registers can not be used.
|
||||
// The two reserved registers cannot be used.
|
||||
#define MMA7455_XOUTL 0x00 // Read only, Output Value X LSB
|
||||
#define MMA7455_XOUTH 0x01 // Read only, Output Value X MSB
|
||||
#define MMA7455_YOUTL 0x02 // Read only, Output Value Y LSB
|
||||
@ -64,9 +64,9 @@
|
||||
#define MMA7455_TW 0x1E // Read/Write, Time Window for Second Pulse Value
|
||||
#define MMA7455_RESERVED2 0x1F // Reserved
|
||||
|
||||
// Defines for the bits, to be able to change
|
||||
// between bit number and binary definition.
|
||||
// By using the bit number, programming the MMA7455
|
||||
// Defines for the bits to be able to change
|
||||
// between the bit number and the binary definition.
|
||||
// By using the bit number, programming MMA7455
|
||||
// is like programming an AVR microcontroller.
|
||||
// But instead of using "(1<<X)", or "_BV(X)",
|
||||
// the Arduino "bit(X)" is used.
|
||||
@ -150,7 +150,7 @@ union accelData {
|
||||
#define BIT(n) (1<<n)
|
||||
|
||||
/**
|
||||
* @brief MMA7455 accelerometer library
|
||||
* @brief MMA7455 Accelerometer library
|
||||
* @defgroup mma7455 libupm-mma7455
|
||||
* @ingroup generic i2c accelerometer
|
||||
*/
|
||||
@ -162,7 +162,7 @@ union accelData {
|
||||
* @man generic
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for MMA7455 chip (accelerometer)
|
||||
* @brief API for the MMA7455 Accelerometer
|
||||
*
|
||||
* This file defines the MMA7455 interface for libmma7455
|
||||
*
|
||||
@ -172,20 +172,20 @@ union accelData {
|
||||
class MMA7455 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a MMA7455 object
|
||||
* Instantiates an MMA7455 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr addres of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
*/
|
||||
MMA7455 (int bus=0, int devAddr=0x1D);
|
||||
|
||||
/**
|
||||
* MMA7455 object destructor, basicaly it close i2c connection.
|
||||
* MMA7455 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MMA7455 ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -193,34 +193,34 @@ class MMA7455 {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calibrate the sensor
|
||||
* Calibrates the sensor
|
||||
*/
|
||||
mraa_result_t calibrate ();
|
||||
|
||||
/**
|
||||
* Read X, Y and Z acceleration data
|
||||
* Reads X-axis, Y-axis, and Z-axis acceleration data
|
||||
*
|
||||
* @param ptrX X axis
|
||||
* @param ptrY Y axis
|
||||
* @param ptrZ Z axis
|
||||
* @param ptrX X-axis
|
||||
* @param ptrY Y-axis
|
||||
* @param ptrZ Z-axis
|
||||
*/
|
||||
mraa_result_t readData (short * ptrX, short * ptrY, short * ptrZ);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param reg register address
|
||||
* @param buf register data buffer
|
||||
* @param size buffer size
|
||||
* @param reg Register address
|
||||
* @param buf Register data buffer
|
||||
* @param size Buffer size
|
||||
*/
|
||||
int ic2ReadReg (unsigned char reg, unsigned char * buf, unsigned char size);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param reg register address
|
||||
* @param buf register data buffer
|
||||
* @param size buffer size
|
||||
* @param reg Register address
|
||||
* @param buf Register data buffer
|
||||
* @param size Buffer size
|
||||
*/
|
||||
mraa_result_t ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size);
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MMA7660 I2C 3-axis digital accelerometer library
|
||||
* @brief MMA7660 I2C 3-Axis Digital Accelerometer library
|
||||
* @defgroup mma7660 libupm-mma7660
|
||||
* @ingroup seeed i2c gpio accelerometer
|
||||
*/
|
||||
@ -46,12 +46,12 @@ namespace upm {
|
||||
* @man seeed
|
||||
* @con i2c gpio
|
||||
*
|
||||
* @brief API for the MMA7660 I2C 3-axis digital accelerometer
|
||||
* @brief API for the MMA7660 I2C 3-Axis Digital Accelerometer
|
||||
*
|
||||
* UPM module for the MMA7660 I2C 3-axis digital accelerometer.
|
||||
* This device supports a variety of capabilities, including the
|
||||
* generation of interrupts for various conditions, tilt and basic
|
||||
* gesture detection, and of course X/Y/Z measurements of g-forces
|
||||
* gesture detection, and X/Y/Z-axis measurements of g-forces
|
||||
* being applied (up to 1.5g)
|
||||
*
|
||||
* This module was tested with the Grove 3-Axis Digital
|
||||
@ -72,7 +72,7 @@ namespace upm {
|
||||
REG_SPCNT = 0x05, // sleep count
|
||||
REG_INTSU = 0x06, // Interrupt setup
|
||||
REG_MODE = 0x07, // operating mode
|
||||
REG_SR = 0x08, // auto wake/sleep, SPS and debounce
|
||||
REG_SR = 0x08, // auto-wake/sleep, SPS, and debounce
|
||||
REG_PDET = 0x09, // tap detection
|
||||
REG_PD = 0x0a // tap debounce count
|
||||
// 0x0b-0x1f reserved
|
||||
@ -83,7 +83,7 @@ namespace upm {
|
||||
INTR_FBINT = 0x01, // front/back
|
||||
INTR_PLINT = 0x02, // up/down/right/left
|
||||
INTR_PDINT = 0x04, // tap detection
|
||||
INTR_ASINT = 0x08, // exit autosleep
|
||||
INTR_ASINT = 0x08, // exit auto-sleep
|
||||
INTR_GINT = 0x10, // measurement intr
|
||||
INTR_SHINTZ = 0x20, // shake on Z
|
||||
INTR_SHINTY = 0x40, // shake on Y
|
||||
@ -96,7 +96,7 @@ namespace upm {
|
||||
MODE_TON = 0x04, // determines mode with MODE_MODE
|
||||
MODE_AWE = 0x08, // auto-wake
|
||||
MODE_ASE = 0x10, // auto-sleep
|
||||
MODE_SCPS = 0x20, // sleep count pre-scale
|
||||
MODE_SCPS = 0x20, // sleep count prescale
|
||||
MODE_IPP = 0x40, // intr out push-pull/open drain
|
||||
MODE_IAH = 0x80 // intr active low/high
|
||||
} MMA7660_MODE_T;
|
||||
@ -115,7 +115,7 @@ namespace upm {
|
||||
LP_VERT_UP = 0x06
|
||||
} MMA7660_TILT_LP_T;
|
||||
|
||||
// sample rate (auto sleep) values
|
||||
// sample rate (auto-sleep) values
|
||||
typedef enum { AUTOSLEEP_120 = 0x00,
|
||||
AUTOSLEEP_64 = 0x01,
|
||||
AUTOSLEEP_32 = 0x02,
|
||||
@ -127,151 +127,151 @@ namespace upm {
|
||||
} MMA7660_AUTOSLEEP_T;
|
||||
|
||||
/**
|
||||
* mma7660 constructor
|
||||
* MMA7660 constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param address the address for this sensor; default is 0x55
|
||||
* @param bus I2C bus to use
|
||||
* @param address Address for this sensor; default is 0x55
|
||||
*/
|
||||
MMA7660(int bus, uint8_t address = MMA7660_DEFAULT_I2C_ADDR);
|
||||
|
||||
/**
|
||||
* MMA7660 Destructor
|
||||
* MMA7660 destructor
|
||||
*/
|
||||
~MMA7660();
|
||||
|
||||
/**
|
||||
* Write byte value into register
|
||||
* Writes a byte value into a register
|
||||
*
|
||||
* @param reg register location to write into
|
||||
* @param byte byte to write
|
||||
* @return true if successful
|
||||
* @param reg Register location to write into
|
||||
* @param byte Byte to write
|
||||
* @return True if successful
|
||||
*/
|
||||
bool writeByte(uint8_t reg, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Read byte value from register
|
||||
* Reads a byte value from a register
|
||||
*
|
||||
* @param reg register location to read from
|
||||
* @return value at specified register
|
||||
* @param reg Register location to read from
|
||||
* @return Value in a specified register
|
||||
*/
|
||||
uint8_t readByte(uint8_t reg);
|
||||
|
||||
/**
|
||||
* Read current value of conversion
|
||||
* Reads the current value of conversion
|
||||
*
|
||||
* @param x returned x value
|
||||
* @param y returned y value
|
||||
* @param z returned z value
|
||||
* @param x Returned x value
|
||||
* @param y Returned y value
|
||||
* @param z Returned z value
|
||||
*/
|
||||
void getRawValues(int *x, int *y, int *z);
|
||||
|
||||
/**
|
||||
* Get the computed acceleration
|
||||
* Gets the computed acceleration
|
||||
*
|
||||
* @param ax returned computed acceleration of X axis
|
||||
* @param ay returned computed acceleration of Y axis
|
||||
* @param az returned computed acceleration of Z axis
|
||||
* @param ax Returned computed acceleration of the X-axis
|
||||
* @param ay Returned computed acceleration of the Y-axis
|
||||
* @param az Returned computed acceleration of the Z-axis
|
||||
*/
|
||||
void getAcceleration(float *ax, float *ay, float *az);
|
||||
|
||||
/**
|
||||
* Read an axis, verifying it's validity. The value passed must
|
||||
* Reads an axis, verifying its validity. The value passed must
|
||||
* be one of REG_XOUT, REG_YOUT, or REG_ZOUT.
|
||||
*
|
||||
* @param axis axis to read
|
||||
* @return axis value
|
||||
* @param axis Axis to read
|
||||
* @return Axis value
|
||||
*/
|
||||
int getVerifiedAxis(MMA7660_REG_T axis);
|
||||
|
||||
/**
|
||||
* Read the tilt register, verifying it's validity.
|
||||
* Reads the tilt register, verifying its validity
|
||||
*
|
||||
* @return tilt value
|
||||
* @return Tilt value
|
||||
*/
|
||||
uint8_t getVerifiedTilt();
|
||||
|
||||
/**
|
||||
* Put the device into active mode. In active mode, register
|
||||
* write are not allowed. Place the device in Standby mode before
|
||||
* Puts the device in the active mode. In this mode, register
|
||||
* writes are not allowed. Place the device in the standby mode before
|
||||
* attempting to write registers.
|
||||
*
|
||||
*/
|
||||
void setModeActive();
|
||||
|
||||
/**
|
||||
* Put the device into Standby (power saving) mode. Note, when in
|
||||
* standby mode, there will be no valid data in the registers. In
|
||||
* addition, the only way to write a register is to place the
|
||||
* device in standby mode.
|
||||
* Puts the device in the standby (power saving) mode. Note: when in
|
||||
* the standby mode, there is no valid data in the registers. In
|
||||
* addition, the only way to write a register is to put the
|
||||
* device in the standby mode.
|
||||
*
|
||||
*/
|
||||
void setModeStandby();
|
||||
|
||||
/**
|
||||
* Read tilt BackFront bits
|
||||
* Reads tiltBackFront bits
|
||||
*
|
||||
* The value returned will be one of the MMA7660_TILT_BF_T values
|
||||
* The value returned is one of the MMA7660_TILT_BF_T values
|
||||
*
|
||||
* @return the bits corresponding to the BackFront tilt status
|
||||
* @return Bits corresponding to the BackFront tilt status
|
||||
*/
|
||||
uint8_t tiltBackFront();
|
||||
|
||||
/**
|
||||
* Read tilt LandscapePortrait bits
|
||||
* Reads tiltLandscapePortrait bits
|
||||
*
|
||||
* The value returned will be one of the MMA7660_TILT_LP_T values
|
||||
* The value returned is one of the MMA7660_TILT_LP_T values
|
||||
*
|
||||
* @return the bits corresponding to the LandscapePortrait tilt status
|
||||
* @return Bits corresponding to the LandscapePortrait tilt status
|
||||
*/
|
||||
uint8_t tiltLandscapePortrait();
|
||||
|
||||
/**
|
||||
* read the tilt Tap status
|
||||
* Reads the tiltTap status
|
||||
*
|
||||
* @return true if a tap was detected
|
||||
* @return True if a tap is detected
|
||||
*/
|
||||
bool tiltTap();
|
||||
|
||||
/**
|
||||
* read the tilt Shake status
|
||||
* Reads the tiltShake status
|
||||
*
|
||||
* @return true if a Shake was detected
|
||||
* @return True if a shake is detected
|
||||
*/
|
||||
bool tiltShake();
|
||||
|
||||
/**
|
||||
* Install an Interrupt Service Routine (ISR) to be called when
|
||||
* Installs an interrupt service routine (ISR) to be called when
|
||||
* an interrupt occurs
|
||||
*
|
||||
* @param pin gpio pin to use as interrupt pin
|
||||
* @param fptr function pointer to function to be called on interrupt
|
||||
* @param arg pointer to an object that will be supplied as an
|
||||
* @param pin GPIO pin to use as the interrupt pin
|
||||
* @param fptr Pointer to a function to be called on interrupt
|
||||
* @param arg Pointer to an object to be supplied as an
|
||||
* argument to the ISR.
|
||||
*/
|
||||
void installISR(int pin, void (*isr)(void *), void *arg);
|
||||
|
||||
/**
|
||||
* Uninstall the previously installed Interrupt Service Routine (ISR)
|
||||
* Uninstalls the previously installed ISR
|
||||
*
|
||||
*/
|
||||
void uninstallISR();
|
||||
|
||||
/**
|
||||
* Enable interrupt generation based on the passed interrupt bits.
|
||||
* The bits are a bit mask of the requested MMA7660_INTR_T values.
|
||||
* Note: The device must be in standby mode to set this register.
|
||||
* Enables interrupt generation based on passed interrupt bits.
|
||||
* The bits are a bitmask of the requested MMA7660_INTR_T values.
|
||||
* Note: the device must be in the standby mode to set this register.
|
||||
*
|
||||
* @param ibits set the requested interrupt bits
|
||||
* @return true if successful
|
||||
* @param ibits Sets the requested interrupt bits
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setInterruptBits(uint8_t ibits);
|
||||
|
||||
/**
|
||||
* Set the sampling rate of the sensor. The value supplied must
|
||||
* Sets the sampling rate of the sensor. The value supplied must
|
||||
* be one of the MMA7660_AUTOSLEEP_T values.
|
||||
*
|
||||
* @param sr one of the MMA7660_AUTOSLEEP_T values
|
||||
* @return true if successful
|
||||
* @param sr One of the MMA7660_AUTOSLEEP_T values
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setSampleRate(MMA7660_AUTOSLEEP_T sr);
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MPL3115A2 atmospheric pressure library
|
||||
* @brief MPL3115A2 Atmospheric Pressure Sensor library
|
||||
* @defgroup mpl3115a2 libupm-mpl3115a2
|
||||
* @ingroup freescale i2c pressure
|
||||
*/
|
||||
@ -69,12 +69,12 @@ namespace upm {
|
||||
* @web http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPL3115A2
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for MPL3115A2 chip (Atmospheric Pressure Sensor)
|
||||
* @brief API for the MPL3115A2 Atmospheric Pressure Sensor
|
||||
*
|
||||
* Freescale [MPL3115A2]
|
||||
* Freescale Semiconductor* [MPL3115A2]
|
||||
* (http://cache.freescale.com/files/sensors/doc/data_sheet/MPL3115A2.pdf)
|
||||
* is a high precision, ultra-low power consumption pressure sensor. It has a
|
||||
* range of between 50 and 110 kPa.
|
||||
* is a high-precision, ultra-low power consumption pressure sensor. Its operating
|
||||
* range is 50-110 kPa.
|
||||
*
|
||||
* @image html mpl3115a2.jpg
|
||||
* @snippet mpl3115a2.cxx Interesting
|
||||
@ -84,92 +84,92 @@ class MPL3115A2 {
|
||||
/**
|
||||
* Instantiates an MPL3115A2 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr address of used i2c device
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
* @param mode MPL3115A2 oversampling (6 = 64x)
|
||||
*/
|
||||
MPL3115A2(int bus, int devAddr=MPL3115A2_I2C_ADDRESS, uint8_t mode=6);
|
||||
|
||||
/**
|
||||
* MPL3115A2 object destructor, basicaly it close i2c connection.
|
||||
* MPL3115A2 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~MPL3115A2();
|
||||
|
||||
/**
|
||||
* Test the sensor and try to determine if operating by looking
|
||||
* Tests the sensor and tries to determine if the sensor is operating by looking
|
||||
* for small variations in the value
|
||||
*/
|
||||
int testSensor(void);
|
||||
|
||||
/**
|
||||
* Perform a soft RESET of the MPL3115A2 device to ensure
|
||||
* it is in a known state. This function can be used to reset
|
||||
* Performs a soft reset of the MPL3115A2 device to ensure
|
||||
* it is in a known state. This function can be used to reset
|
||||
* the min/max temperature and pressure values.
|
||||
*/
|
||||
int resetSensor(void);
|
||||
|
||||
/**
|
||||
* Dump out the i2c register block to stdout
|
||||
* Dumps out the I2C register block to stdout
|
||||
*/
|
||||
void dumpSensor(void);
|
||||
|
||||
/**
|
||||
* Initiate a temp/pressure mesasurement and wait for function
|
||||
* to complete. The temp and pressure registers can be read
|
||||
* Initiates a temperature/pressure mesasurement and waits for the function
|
||||
* to complete. Temperature and pressure registers can be read
|
||||
* after this call.
|
||||
*/
|
||||
int sampleData(void);
|
||||
|
||||
/**
|
||||
* Read a pressure value from the mpl3115a2 [Pa * 100]
|
||||
* Reads the pressure value from MPL3115A2 [Pa * 100]
|
||||
*
|
||||
* @param reg base address of pressure register
|
||||
* @param reg Base address of the pressure register
|
||||
*/
|
||||
int32_t getPressureReg(int reg);
|
||||
|
||||
/**
|
||||
* Read a temperature value from the mpl3115a2 [degC * 1000]
|
||||
* Reads the temperature value from MPL3115A2 [degC * 1000]
|
||||
*
|
||||
* @param reg base address of temperature register
|
||||
* @param reg Base address of the temperature register
|
||||
*/
|
||||
int32_t getTempReg(int reg);
|
||||
|
||||
/**
|
||||
* Read the current pressure value from the mpl3115a2 [Pa]
|
||||
* Reads the current pressure value from MPL3115A2 [Pa]
|
||||
*
|
||||
* @param bSampleData Set non-zero to sample reading
|
||||
* @param bSampleData Sets non-zero to a sample reading
|
||||
*/
|
||||
float getPressure(int bSampleData = true);
|
||||
|
||||
/**
|
||||
* Read the current temperature value from the mpl3115a2 [degC]
|
||||
* Reads the current temperature value from MPL3115A2 [degC]
|
||||
*
|
||||
* @param bSampleData Set non-zero to sample reading
|
||||
* @param bSampleData Sets non-zero to a sample reading
|
||||
*/
|
||||
float getTemperature(int bSampleData = true);
|
||||
|
||||
/**
|
||||
* Read the current pressure and using a known altitude calculate
|
||||
* Reads the current pressure and, using a known altitude, calculates
|
||||
* the sea level pressure value [Pa]
|
||||
* This function should be preceeded by the sampleData() call
|
||||
* This function should be preceded by the sampleData() call
|
||||
*
|
||||
* @param altitudeMeters Altitude in meters
|
||||
*/
|
||||
float getSealevelPressure(float altitudeMeters = 0.0);
|
||||
|
||||
/**
|
||||
* Read the current pressure and using a known sea level pressure
|
||||
* calculate the altitude value [m]
|
||||
* This function should be preceeded by the sampleData() call
|
||||
* Reads the current pressure and, using a known sea level pressure,
|
||||
* calculates the altitude value [m]
|
||||
* This function should be preceded by the sampleData() call
|
||||
*
|
||||
* @param sealevelPressure Current sea level pressure
|
||||
*/
|
||||
float getAltitude (float sealevelPressure = 101325.0);
|
||||
|
||||
/**
|
||||
* Set the oversampling setting (ranges from 0 to 7). The
|
||||
* value represents 2^n samples (ranging from 1 to 128). The
|
||||
* time to calculate the sample is approximately (2^n * 4 + 2) mS
|
||||
* Defines the oversampling setting (ranges from 0 to 7). The
|
||||
* value represents 2^n samples (ranging from 1 to 128). The
|
||||
* time to calculate a sample is approximately (2^n * 4 + 2) ms
|
||||
*
|
||||
* @param oversampling New oversampling value
|
||||
*/
|
||||
@ -181,60 +181,60 @@ class MPL3115A2 {
|
||||
uint8_t getOversampling(void);
|
||||
|
||||
/**
|
||||
* Read the maximum measured temperature [degC]
|
||||
* Reads the maximum measured temperature [degC]
|
||||
*/
|
||||
float getTemperatureMax(void);
|
||||
|
||||
/**
|
||||
* Read the minimum measured temperature [degC]
|
||||
* Reads the minimum measured temperature [degC]
|
||||
*/
|
||||
float getTemperatureMin(void);
|
||||
|
||||
/**
|
||||
* Read the maximum measured pressure [Pa]
|
||||
* Reads the maximum measured pressure [Pa]
|
||||
*/
|
||||
float getPressureMax (void);
|
||||
|
||||
/**
|
||||
* Read the minimum measured pressure [Pa]
|
||||
* Reads the minimum measured pressure [Pa]
|
||||
*/
|
||||
float getPressureMin (void);
|
||||
|
||||
/**
|
||||
* Convert temperature from degC*1000 to degF*1000
|
||||
* Converts temperature from degC*1000 to degF*1000
|
||||
*
|
||||
* @param iTemp Temperature in degC
|
||||
*/
|
||||
float convertTempCtoF(float fTemp);
|
||||
|
||||
/**
|
||||
* Convert pressure from Pa*100 to inHg*10000
|
||||
* Converts pressure from Pa*100 to inHg*10000
|
||||
* This is set for 15degC (Pa = 0.0002961 in Hg)
|
||||
* TODO: Change function to add temp calibration
|
||||
* TODO: Change the function to add temperature calibration
|
||||
*
|
||||
* @param iPressure Pressure in Pa
|
||||
*/
|
||||
float convertPaToinHg(float fPressure);
|
||||
|
||||
/**
|
||||
* Write to one byte to i2c register
|
||||
* Writes one byte to an I2C register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param value byte to be written
|
||||
* @param reg Address of the register
|
||||
* @param value Byte to be written
|
||||
*/
|
||||
mraa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
|
||||
|
||||
/**
|
||||
* Read two bytes from i2c registers
|
||||
* Reads two bytes from an I2C register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param reg Address of the register
|
||||
*/
|
||||
uint16_t i2cReadReg_16 (int reg);
|
||||
|
||||
/**
|
||||
* Read one byte register
|
||||
* Reads a one-byte register
|
||||
*
|
||||
* @param reg address of a register
|
||||
* @param reg Address of the register
|
||||
*/
|
||||
uint8_t i2cReadReg_8 (int reg);
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief MPR121 touch sensor library
|
||||
* @brief MPR121 Touch Sensor library
|
||||
* @defgroup mpr121 libupm-mpr121
|
||||
* @ingroup seeed i2c touch tsk
|
||||
*/
|
||||
@ -46,7 +46,7 @@ namespace upm {
|
||||
* @con i2c
|
||||
* @kit tsk
|
||||
*
|
||||
* @brief API for the MPR121 I2C touch sensor
|
||||
* @brief API for the MPR121 I2C Touch Sensor
|
||||
*
|
||||
* UPM module for the MPR121 touch sensor
|
||||
*
|
||||
@ -56,60 +56,60 @@ namespace upm {
|
||||
class MPR121 {
|
||||
public:
|
||||
/**
|
||||
* mpr121 touch sensor constructor
|
||||
* MPR121 constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param bus I2C bus to use
|
||||
*/
|
||||
MPR121(int bus, uint8_t address = MPR121_DEFAULT_I2C_ADDR);
|
||||
|
||||
/**
|
||||
* MPR121 Destructor
|
||||
* MPR121 destructor
|
||||
*/
|
||||
~MPR121();
|
||||
|
||||
/**
|
||||
* Setup a default configuration, based on Application Note 3944
|
||||
* Sets up a default configuration, based on Application Note 3944
|
||||
* (AN3944):
|
||||
* http://cache.freescale.com/files/sensors/doc/app_note/AN3944.pdf
|
||||
*
|
||||
* After configuration, the sensor will be left in the Run State.
|
||||
* After configuration, the sensor is left in the run state.
|
||||
*
|
||||
* @return True if configuration succeeded
|
||||
* @return True if configuration is successful
|
||||
*/
|
||||
bool configAN3944();
|
||||
|
||||
/**
|
||||
* Read the button states into the m_buttonStates member variable. Also
|
||||
* set the m_overCurrentFault variable if an over current is detected.
|
||||
* Reads button states in the m_buttonStates member variable. Also,
|
||||
* sets the m_overCurrentFault variable if overcurrent is detected.
|
||||
*/
|
||||
void readButtons();
|
||||
|
||||
/**
|
||||
* Write value(s) into registers
|
||||
* Writes value(s) into registers
|
||||
*
|
||||
* @param reg register location to start writing into
|
||||
* @param buffer buffer for data storage
|
||||
* @param len number of bytes to write
|
||||
* @param reg Register location to start writing into
|
||||
* @param buffer Buffer for data storage
|
||||
* @param len Number of bytes to write
|
||||
* @return mraa_result_t
|
||||
*/
|
||||
mraa_result_t writeBytes(uint8_t reg, uint8_t *buffer, unsigned int len);
|
||||
|
||||
/**
|
||||
* Read value(s) from registers
|
||||
* Reads value(s) from registers
|
||||
*
|
||||
* @param reg register location to start reading from
|
||||
* @param buffer buffer for data storage
|
||||
* @param len number of bytes to read
|
||||
* @param reg Register location to start reading from
|
||||
* @param buffer Buffer for data storage
|
||||
* @param len Number of bytes to read
|
||||
*/
|
||||
void readBytes(uint8_t reg, uint8_t *buffer, unsigned int len);
|
||||
|
||||
/**
|
||||
* button states
|
||||
* Button states
|
||||
*/
|
||||
uint16_t m_buttonStates;
|
||||
|
||||
/**
|
||||
* Over current fault detected
|
||||
* Overcurrent detected
|
||||
*/
|
||||
bool m_overCurrentFault;
|
||||
|
||||
|
@ -63,27 +63,27 @@ namespace upm {
|
||||
/**
|
||||
* MPU9150 constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param address the address for this device
|
||||
* @param magAddress the address of the connected magnetometer
|
||||
* @param bus I2C bus to use
|
||||
* @param address The address for this device
|
||||
* @param magAddress The address of the connected magnetometer
|
||||
*/
|
||||
MPU9150 (int bus=MPU9150_I2C_BUS, int address=MPU9150_DEFAULT_I2C_ADDR,
|
||||
int magAddress=AK8975_DEFAULT_I2C_ADDR);
|
||||
|
||||
/**
|
||||
* MPU9150 Destructor
|
||||
* MPU9150 destructor
|
||||
*/
|
||||
~MPU9150 ();
|
||||
|
||||
/**
|
||||
* set up initial values and start operation
|
||||
* Set up initial values and start operation
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
bool init();
|
||||
|
||||
/**
|
||||
* take a measurement and store the current sensor values
|
||||
* Take a measurement and store the current sensor values
|
||||
* internally. Note, these user facing registers are only updated
|
||||
* from the internal device sensor values when the i2c serial
|
||||
* traffic is 'idle'. So, if you are reading the values too fast,
|
||||
@ -97,12 +97,12 @@ namespace upm {
|
||||
void update();
|
||||
|
||||
/**
|
||||
* return the compensated values for the x, y, and z axes. The
|
||||
* Return the compensated values for the x, y, and z axes. The
|
||||
* unit of measurement is in micro-teslas (uT).
|
||||
*
|
||||
* @param x pointer to returned X axis value
|
||||
* @param y pointer to returned Y axis value
|
||||
* @param z pointer to returned Z axis value
|
||||
* @param x Pointer to returned X axis value
|
||||
* @param y Pointer to returned Y axis value
|
||||
* @param z Pointer to returned Z axis value
|
||||
*/
|
||||
void getMagnetometer(float *x, float *y, float *z);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MQ303A alcohol sensor library
|
||||
* @brief MQ303A Alcohol Sensor library
|
||||
* @defgroup mq303a libupm-mq303a
|
||||
* @ingroup seeed analog gpio gaseous tsk
|
||||
*/
|
||||
@ -46,10 +46,10 @@ namespace upm {
|
||||
*
|
||||
* @brief API for the MQ303A Alcohol Sensor
|
||||
*
|
||||
* UPM module for the MQ303A Alcohol Sensor.
|
||||
* UPM module for the MQ303A alcohol sensor.
|
||||
* This sensor needs to be warmed up before stable results are
|
||||
* obtained. The higher the value returned from value(),
|
||||
* the higher the amount of alcohol that was detected.
|
||||
* obtained. The higher the value returned from value(),
|
||||
* the higher the amount of alcohol detected.
|
||||
*
|
||||
* @image html mq303a.jpg
|
||||
* @snippet mq303a.cxx Interesting
|
||||
@ -57,31 +57,31 @@ namespace upm {
|
||||
class MQ303A {
|
||||
public:
|
||||
/**
|
||||
* MQ303A sensor constructor
|
||||
* MQ303A constructor
|
||||
*
|
||||
* @param pin analog pin to use
|
||||
* @param heaterPin digital pin mapped to analog pin to use
|
||||
* @param pin Analog pin to use
|
||||
* @param heaterPin Digital pin mapped to the analog pin to use
|
||||
*/
|
||||
MQ303A(int pin, int heaterPin);
|
||||
|
||||
/**
|
||||
* MQ303A Destructor
|
||||
* MQ303A destructor
|
||||
*/
|
||||
~MQ303A();
|
||||
|
||||
/**
|
||||
* Get the alcohol detected from the sensor.
|
||||
* Gets the alcohol reading from the sensor.
|
||||
* The value read from the analog pin is inverted.
|
||||
* A higher returned value means a higher amount of alcohol was detected.
|
||||
* A higher returned value means a higher amount of alcohol detected.
|
||||
*
|
||||
* @return the alcohol reading
|
||||
* @return Alcohol reading
|
||||
*/
|
||||
int value();
|
||||
|
||||
/**
|
||||
* Enable the heater.
|
||||
* Enables the heater
|
||||
*
|
||||
* @param enable if true, enable the heater else disable
|
||||
* @param enable Enables the heater if true; otherwise, disables it
|
||||
*/
|
||||
void heaterEnable(bool enable);
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief MY9221 led bar library
|
||||
* @brief MY9221 LED Bar library
|
||||
* @defgroup my9221 libupm-my9221
|
||||
* @ingroup seeed display gpio eak
|
||||
*/
|
||||
@ -53,7 +53,7 @@ namespace upm {
|
||||
* @con gpio
|
||||
* @kit eak
|
||||
*
|
||||
* @brief API for MY9221 based LED bars
|
||||
* @brief API for MY9221-based LED Bars
|
||||
*
|
||||
* This file defines the MY9221 interface for libmy9221
|
||||
*
|
||||
@ -64,10 +64,10 @@ namespace upm {
|
||||
class MY9221 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a MY9221 object
|
||||
* Instantiates an MY9221 object
|
||||
*
|
||||
* @param di data pin
|
||||
* @param dcki clock pin
|
||||
* @param di Data pin
|
||||
* @param dcki Clock pin
|
||||
*/
|
||||
MY9221 (uint8_t di, uint8_t dcki);
|
||||
|
||||
@ -77,15 +77,15 @@ class MY9221 {
|
||||
~MY9221 ();
|
||||
|
||||
/**
|
||||
* Set the level bar
|
||||
* Sets the bar level
|
||||
*
|
||||
* @param level selected level for the bar (1 - 10)
|
||||
* @param direction up or down, true is up and is the default
|
||||
* @param level Selected level for the bar (1 - 10)
|
||||
* @param direction Up or down; up is true and default
|
||||
*/
|
||||
mraa_result_t setBarLevel (uint8_t level, bool direction=true);
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ typedef enum {
|
||||
} power_t;
|
||||
|
||||
/**
|
||||
* @brief NRF24L01 transceiver library
|
||||
* @brief NRF24L01 Transceiver library
|
||||
* @defgroup nrf24l01 libupm-nrf24l01
|
||||
* @ingroup seeed sparkfun spi wifi
|
||||
*/
|
||||
@ -164,9 +164,9 @@ typedef enum {
|
||||
* @web http://www.seeedstudio.com/depot/nRF24L01Module-p-1394.html
|
||||
* @con spi
|
||||
*
|
||||
* @brief API for NRF24L01 transceiver module
|
||||
* @brief API for the NRF24L01 Transceiver Module
|
||||
*
|
||||
* This file defines the NRF24l01 interface for libnrf24l01
|
||||
* This file defines the NRF24L01 interface for libnrf24l01
|
||||
*
|
||||
* @image html nrf24l01.jpg
|
||||
* @snippet nrf24l01-receiver.cxx Interesting
|
||||
@ -176,9 +176,9 @@ typedef enum {
|
||||
class NRF24L01 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a NRF24l01 object
|
||||
* Instantiates an NRF24l01 object
|
||||
*
|
||||
* @param cs chip select pin
|
||||
* @param cs Chip select pin
|
||||
*/
|
||||
NRF24L01 (uint8_t cs, uint8_t ce);
|
||||
|
||||
@ -188,7 +188,7 @@ class NRF24L01 {
|
||||
~NRF24L01 ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -196,104 +196,104 @@ class NRF24L01 {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize needed Gpio pins and SPI interface
|
||||
* Initializes needed GPIO pins and SPI
|
||||
*
|
||||
* @param chipSelect setting up the chip select pin
|
||||
* @param chipEnable setting up the chip enable pin
|
||||
* @param chipSelect Sets up the chip select pin
|
||||
* @param chipEnable Sets up the chip enable pin
|
||||
*/
|
||||
void init (uint8_t chipSelect, uint8_t chipEnable);
|
||||
|
||||
/**
|
||||
* Configure NRF24l01 chip
|
||||
* Configures the NRF24L01 transceiver
|
||||
*/
|
||||
void configure ();
|
||||
|
||||
/**
|
||||
* Send the buffer data
|
||||
* Sends the buffer data
|
||||
*
|
||||
* @param *value pointer to the buffer
|
||||
* @param *value Pointer to the buffer
|
||||
*/
|
||||
void send (uint8_t * value);
|
||||
|
||||
/**
|
||||
* Send the data located in inner bufer, user must fill the
|
||||
* Sends the data located in an inner bufer; the user must fill the
|
||||
* m_txBuffer buffer
|
||||
*/
|
||||
void send ();
|
||||
|
||||
/**
|
||||
* Set recieving address of the device
|
||||
* Sets a receiving address of the device
|
||||
*
|
||||
* @param addr 5 bytes addres
|
||||
* @param addr 5-byte address
|
||||
*/
|
||||
void setSourceAddress (uint8_t * addr);
|
||||
|
||||
/**
|
||||
* Set recipient address. nrfSend method will send the data buffer
|
||||
* Sets a recipient address. The nrfSend method sends the data buffer
|
||||
* to this address
|
||||
*
|
||||
* @param addr 5 bytes addres
|
||||
* @param addr 5-byte address
|
||||
*/
|
||||
void setDestinationAddress (uint8_t * addr);
|
||||
|
||||
/**
|
||||
* Set broadcasting address.
|
||||
* Sets a broadcasting address
|
||||
*
|
||||
* @param addr 5 bytes addres
|
||||
* @param addr 5-byte address
|
||||
*/
|
||||
void setBroadcastAddress (uint8_t * addr);
|
||||
|
||||
/**
|
||||
* Set payload size.
|
||||
* Sets the payload size
|
||||
*
|
||||
* @param load size of the payload (MAX 32)
|
||||
* @param load Size of the payload (MAX 32)
|
||||
*/
|
||||
void setPayload (uint8_t load);
|
||||
|
||||
/**
|
||||
* Check if data arrived
|
||||
* Checks if the data has arrived
|
||||
*/
|
||||
bool dataReady ();
|
||||
|
||||
/**
|
||||
* Check if chip in sending mode
|
||||
* Checks if the transceiver is in the sending mode
|
||||
*/
|
||||
bool dataSending ();
|
||||
|
||||
/**
|
||||
* Sink all arrived data into the provided buffer
|
||||
* Sinks all the arrived data into a provided buffer
|
||||
*
|
||||
* @param load size of the payload (MAX 32)
|
||||
* @param load Size of the payload (MAX 32)
|
||||
*/
|
||||
void getData (uint8_t * data);
|
||||
|
||||
/**
|
||||
* Check the chip state
|
||||
* Checks the transceiver state
|
||||
*/
|
||||
uint8_t getStatus ();
|
||||
|
||||
/**
|
||||
* Check if recieving stack is empty
|
||||
* Checks if the receive stack is empty
|
||||
*/
|
||||
bool rxFifoEmpty ();
|
||||
|
||||
/**
|
||||
* Power up reciever
|
||||
* Powers the receiver up
|
||||
*/
|
||||
void rxPowerUp ();
|
||||
|
||||
/**
|
||||
* Flush reciver stack
|
||||
* Flushes the receive stack
|
||||
*/
|
||||
void rxFlushBuffer ();
|
||||
|
||||
/**
|
||||
* Power up transmitter
|
||||
* Powers the transmitter up
|
||||
*/
|
||||
void txPowerUp ();
|
||||
|
||||
/**
|
||||
* Power down all
|
||||
* Powers everything down
|
||||
*/
|
||||
void powerDown ();
|
||||
|
||||
@ -304,77 +304,77 @@ class NRF24L01 {
|
||||
uint8_t setSpeedRate (speed_rate_t rate);
|
||||
|
||||
/**
|
||||
* Flush transmit stack
|
||||
* Flushes the transmit stack
|
||||
*/
|
||||
void txFlushBuffer ();
|
||||
|
||||
/**
|
||||
* Pulling method which listenning for arrived data, if data
|
||||
* arrived dataRecievedHandler will be triggered
|
||||
* Pulling the method listening for the arrived data,
|
||||
* dataRecievedHandler is triggered if data arrives
|
||||
*/
|
||||
void pollListener ();
|
||||
|
||||
/**
|
||||
* Set chip enable pin HIGH
|
||||
* Sets the chip enable pin to HIGH
|
||||
*/
|
||||
mraa_result_t ceHigh ();
|
||||
|
||||
/**
|
||||
* Set chip enable LOW
|
||||
* Sets the chip enable pin to LOW
|
||||
*/
|
||||
mraa_result_t ceLow ();
|
||||
|
||||
/**
|
||||
* Set chip select pin LOW
|
||||
* Sets the chip select pin to LOW
|
||||
*/
|
||||
mraa_result_t csOn ();
|
||||
|
||||
/**
|
||||
* Set chip select pin HIGH
|
||||
* Sets the chip select pin to HIGH
|
||||
*/
|
||||
mraa_result_t csOff ();
|
||||
|
||||
/**
|
||||
* Configure nRF24l01 module to behave as BLE
|
||||
* Configures the NRF24L01 transceiver to behave as a BLE
|
||||
* (Bluetooth Low Energy) beaconing devcie.
|
||||
*/
|
||||
void setBeaconingMode ();
|
||||
|
||||
/**
|
||||
* Beaconing the provided message to BLE scanners.
|
||||
* Beacons the provided message to BLE scanners.
|
||||
*
|
||||
* @param msg beacon the provated message (max length is 16 bytes)
|
||||
* @param msg Beacons the provided message (max length is 16 bytes)
|
||||
*/
|
||||
void sendBeaconingMsg (uint8_t * msg);
|
||||
|
||||
uint8_t m_rxBuffer[MAX_BUFFER]; /**< Reciver buffer */
|
||||
uint8_t m_rxBuffer[MAX_BUFFER]; /**< Receive buffer */
|
||||
uint8_t m_txBuffer[MAX_BUFFER]; /**< Transmit buffer */
|
||||
uint8_t m_bleBuffer [32]; /**< BLE buffer */
|
||||
|
||||
funcPtrVoidVoid dataRecievedHandler; /**< Data arrived handler */
|
||||
private:
|
||||
/**
|
||||
* Write bytes to the SPI device.
|
||||
* Writes bytes to an SPI device
|
||||
*/
|
||||
void writeBytes (uint8_t * dataout, uint8_t * datain, uint8_t len);
|
||||
/**
|
||||
* Set register value on SPI device. [one byte]
|
||||
* Sets the register value on an SPI device [one byte]
|
||||
*/
|
||||
void setRegister (uint8_t reg, uint8_t value);
|
||||
/**
|
||||
* Get register value from SPI device. [one byte]
|
||||
* Gets the register value from an SPI device [one byte]
|
||||
*/
|
||||
uint8_t getRegister (uint8_t reg);
|
||||
/**
|
||||
* Reads an array of bytes from the given start position in the nrf24l01 registers.
|
||||
* Reads an array of bytes from the given starting position in NRF24L01 registers
|
||||
*/
|
||||
void readRegister (uint8_t reg, uint8_t * value, uint8_t len);
|
||||
/**
|
||||
* Writes an array of bytes into inte the nrf24l01 registers.
|
||||
* Writes an array of bytes into NRF24L01 registers
|
||||
*/
|
||||
void writeRegister (uint8_t reg, uint8_t * value, uint8_t len);
|
||||
/**
|
||||
* Send command to the nrf24l01.
|
||||
* Sends a command to NRF24L01
|
||||
*/
|
||||
void sendCommand (uint8_t cmd);
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief NRF8001 bluetooth low energy library
|
||||
* @brief NRF8001 Bluetooth Low Energy library
|
||||
* @defgroup nrf8001 libupm-nrf8001
|
||||
* @ingroup adafruit wifi analog gpio spi
|
||||
*/
|
||||
@ -36,12 +36,12 @@
|
||||
* @web https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/introduction
|
||||
* @con spi gpio analog
|
||||
*
|
||||
* @brief nrf8001 Bluetooth Low Energy library
|
||||
* @brief NRF8001 Bluetooth Low Energy library
|
||||
*
|
||||
* These files define the NRF8001 interface for lib-nrf8001. Interaction
|
||||
* with this device is done through the ACI routines included with the library.
|
||||
* You can use the nRF UART app in the Apple iOS app store and Google Play for
|
||||
* Android 4.3 for Samsung Galaxy S4 to interact with a microcontroller running
|
||||
* You can use the nRF UART app in Apple* App Store and Google* Play* on
|
||||
* Samsung* Galaxy S*4 running Android* 4.3 to interact with a microcontroller running
|
||||
* the 'hello world' example.
|
||||
*
|
||||
* @image html nrf8001.jpg
|
||||
|
@ -31,33 +31,33 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief Wii Nunchuck library
|
||||
* @brief Wii Nunchuk library
|
||||
* @defgroup nunchuck libupm-nunchuck
|
||||
* @ingroup generic i2c accelerometer robok
|
||||
*/
|
||||
/**
|
||||
* @library nunchuck
|
||||
* @sensor nunchuck
|
||||
* @comname Wii Nunchuck
|
||||
* @comname Wii Nunchuk
|
||||
* @type accelerometer
|
||||
* @man generic
|
||||
* @web http://wiibrew.org/wiki/Wiimote/Extension_Controllers
|
||||
* @con i2c
|
||||
* @kit robok
|
||||
*
|
||||
* @brief API for the Wii Nunchuck
|
||||
* @brief API for the Wii* Nunchuk controller
|
||||
*
|
||||
* UPM module for the Wii Nunchuck. This module was tested with the
|
||||
* Wii Nunchuck connected to I2C via a Grove Wii Nunchuck adapter.
|
||||
* UPM module for the Wii Nunchuk controller. This module was tested with
|
||||
* Wii Nunchuk connected to I2C via a Grove Wii Nunchuk adapter.
|
||||
*
|
||||
* See http://wiibrew.org/wiki/Wiimote/Extension_Controllers and
|
||||
* http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck
|
||||
* for more detailed information on the controller and it's protocol.
|
||||
* for more details on the controller and its protocol.
|
||||
*
|
||||
* A warning for the Grove nunchuck adapter: It has 2 traces on one
|
||||
* A warning for the Grove Wii Nunchuk adapter: it has 2 traces on one
|
||||
* side, and 3 traces on the other. Do not match these up with the
|
||||
* nunchuck connector's traces. The nunchuck connector 'groove'
|
||||
* should be on the same side as the grove interface socket on the
|
||||
* Nunchuk connector's traces. The connector's 'Grove'
|
||||
* should be on the same side as the Grove interface socket on the
|
||||
* adapter.
|
||||
*
|
||||
* @image html nunchuck.jpg
|
||||
@ -68,8 +68,8 @@ namespace upm {
|
||||
/**
|
||||
* NUNCHUCK constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param addr i2c address to use
|
||||
* @param bus I2C bus to use
|
||||
* @param addr I2C address to use
|
||||
*/
|
||||
NUNCHUCK(int bus, uint8_t addr=NUNCHUCK_I2C_ADDR);
|
||||
|
||||
@ -79,34 +79,34 @@ namespace upm {
|
||||
~NUNCHUCK();
|
||||
|
||||
/**
|
||||
* Write value(s) into registers
|
||||
* Writes value(s) into registers
|
||||
*
|
||||
* @param reg register location to start writing into
|
||||
* @param byte byte to write
|
||||
* @return true if successful
|
||||
* @param reg Register location to start writing into
|
||||
* @param byte Byte to write
|
||||
* @return True if successful
|
||||
*/
|
||||
bool writeByte(uint8_t reg, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Read value(s) from registers
|
||||
* Reads value(s) from registers
|
||||
*
|
||||
* @param reg register location to start reading from
|
||||
* @param buffer buffer for data storage
|
||||
* @param len number of bytes to read
|
||||
* @return number of bytes read
|
||||
* @param reg Register location to start reading from
|
||||
* @param buffer Buffer for data storage
|
||||
* @param len Number of bytes to read
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
uint8_t readBytes(uint8_t reg, uint8_t *buffer, unsigned int len);
|
||||
|
||||
/**
|
||||
* Initialize the controller. Here, we disable encryption after
|
||||
* Initializes the controller. Here, we disable encryption after
|
||||
* delaying for a time to ensure the controller is ready.
|
||||
*
|
||||
* @return true if initialized successfully
|
||||
* @return True if initialization is successful
|
||||
*/
|
||||
bool init();
|
||||
|
||||
/**
|
||||
* Read and update the current state of the controller.
|
||||
* Reads and updates the current state of the controller.
|
||||
*
|
||||
*/
|
||||
void update();
|
||||
|
@ -45,24 +45,24 @@ namespace upm {
|
||||
*
|
||||
* @brief API for the OTP538U IR Temperature Sensor
|
||||
*
|
||||
* UPM module for the OTP538U IR Temperature Sensor
|
||||
* UPM module for the OTP538U IR temperature sensor
|
||||
*
|
||||
* This module was tested with the Grove IR non-contact temperature
|
||||
* sensor.
|
||||
*
|
||||
* The sensor provides 2 analog outputs - one for the thermistor
|
||||
* that measures ambient temperature, and another for the thermopile
|
||||
* that measures object temperature.
|
||||
* The sensor provides 2 analog outputs: one for the thermistor
|
||||
* that measures the ambient temperature, and the other for the thermopile
|
||||
* that measures the object temperature.
|
||||
*
|
||||
* Much of the code depends on analyzing the SeeedStudio examples
|
||||
* and circuit design. As a result, there are several 'magic'
|
||||
* numbers that were derived from their circuit design. By default,
|
||||
* these values will be used.
|
||||
* Much of the code depends on analyzing Seeed Studio* examples
|
||||
* and the circuit design. As a result, there are several 'magic'
|
||||
* numbers derived from their circuit design. These values are used
|
||||
* by default.
|
||||
*
|
||||
* The tables used came from the datasheets "538U VT
|
||||
* Table__20_200(v1.3).pdf" and "538RT_table.pdf".
|
||||
* The tables used came from the "538U VT
|
||||
* Table__20_200(v1.3).pdf" and "538RT_table.pdf" datasheets.
|
||||
*
|
||||
* These tables assume the object to be measured is 9cm (3.54
|
||||
* These tables assume the object to be measured is 9 cm (3.54
|
||||
* inches) from the sensor.
|
||||
*
|
||||
* @image html otp538u.jpg
|
||||
@ -71,71 +71,71 @@ namespace upm {
|
||||
class OTP538U {
|
||||
public:
|
||||
/**
|
||||
* OTP538U sensor constructor
|
||||
* OTP538U constructor
|
||||
*
|
||||
* @param pinA analog pin to use for Ambient temperature
|
||||
* @param pinO analog pin to use for Object temperature
|
||||
* @param aref analog reference voltage, default 5.0
|
||||
* @param pinA Analog pin to use for the ambient temperature
|
||||
* @param pinO Analog pin to use for the object temperature
|
||||
* @param aref Analog reference voltage; default is 5.0 V
|
||||
*/
|
||||
OTP538U(int pinA, int pinO, float aref = 5.0);
|
||||
|
||||
/**
|
||||
* OTP538U Destructor
|
||||
* OTP538U destructor
|
||||
*/
|
||||
~OTP538U();
|
||||
|
||||
/**
|
||||
* Get the ambient temperature in C
|
||||
* Gets the ambient temperature in Celsius
|
||||
*
|
||||
* @return the ambient temperature
|
||||
* @return Ambient temperature
|
||||
*/
|
||||
float ambientTemperature();
|
||||
|
||||
/**
|
||||
* Get the object temperature in C
|
||||
* Gets the object temperature in Celsius
|
||||
*
|
||||
* @return the object's temperature
|
||||
* @return Object temperature
|
||||
*/
|
||||
float objectTemperature();
|
||||
|
||||
/**
|
||||
* Set the offset voltage
|
||||
* Sets the offset voltage
|
||||
*
|
||||
* The Seeedstudio wiki gives an example on calibrating the sensor
|
||||
* and calculating the offset voltage to apply. Currently, the
|
||||
* The Seeed Studio wiki gives an example of calibrating the sensor
|
||||
* and calculating the offset voltage to apply. Currently, the
|
||||
* default value is set, but you can use the function to set one
|
||||
* of your own.
|
||||
*
|
||||
* @param vOffset the desired offset voltage
|
||||
* @param vOffset Desired offset voltage
|
||||
*/
|
||||
void setVoltageOffset(float vOffset) { m_offsetVoltage = vOffset; };
|
||||
|
||||
/**
|
||||
* Set the output resistance value
|
||||
* Sets the output resistance value
|
||||
*
|
||||
* The Seeedstudio wiki example uses a value, 2000000 in one of
|
||||
* the equations used to calculate a voltage. The value is the
|
||||
* The Seeed Studio wiki example uses a value of 2,000,000 in one of
|
||||
* the equations used to calculate voltage. The value is the
|
||||
* resistance of a resistor they use in the output stage of their
|
||||
* SIG2 output. This was 'decoded' by looking at the eagle files
|
||||
* SIG2 output. This was 'decoded' by looking at the EAGLE* files
|
||||
* containing their schematics for this device.
|
||||
*
|
||||
* @param outResistance value of output resistor, default 2M Ohm.
|
||||
* @param outResistance Value of the output resistor; default is 2M Ohm
|
||||
*/
|
||||
void setOutputResistence(int outResistance) {
|
||||
m_vResistance = outResistance; };
|
||||
|
||||
/**
|
||||
* Set the voltage reference of the internal seedstudio voltage
|
||||
* Sets the reference voltage of the internal Seeed Studio voltage
|
||||
* regulator on the sensor board.
|
||||
*
|
||||
* The Seeedstudio wiki example uses a value, 2.5 in one of the
|
||||
* The Seeed Studio wiki example uses a value of 2.5 in one of the
|
||||
* equations used to calculate the resistance of the ambient
|
||||
* thermistor. The value is the voltage of an internal voltage
|
||||
* regulator used in the sensor board. This was 'decoded' by
|
||||
* looking at the eagle files containing their schematics for this
|
||||
* thermistor. The value is the voltage of an internal voltage
|
||||
* regulator used on the sensor board. This was 'decoded' by
|
||||
* looking at the EAGLE files containing their schematics for this
|
||||
* device.
|
||||
*
|
||||
* @param vref internal sensor voltage reference, default 2.5
|
||||
* @param vref Reference voltage of the internal sensor; default is 2.5 V
|
||||
*/
|
||||
void setVRef(float vref) { m_vref = vref; };
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// This table was taken from the 538RT_table.pdf datasheet. It maps
|
||||
// This table was taken from the '538RT_table.pdf' datasheet. It maps
|
||||
// resistance values to ambient temperatures starting at -20C and
|
||||
// going to 200C in increments of 1C
|
||||
// going up to 200C in increments of 1C
|
||||
|
||||
static const int otp538u_rt_table_max = 121;
|
||||
|
||||
|
@ -22,12 +22,12 @@
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// This table was taken from the 538U VT Table__20_200(v1.3).pdf
|
||||
// This table was taken from the '538U VT Table__20_200(v1.3).pdf'
|
||||
// datasheet, but the 25C column has been removed for consistency.
|
||||
|
||||
static const int otp538u_vt_table_max = 23;
|
||||
|
||||
// Thermister temperature (C)
|
||||
// Thermistor temperature (C)
|
||||
// { -20 -10 0 10 20 30 40 50 60 70 80 90 100 }
|
||||
|
||||
static float otp538u_vt_table[otp538u_vt_table_max][13] = {
|
||||
|
@ -39,7 +39,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief PCA9685 PWM controller library
|
||||
* @brief PCA9685 PWM Controller library
|
||||
* @defgroup pca9685 libupm-pca9685
|
||||
* @ingroup adafruit i2c led motor
|
||||
*/
|
||||
@ -52,10 +52,10 @@ namespace upm {
|
||||
* @web http://www.adafruit.com/products/815
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for the PCA9685 16 channel, 12 bit pwm LED controller
|
||||
* @brief API for the PCA9685 16-channel, 12-bit PWM LED Controller
|
||||
*
|
||||
* This controller is also used on the Adafruit Motor Shield v2.3
|
||||
* board to control up to 4 DC motors, 2 step motors and 2 servo
|
||||
* This controller is also used on the Adafruit* Motor Shield v2.3
|
||||
* board to control up to 4 DC motors, 2 stepper motors, and 2 servo
|
||||
* motors.
|
||||
*
|
||||
* This module was tested with the Adafruit Motor Shield v2.3
|
||||
@ -178,137 +178,136 @@ namespace upm {
|
||||
} PCA9685_MODE2_T;
|
||||
|
||||
/**
|
||||
* pca9685 constructor
|
||||
* PCA9685 constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param address the address for this device
|
||||
* @param bus I2C bus to use
|
||||
* @param address Address for this device
|
||||
*/
|
||||
PCA9685(int bus, uint8_t address = PCA9685_DEFAULT_I2C_ADDR);
|
||||
|
||||
/**
|
||||
* PCA9685 Destructor
|
||||
* PCA9685 destructor
|
||||
*/
|
||||
~PCA9685();
|
||||
|
||||
/**
|
||||
* Write byte value into register
|
||||
* Writes a byte value into a register
|
||||
*
|
||||
* @param reg register location to write into
|
||||
* @param byte byte to write
|
||||
* @return true if successful
|
||||
* @param reg Register location to write into
|
||||
* @param byte Byte to write
|
||||
* @return True if successful
|
||||
*/
|
||||
bool writeByte(uint8_t reg, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Write word value at register. Note, the device must have the
|
||||
* Writes a word value into a register. Note: the device must have the
|
||||
* auto-increment bit set in the MODE1 register to work.
|
||||
*
|
||||
* @param reg register location to write into
|
||||
* @param word word to write
|
||||
* @return true if successful
|
||||
* @param reg Register location to write into
|
||||
* @param word Word to write
|
||||
* @return True if successful
|
||||
*/
|
||||
bool writeWord(uint8_t reg, uint16_t word);
|
||||
|
||||
/**
|
||||
* Read byte value from register
|
||||
* Reads a byte value from a register
|
||||
*
|
||||
* @param reg register location to read from
|
||||
* @return value at specified register
|
||||
* @param reg Register location to read from
|
||||
* @return Value in a specified register
|
||||
*/
|
||||
uint8_t readByte(uint8_t reg);
|
||||
|
||||
/**
|
||||
* Read word value from register. Note, the device must have the
|
||||
* Reads a word value from a register. Note: the device must have the
|
||||
* auto-increment bit set in the MODE1 register to work.
|
||||
*
|
||||
* @param reg register location to read from
|
||||
* @return value at specified register
|
||||
* @param reg Register location to read from
|
||||
* @return Value in a specified register
|
||||
*/
|
||||
uint16_t readWord(uint8_t reg);
|
||||
|
||||
/**
|
||||
* Put the device into or out of Sleep mode. The device is always
|
||||
* in sleep mode upon power up.
|
||||
* Puts the device in or out of the sleep mode. The device is always
|
||||
* in the sleep mode upon power-up.
|
||||
*
|
||||
* @param sleep true to put into sleep mode, false to take out of
|
||||
* sleep mode.
|
||||
* @return true if successful
|
||||
* @param sleep True to put the device in the sleep mode, false to put out
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setModeSleep(bool sleep);
|
||||
|
||||
/**
|
||||
* set or clear the FULL ON bit for a given LED
|
||||
* Sets or clears the FULL ON bit for a given LED
|
||||
*
|
||||
* @param led led number, valid values: 0-15, PCA9685_ALL_LED
|
||||
* @param val true to set the bit, false to clear it
|
||||
* @return true if successful
|
||||
* @param led LED number; valid values are 0-15, PCA9685_ALL_LED
|
||||
* @param val True to set the bit, false to clear it
|
||||
* @return True if successful
|
||||
*/
|
||||
bool ledFullOn(uint8_t led, bool val);
|
||||
|
||||
/**
|
||||
* set or clear the FULL OFF bit for a given LED. If the FULL ON
|
||||
* bit is also set, then FULL OFF has precendence.
|
||||
* Sets or clears the FULL OFF bit for a given LED. If the FULL ON
|
||||
* bit is also set, FULL OFF has precedence.
|
||||
*
|
||||
* @param led led number, valid values: 0-15, PCA9685_ALL_LED
|
||||
* @param val true to set the bit, false to clear it
|
||||
* @return true if successful
|
||||
* @param led LED number; valid values are 0-15, PCA9685_ALL_LED
|
||||
* @param val True to set the bit, false to clear it
|
||||
* @return True if successful
|
||||
*/
|
||||
bool ledFullOff(uint8_t led, bool val);
|
||||
|
||||
/**
|
||||
* set the LED on time (0-4095). See the pca9685 datasheet for details.
|
||||
* Sets the 'LED on' time (0-4,095). See the PCA9685 datasheet for details.
|
||||
*
|
||||
* @param led led number, valid values: 0-15, PCA9685_ALL_LED
|
||||
* @param time the 12 bit value at which point the LED will turn on
|
||||
* @return true if successful
|
||||
* @param led LED number; valid values are 0-15, PCA9685_ALL_LED
|
||||
* @param time 12-bit value at which point the LED turns on
|
||||
* @return True if successful
|
||||
*/
|
||||
bool ledOnTime(uint8_t led, uint16_t time);
|
||||
|
||||
/**
|
||||
* set the LED off time (0-4095). See the pca9685 datasheet for details.
|
||||
* Sets the 'LED off' time (0-4,095). See the PCA9685 datasheet for details.
|
||||
*
|
||||
* @param led led number, valid values: 0-15, PCA9685_ALL_LED
|
||||
* @param time the 12 bit value at which point the LED will turn off
|
||||
* @return true if successful
|
||||
* @param led LED number; valid values are 0-15, PCA9685_ALL_LED
|
||||
* @param time 12-bit value at which point the LED turns off
|
||||
* @return True if successful
|
||||
*/
|
||||
bool ledOffTime(uint8_t led, uint16_t time);
|
||||
|
||||
/**
|
||||
* set the prescale value. See the pca9685 datasheet for
|
||||
* Sets the prescale value. See the PCA9685 datasheet for
|
||||
* details. The prescale can only be set when the device is in
|
||||
* sleep mode.
|
||||
* the sleep mode.
|
||||
*
|
||||
* @param prescale the prescale value
|
||||
* @return true if successful
|
||||
* @param prescale Prescale value
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setPrescale(uint8_t prescale);
|
||||
|
||||
/**
|
||||
* set the prescale value based on a desired frequency in hz. The
|
||||
* prescale can only be set when the device is in sleep mode.
|
||||
* Sets the prescale value based on a desired frequency in Hz. The
|
||||
* prescale can only be set when the device is in the sleep mode.
|
||||
*
|
||||
* @param hz the desired frequency in hz
|
||||
* @param oscFreq the oscillator frequency, defaul 25Mhz
|
||||
* @return true if successful
|
||||
* @param hz Desired frequency in Hz
|
||||
* @param oscFreq Oscillator frequency; default is 25 MHz
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setPrescaleFromHz(float hz,
|
||||
float oscFreq=PCA9685_INTERNAL_OSC);
|
||||
|
||||
/**
|
||||
* enable or disable the RESTART capability of the controller
|
||||
* Enables or disables the restart capability of the controller
|
||||
*
|
||||
* @param enabled true to enable restart, false to disable.
|
||||
* Default is enabled.
|
||||
* @param enabled True to enable, false to disable
|
||||
* It is enabled by default.
|
||||
*/
|
||||
void enableRestart(bool enabled) { m_restartEnabled = enabled; };
|
||||
|
||||
private:
|
||||
/**
|
||||
* Enable I2C register auto-increment. This needs to be enabled
|
||||
* for write/readWord() to work. The contructor enables this by
|
||||
* Enables the I2C register auto-increment. This needs to be enabled
|
||||
* for write/readWord() to work. The contructor enables this by
|
||||
* default.
|
||||
*
|
||||
* @param ai true to enable auto-increment of i2c regs, false otherwise
|
||||
* @param ai True to enable, false otherwise
|
||||
*/
|
||||
bool enableAutoIncrement(bool ai);
|
||||
|
||||
|
@ -37,7 +37,7 @@ typedef struct
|
||||
} dustData;
|
||||
|
||||
/**
|
||||
* @brief PPD42NS dust sensor library
|
||||
* @brief PPD42NS Dust Sensor library
|
||||
* @defgroup ppd42ns libupm-ppd42ns
|
||||
* @ingroup seeed gpio other eak
|
||||
*/
|
||||
@ -52,9 +52,9 @@ typedef struct
|
||||
* @con gpio
|
||||
* @kit eak
|
||||
*
|
||||
* @brief API for the Dust Sensor
|
||||
* @brief API for the PPD42NS Dust Sensor
|
||||
*
|
||||
* UPM module for the Dust Sensor
|
||||
* UPM module for the PPD42NS dust sensor
|
||||
*
|
||||
* @image html ppd42ns.jpg
|
||||
* @snippet ppd42ns.cxx Interesting
|
||||
@ -62,28 +62,28 @@ typedef struct
|
||||
class PPD42NS {
|
||||
public:
|
||||
/**
|
||||
* Dust Sensor Constructor
|
||||
* PPD42NS constructor
|
||||
*
|
||||
* @param pin digital pin to use
|
||||
* @param pin Digital pin to use
|
||||
*/
|
||||
PPD42NS(int pin);
|
||||
/**
|
||||
* Dust Sensor Destructor
|
||||
* PPD42NS destructor
|
||||
*/
|
||||
~PPD42NS();
|
||||
/**
|
||||
* Print dust concentration
|
||||
* Prints dust concentration
|
||||
*
|
||||
* @return struct dustData contains data from dust sensor
|
||||
* @return struct dustData Contains data from the dust sensor
|
||||
*/
|
||||
dustData getData();
|
||||
|
||||
private:
|
||||
mraa_gpio_context m_gpio;
|
||||
/**
|
||||
* Return the amount of time it takes a pin to go from HIGH to LOW or LOW to HIGH
|
||||
* Returns the amount of time it takes a pin to go from HIGH to LOW or from LOW to HIGH
|
||||
*
|
||||
* @param highLowValue int do we measure from HIGH to LOW or LOW to HIGH. highLowValue is "from" value
|
||||
* @param highLowValue int Do we measure movements from HIGH to LOW or from LOW to HIGH? highLowValue is the "from" value
|
||||
*/
|
||||
double pulseIn_polyfill(bool highLowValue, double endTime);
|
||||
double m_timediff(timespec time1, timespec time2);
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define FALSE LOW
|
||||
|
||||
/**
|
||||
* @brief pulsensor pulse sensor library
|
||||
* @brief Pulsensor Pulse Sensor library
|
||||
* @defgroup pulsensor libupm-pulsensor
|
||||
* @ingroup seeed analog medical
|
||||
*/
|
||||
@ -53,9 +53,9 @@
|
||||
* @web http://www.adafruit.com/products/1093
|
||||
* @con analog
|
||||
*
|
||||
* @brief C++ API for 3-wire pulse sensor
|
||||
* @brief C++ API for the 3-Wire Pulse Sensor
|
||||
*
|
||||
* This is a library for the 3-wire pulse sensor sold by several manufacturers.
|
||||
* This is a library for a 3-wire pulse sensor sold by several manufacturers.
|
||||
* Usually, you can identify the sensor based on the round breakout and the
|
||||
* distinctive heart symbol.
|
||||
*
|
||||
@ -68,7 +68,7 @@
|
||||
* @brief callback data
|
||||
*/
|
||||
struct clbk_data {
|
||||
int is_heart_beat; /**< heart beat check */
|
||||
int is_heart_beat; /**< heartbeat check */
|
||||
};
|
||||
|
||||
typedef void (* callback_handler) (clbk_data);
|
||||
@ -80,7 +80,7 @@ typedef void (* callback_handler) (clbk_data);
|
||||
struct pulsensor_context {
|
||||
pthread_t sample_thread; /**< Thread for the code sample */
|
||||
uint32_t sample_counter; /**< Counter for the code sample */
|
||||
uint32_t last_beat_time; /**< Last heart beat time */
|
||||
uint32_t last_beat_time; /**< Last heartbeat time */
|
||||
int threshold; /**< Threshold */
|
||||
int ibi_rate[10]; /**< ibi rate */
|
||||
int ibi; /**< ibi */
|
||||
@ -90,8 +90,8 @@ struct pulsensor_context {
|
||||
int apmlitude; /**< Amplitude */
|
||||
uint8_t qs; /**< qs */
|
||||
uint8_t is_pulse; /**< Is pulse check */
|
||||
uint8_t first_beat; /**< First heart beat */
|
||||
uint8_t second_beat; /**< Second heart beat */
|
||||
uint8_t first_beat; /**< First heartbeat */
|
||||
uint8_t second_beat; /**< Second heartbeat */
|
||||
uint8_t pin; /**< Pin */
|
||||
uint8_t ret; /**< Return value */
|
||||
mraa_aio_context pin_ctx; /**< The pin context */
|
||||
|
@ -44,11 +44,11 @@ namespace upm {
|
||||
* @con gpio
|
||||
* @kit robok tsk
|
||||
*
|
||||
* @brief API for the RFR359F based Grove Distance Interrupter.
|
||||
* @brief API for the RFR359F-based Grove Distance Interrupter.
|
||||
*
|
||||
* UPM module for the Grove Distance Interrupter. The sensitivity
|
||||
* can be adjusted with the potentiometer on the sensor module. It
|
||||
* has a range of approximately 4 inches and a fast response time.
|
||||
* UPM module for the Grove distance interrupter. The sensitivity
|
||||
* can be adjusted with the potentiometer on the sensor module. It
|
||||
* has a range of approximately 4 inches and a quick response time.
|
||||
*
|
||||
* @image html rfr359f.jpg
|
||||
* @snippet rfr359f.cxx Interesting
|
||||
@ -56,21 +56,21 @@ namespace upm {
|
||||
class RFR359F {
|
||||
public:
|
||||
/**
|
||||
* Grove Distance Interrupter constructor
|
||||
* RFR359F constructor
|
||||
*
|
||||
* @param pin digital pin to use
|
||||
* @param pin Digital pin to use
|
||||
*/
|
||||
RFR359F(int pin);
|
||||
|
||||
/**
|
||||
* RFR359F Destructor
|
||||
* RFR359F destructor
|
||||
*/
|
||||
~RFR359F();
|
||||
|
||||
/**
|
||||
* Get the status of the pin, true means object detected
|
||||
* Gets the status of the pin; true means an object has been detected
|
||||
*
|
||||
* @return true if the sensor detected an object
|
||||
* @return True if the sensor has detected an object
|
||||
*/
|
||||
bool objectDetected();
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief Sparkfun RGB RingCoder
|
||||
* @brief SparkFun RGB RingCoder
|
||||
* @defgroup rgbringcoder libupm-rgbringcoder
|
||||
* @ingroup seeed gpio led
|
||||
*/
|
||||
@ -41,19 +41,19 @@ namespace upm {
|
||||
/**
|
||||
* @library rgbringcoder
|
||||
* @sensor rgbringcoder
|
||||
* @comname Sparkfun RGB Ringcoder
|
||||
* @comname SparkFun RGB Ringcoder
|
||||
* @type led
|
||||
* @web https://www.sparkfun.com/products/11040
|
||||
* @man sparkfun
|
||||
* @con pwm gpio
|
||||
*
|
||||
* @brief API for the Sparkfun RGB Ringcoder
|
||||
* @brief API for the SparkFun* RGB RingCoder
|
||||
*
|
||||
* The RGB RingCoder is a breakout board, a circular LED containing
|
||||
* 16 LEDs arranged in a ring, and a rotary encoder. The encoder
|
||||
* RGB RingCoder is a breakout board, a circular LED containing
|
||||
* 16 LEDs arranged in a ring, and a rotary encoder. The encoder
|
||||
* contains an RGB LED as well as a push button function.
|
||||
*
|
||||
* The device will require 11 pins, 3 of which must be PWM capable
|
||||
* The device requires 11 pins, 3 of which must be PWM-capable
|
||||
* (for the RGB LEDs).
|
||||
*
|
||||
* @image html rgbringcoder.jpg
|
||||
@ -66,62 +66,62 @@ namespace upm {
|
||||
/**
|
||||
* RGBRingCoder constructor
|
||||
*
|
||||
* @param en enable gpio
|
||||
* @param latch latch gpio
|
||||
* @param clear clear gpio
|
||||
* @param clk clock gpio
|
||||
* @param dat data out gpio
|
||||
* @param sw push button switch gpio
|
||||
* @param encA encoder A gpio
|
||||
* @param encB encoder B gpio
|
||||
* @param red RGB red led pwm
|
||||
* @param green RGB green led pwm
|
||||
* @param blue RGB blue led pwm
|
||||
* @param en Enables GPIO
|
||||
* @param latch Latch GPIO
|
||||
* @param clear Clears GPIO
|
||||
* @param clk Clock GPIO
|
||||
* @param dat Data out GPIO
|
||||
* @param sw Push button switch GPIO
|
||||
* @param encA Encoder A GPIO
|
||||
* @param encB Encoder B GPIO
|
||||
* @param red RGB red LED PWM
|
||||
* @param green RGB green LED PWM
|
||||
* @param blue RGB blue LED PWM
|
||||
*/
|
||||
RGBRingCoder(int en, int latch, int clear, int clk, int dat, int sw,
|
||||
int encA, int encB, int red, int green, int blue);
|
||||
|
||||
/**
|
||||
* RGBRingCoder Destructor
|
||||
* RGBRingCoder destructor
|
||||
*/
|
||||
~RGBRingCoder();
|
||||
|
||||
/*
|
||||
* set the state of the ring LEDs. This is a 16 bit value, where
|
||||
* each bit corresponds to one of the ring LEDs. A 1 bit means
|
||||
* that specific LED is on, and 0 bit means that specific LED is
|
||||
* Sets the state of the ring LEDs. This is a 16-bit value, where
|
||||
* each bit corresponds to one of the ring LEDs. A 1 bit means
|
||||
* that a specific LED is on, and a 0 bit means that a specific LED is
|
||||
* off.
|
||||
*
|
||||
* @param bits the bits representing the state of each LED
|
||||
* @param bits Bits representing the state of each LED
|
||||
*/
|
||||
void setRingLEDS(uint16_t bits);
|
||||
|
||||
/*
|
||||
* return the state of the button
|
||||
* Returns the state of the button
|
||||
*
|
||||
* @return true if the button is pressed, false otherwise
|
||||
* @return True if the button is pressed, false otherwise
|
||||
*/
|
||||
bool getButtonState();
|
||||
|
||||
/*
|
||||
* get the current rotary encoder counter value
|
||||
* Gets the current rotary encoder counter value
|
||||
*
|
||||
* @return the current counter value
|
||||
* @return Current counter value
|
||||
*/
|
||||
int getEncoderPosition() { return m_counter; };
|
||||
|
||||
/*
|
||||
* set the encoder counter to 0
|
||||
* Sets the encoder counter to 0
|
||||
*/
|
||||
void clearEncoderPosition() { m_counter = 0; };
|
||||
|
||||
/*
|
||||
* set the intensity of the red, grenn, and blue LEDs. Values can
|
||||
* be between 0.0 and 1.0. Lower is brighter, higher is dimmer.
|
||||
* Sets the intensity of the red, green, and blue LEDs. Values can
|
||||
* be between 0.0 and 1.0. Lower is brighter, higher is dimmer.
|
||||
*
|
||||
* @param r the red value, valid values are between 0.0 and 1.0
|
||||
* @param g the green value, valid values are between 0.0 and 1.0
|
||||
* @param b the blue value, valid values are between 0.0 and 1.0
|
||||
* @param r Red value; valid values are 0.0-1.0
|
||||
* @param g Green value; valid values are 0.0-1.0
|
||||
* @param b Blue value; valid values are 0.0-1.0
|
||||
*/
|
||||
void setRGBLED(float r, float g, float b);
|
||||
|
||||
|
@ -47,11 +47,11 @@ namespace upm {
|
||||
*
|
||||
* @brief API for the Grove Rotary Encoder
|
||||
*
|
||||
* UPM module for the Grove Rotary Encoder. A Rotary Encoder
|
||||
* UPM module for the Grove rotary encoder. This rotary encoder
|
||||
* encodes a rotation signal into electronic pulses that can be used
|
||||
* to measure rotation and direction. It is useful in cases where a
|
||||
* to measure rotation and direction. It is useful in cases where a
|
||||
* rotary knob is required, but using a potentiometer is not
|
||||
* desirable. A rotary encoder can turn a full 360 degrees+
|
||||
* desirable. A rotary encoder can turn a full 360 degrees
|
||||
* without a stop and does not place a resistive load on the
|
||||
* circuit, as is the case with a potentiometer.
|
||||
*
|
||||
@ -66,32 +66,32 @@ namespace upm {
|
||||
/**
|
||||
* RotaryEncoder constructor
|
||||
*
|
||||
* @param pinA digital pin to use for signal A
|
||||
* @param pinB digital pin to use for signal B
|
||||
* @param pinA Digital pin to use for signal A
|
||||
* @param pinB Digital pin to use for signal B
|
||||
*/
|
||||
RotaryEncoder(int pinA, int pinB);
|
||||
/**
|
||||
* RotaryEncoder Destructor
|
||||
* RotaryEncoder destructor
|
||||
*/
|
||||
~RotaryEncoder();
|
||||
|
||||
/**
|
||||
* Reset the position to a given number, default is 0.
|
||||
* Resets the position to a given number; default is 0.
|
||||
*
|
||||
* @param count integer to initialize the position to
|
||||
* @param count Integer to initialize the position to
|
||||
*/
|
||||
void initPosition(int count=0);
|
||||
|
||||
/**
|
||||
* Get the position value
|
||||
* Gets the position value
|
||||
*
|
||||
*/
|
||||
int position();
|
||||
|
||||
/**
|
||||
* ISR for signal A
|
||||
* Interrupt service routine (ISR) for signal A
|
||||
*
|
||||
* @param ctx user context for the ISR (*this pointer)
|
||||
* @param ctx User context for the ISR (*this pointer)
|
||||
*/
|
||||
static void signalAISR(void *ctx);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief RPR220 IR reflective sensor library
|
||||
* @brief RPR220 IR Reflective Sensor library
|
||||
* @defgroup rpr220 libupm-rpr220
|
||||
* @ingroup seeed gpio light tsk hak
|
||||
*/
|
||||
@ -44,18 +44,18 @@ namespace upm {
|
||||
* @con gpio
|
||||
* @kit tsk hak
|
||||
*
|
||||
* @brief API for the RPR220 based Grove IR Reflective Sensor
|
||||
* @brief API for the RPR220-based Grove IR Reflective Sensor
|
||||
*
|
||||
* UPM module for the Grove IR Reflective Sensor. The sensitivity
|
||||
* can be adjusted with the potentiometer on the sensor module. It
|
||||
* has a range of approximately 15mm, and a fast response time.
|
||||
* UPM module for the Grove IR reflective sensor. The sensitivity
|
||||
* can be adjusted with the potentiometer on the sensor module. It
|
||||
* has a range of approximately 15 mm, and a quick response time.
|
||||
*
|
||||
* It detects high contrast dark areas on a light background.
|
||||
* It detects high-contrast dark areas on a light background.
|
||||
*
|
||||
* This module allows the user to determine the current status
|
||||
* (black detected or not). Additionally, if desired, an Interrupt
|
||||
* Service Routine (ISR) can be installed that will be called when
|
||||
* black is detected. Either method can be used, depending on your
|
||||
* (black detected or not). Additionally, if desired, an interrupt
|
||||
* service routine (ISR) can be installed that is called when
|
||||
* black is detected. Either method can be used, depending on your
|
||||
* use case.
|
||||
*
|
||||
* @image html rpr220.jpg
|
||||
@ -65,36 +65,36 @@ namespace upm {
|
||||
class RPR220 {
|
||||
public:
|
||||
/**
|
||||
* Grove IR Reflective Sensor constructor
|
||||
* RPR220 constructor
|
||||
*
|
||||
* @param pin digital pin to use
|
||||
* @param pin Digital pin to use
|
||||
*/
|
||||
RPR220(int pin);
|
||||
|
||||
/**
|
||||
* RPR220 Destructor
|
||||
* RPR220 destructor
|
||||
*/
|
||||
~RPR220();
|
||||
|
||||
/**
|
||||
* Get the status of the pin, true means black detected
|
||||
* Gets the status of the pin; true means black has been detected
|
||||
*
|
||||
* @return true if the sensor is detecting black
|
||||
* @return True if the sensor has detected black
|
||||
*/
|
||||
bool blackDetected();
|
||||
|
||||
/**
|
||||
* Install an Interrupt Service Routine (ISR) to be called when
|
||||
* Installs an ISR to be called when
|
||||
* black is detected
|
||||
*
|
||||
* @param fptr function pointer to function to be called on interrupt
|
||||
* @param arg pointer to an object that will be supplied as an
|
||||
* arguement to the ISR.
|
||||
* @param fptr Pointer to a function to be called on interrupt
|
||||
* @param arg Pointer to an object to be supplied as an
|
||||
* argument to the ISR.
|
||||
*/
|
||||
void installISR(void (*isr)(void *), void *arg);
|
||||
|
||||
/**
|
||||
* Uninstall the previously installed Interrupt Service Routine (ISR)
|
||||
* Uninstalls the previously installed ISR
|
||||
*
|
||||
*/
|
||||
void uninstallISR();
|
||||
|
@ -39,11 +39,11 @@ namespace upm {
|
||||
* @con pwm
|
||||
* @kit gsk
|
||||
*
|
||||
* @brief API for ES08A servo component
|
||||
* @brief API for the ES08A Servo
|
||||
*
|
||||
* This file defines the ES08A interface for ES08A servos.
|
||||
* Like other servos, the ES08A servo has a shaft that can be controlled
|
||||
* by setting the desired angle. There are also routines for setting
|
||||
* by setting the desired angle. There are also routines for setting
|
||||
* and getting the minimum and maximum pulse width as well as the
|
||||
* maximum period.
|
||||
*
|
||||
@ -55,12 +55,12 @@ namespace upm {
|
||||
/**
|
||||
* Instantiates an ES08A object
|
||||
*
|
||||
* @param pin servo pin number
|
||||
* @param pin Servo pin number
|
||||
*/
|
||||
ES08A (int pin);
|
||||
|
||||
/**
|
||||
* ES08A object destructor.
|
||||
* ES08A object destructor
|
||||
*/
|
||||
~ES08A ();
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ namespace upm {
|
||||
/**
|
||||
* @brief Servo library
|
||||
*
|
||||
* The base class Servo provides routines for setting the angle of the shaft
|
||||
* The base Servo class provides routines for setting the angle of the shaft
|
||||
* as well as setting and getting the minimum and maximum pulse width and
|
||||
* the maximum period.
|
||||
*
|
||||
@ -50,42 +50,42 @@ namespace upm {
|
||||
class Servo {
|
||||
public:
|
||||
/**
|
||||
* Instantiates a servo object
|
||||
* Instantiates a Servo object
|
||||
*
|
||||
* @param pin servo pin number
|
||||
* @param pin Servo pin number
|
||||
*/
|
||||
Servo (int pin);
|
||||
|
||||
/**
|
||||
* Instantiates a servo object
|
||||
* Instantiates a Servo object
|
||||
*
|
||||
* @param pin servo pin number
|
||||
* @param minPulseWidth minimum pulse width, in microseconds
|
||||
* @param maxPulseWidth maximum pulse width, in microseconds
|
||||
* @param pin Servo pin number
|
||||
* @param minPulseWidth Minimum pulse width, in microseconds
|
||||
* @param maxPulseWidth Maximum pulse width, in microseconds
|
||||
*/
|
||||
Servo (int pin, int minPulseWidth, int maxPulseWidth);
|
||||
|
||||
/**
|
||||
* Instantiates a servo object
|
||||
* Instantiates a Servo object
|
||||
*
|
||||
* @param pin servo pin number
|
||||
* @param minPulseWidth minimum pulse width, in microseconds
|
||||
* @param maxPulseWidth maximum pulse width, in microseconds
|
||||
* @param waitAndDisablePwm if 1, PWM will be enabled only during setAngle() execution
|
||||
* for a period of 1 second, and then turned back off. If 0, PWM will remain on afterward.
|
||||
* @param pin Servo pin number
|
||||
* @param minPulseWidth Minimum pulse width, in microseconds
|
||||
* @param maxPulseWidth Maximum pulse width, in microseconds
|
||||
* @param waitAndDisablePwm If 1, PWM is enabled only during the setAngle() execution
|
||||
* for a period of 1 second, and then turned back off. If 0, PWM remains on afterward.
|
||||
*/
|
||||
Servo (int pin, int minPulseWidth, int maxPulseWidth, int waitAndDisablePwm);
|
||||
|
||||
/**
|
||||
* Servo object destructor.
|
||||
* Servo object destructor
|
||||
*/
|
||||
~Servo();
|
||||
|
||||
/**
|
||||
* Set the angle of the servo engine.
|
||||
* Sets the angle of the servo engine.
|
||||
*
|
||||
* @param angle number between 0 and 180
|
||||
* @return 0 on success; non-zero otherwise
|
||||
* @param angle Number between 0 and 180
|
||||
* @return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
mraa_result_t setAngle (int angle);
|
||||
|
||||
@ -95,9 +95,9 @@ class Servo {
|
||||
mraa_result_t haltPwm ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*
|
||||
* @return name of the component
|
||||
* @return Name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -105,44 +105,44 @@ class Servo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimum pulse width
|
||||
* Sets the minimum pulse width
|
||||
*
|
||||
* @param width minimum HIGH signal width
|
||||
* @param width Minimum HIGH signal width
|
||||
*/
|
||||
void setMinPulseWidth (int width);
|
||||
|
||||
/**
|
||||
* Set maximum pulse width
|
||||
* Sets the maximum pulse width
|
||||
*
|
||||
* @param width maximum HIGH signal width
|
||||
* @param width Maximum HIGH signal width
|
||||
*/
|
||||
void setMaxPulseWidth (int width);
|
||||
|
||||
/**
|
||||
* Set maximum period width
|
||||
* Sets the maximum period width
|
||||
*
|
||||
* @param period PWM period width
|
||||
*/
|
||||
void setPeriod (int period);
|
||||
|
||||
/**
|
||||
* Return minimum pulse width
|
||||
* Returns the minimum pulse width
|
||||
*
|
||||
* @return minimum pulse width
|
||||
* @return Minimum pulse width
|
||||
*/
|
||||
int getMinPulseWidth ();
|
||||
|
||||
/**
|
||||
* Return maximum pulse width
|
||||
* Returns the maximum pulse width
|
||||
*
|
||||
* @return maximum pulse width
|
||||
* @return Maximum pulse width
|
||||
*/
|
||||
int getMaxPulseWidth ();
|
||||
|
||||
/**
|
||||
* Return maximum PWM period width
|
||||
* Returns the maximum PWM period width
|
||||
*
|
||||
* @return maximum PWM period width
|
||||
* @return Maximum PWM period width
|
||||
*/
|
||||
int getPeriod ();
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief SI1145 UV light sensor library
|
||||
* @brief SI1145 UV Light Sensor library
|
||||
* @defgroup si114x libupm-si114x
|
||||
* @ingroup adafruit i2c light
|
||||
*/
|
||||
@ -45,23 +45,23 @@ namespace upm {
|
||||
/**
|
||||
* @library si114x
|
||||
* @sensor si114x
|
||||
* @comname SI1145 UV light sensor
|
||||
* @comname SI1145 UV Light Sensor
|
||||
* @altname SI1146, SI1147
|
||||
* @type light
|
||||
* @man adafruit
|
||||
* @web https://www.adafruit.com/products/1777
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for the SI1145 UV light sensor
|
||||
* @brief API for the SI1145 UV Light Sensor
|
||||
*
|
||||
* This module was tested with the Adafruit UV Sensor
|
||||
* This module was tested with the Adafruit* UV Light Sensor
|
||||
*
|
||||
* This device is also capable of measuring IR and visible ambient
|
||||
* light as well. It also supports the ability to use externally
|
||||
* attached LED's to perform proximity detection on 3 separate
|
||||
* This device is capable of measuring IR and visible ambient
|
||||
* light as well. It also supports the ability to use externally
|
||||
* attached LEDs to perform proximity detection on 3 separate
|
||||
* channels.
|
||||
*
|
||||
* This class currently only supports the retriving of the
|
||||
* Currently, this class only supports the retrieving of the
|
||||
* calculated UV index measured by the device, but enough
|
||||
* infrastructure is provided to make it easy to enhance this driver
|
||||
* in the future to support additional capabilities, including
|
||||
@ -175,13 +175,13 @@ namespace upm {
|
||||
CMD_ALS_AUTO = 0x0e,
|
||||
CMD_PSALS_AUTO = 0x0f,
|
||||
|
||||
CMD_PARAM_QUERY = 0x80, // or'd with PARAM_T value
|
||||
CMD_PARAM_SET = 0xa0 // or'd with PARAM_T value
|
||||
CMD_PARAM_QUERY = 0x80, // OR'd with PARAM_T value
|
||||
CMD_PARAM_SET = 0xa0 // OR'd with PARAM_T value
|
||||
} SI114X_CMD_T;
|
||||
|
||||
|
||||
/**
|
||||
* Channel List enable bits
|
||||
* Channel list enable bits
|
||||
*/
|
||||
typedef enum { CHLIST_EN_PS1 = 0x01, // proximity sense 1-3
|
||||
CHLIST_EN_PS2 = 0x02,
|
||||
@ -218,95 +218,95 @@ namespace upm {
|
||||
} SI114X_IRQEN_BITS_T;
|
||||
|
||||
/**
|
||||
* si114x constructor
|
||||
* SI114X constructor
|
||||
*
|
||||
* @param bus i2c bus to use
|
||||
* @param address the address for this device
|
||||
* @param bus I2C bus to use
|
||||
* @param address Address for this device
|
||||
*/
|
||||
SI114X(int bus, uint8_t address = SI114X_DEFAULT_I2C_ADDR);
|
||||
|
||||
/**
|
||||
* SI114X Destructor
|
||||
* SI114X destructor
|
||||
*/
|
||||
~SI114X();
|
||||
|
||||
/**
|
||||
* Write byte value into register
|
||||
* Writes a byte value into a register
|
||||
*
|
||||
* @param reg register location to write into
|
||||
* @param byte byte to write
|
||||
* @return true if successful
|
||||
* @param reg Register location to write into
|
||||
* @param byte Byte to write
|
||||
* @return True if successful
|
||||
*/
|
||||
bool writeByte(uint8_t reg, uint8_t byte);
|
||||
|
||||
/**
|
||||
* Read byte value from register
|
||||
* Reads a byte value from a register
|
||||
*
|
||||
* @param reg register location to read from
|
||||
* @return value at specified register
|
||||
* @param reg Register location to read from
|
||||
* @return Value in a specified register
|
||||
*/
|
||||
uint8_t readByte(uint8_t reg);
|
||||
|
||||
/**
|
||||
* Read word value from register.
|
||||
* Reads a word value from a register
|
||||
*
|
||||
* @param reg register location to read from
|
||||
* @return value at specified register
|
||||
* @param reg Register location to read from
|
||||
* @return Value in a specified register
|
||||
*/
|
||||
uint16_t readWord(uint8_t reg);
|
||||
|
||||
/**
|
||||
* disable interrupts and auto measuring, issue a device reset,
|
||||
* and then set the hardware key.
|
||||
* Disables interrupts and auto-measuring, issues a device reset,
|
||||
* and then sets the hardware key.
|
||||
*/
|
||||
void reset();
|
||||
|
||||
/**
|
||||
* set the UV calibration values. The constructor sets default
|
||||
* Sets UV calibration values. The constructor sets default
|
||||
* values for you, so you only need this function if you need
|
||||
* different values for your device and situation. If you set new
|
||||
* different values for your device and situation. If you set new
|
||||
* values here, be sure to do so before calling initialize().
|
||||
*
|
||||
* @param uvcoeff0 coefficient for REG_UCOEF0
|
||||
* @param uvcoeff1 coefficient for REG_UCOEF1
|
||||
* @param uvcoeff2 coefficient for REG_UCOEF2
|
||||
* @param uvcoeff3 coefficient for REG_UCOEF3
|
||||
* @param uvcoeff0 Coefficient for REG_UCOEF0
|
||||
* @param uvcoeff1 Coefficient for REG_UCOEF1
|
||||
* @param uvcoeff2 Coefficient for REG_UCOEF2
|
||||
* @param uvcoeff3 Coefficient for REG_UCOEF3
|
||||
*
|
||||
*/
|
||||
void setUVCalibration(uint8_t uvcoeff0, uint8_t uvcoeff1, uint8_t uvcoeff2,
|
||||
uint8_t uvcoeff3);
|
||||
|
||||
/**
|
||||
* write a value to parameter memory.
|
||||
* Writes a value to the parameter memory.
|
||||
*
|
||||
* @param param the SI114X_PARAM_T register to write
|
||||
* @param value the value to write
|
||||
* @param param SI114X_PARAM_T register to write
|
||||
* @param value Value to write
|
||||
*/
|
||||
void writeParam(SI114X_PARAM_T param, uint8_t value);
|
||||
|
||||
/**
|
||||
* read a value from parameter memory
|
||||
* Reads a value from the parameter memory
|
||||
*
|
||||
* @param param the SI114X_PARAM_T register to read
|
||||
* @return the value
|
||||
* @param param SI114X_PARAM_T register to read
|
||||
* @return Value
|
||||
*/
|
||||
uint8_t readParam(SI114X_PARAM_T param);
|
||||
|
||||
/**
|
||||
* Reset and initialize device, start auto sampling
|
||||
* Resets and initializes the device and starts auto-sampling
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* update stored values. You should call this before calling
|
||||
* Updates stored values. You should call this before calling
|
||||
* getUVIndex()
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* Read the currently measured UV Index value
|
||||
* Reads the currently measured UV index value
|
||||
*
|
||||
* @return UV Index value
|
||||
* @return UV index value
|
||||
*/
|
||||
float getUVIndex() { return m_uvIndex; };
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief SM130 RFID reader module sensor library
|
||||
* @brief SM130 RFID Reader Module library
|
||||
* @defgroup sm130 libupm-sm130
|
||||
* @ingroup sparkfun gpio rfid
|
||||
*/
|
||||
@ -54,12 +54,12 @@ namespace upm {
|
||||
* @web https://www.sparkfun.com/products/10126
|
||||
* @con gpio
|
||||
*
|
||||
* @brief API for SM130 RFID reader module
|
||||
* @brief API for the SM130 RFID Reader Module
|
||||
*
|
||||
* This file defines the interface for sm130 RFID library
|
||||
* This file defines the SM130 interface for the sm130 RFID library
|
||||
*
|
||||
* @image html sm130.jpg
|
||||
* <br><em>SM130 RFID Reader image provided by SparkFun under
|
||||
* <br><em>SM130 RFID Reader image provided by SparkFun* under
|
||||
* <a href=https://creativecommons.org/licenses/by-nc-sa/3.0/>
|
||||
* CC BY-NC-SA-3.0</a>.</em>
|
||||
*
|
||||
@ -103,10 +103,10 @@ class SM130 {
|
||||
static const uint8_t CMD_SLEEP = 0x96;
|
||||
|
||||
/**
|
||||
* Instanciates a SM130 object
|
||||
* Instantiates an SM130 object
|
||||
*
|
||||
* @param di data pin
|
||||
* @param dcki clock pin
|
||||
* @param di Data pin
|
||||
* @param dcki Clock pin
|
||||
*/
|
||||
SM130 (int bus, int devAddr, int rst, int dready);
|
||||
|
||||
@ -116,22 +116,22 @@ class SM130 {
|
||||
~SM130 ();
|
||||
|
||||
/**
|
||||
* Get the firmware version string.
|
||||
* Gets the firmware version string.
|
||||
*/
|
||||
const char* getFirmwareVersion ();
|
||||
|
||||
/**
|
||||
* Checks for availability of a valid response packet.
|
||||
*
|
||||
* This function should always be called and return true prior to using results
|
||||
* This function should always be called and return true prior to using the results
|
||||
* of a command.
|
||||
*
|
||||
* @returns true if a valid response packet is available
|
||||
* @returns True if a valid response packet is available
|
||||
*/
|
||||
uint8_t available ();
|
||||
|
||||
/**
|
||||
* Returns the packet length, excluding checksum
|
||||
* Returns the packet length, excluding the checksum
|
||||
*/
|
||||
uint8_t getPacketLength () { return this->m_Data[0]; };
|
||||
|
||||
@ -141,7 +141,7 @@ class SM130 {
|
||||
uint8_t getCommand () { return this->m_Data[1]; };
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
138
src/st7735/gfx.h
138
src/st7735/gfx.h
@ -36,17 +36,17 @@ namespace upm {
|
||||
/**
|
||||
* @brief GFX helper class
|
||||
*
|
||||
* This file used by the screen.
|
||||
* This file is used by the screen.
|
||||
*/
|
||||
class GFX {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a GFX object
|
||||
* Instantiates a GFX object
|
||||
*
|
||||
* @param width screen width
|
||||
* @param height screen height
|
||||
* @param screenBuffer pointer to screen buffer
|
||||
* @param font pointer to font map
|
||||
* @param width Screen width
|
||||
* @param height Screen height
|
||||
* @param screenBuffer Pointer to the screen buffer
|
||||
* @param font Pointer to the font map
|
||||
*/
|
||||
GFX (int width, int height, uint8_t * screenBuffer, const unsigned char * font);
|
||||
|
||||
@ -56,147 +56,147 @@ class GFX {
|
||||
~GFX ();
|
||||
|
||||
/**
|
||||
* Set the window address
|
||||
* Sets the window address
|
||||
*
|
||||
* @param x0 first coordinate
|
||||
* @param y0 first coordinate
|
||||
* @param x1 second coordinate
|
||||
* @param y1 second coordinate
|
||||
* @param x0 First coordinate
|
||||
* @param y0 First coordinate
|
||||
* @param x1 Second coordinate
|
||||
* @param y1 Second coordinate
|
||||
*/
|
||||
virtual void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) = 0;
|
||||
|
||||
/**
|
||||
* Send pixel collor (RGB) to the chip. Must be implemented by
|
||||
* Sends a pixel color (RGB) to the chip. Must be implemented by the
|
||||
* inherited class.
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param color rgb value
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
* @param color RGB value
|
||||
*/
|
||||
virtual void drawPixel (int16_t x, int16_t y, uint16_t color) = 0;
|
||||
|
||||
/**
|
||||
* Copy the buffer to the chip via SPI interface.
|
||||
* Copies the buffer to the chip via the SPI.
|
||||
*/
|
||||
virtual void refresh () = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param data character to write
|
||||
* @param color character's color
|
||||
* @param bg character's background color
|
||||
* @param size size of the font
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
* @param data Character to write
|
||||
* @param color Character color
|
||||
* @param bg Character background color
|
||||
* @param size Size of the font
|
||||
*/
|
||||
void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size);
|
||||
|
||||
/**
|
||||
* Print the message to the screen
|
||||
* Prints a message on the screen
|
||||
*
|
||||
* @param msg message which will be printed
|
||||
* @param msg Message to print
|
||||
*/
|
||||
void print (std::string msg);
|
||||
|
||||
/**
|
||||
* Print the message to the screen
|
||||
* Prints a message on the screen
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param color pixel's color
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
* @param color Pixel color
|
||||
*/
|
||||
mraa_result_t setPixel (int x, int y, uint16_t color);
|
||||
|
||||
/**
|
||||
* Fill screen with selected color
|
||||
* Fills the screen with a selected color
|
||||
*
|
||||
* @param color selected's color
|
||||
* @param color Selected color
|
||||
*/
|
||||
void fillScreen (uint16_t color);
|
||||
|
||||
/**
|
||||
* Fill rectangle with selected color
|
||||
* Fills a rectangle with a selected color
|
||||
*
|
||||
* @param x axis on horizontal scale (top left corner)
|
||||
* @param y axis on vertical scale (top left corner)
|
||||
* @param w distanse from x
|
||||
* @param h distanse from y
|
||||
* @param color selected color
|
||||
* @param x Axis on the horizontal scale (top-left corner)
|
||||
* @param y Axis on the vertical scale (top-left corner)
|
||||
* @param w Distanse from x
|
||||
* @param h Distanse from y
|
||||
* @param color Selected color
|
||||
*/
|
||||
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
|
||||
/**
|
||||
* Draw line in vertical scale.
|
||||
* Draws a line on the vertical scale
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param h distanse from y
|
||||
* @param color selected color
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
* @param h Distanse from y
|
||||
* @param color Selected color
|
||||
*/
|
||||
void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
|
||||
/**
|
||||
* Draw line from coordinate C0 to coordinate C1
|
||||
* Draws a line from coordinate C0 to coordinate C1
|
||||
*
|
||||
* @param x0 first coordinate
|
||||
* @param y0 first coordinate
|
||||
* @param x1 second coordinate
|
||||
* @param y1 second coordinate
|
||||
* @param x0 First coordinate
|
||||
* @param y0 First coordinate
|
||||
* @param x1 Second coordinate
|
||||
* @param y1 Second coordinate
|
||||
* @param color selected color
|
||||
*/
|
||||
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
|
||||
|
||||
/**
|
||||
* Draw a triangle
|
||||
* Draws a triangle
|
||||
*
|
||||
* @param x0 first coordinate
|
||||
* @param y0 first coordinate
|
||||
* @param x1 second coordinate
|
||||
* @param y1 second coordinate
|
||||
* @param x2 third coordinate
|
||||
* @param y2 third coordinate
|
||||
* @param color selected color
|
||||
* @param x0 First coordinate
|
||||
* @param y0 First coordinate
|
||||
* @param x1 Second coordinate
|
||||
* @param y1 Second coordinate
|
||||
* @param x2 Third coordinate
|
||||
* @param y2 Third coordinate
|
||||
* @param color Selected color
|
||||
*/
|
||||
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
|
||||
|
||||
/**
|
||||
* Draw a circle
|
||||
* Draws a circle
|
||||
*
|
||||
* @param x center of circle on X scale
|
||||
* @param y center of circle on Y scale
|
||||
* @param r radius of circle
|
||||
* @param color color of circle
|
||||
* @param x Center of the circle on the horizontal scale
|
||||
* @param y Center of the circle on the vertical scale
|
||||
* @param r Radius of the circle
|
||||
* @param color Color of the circle
|
||||
*/
|
||||
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color);
|
||||
|
||||
/**
|
||||
* Set cursor for text message
|
||||
* Sets the cursor for a text message
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
*/
|
||||
void setCursor (int16_t x, int16_t y);
|
||||
|
||||
/**
|
||||
* Set text color for the message
|
||||
* Sets a text color for a message
|
||||
*
|
||||
* @param textColor font color
|
||||
* @param textBGColor background color
|
||||
* @param textColor Font color
|
||||
* @param textBGColor Background color
|
||||
*/
|
||||
void setTextColor (uint16_t textColor, uint16_t textBGColor);
|
||||
|
||||
/**
|
||||
* Set the size of the font
|
||||
* Sets the size of the font
|
||||
*
|
||||
* @param size font size
|
||||
* @param size Font size
|
||||
*/
|
||||
void setTextSize (uint8_t size);
|
||||
|
||||
/**
|
||||
* Wrap printed message.
|
||||
* Wraps a printed message
|
||||
*
|
||||
* @param wrap true (0x1) or false (0x0)
|
||||
* @param wrap True (0x1) or false (0x0)
|
||||
*/
|
||||
void setTextWrap (uint8_t wrap);
|
||||
|
||||
|
@ -494,22 +494,22 @@ const unsigned char font[] = {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief ST7735 LCD display library
|
||||
* @brief ST7735 LCD library
|
||||
* @defgroup st7735 libupm-st7735
|
||||
* @ingroup adafruit spi display
|
||||
*/
|
||||
/**
|
||||
* @library st7735
|
||||
* @sensor st7735
|
||||
* @comname ST7735 LCD display
|
||||
* @comname ST7735 LCD
|
||||
* @type display
|
||||
* @man adafruit
|
||||
* @web http://www.adafruit.com/product/358
|
||||
* @con spi
|
||||
*
|
||||
* @brief API for the st7735 lcd display library
|
||||
* @brief API for the ST7735 LCD
|
||||
*
|
||||
* This file defines the interface for ST7735 display library
|
||||
* This file defines the interface for the ST7735 display library
|
||||
*
|
||||
* @image html st7735.jpg
|
||||
* @snippet st7735.cxx Interesting
|
||||
@ -517,12 +517,12 @@ const unsigned char font[] = {
|
||||
class ST7735 : public GFX {
|
||||
public:
|
||||
/**
|
||||
* Instantiates a ST7735 object
|
||||
* Instantiates an ST7735 object
|
||||
*
|
||||
* @param csLCD LCD chip select pin
|
||||
* @param cSD SD card chip select pin
|
||||
* @param rs data/command pin
|
||||
* @param rst reset pin
|
||||
* @param rs Data/command pin
|
||||
* @param rst Reset pin
|
||||
*/
|
||||
ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst);
|
||||
|
||||
@ -532,7 +532,7 @@ class ST7735 : public GFX {
|
||||
~ST7735 ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
@ -540,88 +540,88 @@ class ST7735 : public GFX {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the modules GPIOs
|
||||
* Initializes the module GPIOs
|
||||
*/
|
||||
void initModule ();
|
||||
|
||||
/**
|
||||
* Configure the chip via SPI interface
|
||||
* Configures the chip via the SPI
|
||||
*/
|
||||
void configModule ();
|
||||
|
||||
/**
|
||||
* Send command to SPI bus (rs must be LOW)
|
||||
* Sends a command to an SPI bus (rs must be LOW)
|
||||
*
|
||||
* @param value command number
|
||||
* @param value Command number
|
||||
*/
|
||||
void write (uint8_t value);
|
||||
|
||||
/**
|
||||
* Send data to SPI bus (rs must be HIGH)
|
||||
* Sends data to an SPI bus (rs must be HIGH)
|
||||
*
|
||||
* @param value command number
|
||||
* @param value Command number
|
||||
*/
|
||||
void data (uint8_t value);
|
||||
|
||||
/**
|
||||
* Execute set of commands and data
|
||||
* Executes a set of commands and data
|
||||
*
|
||||
* @param addr pointer to start of the commands/data section
|
||||
* @param addr Pointer to the start of the commands/data section
|
||||
*/
|
||||
void executeCMDList (const uint8_t *addr);
|
||||
|
||||
/**
|
||||
* Set the window size inside the screen where the pixels data
|
||||
* will be written.
|
||||
* Sets the window size inside the screen where pixels data
|
||||
* is written.
|
||||
*
|
||||
* @param x0 first coordinate
|
||||
* @param y0 first coordinate
|
||||
* @param x1 second coordinate
|
||||
* @param y1 second coordinate
|
||||
* @param x0 First coordinate
|
||||
* @param y0 First coordinate
|
||||
* @param x1 Second coordinate
|
||||
* @param y1 Second coordinate
|
||||
*/
|
||||
void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1);
|
||||
|
||||
/**
|
||||
* Send pixel collor (RGB) to the chip.
|
||||
* Sends a pixel color (RGB) to the chip.
|
||||
*
|
||||
* @param x axis on horizontal scale
|
||||
* @param y axis on vertical scale
|
||||
* @param color rgb (16bit) color (R[0-4], G[5-10], B[11-15])
|
||||
* @param x Axis on the horizontal scale
|
||||
* @param y Axis on the vertical scale
|
||||
* @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15])
|
||||
*/
|
||||
void drawPixel (int16_t x, int16_t y, uint16_t color);
|
||||
|
||||
/**
|
||||
* Copy the buffer to the chip via SPI interface.
|
||||
* Copies the buffer to the chip via the SPI.
|
||||
*/
|
||||
void refresh ();
|
||||
|
||||
/**
|
||||
* LCD chip select LOW.
|
||||
* LCD chip select is LOW
|
||||
*/
|
||||
mraa_result_t lcdCSOn ();
|
||||
|
||||
/**
|
||||
* LCD chip select HIGH.
|
||||
* LCD chip select is HIGH
|
||||
*/
|
||||
mraa_result_t lcdCSOff ();
|
||||
|
||||
/**
|
||||
* CD card chip select LOW.
|
||||
* CD card chip select is LOW
|
||||
*/
|
||||
mraa_result_t sdCSOn ();
|
||||
|
||||
/**
|
||||
* CD card select HIGH.
|
||||
* CD card select is HIGH
|
||||
*/
|
||||
mraa_result_t sdCSOff ();
|
||||
|
||||
/**
|
||||
* Data select HIGH.
|
||||
* Data select is HIGH
|
||||
*/
|
||||
mraa_result_t rsHIGH ();
|
||||
|
||||
/**
|
||||
* Data select LOW.
|
||||
* Data select is LOW
|
||||
*/
|
||||
mraa_result_t rsLOW ();
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief Stepper motor library
|
||||
* @brief Stepper Motor library
|
||||
* @defgroup stepper libupm-stepper
|
||||
* @ingroup seeed sparkfun pwm gpio motor
|
||||
*/
|
||||
@ -55,10 +55,10 @@ namespace upm {
|
||||
* @web http://www.schmalzhaus.com/EasyDriver/index.html
|
||||
* @con pwm gpio
|
||||
*
|
||||
* @brief API for the Stepper motor library
|
||||
* @brief API for the Stepper Motor
|
||||
*
|
||||
* This file defines the StepMotor interface. It is compatible with Stepper
|
||||
* Motor Drivers that use 2 pins to control the motor, like the EasyDriver
|
||||
* This file defines the Stepper Motor interface. It is compatible with stepper
|
||||
* motor drivers that use 2 pins to control the motor, like an Easy Driver
|
||||
* from Brian Schmalz.
|
||||
*
|
||||
* @image html stepmotor.jpg
|
||||
@ -69,34 +69,34 @@ class StepMotor {
|
||||
/**
|
||||
* Instantiates a StepMotor object
|
||||
*
|
||||
* @param dirPin direction GPIO pin
|
||||
* @param stePin stepper pulse PWM pin
|
||||
* @param dirPin Direction GPIO pin
|
||||
* @param stePin Stepper pulse PWM pin
|
||||
*/
|
||||
StepMotor (int dirPin, int stePin);
|
||||
|
||||
/**
|
||||
* StepMotor object destructor.
|
||||
* StepMotor object destructor
|
||||
*/
|
||||
~StepMotor ();
|
||||
|
||||
/**
|
||||
* Set the speed of rotation
|
||||
* Sets the rotation speed
|
||||
*
|
||||
* @param speed rotation speed
|
||||
* @param speed Rotation speed
|
||||
*/
|
||||
void setSpeed (int speed);
|
||||
|
||||
/**
|
||||
* Rotate motor forward
|
||||
* Rotates the motor forward
|
||||
*
|
||||
* @param ticks number of ticks the motor will move
|
||||
* @param ticks Number of ticks the motor moves
|
||||
*/
|
||||
mraa_result_t stepForward (int ticks);
|
||||
|
||||
/**
|
||||
* Rotate motor backward
|
||||
* Rotates the motor backward
|
||||
*
|
||||
* @param ticks number of ticks the motor will move
|
||||
* @param ticks Number of ticks the motor moves
|
||||
*/
|
||||
mraa_result_t stepBackwards (int ticks);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief SX6119 based FM receiver library
|
||||
* @brief SX6119-based FM Receiver library
|
||||
* @defgroup sx6119 libupm-sx6119
|
||||
* @ingroup seeed gpio sound
|
||||
*/
|
||||
@ -43,10 +43,10 @@ namespace upm {
|
||||
* @man seeed
|
||||
* @con gpio
|
||||
*
|
||||
* @brief API support for the SX6119 based Grove FM Receiver
|
||||
* @brief API support for the SX6119-based Grove FM Receiver
|
||||
*
|
||||
* This class implements support for the FM Receiver. There are
|
||||
* two digital pins, one that toggles power on/off, and one that
|
||||
* This class implements support for the SX6119 FM Receiver. There are
|
||||
* two digital pins: one that toggles power on/off, and the other that
|
||||
* does a seek to the next station.
|
||||
*
|
||||
* @image html sx6119.jpg
|
||||
@ -56,26 +56,26 @@ namespace upm {
|
||||
public:
|
||||
|
||||
/**
|
||||
* SX6119 module constructor
|
||||
* SX6119 constructor
|
||||
*
|
||||
* @param powerPin the pin to use for recording
|
||||
* @param seekPin the pin to use to seek to the next station
|
||||
* @param powerPin Pin to use for recording
|
||||
* @param seekPin Pin to use for seeking to the next station
|
||||
*/
|
||||
SX6119(int powerPin, int seekPin);
|
||||
|
||||
/**
|
||||
* SX6119 module Destructor
|
||||
* SX6119 destructor
|
||||
*/
|
||||
~SX6119();
|
||||
|
||||
/**
|
||||
* Toggle the device power on or off
|
||||
* Toggles the device power on or off
|
||||
*
|
||||
*/
|
||||
void togglePower();
|
||||
|
||||
/**
|
||||
* Seek to the next station
|
||||
* Seeks to the next station
|
||||
*
|
||||
*/
|
||||
void seek();
|
||||
|
@ -34,26 +34,26 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief TA12-200 current transformer library
|
||||
* @brief TA12-200 Current Transformer library
|
||||
* @defgroup ta12200 libupm-ta12200
|
||||
* @ingroup seeed analog electric
|
||||
*/
|
||||
/**
|
||||
* @library ta12200
|
||||
* @sensor ta12200
|
||||
* @comname TA12-200 Current transformer
|
||||
* @comname TA12-200 Current Transformer
|
||||
* @altname Grove Electricity Sensor
|
||||
* @type electric
|
||||
* @man seeed
|
||||
* @web http://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor
|
||||
* @con analog
|
||||
*
|
||||
* @brief API for the TA12-200 current transformer
|
||||
* @brief API for the TA12-200 Current Transformer
|
||||
*
|
||||
* UPM module for the TA12-200 current transformer, which is found,
|
||||
* UPM module for the TA12-200 current transformer found,
|
||||
* for instance, in the Grove Electricity Sensor.
|
||||
* This module can measure AC current moving through a wire at up
|
||||
* to 5A.
|
||||
* This module can measure AC moving through a wire at up
|
||||
* to 5 A.
|
||||
*
|
||||
* @image html ta12200.jpg
|
||||
* @snippet ta12200.cxx Interesting
|
||||
@ -61,45 +61,45 @@ namespace upm {
|
||||
class TA12200 {
|
||||
public:
|
||||
/**
|
||||
* TA12200 sensor constructor
|
||||
* TA12200 constructor
|
||||
*
|
||||
* @param pin analog pin to use
|
||||
* @param pin Analog pin to use
|
||||
*/
|
||||
TA12200(int pin);
|
||||
|
||||
/**
|
||||
* TA12200 Destructor
|
||||
* TA12200 destructor
|
||||
*/
|
||||
~TA12200();
|
||||
|
||||
/**
|
||||
* Return the number of milliseconds elapsed since initClock()
|
||||
* Returns the number of milliseconds elapsed since initClock()
|
||||
* was last called.
|
||||
*
|
||||
* @return elapsed milliseconds
|
||||
* @return Elapsed milliseconds
|
||||
*/
|
||||
uint32_t getMillis();
|
||||
|
||||
/**
|
||||
* Reset the Clock
|
||||
* Resets the clock
|
||||
*
|
||||
*/
|
||||
void initClock();
|
||||
|
||||
/**
|
||||
* Get the conversion value from the sensor
|
||||
* Gets the conversion value from the sensor
|
||||
*
|
||||
* @return the highest value obtained over 1 second of measuring
|
||||
* @return Highest value obtained over 1 second of measuring
|
||||
*/
|
||||
unsigned int highestValue();
|
||||
|
||||
/**
|
||||
* Compute the measured voltage
|
||||
* Computes the measured voltage
|
||||
*
|
||||
* @param val value measured by highestValue()
|
||||
* @param val Value measured by highestValue()
|
||||
* @param res ADC resolution
|
||||
*
|
||||
* @return the measured current in milliamps
|
||||
* @return Measured current in mA
|
||||
*/
|
||||
float milliAmps(unsigned int val, int res=TA12200_ADC_RES);
|
||||
|
||||
|
@ -105,7 +105,7 @@ typedef struct {
|
||||
} tcs3414sc_rgb_t;
|
||||
|
||||
/**
|
||||
* @brief TCS3414CS color sensor library
|
||||
* @brief TCS3414CS Color Sensor library
|
||||
* @defgroup tcs3414cs libupm-tcs3414cs
|
||||
* @ingroup seeed i2c color
|
||||
*/
|
||||
@ -119,9 +119,9 @@ typedef struct {
|
||||
* @web http://www.seeedstudio.com/wiki/Grove_-_I2C_Color_Sensor
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for TCS3414CS chip (Color sensor)
|
||||
* @brief API for the TCS3414CS Color Sensor
|
||||
*
|
||||
* This file defines the TCS3414CS interface for the color sensor
|
||||
* This file defines the TCS3414CS interface for the color sensor
|
||||
*
|
||||
* @image html tcs3414cs.jpg
|
||||
* @snippet tcs3414cs.cxx Interesting
|
||||
@ -129,31 +129,31 @@ typedef struct {
|
||||
class TCS3414CS {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a TCS3414CS object
|
||||
* Instantiates a TCS3414CS object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param bus Number of the used bus
|
||||
*/
|
||||
TCS3414CS ();
|
||||
|
||||
/**
|
||||
* TCS3414CS object destructor, basicaly it close i2c connection.
|
||||
* TCS3414CS object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~TCS3414CS ();
|
||||
|
||||
/**
|
||||
* Get the RGB value from sensor.
|
||||
* Gets the RGB value from the sensor.
|
||||
*
|
||||
* @param rgb color values
|
||||
* @param rgb Color values
|
||||
*/
|
||||
void readRGB (tcs3414sc_rgb_t * rgb);
|
||||
|
||||
/**
|
||||
* Clear interrupts.
|
||||
* Clears interrupts.
|
||||
*/
|
||||
void clearInterrupt ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
@ -45,7 +45,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief TH02 temperature & humidity sensor library
|
||||
* @brief TH02 Temperature & Humidity Sensor library
|
||||
* @defgroup th02 libupm-th02
|
||||
* @ingroup seeed i2c temp
|
||||
*/
|
||||
@ -53,18 +53,18 @@ namespace upm {
|
||||
* @library th02
|
||||
* @sensor th02
|
||||
* @comname TH02 Temperature & Humidity Sensor
|
||||
* @altname Grove Temperature & Humidity Sensor (High Accuracy & Mini)
|
||||
* @altname Grove Temperature & Humidity Sensor (High-Accuracy & Mini)
|
||||
* @type temp
|
||||
* @man seeed
|
||||
* @web http://www.seeedstudio.com/wiki/Grove_-_Tempture%26Humidity_Sensor_(High-Accuracy_%26Mini)_v1.0
|
||||
* @con i2c
|
||||
*
|
||||
* @brief API for th02 temperature & humidity sensor library
|
||||
* @brief API for the TH02 Temperature & Humidity Sensor
|
||||
*
|
||||
* This file defines the TH02 interface for libth02
|
||||
*
|
||||
* NOTE: For use on the Edison with the Arduino breakout board, the
|
||||
* Edison must be set to 3v rather than 5v.
|
||||
* Note: For use on Intel(R) Edison with an Arduino* breakout board, Intel
|
||||
* Edison must be set to 3 V rather than 5 V.
|
||||
*
|
||||
* @image html th02.jpg
|
||||
* @snippet th02.cxx Interesting
|
||||
@ -72,32 +72,32 @@ namespace upm {
|
||||
class TH02 {
|
||||
public:
|
||||
/**
|
||||
* Instanciates a TH02 object
|
||||
* Instantiates a TH02 object
|
||||
*/
|
||||
TH02 (int bus=0, uint8_t addr=TH02_ADDR);
|
||||
|
||||
/**
|
||||
* TH02 object destructor, basicaly it close i2c connection.
|
||||
* TH02 object destructor; basically, it closes the I2C connection.
|
||||
*/
|
||||
~TH02 ();
|
||||
|
||||
/**
|
||||
* Get the temperature value from sensor.
|
||||
* Gets the temperature value from the sensor.
|
||||
*/
|
||||
float getTemperature ();
|
||||
|
||||
/**
|
||||
* Get the humidity value from sensor.
|
||||
* Gets the humidity value from the sensor.
|
||||
*/
|
||||
float getHumidity ();
|
||||
|
||||
/**
|
||||
* Get the sensor's status.
|
||||
* Gets the sensor status.
|
||||
*/
|
||||
bool getStatus ();
|
||||
|
||||
/**
|
||||
* Return name of the component
|
||||
* Returns the name of the component
|
||||
*/
|
||||
std::string name()
|
||||
{
|
||||
|
@ -32,19 +32,19 @@
|
||||
#include <mraa/gpio.h>
|
||||
|
||||
|
||||
// TM1637 specific register addresses for writing all digits at a time
|
||||
// TM1637-specific register addresses for writing all digits at a time
|
||||
#define TM1637_ADDR 0x40
|
||||
#define TM1637_REG 0xC0
|
||||
#define TM1637_CMD 0x88
|
||||
|
||||
// Display specific values
|
||||
// Display-specific values
|
||||
#define M_DISPLAY_DIGITS 4
|
||||
|
||||
namespace upm
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief TM1637 7-segment display library
|
||||
* @brief TM1637 7-Segment Display library
|
||||
* @defgroup tm1637 libupm-tm1637
|
||||
* @ingroup seeed gpio display
|
||||
*/
|
||||
@ -58,13 +58,13 @@ namespace upm
|
||||
* @man seeed
|
||||
* @con gpio
|
||||
*
|
||||
* @brief API for TM1637 (7-segment display)
|
||||
* @brief API for the TM1637 7-Segment Display
|
||||
*
|
||||
* The TM1637 is a display controller for LED based 7-segment displays.
|
||||
* TM1637 is a display controller for LED-based 7-segment displays.
|
||||
* It can be used to address and write data to multiple display digits. This
|
||||
* driver is based on the Grove version of the TM1637 display which uses 4
|
||||
* digits thus making it ideal for clock displays, timers, counters or even
|
||||
* score display in a two player arcade game.
|
||||
* driver is based on the Grove version of the TM1637 display that uses 4
|
||||
* digits, thus making it ideal for clock displays, timers, counters, or even
|
||||
* score displays in a two-player arcade game.
|
||||
*
|
||||
* @image html tm1637.jpeg
|
||||
* @snippet tm1637.cxx Interesting
|
||||
@ -74,7 +74,7 @@ namespace upm
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Enum for memory mapped GPIO
|
||||
* Enum for the memory-mapped GPIO
|
||||
*/
|
||||
typedef enum {
|
||||
NO = 0,
|
||||
@ -83,10 +83,10 @@ namespace upm
|
||||
/**
|
||||
* TM1637 constructor
|
||||
*
|
||||
* @param clk_pin the clock pin the sensor is connected to
|
||||
* @param dio_pin the data pin the sensor is connected to
|
||||
* @param bright initial brightness from 0 to 7 dark to bright (default 3)
|
||||
* @param mmio fast memory mapped gpio writes, default is yes
|
||||
* @param clk_pin Clock pin the sensor is connected to
|
||||
* @param dio_pin Data pin the sensor is connected to
|
||||
* @param bright Initial brightness, from 0 (dark) to 7 (bright) (default is 3)
|
||||
* @param mmio Fast memory-mapped GPIO writes; default is yes
|
||||
*/
|
||||
TM1637(int clk_pin, int dio_pin, int bright = 3, M_FAST_GPIO mmio = YES);
|
||||
/**
|
||||
@ -94,44 +94,44 @@ namespace upm
|
||||
*/
|
||||
~TM1637();
|
||||
/**
|
||||
* Write digits to the display in 7 segment encoding
|
||||
* Writes digits to the display in a 7-segment encoding
|
||||
*
|
||||
* @param digits an array of digits to send to the display
|
||||
* @return 0 if the write was successful, error code otherwise
|
||||
* @param digits Array of digits to send to the display
|
||||
* @return 0 if successful, error code otherwise
|
||||
*/
|
||||
mraa_result_t write(uint8_t *digits);
|
||||
/**
|
||||
* Write digits to the display in 7 segment encoding
|
||||
* Writes digits to the display in a 7-segment encoding
|
||||
*
|
||||
* @param d list of multiple arguments to send to the display
|
||||
* @return 0 if the write was successful, error code otherwise
|
||||
* @param d List of multiple arguments to send to the display
|
||||
* @return 0 if successful, error code otherwise
|
||||
*/
|
||||
mraa_result_t write(int d, ...);
|
||||
/**
|
||||
* Write a symbol (digit or letter) to the display at a specified index
|
||||
* Writes a symbol (digit or letter) to the display in a specified index
|
||||
*
|
||||
* @param index 0-based index of the digit to change from the left
|
||||
* @param symbol the digit or letter to display
|
||||
* @return 0 if the write was successful, error code otherwise
|
||||
* @param symbol Digit or letter to display
|
||||
* @return 0 if successful, error code otherwise
|
||||
*/
|
||||
mraa_result_t writeAt(int index, char symbol);
|
||||
/**
|
||||
* Write all the digits or letters to the display as a string
|
||||
* Writes all the digits or letters to the display as a string
|
||||
*
|
||||
* @param digits a string of symbols to display
|
||||
* @return 0 if the write was successful, error code otherwise
|
||||
* @param digits String of symbols to display
|
||||
* @return 0 if successful, error code otherwise
|
||||
*/
|
||||
mraa_result_t write(std::string digits);
|
||||
/**
|
||||
* Toggles the colon between digits on the display
|
||||
*
|
||||
* @param value pass true to turn on the colon, false to turn it off
|
||||
* @param value True to turn the colon on, false to turn it off
|
||||
*/
|
||||
void setColon(bool value);
|
||||
/**
|
||||
* Use to control the brightness of the display
|
||||
* Controls the brightness of the display
|
||||
*
|
||||
* @param value between 0 and 7, darkest to brightest
|
||||
* @param value Brightness, from 0 (darkest) to 7 (brightest)
|
||||
*/
|
||||
void setBrightness(int value);
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace upm {
|
||||
#define LUX_M8C (0x0000) // 0.000 * 2^LUX_SCALE
|
||||
|
||||
/**
|
||||
* @brief TSL2561 digital light sensor library
|
||||
* @brief TSL2561 Digital Light Sensor library
|
||||
* @defgroup tsl2561 libupm-tsl2561
|
||||
* @ingroup seeed i2c light eak
|
||||
*/
|
||||
@ -107,12 +107,10 @@ namespace upm {
|
||||
* @con i2c
|
||||
* @kit eak
|
||||
*
|
||||
* @brief TSL2561 Digital Light Sensor library
|
||||
* @brief API for the TSL2561 Digital Light Sensor
|
||||
*
|
||||
* The LIGHT-TO-DIGITAL CONVERTER [TAOS-TSL2561]
|
||||
* (http://www.adafruit.com/datasheets/TSL2561.pdf)
|
||||
* The TSL2560 and TSL2561 are light-to-digital converters that transform
|
||||
* light intensity to a digital signal output capable of direct I2C (TSL2561)
|
||||
* TSL2560 and TSL2561 are light-to-digital converters that transform
|
||||
* light intensity to a digital signal output capable of a direct I2C (TSL2561) interface
|
||||
*
|
||||
* @image html tsl2561.jpg
|
||||
* @snippet tsl2561.cxx Interesting
|
||||
@ -120,42 +118,42 @@ namespace upm {
|
||||
class TSL2561{
|
||||
public:
|
||||
/**
|
||||
* Instanciates a TSL2561 object
|
||||
* Instantiates a TSL2561 object
|
||||
*
|
||||
* @param bus number of used bus
|
||||
* @param devAddr address of used i2c device
|
||||
* @param gain the correct gain to use
|
||||
* @param integration time to use
|
||||
* @param bus Number of the used bus
|
||||
* @param devAddr Address of the used I2C device
|
||||
* @param gain Correct gain to use
|
||||
* @param integration Time to use
|
||||
*/
|
||||
TSL2561(int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS);
|
||||
|
||||
/**
|
||||
* GY65 object destructor to power down TSL2561 and close i2c connection.
|
||||
* GY65 object destructor; powers down TSL2561 and closes the I2C connection.
|
||||
*/
|
||||
~TSL2561();
|
||||
|
||||
/**
|
||||
* Get calculated lux reading from TSL2561
|
||||
* Gets the calculated lux reading from TSL2561
|
||||
*
|
||||
* @return the calculated lux value from the sensor
|
||||
* @return Calculated lux value from the sensor
|
||||
*/
|
||||
int getLux();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Write to TSL2561 register
|
||||
* Writes to a TSL2561 register
|
||||
*
|
||||
* @param reg addess to write
|
||||
* @param value to write
|
||||
* @param reg Addess to write
|
||||
* @param Value to write
|
||||
* @return mraa_result_t
|
||||
*/
|
||||
mraa_result_t i2cWriteReg(uint8_t reg, uint8_t value);
|
||||
|
||||
/**
|
||||
* Read from TSL2561 register
|
||||
* Reads from a TSL2561 register
|
||||
*
|
||||
* @param reg addess to read
|
||||
* @param data byte read from the register
|
||||
* @param reg Addess to read
|
||||
* @param data Byte read from the register
|
||||
* @return mraa_result_t
|
||||
*/
|
||||
mraa_result_t i2cReadReg(uint8_t reg, uint8_t &data);
|
||||
|
@ -28,13 +28,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief TTP223 touch detector sensor library
|
||||
*
|
||||
* This touch sensor detects when a finger is near the metallic pad
|
||||
* by a change in capacitance. It can replace a more traditional push
|
||||
* button. The touch sensor can still function when placed under a
|
||||
* non-metallic surface like glass or plastic.
|
||||
*
|
||||
* @brief TTP223 Touch Detector Sensor library
|
||||
* @defgroup ttp223 libupm-ttp223
|
||||
* @ingroup seeed gpio touch
|
||||
*/
|
||||
@ -48,11 +42,11 @@ namespace upm {
|
||||
* @web http://www.seeedstudio.com/depot/Grove-Touch-Sensor-p-747.html
|
||||
* @con gpio
|
||||
*
|
||||
* @brief TTP223 Touch Detector sensor library
|
||||
* @brief API for the TTP223 Touch Sensor
|
||||
*
|
||||
* This touch sensor detects when a finger is near the metallic pad
|
||||
* by a change in capacitance. It can replace a more traditional push
|
||||
* button. The touch sensor can still function when placed under a
|
||||
* by the change in capacitance. It can replace a more traditional push
|
||||
* button. The touch sensor can still function when placed under a
|
||||
* non-metallic surface like glass or plastic.
|
||||
*
|
||||
* @image html ttp223.jpg
|
||||
@ -61,9 +55,9 @@ namespace upm {
|
||||
class TTP223 {
|
||||
public:
|
||||
/**
|
||||
* TTP223 touch sensor constructor
|
||||
* TTP223 constructor
|
||||
*
|
||||
* @param pin GPIO pin where sensor is connected
|
||||
* @param pin GPIO pin where the sensor is connected
|
||||
*/
|
||||
TTP223(unsigned int pin);
|
||||
|
||||
@ -73,23 +67,23 @@ class TTP223 {
|
||||
~TTP223();
|
||||
|
||||
/**
|
||||
* Return name of this sensor
|
||||
* Returns the name of this sensor
|
||||
*
|
||||
* @return the name of this sensor
|
||||
* @return Name of this sensor
|
||||
*/
|
||||
std::string name();
|
||||
|
||||
/**
|
||||
* Get value from GPIO pin
|
||||
* Gets the value from the GPIO pin
|
||||
*
|
||||
* @return the value from the GPIO pin
|
||||
* @return Value from the GPIO pin
|
||||
*/
|
||||
int value();
|
||||
|
||||
/**
|
||||
* Returns whether or not the touch sensor is being touched
|
||||
* Determines whether the touch sensor is being touched
|
||||
*
|
||||
* @return true if the touch sensor is being touched; false otherwise
|
||||
* @return True if touched, false otherwise
|
||||
*/
|
||||
bool isPressed();
|
||||
|
||||
|
@ -44,7 +44,7 @@ const int UBLOX6_DEFAULT_UART = 0;
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief UBLOX6 & SIM28 GPS module library
|
||||
* @brief UBLOX6 & SIM28 GPS Module library
|
||||
* @defgroup ublox6 libupm-ublox6
|
||||
* @ingroup seeed uart gps tsk
|
||||
*/
|
||||
@ -52,17 +52,17 @@ namespace upm {
|
||||
* @library ublox6
|
||||
* @sensor ublox6
|
||||
* @comname Grove GPS
|
||||
* @altname U-BLOX6 SIM28
|
||||
* @altname U-BLOX 6 SIM28
|
||||
* @type gps
|
||||
* @man seeed
|
||||
* @web http://www.seeedstudio.com/depot/Grove-GPS-p-959.html
|
||||
* @con uart
|
||||
* @kit tsk
|
||||
*
|
||||
* @brief API for the U-BLOX 6 and SIM28 GPS modules
|
||||
* @brief API for the U-BLOX 6 and SIM28 GPS Modules
|
||||
*
|
||||
* UPM support for the U-BLOX 6 GPS Module. It is also compatible with
|
||||
* the SIM28 GPS Module.
|
||||
* UPM support for the U-BLOX 6 GPS module. It is also compatible with
|
||||
* the SIM28 GPS module.
|
||||
*
|
||||
* @image html ublox6.jpg
|
||||
* @snippet ublox6.cxx Interesting
|
||||
@ -70,51 +70,51 @@ namespace upm {
|
||||
class Ublox6 {
|
||||
public:
|
||||
/**
|
||||
* U-BLOX 6 GPS module constructor
|
||||
* Ublox6 object constructor
|
||||
*
|
||||
* @param uart defualt uart to use (0 or 1)
|
||||
* @param uart Default UART to use (0 or 1)
|
||||
*/
|
||||
Ublox6(int uart);
|
||||
|
||||
/**
|
||||
* U-BLOX 6 GPS module Destructor
|
||||
* Ublox6 object destructor
|
||||
*/
|
||||
~Ublox6();
|
||||
|
||||
/**
|
||||
* Check to see if there is data available for reading
|
||||
* Checks to see if there is data available for reading
|
||||
*
|
||||
* @return true if there is data available to be read
|
||||
* @return True if there is data available for reading
|
||||
*/
|
||||
bool dataAvailable();
|
||||
|
||||
/**
|
||||
* read any available data into a user-supplied buffer. Note, the
|
||||
* call will block until data is available to be read. Use
|
||||
* Reads any available data in a user-supplied buffer. Note: the
|
||||
* call blocks until data is available to be read. Use
|
||||
* dataAvailable() to determine whether there is data available
|
||||
* beforehand, to avoid blocking.
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes read
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return the Number of bytes read
|
||||
*/
|
||||
int readData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* write the data in buffer to the device
|
||||
* Writes the data in the buffer to the device
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes written
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int writeData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* setup the proper tty i/o modes and the baudrate. The default
|
||||
* baud rate is 9600 (B9600).
|
||||
* Sets up proper tty I/O modes and the baud rate. The default
|
||||
* baud rate is 9,600 (B9600).
|
||||
*
|
||||
* @param baud the desired baud rate.
|
||||
* @return true if successful
|
||||
* @param baud Desired baud rate
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setupTty(speed_t baud=B9600);
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
namespace upm {
|
||||
|
||||
/**
|
||||
* @brief ULN200XA stepper driver library
|
||||
* @brief ULN200XA Stepper Driver library
|
||||
* @defgroup uln200xa libupm-uln200xa
|
||||
* @ingroup seeed gpio motor
|
||||
*/
|
||||
@ -47,11 +47,11 @@ namespace upm {
|
||||
* @web http://www.seeedstudio.com/depot/Gear-Stepper-Motor-with-Driver-p-1685.html?cPath=39_40
|
||||
* @con gpio
|
||||
*
|
||||
* @brief UPM module for the ULN200XA Darlington Stepper driver
|
||||
* @brief UPM module for the ULN200XA Darlington Stepper Driver
|
||||
*
|
||||
* This module was developed on a ULBN2003A Stepper Driver. It
|
||||
* should support the uln2001a, 2002a, 2003a, and 2004a devices, for
|
||||
* use in driving a unipolar stepper motor, the 28BYJ-48.
|
||||
* This module was developed on a ULN2003A Stepper Driver. It
|
||||
* should also support the ULN2001A, ULN2002A, and ULN2004A devices, when
|
||||
* using to drive the 28BYJ-48 unipolar stepper motor.
|
||||
*
|
||||
* @image html uln200xa.jpg
|
||||
* Example driving a stepper motor
|
||||
@ -73,56 +73,56 @@ namespace upm {
|
||||
/**
|
||||
* ULN200XA constructor
|
||||
*
|
||||
* @param stepsPerRev number of steps per full revolution
|
||||
* @param i1 digital pin to use for stepper input 1
|
||||
* @param i2 digital pin to use for stepper input 2
|
||||
* @param i3 digital pin to use for stepper input 3
|
||||
* @param i4 digital pin to use for stepper input 4
|
||||
* @param stepsPerRev Number of steps per full revolution
|
||||
* @param i1 Digital pin to use for stepper input 1
|
||||
* @param i2 Digital pin to use for stepper input 2
|
||||
* @param i3 Digital pin to use for stepper input 3
|
||||
* @param i4 Digital pin to use for stepper input 4
|
||||
*/
|
||||
ULN200XA(int stepsPerRev, int i1, int i2, int i3, int i4);
|
||||
|
||||
/**
|
||||
* ULN200XA Destructor
|
||||
* ULN200XA destructor
|
||||
*/
|
||||
~ULN200XA();
|
||||
|
||||
/**
|
||||
* Return the number of milliseconds elapsed since initClock()
|
||||
* Returns the number of milliseconds elapsed since initClock()
|
||||
* was last called.
|
||||
*
|
||||
* @return elapsed milliseconds
|
||||
* @return Elapsed milliseconds
|
||||
*/
|
||||
uint32_t getMillis();
|
||||
|
||||
/**
|
||||
* Reset the Clock
|
||||
* Resets the clock
|
||||
*
|
||||
*/
|
||||
void initClock();
|
||||
|
||||
/**
|
||||
* set the speed of the stepper in RPM (Rotation Per Minute
|
||||
* Sets the speed of the stepper motor in revolutions per minute (RPM)
|
||||
*
|
||||
* @param speed speed to set the motor to in RPM's
|
||||
* @param speed Speed to set the motor to, in RPM
|
||||
*/
|
||||
void setSpeed(int speed);
|
||||
|
||||
/**
|
||||
* set the direction of the motor, clockwise or counter clockwise
|
||||
* Sets the direction of the motor, clockwise or counterclockwise
|
||||
*
|
||||
* @param dir direction to set the motor to
|
||||
* @param dir Direction to set the motor to
|
||||
*/
|
||||
void setDirection(ULN200XA_DIRECTION_T dir);
|
||||
|
||||
/**
|
||||
* step the stepper motor a specified number of steps
|
||||
* Steps the stepper motor a specified number of steps
|
||||
*
|
||||
* @param steps number of steps to move the stepper motor
|
||||
* @param steps Number of steps to move the stepper motor
|
||||
*/
|
||||
void stepperSteps(unsigned int steps);
|
||||
|
||||
/**
|
||||
* release the stepper, by removing power
|
||||
* Releases the stepper motor by removing power
|
||||
*
|
||||
*/
|
||||
void release();
|
||||
@ -142,13 +142,13 @@ namespace upm {
|
||||
uint32_t m_stepDelay;
|
||||
|
||||
/**
|
||||
* step the motor one tick
|
||||
* Steps the stepper motor one tick
|
||||
*
|
||||
*/
|
||||
void stepperStep();
|
||||
|
||||
/**
|
||||
* step direction - 1 = forward, -1 = backward
|
||||
* Defines the step direction: 1 = forward, -1 = backward
|
||||
*
|
||||
*/
|
||||
int m_stepDirection;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief Water Level switch library
|
||||
* @brief Water Level Switch Library
|
||||
* @defgroup waterlevel libupm-waterlevel
|
||||
* @ingroup seeed gpio liquid
|
||||
*/
|
||||
@ -50,17 +50,17 @@ namespace upm {
|
||||
class WaterLevel {
|
||||
public:
|
||||
/**
|
||||
* Water Level Constructor
|
||||
* WaterLevel constructor
|
||||
*
|
||||
* @param pin digital pin to use
|
||||
* @param pin Digital pin to use
|
||||
*/
|
||||
WaterLevel(int pin);
|
||||
/**
|
||||
* Water Level Destructor
|
||||
* WaterLevel destructor
|
||||
*/
|
||||
~WaterLevel();
|
||||
/**
|
||||
* @return bool returns whether liquid has gone above sensor
|
||||
* @return bool Determines whether liquid has risen above the sensor
|
||||
*/
|
||||
bool isSubmerged();
|
||||
|
||||
|
@ -63,9 +63,9 @@ namespace upm {
|
||||
* @web http://www.seeedstudio.com/wiki/Grove_%E2%80%93_Serial_MP3_Player
|
||||
* @con uart
|
||||
*
|
||||
* @brief API for the WT5001 Serial MP3 module
|
||||
* @brief API for the WT5001 Serial MP3 Module
|
||||
*
|
||||
* UPM support for the WT5001 Serial MP3 Module. This was tested
|
||||
* UPM support for the WT5001 Serial MP3 module. This was tested
|
||||
* specifically with the Grove Serial MP3 module.
|
||||
*
|
||||
* @image html wt5001.jpg
|
||||
@ -120,220 +120,220 @@ namespace upm {
|
||||
} WT5001_PLAYSOURCE_T;
|
||||
|
||||
/**
|
||||
* WT5001 Serial MP3 module constructor
|
||||
* WT5001 constructor
|
||||
*
|
||||
* @param uart default uart to use (0 or 1)
|
||||
* @param uart Default UART to use (0 or 1)
|
||||
*/
|
||||
WT5001(int uart);
|
||||
|
||||
/**
|
||||
* WT5001 Serial MP3 module Destructor
|
||||
* WT5001 destructor
|
||||
*/
|
||||
~WT5001();
|
||||
|
||||
/**
|
||||
* Check to see if there is data available for reading
|
||||
* Checks to see if there is data available for reading
|
||||
*
|
||||
* @param millis number of milliseconds to wait, 0 means no wait.
|
||||
* @return true if there is data available to be read
|
||||
* @param millis Number of milliseconds to wait; 0 means no waiting
|
||||
* @return True if there is data available for reading
|
||||
*/
|
||||
bool dataAvailable(unsigned int millis);
|
||||
|
||||
/**
|
||||
* read any available data into a user-supplied buffer. Note, the
|
||||
* call will block until data is available to be read. Use
|
||||
* Reads any available data in a user-supplied buffer. Note: the
|
||||
* call blocks until data is available to be read. Use
|
||||
* dataAvailable() to determine whether there is data available
|
||||
* beforehand, to avoid blocking.
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes read
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
int readData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* write the data in buffer to the device
|
||||
* Writes the data in the buffer to the device
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes written
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int writeData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* setup the proper tty i/o modes and the baudrate. The default
|
||||
* baud rate is 9600 (B9600).
|
||||
* Sets up proper tty I/O modes and the baud rate. The default
|
||||
* baud rate is 9,600 (B9600).
|
||||
*
|
||||
* @param baud the desired baud rate.
|
||||
* @return true if successful
|
||||
* @param baud Desired baud rate.
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setupTty(speed_t baud=B9600);
|
||||
|
||||
/**
|
||||
* Get a command response and return it's validity
|
||||
* Gets a command response and returns its validity
|
||||
*
|
||||
* @param index opcode to verify
|
||||
* @return true if successful
|
||||
* @param index Opcode to verify
|
||||
* @return True if successful
|
||||
*/
|
||||
bool checkResponse(WT5001_OPCODE_T opcode);
|
||||
|
||||
/**
|
||||
* play a file, from a source
|
||||
* Plays a file from a source
|
||||
*
|
||||
* @param psrc the play source (SD, UDISK, SPI)
|
||||
* @param index file number to play
|
||||
* @return true if successful
|
||||
* @param psrc Play source (SD, UDISK, SPI)
|
||||
* @param index File number to play
|
||||
* @return True if successful
|
||||
*/
|
||||
bool play(WT5001_PLAYSOURCE_T psrc, uint16_t index);
|
||||
|
||||
/**
|
||||
* stop playing
|
||||
* Stops playing
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool stop();
|
||||
|
||||
/**
|
||||
* pause playback, or resume playback if already paused
|
||||
* Pauses the playback or resumes it if already paused
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool pause();
|
||||
|
||||
/**
|
||||
* go to next track
|
||||
* Moves to the next track
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool next();
|
||||
|
||||
/**
|
||||
* go to previous track
|
||||
* Moves to the previous track
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool previous();
|
||||
|
||||
/**
|
||||
* set the volume. Range is between 0-31. 0 means mute.
|
||||
* Sets the volume. Valid range is 0-31. 0 means mute.
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setVolume(uint8_t vol);
|
||||
|
||||
/**
|
||||
* queue a track to play next, when current song is finished
|
||||
* Queues a track to play next, when the current song is finished
|
||||
*
|
||||
* @param index file number to queue
|
||||
* @return true if successful
|
||||
* @param index File number to queue
|
||||
* @return True if successful
|
||||
*/
|
||||
bool queue(uint16_t index);
|
||||
|
||||
/**
|
||||
* set the playback mode
|
||||
* Sets the playback mode
|
||||
*
|
||||
* @param pm play mode to enable
|
||||
* @return true if successful
|
||||
* @param pm Play mode to enable
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setPlayMode(WT5001_PLAYMODE_T pm);
|
||||
|
||||
/**
|
||||
* insert a track to play immediately, interrupting the current
|
||||
* track. When the inserted track is finished playing, the
|
||||
* interrupted track will resume where it was interrupted.
|
||||
* Inserts a track to play immediately, interrupting the current
|
||||
* track. When the inserted track is finished, the
|
||||
* interrupted track resumes where it was interrupted.
|
||||
*
|
||||
* @param index file number to insert
|
||||
* @return true if successful
|
||||
* @param index File number to insert
|
||||
* @return True if successful
|
||||
*/
|
||||
bool insert(uint16_t index);
|
||||
|
||||
/**
|
||||
* set the date of the internal clock
|
||||
* Sets the date of the internal clock
|
||||
*
|
||||
* @param year 4 digit year
|
||||
* @param month the month
|
||||
* @param day the day
|
||||
* @return true if successful
|
||||
* @param year 4-digit year
|
||||
* @param month Month
|
||||
* @param day Day
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setDate(uint16_t year, uint8_t month, uint8_t day);
|
||||
|
||||
/**
|
||||
* set the time of the internal clock
|
||||
* Sets the time of the internal clock
|
||||
*
|
||||
* @param hour hour
|
||||
* @param minute minute
|
||||
* @param second second
|
||||
* @return true if successful
|
||||
* @param hour Hour
|
||||
* @param minute Minute
|
||||
* @param second Second
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setTime(uint8_t hour, uint8_t minute, uint8_t second);
|
||||
|
||||
/**
|
||||
* set the alarm
|
||||
* Sets the alarm
|
||||
*
|
||||
* @param hour hour
|
||||
* @param minute minute
|
||||
* @param second second
|
||||
* @return true if successful
|
||||
* @param hour Hour
|
||||
* @param minute Minute
|
||||
* @param second Second
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setAlarm(uint8_t hour, uint8_t minute, uint8_t second);
|
||||
|
||||
/**
|
||||
* clear any alarm that has been set
|
||||
* Clears any alarm that has been set
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool clearAlarm();
|
||||
|
||||
/**
|
||||
* get the current volume
|
||||
* Gets the current volume
|
||||
*
|
||||
* @param vol the returned volume
|
||||
* @return true if successful
|
||||
* @param vol Volume
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getVolume(uint8_t *vol);
|
||||
|
||||
/**
|
||||
* get the current play state. 1 = playing, 2 = stopped, 3 = paused
|
||||
* Gets the current play state: 1 = playing, 2 = stopped, 3 = paused
|
||||
*
|
||||
* @param ps the returned play state
|
||||
* @return true if successful
|
||||
* @param ps Play state
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getPlayState(uint8_t *ps);
|
||||
|
||||
/**
|
||||
* get the number of files present on the source device
|
||||
* Gets the number of files present on the source device
|
||||
*
|
||||
* @param psrc the storage source
|
||||
* @param numf the returned number of files
|
||||
* @return true if successful
|
||||
* @param psrc Storage source
|
||||
* @param numf Number of files
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getNumFiles(WT5001_PLAYSOURCE_T psrc, uint16_t *numf);
|
||||
|
||||
/**
|
||||
* get the index of the current file
|
||||
* Gets the index of the current file
|
||||
*
|
||||
* @param curf the index of the current file
|
||||
* @return true if successful
|
||||
* @param curf Index of the current file
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getCurrentFile(uint16_t *curf);
|
||||
|
||||
/**
|
||||
* get the device date
|
||||
* Gets the device date
|
||||
*
|
||||
* @param year returned 4 digit year
|
||||
* @param month returned month
|
||||
* @param day returned day
|
||||
* @return true if successful
|
||||
* @param year 4-digit year
|
||||
* @param month Month
|
||||
* @param day Day
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getDate(uint16_t *year, uint8_t *month, uint8_t *day);
|
||||
|
||||
/**
|
||||
* get the device time
|
||||
* Gets the device time
|
||||
*
|
||||
* @param hour returned hour
|
||||
* @param minute returned minute
|
||||
* @param second returned second
|
||||
* @return true if successful
|
||||
* @param hour Hour
|
||||
* @param minute Minute
|
||||
* @param second Second
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getTime(uint8_t *hour, uint8_t *minute, uint8_t *second);
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief YG1006 flame sensor library
|
||||
* @brief YG1006 Flame Sensor library
|
||||
* @defgroup yg1006 libupm-yg1006
|
||||
* @ingroup seeed gpio light hak
|
||||
*/
|
||||
@ -43,10 +43,10 @@ namespace upm {
|
||||
* @con gpio
|
||||
* @kit hak
|
||||
*
|
||||
* @brief API for the YG1006 flame sensor
|
||||
* @brief API for the YG1006 Flame Sensor
|
||||
*
|
||||
* UPM module for the YG1006 flame sensor. It detects flame or any
|
||||
* other light in the 760nm - 1100nm wavelength range.
|
||||
* UPM module for the YG1006 flame sensor. It detects a flame or any
|
||||
* other light source in the 760-1,100 nm wavelength range.
|
||||
*
|
||||
* @image html yg1006.jpg
|
||||
* @snippet yg1006.cxx Interesting
|
||||
@ -54,19 +54,19 @@ namespace upm {
|
||||
class YG1006 {
|
||||
public:
|
||||
/**
|
||||
* YG1006 digital flame sensor constructor
|
||||
* YG1006 constructor
|
||||
*
|
||||
* @param pin digital pin to use
|
||||
* @param pin Digital pin to use
|
||||
*/
|
||||
YG1006(int pin);
|
||||
/**
|
||||
* YG1006 Destructor
|
||||
* YG1006 destructor
|
||||
*/
|
||||
~YG1006();
|
||||
/**
|
||||
* Determine whether a flame has been detected
|
||||
* Determines whether a flame has been detected
|
||||
*
|
||||
* @return True if a flame or other comparable light source is detected
|
||||
* @return True if a flame or another comparable light source has been detected
|
||||
*/
|
||||
bool flameDetected();
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
* @brief ZFM-20 fingerprint sensor module library
|
||||
* @brief ZFM-20 Fingerprint Sensor Module library
|
||||
* @defgroup zfm20 libupm-zfm20
|
||||
* @ingroup seeed uart touch
|
||||
*/
|
||||
@ -73,14 +73,14 @@ namespace upm {
|
||||
* @man seeed
|
||||
* @con uart
|
||||
*
|
||||
* @brief API for the ZFM-20 fingerprint sensor module
|
||||
* @brief API for the ZFM-20 Fingerprint Sensor Module
|
||||
*
|
||||
* This class was tested on the Grove Fingerprint Sensor
|
||||
* Module. It can store up to 163 fingerprints.
|
||||
*
|
||||
* It is connected via a UART at 57600 baud.
|
||||
* It is connected via a UART at 57,600 baud.
|
||||
*
|
||||
* @image html zfm20.jpg
|
||||
* @image html zfm20.jpg
|
||||
* This example demonstrates how to register and store a new fingerprint
|
||||
* @snippet zfm20-register.cxx Interesting
|
||||
* This example demonstrates reading a fingerprint and locating it in the DB
|
||||
@ -138,7 +138,7 @@ namespace upm {
|
||||
ERR_INVALID_REG = 0x1a,
|
||||
ERR_INVALID_ADDR = 0x20,
|
||||
ERR_NEEDS_PWD = 0x21,
|
||||
// end of module specific errors
|
||||
// end of module-specific errors
|
||||
ERR_INTERNAL_ERR = 0xff // API internal error
|
||||
} ZFM20_ERRORS_T;
|
||||
|
||||
@ -150,215 +150,215 @@ namespace upm {
|
||||
} ZFM20_PKTCODES_T;
|
||||
|
||||
/**
|
||||
* ZFM20 module constructor
|
||||
* ZFM20 constructor
|
||||
*
|
||||
* @param uart default uart to use (0 or 1)
|
||||
* @param uart Default UART to use (0 or 1)
|
||||
*/
|
||||
ZFM20(int uart);
|
||||
|
||||
/**
|
||||
* ZFM20 module Destructor
|
||||
* ZFM20 destructor
|
||||
*/
|
||||
~ZFM20();
|
||||
|
||||
/**
|
||||
* check to see if there is data available for reading
|
||||
* Checks to see if there is data available for reading
|
||||
*
|
||||
* @param millis number of milliseconds to wait, 0 means no wait.
|
||||
* @return true if there is data available to be read
|
||||
* @param millis Number of milliseconds to wait; 0 means no waiting
|
||||
* @return true if there is data available for reading
|
||||
*/
|
||||
bool dataAvailable(unsigned int millis);
|
||||
|
||||
/**
|
||||
* read any available data into a user-supplied buffer. Note, the
|
||||
* call will block until data is available to be read. Use
|
||||
* Reads any available data in a user-supplied buffer. Note: the
|
||||
* call blocks until data is available to be read. Use
|
||||
* dataAvailable() to determine whether there is data available
|
||||
* beforehand, to avoid blocking.
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes read
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
int readData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* write the data in buffer to the device
|
||||
* Writes the data in the buffer to the device
|
||||
*
|
||||
* @param buffer the buffer to hold the data read
|
||||
* @param len the length of the buffer
|
||||
* @return the number of bytes written
|
||||
* @param buffer Buffer to hold the data read
|
||||
* @param len Length of the buffer
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int writeData(char *buffer, size_t len);
|
||||
|
||||
/**
|
||||
* setup the proper tty i/o modes and the baudrate. The default
|
||||
* baud rate is 57600 (B57600) for this device.
|
||||
* Sets up proper tty I/O modes and the baud rate. For this device,
|
||||
* the default baud rate is 57,600 (B57600).
|
||||
*
|
||||
* @param baud the desired baud rate.
|
||||
* @return true if successful
|
||||
* @param baud Desired baud rate.
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setupTty(speed_t baud=B57600);
|
||||
|
||||
/**
|
||||
* compose and write a command packet
|
||||
* Composes and writes a command packet
|
||||
*
|
||||
* @param pkt the packet
|
||||
* @param len length of packet
|
||||
* @return the number of bytes written
|
||||
* @param pkt Packet
|
||||
* @param len Length of packet
|
||||
* @return Number of bytes written
|
||||
*/
|
||||
int writeCmdPacket(unsigned char *pkt, int len);
|
||||
|
||||
/**
|
||||
* verify the packet header and indicate it's validity
|
||||
* Verifies the packet header and indicates its validity
|
||||
*
|
||||
* @param pkt the packet to check
|
||||
* @return true if valid checksum, false otherwise
|
||||
* @param pkt Packet to check
|
||||
* @return True if the checksum is valid, false otherwise
|
||||
*/
|
||||
bool verifyPacket(unsigned char *pkt);
|
||||
|
||||
/**
|
||||
* Return the number of milliseconds elapsed since initClock()
|
||||
* was last called.
|
||||
* Returns the number of milliseconds elapsed since initClock()
|
||||
* was last called
|
||||
*
|
||||
* @return elapsed milliseconds
|
||||
* @return Elapsed milliseconds
|
||||
*/
|
||||
uint32_t getMillis();
|
||||
|
||||
/**
|
||||
* Reset the Clock
|
||||
* Resets the clock
|
||||
*
|
||||
*/
|
||||
void initClock();
|
||||
|
||||
/**
|
||||
* set the address that should be used to access the module
|
||||
* Sets the address that should be used to access the module
|
||||
*
|
||||
* @param addr the address to use
|
||||
* @param addr Address to use
|
||||
*/
|
||||
void setAddress(uint32_t addr) { m_address = addr; };
|
||||
|
||||
/**
|
||||
* set the password that should be used to access the module
|
||||
* Sets the password that should be used to access the module
|
||||
*
|
||||
* @param pw password to use
|
||||
* @param pw Password to use
|
||||
*/
|
||||
void setPassword(uint32_t pw) { m_password = pw; };
|
||||
|
||||
/**
|
||||
* get the returned data from a request
|
||||
* Gets the returned data from a request
|
||||
*
|
||||
* @param pkt the buffer to store the returned data into
|
||||
* @param len the expected response length. pkt should be at least this
|
||||
* big.
|
||||
* @return true if successful
|
||||
* @param pkt Buffer to store the returned data
|
||||
* @param len Expected response length; pkt should be at least this
|
||||
* large
|
||||
* @return True if successful
|
||||
*/
|
||||
bool getResponse(unsigned char *pkt, int len);
|
||||
|
||||
/**
|
||||
* verify and authenticate to the module. The password used is
|
||||
* the one last set by setPassword().
|
||||
* Verifies and authenticates to the module. The password used is
|
||||
* the last one set by setPassword().
|
||||
*
|
||||
* @return true if successful
|
||||
* @return True if successful
|
||||
*/
|
||||
bool verifyPassword();
|
||||
|
||||
/**
|
||||
* query the module for the number of stored templates
|
||||
* Queries the module for the number of stored templates
|
||||
* (fingerprints).
|
||||
*
|
||||
* @return the number of currently stored templates
|
||||
* @return Number of currently stored templates
|
||||
*/
|
||||
int getNumTemplates();
|
||||
|
||||
/**
|
||||
* set a new password for the module. This passowrd will be
|
||||
* stored on the module, and will be required in order to access
|
||||
* Sets a new password for the module. This passowrd is
|
||||
* stored in the module, and is required to access
|
||||
* the module in the future.
|
||||
*
|
||||
* @param pwd the new password to set on the module
|
||||
* @return true if successful
|
||||
* @param pwd New password to set on the module
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setNewPassword(uint32_t pwd);
|
||||
|
||||
/**
|
||||
* set a new address for the module. This address will be
|
||||
* stored on the module, and will be required in order to access
|
||||
* Sets a new address for the module. This address is
|
||||
* stored in the module, and is required to access
|
||||
* the module in the future.
|
||||
*
|
||||
* @param addr the new address to set on the module
|
||||
* @return true if successful
|
||||
* @param addr New address to set on the module
|
||||
* @return True if successful
|
||||
*/
|
||||
bool setNewAddress(uint32_t addr);
|
||||
|
||||
/**
|
||||
* generate a new fingerprint image (scan a fingerprint)
|
||||
* Generates a new fingerprint image (scans a fingerprint)
|
||||
*
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t generateImage();
|
||||
|
||||
/**
|
||||
* convert the image in the image buffer (generated by
|
||||
* generateImage()) and store it in one of the two characteristics
|
||||
* Converts the image in the image buffer (generated by
|
||||
* generateImage()) and stores it in one of the two characteristics
|
||||
* buffers, 1 or 2
|
||||
*
|
||||
* @param slot the characteristics buffer to use. Must be 1 or 2.
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @param slot Characteristics buffer to use; must be 1 or 2
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t image2Tz(int slot);
|
||||
|
||||
/**
|
||||
* based on the two characteristics bufferes (1 & 2), create a
|
||||
* fingerprint model. Once a model has been successfully created,
|
||||
* Based on the two characteristics buffers (1 & 2), creates a
|
||||
* fingerprint model. Once a model is successfully created,
|
||||
* it can be stored in the module with storeModel().
|
||||
*
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t createModel();
|
||||
|
||||
/**
|
||||
* once a fingerprint model has been created, this method can be
|
||||
* Once a fingerprint model is created, this method can be
|
||||
* used to store it (via one of the characteristics buffers) in a
|
||||
* given location.
|
||||
*
|
||||
* @param slot the characteristics buffer to store (1 or 2)
|
||||
* @param id the location in which to store the model
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @param slot Characteristics buffer to store the model, 1 or 2
|
||||
* @param id Location to store the model
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t storeModel(int slot, uint16_t id);
|
||||
|
||||
/**
|
||||
* delete a stored model.
|
||||
* Deletes a stored model
|
||||
*
|
||||
* @param id the location containing the model to delete
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @param id Location containing the model to delete
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t deleteModel(uint16_t id);
|
||||
|
||||
/**
|
||||
* delete the model database
|
||||
* Deletes the model database (DB)
|
||||
*
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t deleteDB();
|
||||
|
||||
/**
|
||||
* search the fingerprint DB and return the id and score, if found
|
||||
* Searches the fingerprint DB and returns an ID and score, if found
|
||||
*
|
||||
*
|
||||
* @param slot the slot containing a converted image to search for
|
||||
* @param id the returned id if found, 0 otherwise
|
||||
* @param score the returned score if found, 0 otherwise
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @param slot Slot containing a converted image to search for
|
||||
* @param id ID if found, 0 otherwise
|
||||
* @param score Score if found, 0 otherwise
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t search(int slot, uint16_t *id, uint16_t *score);
|
||||
|
||||
/**
|
||||
* compares the features in characteristic buffers 1 and 2 and
|
||||
* Compares the features in characteristics buffers 1 and 2 and
|
||||
* returns a score if they match
|
||||
*
|
||||
* @param score the returned score
|
||||
* @return one of the ZFM20_ERRORS_T values
|
||||
* @param score Score
|
||||
* @return One of the ZFM20_ERRORS_T values
|
||||
*/
|
||||
uint8_t match(uint16_t *score);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user