Private
Public Access
2
0

maa: change complex C++ write calls to CamelCase for spi & i2c

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-06-24 14:42:24 +01:00
parent 2664d7c0e0
commit 79d0da4853
5 changed files with 8 additions and 8 deletions

View File

@@ -127,7 +127,7 @@ class Gpio {
* *
* @return Result of operation * @return Result of operation
*/ */
maa_result_t isr_exit() { maa_result_t isrExit() {
return maa_gpio_isr_exit(m_gpio); return maa_gpio_isr_exit(m_gpio);
} }
/** /**

View File

@@ -85,7 +85,7 @@ class I2c {
* *
* @return Char read from the bus * @return Char read from the bus
*/ */
unsigned char read_byte() { unsigned char readByte() {
return (unsigned char) maa_i2c_read_byte(m_i2c); return (unsigned char) maa_i2c_read_byte(m_i2c);
} }
/** /**
@@ -127,7 +127,7 @@ class I2c {
* @param data The byte to send on the bus * @param data The byte to send on the bus
* @return Result of operation * @return Result of operation
*/ */
maa_result_t write_byte(const unsigned char data) { maa_result_t write(const unsigned char data) {
return maa_i2c_write_byte(m_i2c, data); return maa_i2c_write_byte(m_i2c, data);
} }
private: private:

View File

@@ -85,7 +85,7 @@ class Spi {
* @param length size of buffer to send * @param length size of buffer to send
* @return char* data received on the miso line. Same length as passed in * @return char* data received on the miso line. Same length as passed in
*/ */
unsigned char* write_buf(uint8_t* data, int length) { unsigned char* write(uint8_t* data, int length) {
return (unsigned char*) maa_spi_write_buf(m_spi, data, length); return (unsigned char*) maa_spi_write_buf(m_spi, data, length);
} }
/** /**
@@ -103,7 +103,7 @@ class Spi {
* @param bits bits per word * @param bits bits per word
* @return Result of operation * @return Result of operation
*/ */
maa_result_t bit_per_word(unsigned int bits) { maa_result_t bitPerWord(unsigned int bits) {
return maa_spi_bit_per_word(m_spi, bits); return maa_spi_bit_per_word(m_spi, bits);
} }
private: private:

View File

@@ -116,7 +116,7 @@ int main ()
while (running == 0) { while (running == 0) {
i2c->address(HMC5883L_I2C_ADDR); i2c->address(HMC5883L_I2C_ADDR);
i2c->write_byte(HMC5883L_DATA_REG); i2c->write(HMC5883L_DATA_REG);
i2c->address(HMC5883L_I2C_ADDR); i2c->address(HMC5883L_I2C_ADDR);
i2c->read(rx_tx_buf, DATA_REG_SIZE); i2c->read(rx_tx_buf, DATA_REG_SIZE);

View File

@@ -54,14 +54,14 @@ int main ()
int i; int i;
for (i = 90; i < 130; i++) { for (i = 90; i < 130; i++) {
data[1] = i; data[1] = i;
recv = spi->write_buf(data, 2); recv = spi->write(data, 2);
printf("Writing -%i",i); printf("Writing -%i",i);
printf("RECIVED-%i-%i\n",recv[0],recv[1]); printf("RECIVED-%i-%i\n",recv[0],recv[1]);
usleep(100000); usleep(100000);
} }
for (i = 130; i > 90; i--) { for (i = 130; i > 90; i--) {
data[1] = i; data[1] = i;
recv = spi->write_buf(data, 2); recv = spi->write(data, 2);
printf("Writing -%i",i); printf("Writing -%i",i);
printf("RECIVED-%i-%i\n",recv[0],recv[1]); printf("RECIVED-%i-%i\n",recv[0],recv[1]);
usleep(100000); usleep(100000);