examples: misc static code analysis fixes
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
bb3584fcdb
commit
32340f6819
@@ -44,6 +44,7 @@ public class GpioMmapped {
|
||||
String version = mraa.getVersion();
|
||||
System.out.println("hello mraa");
|
||||
System.out.println(String.format("Version: %s", version));
|
||||
System.out.println(String.format("Platform: %s", board));
|
||||
|
||||
Gpio gpio = new Gpio(1);
|
||||
|
||||
|
||||
@@ -117,9 +117,9 @@ public class I2cCompass {
|
||||
i2c.address(HMC5883L_I2C_ADDR);
|
||||
i2c.read(rx_tx_buf);
|
||||
|
||||
x = (rx_tx_buf[HMC5883L_X_MSB_REG] << 8) | rx_tx_buf[HMC5883L_X_LSB_REG];
|
||||
z = (rx_tx_buf[HMC5883L_Z_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Z_LSB_REG];
|
||||
y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Y_LSB_REG];
|
||||
x = (rx_tx_buf[HMC5883L_X_MSB_REG] << 8) | (rx_tx_buf[HMC5883L_X_LSB_REG] & 0xFF);
|
||||
z = (rx_tx_buf[HMC5883L_Z_MSB_REG] << 8) | (rx_tx_buf[HMC5883L_Z_LSB_REG] & 0xFF);
|
||||
y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | (rx_tx_buf[HMC5883L_Y_LSB_REG] & 0xFF);
|
||||
|
||||
direction = (float) Math.atan2(y * SCALE_0_92_MG, x * SCALE_0_92_MG);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user