From d15bf22536e4daed5bc0aca0f4ce7f26d2517b9b Mon Sep 17 00:00:00 2001 From: Kirill Luchikhin Date: Tue, 29 Jul 2014 21:46:48 +0400 Subject: [PATCH 1/1] Fix some dosctrings errors and trailing whitespaces Signed-off-by: Kirill Luchikhin --- src/buzzer/buzzer.h | 2 +- src/gy65/gy65.h | 3 ++- src/hmc5883l/hmc5883l.h | 25 ++++++++++++++++++++++--- src/lcd/i2clcd.h | 4 ++-- src/lcd/jhd1313m1.cxx | 4 ++-- src/lcd/lcm1602.cxx | 2 +- src/lcd/ssd1308.h | 2 +- src/mic/mic.h | 19 +++++++++++++------ src/mma7455/mma7455.cxx | 45 ++++++++++++++++++++++----------------------- src/mma7455/mma7455.h | 26 +++++++++++++------------- src/my9221/my9221.cxx | 4 ++-- src/nrf24l01/nrf24l01.cxx | 1 - src/nrf24l01/nrf24l01.h | 14 +++++++------- src/pulsensor/pulsensor.cxx | 36 ++++++++++++++++++------------------ src/pulsensor/pulsensor.h | 2 +- src/servo/servo.cxx | 24 ++++++++++++------------ src/servo/servo.h | 16 ++++++++-------- src/st7735/gfx.h | 6 ++++-- src/st7735/st7735.h | 2 +- src/tm1637/tm1637.cxx | 2 +- src/tm1637/tm1637.h | 2 +- 21 files changed, 134 insertions(+), 107 deletions(-) diff --git a/src/buzzer/buzzer.h b/src/buzzer/buzzer.h index 7478f92..7ff0468 100644 --- a/src/buzzer/buzzer.h +++ b/src/buzzer/buzzer.h @@ -49,7 +49,7 @@ class Buzzer { /** * Instanciates a Buzzer object * - * @param pin Buzzer pin number + * @param pinNumber Buzzer pin number */ Buzzer (int pinNumber); diff --git a/src/gy65/gy65.h b/src/gy65/gy65.h index afb0cc2..e3133d2 100644 --- a/src/gy65/gy65.h +++ b/src/gy65/gy65.h @@ -73,7 +73,8 @@ class GY65 { * Instanciates a GY65 object * * @param bus number of used bus - * @param devAddr addres of used i2c device + * @param devAddr address of used i2c device + * @param mode BMP085 mode */ GY65 (int bus, int devAddr, uint8_t mode = BMP085_ULTRAHIGHRES); diff --git a/src/hmc5883l/hmc5883l.h b/src/hmc5883l/hmc5883l.h index a274ba2..8456099 100644 --- a/src/hmc5883l/hmc5883l.h +++ b/src/hmc5883l/hmc5883l.h @@ -29,19 +29,38 @@ namespace upm { +/** + * @brief C++ API for HMC5883l (3-axis digital compass) + * + * This file defines the HMC5883l C++ interface for libhmc5883l + * + * @snippet hmc5883l.cxx Interesting + * + */ + class Hmc5883l { public: - /// Creates a Hmc5883l object + /** + * Creates a Hmc5883l object + * + * @param bus number of used i2c bus + * + */ Hmc5883l(int bus); - /// Returns the direction + /* + * Returns the direction + */ float direction(); - /// Returns the heading + /* + * Returns the heading + */ float heading(); /** * Returns a pointer to an int[3] that contains the coordinates as ints + * * @return *int to an int[3] */ int* coordinates(); diff --git a/src/lcd/i2clcd.h b/src/lcd/i2clcd.h index d7ec3ea..48530ce 100644 --- a/src/lcd/i2clcd.h +++ b/src/lcd/i2clcd.h @@ -76,7 +76,7 @@ class I2CLcd { public: I2CLcd (int bus, int lcdAddress); mraa_result_t write (int x, int y, std::string msg); - + virtual mraa_result_t write (std::string msg) = 0; virtual mraa_result_t setCursor (int row, int column) = 0; virtual mraa_result_t clear () = 0; @@ -84,7 +84,7 @@ class I2CLcd { virtual mraa_result_t i2Cmd (mraa_i2c_context ctx, uint8_t value); virtual mraa_result_t i2cReg (mraa_i2c_context ctx, int deviceAdress, int addr, uint8_t data); virtual mraa_result_t i2cData (mraa_i2c_context ctx, uint8_t value); - + mraa_result_t close(); std::string name() { diff --git a/src/lcd/jhd1313m1.cxx b/src/lcd/jhd1313m1.cxx index 5f094f8..5446c57 100644 --- a/src/lcd/jhd1313m1.cxx +++ b/src/lcd/jhd1313m1.cxx @@ -52,7 +52,7 @@ Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcd i2Cmd (m_i2c_lcd_control, LCD_DISPLAYCONTROL | LCD_DISPLAYON); clear (); usleep(4500); - + i2Cmd (m_i2c_lcd_control, LCD_ENTRYMODESET | LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT); @@ -67,7 +67,7 @@ Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcd } Jhd1313m1::~Jhd1313m1() { - + } mraa_result_t diff --git a/src/lcd/lcm1602.cxx b/src/lcd/lcm1602.cxx index dd76f5d..007f5a4 100644 --- a/src/lcd/lcm1602.cxx +++ b/src/lcd/lcm1602.cxx @@ -61,7 +61,7 @@ Lcm1602::Lcm1602(int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) { } Lcm1602::~Lcm1602 () { - + } /* diff --git a/src/lcd/ssd1308.h b/src/lcd/ssd1308.h index 2e42376..3bdbde6 100644 --- a/src/lcd/ssd1308.h +++ b/src/lcd/ssd1308.h @@ -29,7 +29,7 @@ namespace upm { -#define DISPLAY_CMD_OFF 0xAE +#define DISPLAY_CMD_OFF 0xAE #define DISPLAY_CMD_ON 0xAF #define BASE_LOW_COLUMN_ADDR 0x00 diff --git a/src/mic/mic.h b/src/mic/mic.h index 9b72059..f7fafa0 100644 --- a/src/mic/mic.h +++ b/src/mic/mic.h @@ -61,9 +61,9 @@ class Microphone { * Get samples from microphone according to provided window and * number of samples * - * @return freqMS time between each sample (in microseconds) - * @return numberOfSamples number of sample to sample for this window - * @return 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 bufer with sampled data */ int getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples, uint16_t * buffer); @@ -71,12 +71,19 @@ class Microphone { * Given sampled buffer this method will return TRUE/FALSE if threshold * was reached * - * @return threshold sample threshold - * @return buffer buffer with samples - * @return len bufer len + * @param ctx threshold context + * @param threshold sample threshold + * @param buffer buffer with samples + * @param len bufer len */ int findThreshold (thresholdContext* ctx, unsigned int threshold, uint16_t * buffer, unsigned int len); + /** + * + * Print running average of threshold context + * + * @param ctx threshold context + */ void printGraph (thresholdContext* ctx); private: diff --git a/src/mma7455/mma7455.cxx b/src/mma7455/mma7455.cxx index 074ed32..0d79de3 100644 --- a/src/mma7455/mma7455.cxx +++ b/src/mma7455/mma7455.cxx @@ -36,7 +36,7 @@ using namespace upm; MMA7455::MMA7455 (int bus, int devAddr) { unsigned char data = 0; int nBytes = 0; - + m_name = "MMA7455"; m_controlAddr = devAddr; @@ -49,7 +49,7 @@ MMA7455::MMA7455 (int bus, int devAddr) { fprintf(stderr, "Messed up i2c bus\n"); return; } - + // setting GLVL 0x1 (64LSB/g) and MODE 0x1 (Measurement Mode) data = (BIT (MMA7455_GLVL0) | BIT (MMA7455_MODE0)); error = ic2WriteReg (MMA7455_MCTL, &data, 0x1); @@ -57,7 +57,7 @@ MMA7455::MMA7455 (int bus, int devAddr) { std::cout << "ERROR :: MMA7455 instance wan not created (Mode)" << std::endl; return; } - + if (MRAA_SUCCESS != calibrate ()) { std::cout << "ERROR :: MMA7455 instance wan not created (Calibrate)" << std::endl; return; @@ -68,63 +68,63 @@ MMA7455::~MMA7455() { mraa_i2c_stop(m_i2ControlCtx); } -mraa_result_t +mraa_result_t MMA7455::calibrate () { mraa_result_t error = MRAA_SUCCESS; int i = 0; - + accelData xyz; xyz.value.x = xyz.value.y = xyz.value.z = 0; - + do { error = readData (&xyz.value.x, &xyz.value.y, &xyz.value.z); if (MRAA_SUCCESS != error) { return error; } - + xyz.value.x += 2 * -xyz.value.x; xyz.value.y += 2 * -xyz.value.y; xyz.value.z += 2 * -(xyz.value.z - 64); - + error = ic2WriteReg (MMA7455_XOFFL, (unsigned char *) &xyz, 0x6); if (error != MRAA_SUCCESS) { return error; } - + } while ( ++i < 3 ); - + return error; } -mraa_result_t +mraa_result_t MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) { accelData xyz; unsigned char data = 0; int nBytes = 0; - + /*do { nBytes = ic2ReadReg (MMA7455_STATUS, &data, 0x1); } while ( !(data & MMA7455_DRDY) && nBytes == MRAA_SUCCESS); - + if (nBytes == MRAA_SUCCESS) { std::cout << "NO_GDB :: 1" << std::endl; return MRAA_SUCCESS; }*/ - + nBytes = ic2ReadReg (MMA7455_XOUTL, (unsigned char *) &xyz, 0x6); if (nBytes == 0) { std::cout << "NO_GDB :: 2" << std::endl; return MRAA_ERROR_UNSPECIFIED; } - + if (xyz.reg.x_msb & 0x02) { xyz.reg.x_msb |= 0xFC; } - + if (xyz.reg.y_msb & 0x02) { xyz.reg.y_msb |= 0xFC; } - + if (xyz.reg.z_msb & 0x02) { xyz.reg.z_msb |= 0xFC; } @@ -133,16 +133,16 @@ MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) { *ptrX = xyz.value.x; *ptrY = xyz.value.y; *ptrZ = xyz.value.z; - + return MRAA_SUCCESS; } -int +int MMA7455::ic2ReadReg (unsigned char reg, unsigned char * buf, unsigned char size) { if (MRAA_SUCCESS != mraa_i2c_address(m_i2ControlCtx, m_controlAddr)) { return 0; } - + if (MRAA_SUCCESS != mraa_i2c_write_byte(m_i2ControlCtx, reg)) { return 0; } @@ -150,11 +150,11 @@ MMA7455::ic2ReadReg (unsigned char reg, unsigned char * buf, unsigned char size) if (MRAA_SUCCESS != mraa_i2c_address(m_i2ControlCtx, m_controlAddr)) { return 0; } - + return (int) mraa_i2c_read(m_i2ControlCtx, buf, size); } -mraa_result_t +mraa_result_t MMA7455::ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size) { mraa_result_t error = MRAA_SUCCESS; @@ -173,4 +173,3 @@ MMA7455::ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size return error; } - diff --git a/src/mma7455/mma7455.h b/src/mma7455/mma7455.h index a639659..10f8f68 100644 --- a/src/mma7455/mma7455.h +++ b/src/mma7455/mma7455.h @@ -53,7 +53,7 @@ #define MMA7455_YOFFH 0x13 // Read/Write, Offset Drift Y MSB #define MMA7455_ZOFFL 0x14 // Read/Write, Offset Drift Z LSB #define MMA7455_ZOFFH 0x15 // Read/Write, Offset Drift Z MSB -#define MMA7455_MCTL 0x16 // Read/Write, Mode Control Register +#define MMA7455_MCTL 0x16 // Read/Write, Mode Control Register #define MMA7455_INTRST 0x17 // Read/Write, Interrupt Latch Reset #define MMA7455_CTL1 0x18 // Read/Write, Control 1 Register #define MMA7455_CTL2 0x19 // Read/Write, Control 2 Register @@ -64,11 +64,11 @@ #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 +// Defines for the bits, to be able to change // between bit number and binary definition. -// By using the bit number, programming the MMA7455 +// By using the bit number, programming the MMA7455 // is like programming an AVR microcontroller. -// But instead of using "(1<callback = handler; - + ctx->pin_ctx = mraa_aio_init(0); - + ctx->sample_counter = 0; ctx->last_beat_time = 0; ctx->threshold = 512; @@ -66,51 +66,51 @@ void * do_sample (void * arg) { mraa_aio_context pin = ctx->pin_ctx; data_from_sensor = mraa_aio_read (pin); ctx->ret = FALSE; - + ctx->sample_counter += 2; int N = ctx->sample_counter - ctx->last_beat_time; - + if (data_from_sensor < ctx->threshold && N > ( ctx->ibi / 5)* 3) { if (data_from_sensor < ctx->trough) { ctx->trough = data_from_sensor; } } - + if (data_from_sensor > ctx->threshold && data_from_sensor > ctx->peak) { ctx->peak = data_from_sensor; } - + if (N > 250) { // printf ("(NO_GDB) DEBUG\n"); - if ( (data_from_sensor > ctx->threshold) && - (ctx->is_pulse == FALSE) && + if ( (data_from_sensor > ctx->threshold) && + (ctx->is_pulse == FALSE) && (N > (ctx->ibi / 5)* 3) ) { ctx->is_pulse = callback_data.is_heart_beat = TRUE; ((pulsensor_context *) arg)->callback(callback_data); - + ctx->ibi = ctx->sample_counter - ctx->last_beat_time; ctx->last_beat_time = ctx->sample_counter; - + // second beat if (ctx->second_beat) { ctx->second_beat = FALSE; for (int i = 0; i <= 9; i++) { - ctx->ibi_rate[i] = ctx->ibi; + ctx->ibi_rate[i] = ctx->ibi; } } - + // first beat if (ctx->first_beat) { ctx->first_beat = FALSE; ctx->second_beat = TRUE; ctx->ret = TRUE; - } else { + } else { uint32_t running_total = 0; for(int i = 0; i <= 8; i++){ ctx->ibi_rate[i] = ctx->ibi_rate[i+1]; running_total += ctx->ibi_rate[i]; } - + ctx->ibi_rate[9] = ctx->ibi; running_total += ctx->ibi_rate[9]; running_total /= 10; @@ -119,12 +119,12 @@ void * do_sample (void * arg) { } } } - + if (ctx->ret == FALSE) { if (data_from_sensor < ctx->threshold && ctx->is_pulse == TRUE) { ctx->is_pulse = callback_data.is_heart_beat = FALSE; ((pulsensor_context *) arg)->callback(callback_data); - + ctx->is_pulse = FALSE; ctx->apmlitude = ctx->peak - ctx->trough; ctx->threshold = ctx->apmlitude / 2 + ctx->trough; @@ -136,12 +136,12 @@ void * do_sample (void * arg) { ctx->threshold = 512; ctx->peak = 512; ctx->trough = 512; - ctx->last_beat_time = ctx->sample_counter; + ctx->last_beat_time = ctx->sample_counter; ctx->first_beat = TRUE; ctx->second_beat = FALSE; } } - + usleep (2000); } } diff --git a/src/pulsensor/pulsensor.h b/src/pulsensor/pulsensor.h index a2ef64f..29b2c04 100644 --- a/src/pulsensor/pulsensor.h +++ b/src/pulsensor/pulsensor.h @@ -63,7 +63,7 @@ struct pulsensor_context { uint8_t pin; uint8_t ret; mraa_aio_context pin_ctx; - + callback_handler callback; }; diff --git a/src/servo/servo.cxx b/src/servo/servo.cxx index ce9f5b2..b5ebe15 100644 --- a/src/servo/servo.cxx +++ b/src/servo/servo.cxx @@ -41,9 +41,9 @@ Servo::Servo (int pin) { m_maxAngle = 180.0; m_servoPin = pin; m_pwmServoContext = mraa_pwm_init (m_servoPin); - + m_currAngle = 180; - + setAngle (0); } @@ -67,13 +67,13 @@ mraa_result_t Servo::setAngle (int angle) { std::cout << "PWM context is NULL" << std::endl; return MRAA_ERROR_UNSPECIFIED; } - + if (angle > m_maxAngle || angle < 0) { return MRAA_ERROR_UNSPECIFIED; } int period = (m_maxPulseWidth - m_minPulseWidth) / m_maxAngle; - + int cycles = (int)(100.0 * (abs (m_currAngle - angle) / m_maxAngle)); // int cycles = (int)(100.0 * ((float)angle / (float)m_maxAngle)); @@ -86,7 +86,7 @@ mraa_result_t Servo::setAngle (int angle) { mraa_pwm_enable (m_pwmServoContext, 0); std::cout << "angle = " << angle << " ,pulse = " << calcPulseTraveling(angle) << ", cycles " << cycles << std::endl; - + m_currAngle = angle; } @@ -108,32 +108,32 @@ int Servo::calcPulseTraveling (int value) { return (int) ((float)m_minPulseWidth + ((float)value / m_maxAngle) * ((float)m_maxPulseWidth - (float)m_minPulseWidth)); } -void +void Servo::setMinPulseWidth (int width) { m_minPulseWidth = width; } -void +void Servo::setMaxPulseWidth (int width) { m_maxPulseWidth = width; } -void +void Servo::setMaxPeriod (int width) { m_maxPeriod = width; } -int +int Servo::getMinPulseWidth () { return m_minPulseWidth; } - -int + +int Servo::getMaxPulseWidth () { return m_maxPulseWidth; } -int +int Servo::getMaxPeriod () { return m_maxPeriod; } diff --git a/src/servo/servo.h b/src/servo/servo.h index 907e160..dc05e8e 100644 --- a/src/servo/servo.h +++ b/src/servo/servo.h @@ -79,43 +79,43 @@ class Servo { { return m_name; } - + /** * Set min pulse width * * @param width HIGH signal width */ void setMinPulseWidth (int width); - + /** * Set max pulse width * * @param width HIGH signal width */ void setMaxPulseWidth (int width); - + /** * Set max period width * * @param width PWM period width */ void setMaxPeriod (int width); - + /** * Return min pulse width */ int getMinPulseWidth (); - + /** * Return max pulse width */ int getMaxPulseWidth (); - + /** * Return max PWM period width */ int getMaxPeriod (); - + protected: int calcPulseTraveling (int value); @@ -124,7 +124,7 @@ class Servo { float m_maxAngle; mraa_pwm_context m_pwmServoContext; int m_currAngle; - + int m_minPulseWidth; int m_maxPulseWidth; int m_maxPeriod; diff --git a/src/st7735/gfx.h b/src/st7735/gfx.h index df19c1a..797302a 100644 --- a/src/st7735/gfx.h +++ b/src/st7735/gfx.h @@ -163,8 +163,10 @@ class GFX { /** * Draw a circle * - * @param x center of circule on X scale - * @param y center of circule on Y scale + * @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 */ void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color); diff --git a/src/st7735/st7735.h b/src/st7735/st7735.h index fd183ad..f1d50eb 100644 --- a/src/st7735/st7735.h +++ b/src/st7735/st7735.h @@ -552,7 +552,7 @@ class ST7735 : public GFX { /** * Execute set of commands and data * - * @param *addr pointer to start of the commands/data section + * @param addr pointer to start of the commands/data section */ void executeCMDList (const uint8_t *addr); diff --git a/src/tm1637/tm1637.cxx b/src/tm1637/tm1637.cxx index f976c27..f51db46 100644 --- a/src/tm1637/tm1637.cxx +++ b/src/tm1637/tm1637.cxx @@ -66,7 +66,7 @@ TM1637::TM1637 (uint8_t di, uint8_t dcki) { fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", di); exit(1); } - + // set direction (out) error = mraa_gpio_dir(m_clkPinCtx, MRAA_GPIO_IN); if (error != MRAA_SUCCESS) { diff --git a/src/tm1637/tm1637.h b/src/tm1637/tm1637.h index c8d44f5..7e52582 100644 --- a/src/tm1637/tm1637.h +++ b/src/tm1637/tm1637.h @@ -87,7 +87,7 @@ class TM1637 { /** * Set the the segment screen data and number of segments * - * @param segments[] data to write on the segments, each elemnt + * @param segments data to write on the segments, each elemnt * in array is segment * @param length number of elements in segments array * @param pos data writing offset -- 2.7.4