Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ltc2991_test by
Revision 4:85017622b676, committed 2016-12-08
- Comitter:
- lrdawg99
- Date:
- Thu Dec 08 21:42:33 2016 +0000
- Parent:
- 3:34e56211d5b6
- Child:
- 5:8aa0f4e6788c
- Commit message:
- scl sda switch issue
Changed in this revision
| LTC2991.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LTC2991.cpp Thu Dec 08 19:58:24 2016 +0000
+++ b/LTC2991.cpp Thu Dec 08 21:42:33 2016 +0000
@@ -78,7 +78,7 @@
}
LTC2991::LTC2991(PinName i2c_scl_, PinName i2c_sda_) {
- lti2c = new LT_I2C(i2c_scl_, i2c_sda_);
+ lti2c = new LT_I2C(i2c_sda_, i2c_scl_);
}
// Reads a 14-bit adc_code from LTC2991.
--- a/main.cpp Thu Dec 08 19:58:24 2016 +0000
+++ b/main.cpp Thu Dec 08 21:42:33 2016 +0000
@@ -9,7 +9,7 @@
//These pins for the nucleo nucleo f401re
LTC2991 *ltc0 = new LTC2991(I2C_SDA, I2C_SCL);
LTC2991 *ltc1 = new LTC2991(PB_3, PB_10);
-LTC2991 *ltc2 = new LTC2991(PB_4, PA_8);
+LTC2991 *ltc2 = new LTC2991(PA_8, PB_4);
//void setup();
@@ -24,10 +24,10 @@
while (true)
{
pc.printf("boot\n");
- ack |= ltc0->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CHANNEL_ENABLE_REG, LTC2991_ENABLE_ALL_CHANNELS); //! Enables all channels
- ack |= ltc0->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00); //! Sets registers to default starting values.
- ack |= ltc0->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V5678_REG, 0x00);
- ack |= ltc0->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_PWM_Tinternal_REG, LTC2991_REPEAT_MODE); //! Configures LTC2991 for Repeated Acquisition mode
+ ack |= ltc2->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CHANNEL_ENABLE_REG, LTC2991_ENABLE_ALL_CHANNELS); //! Enables all channels
+ ack |= ltc2->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00); //! Sets registers to default starting values.
+ ack |= ltc2->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V5678_REG, 0x00);
+ ack |= ltc2->LTC2991_register_write(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_PWM_Tinternal_REG, LTC2991_REPEAT_MODE); //! Configures LTC2991 for Repeated Acquisition mode
if (ack != 0) {
pc.printf("Error: No Acknowledge. Check I2C Address.\n");
@@ -52,9 +52,9 @@
int16_t code;
float voltage;
ack = 0;
- ack |= ltc0->LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00, LTC2991_V1_V2_DIFFERENTIAL_ENABLE | LTC2991_V1_V2_TEMP_ENABLE);
- ack |= ltc0->LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V1_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
- voltage = ltc0->LTC2991_code_to_single_ended_voltage(code, LTC2991_SINGLE_ENDED_lsb);
+ ack |= ltc2->LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, 0x00, LTC2991_V1_V2_DIFFERENTIAL_ENABLE | LTC2991_V1_V2_TEMP_ENABLE);
+ ack |= ltc2->LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V1_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
+ voltage = ltc2->LTC2991_code_to_single_ended_voltage(code, LTC2991_SINGLE_ENDED_lsb);
if (ack != 0) {
pc.printf("Error: No Acknowledge.\n");
} else {
@@ -67,9 +67,9 @@
int16_t code;
float voltage;
ack = 0;
- ack |= ltc0->LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, LTC2991_V1_V2_DIFFERENTIAL_ENABLE, LTC2991_V1_V2_TEMP_ENABLE);
- ack |= ltc0->LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V2_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
- voltage = ltc0->LTC2991_code_to_differential_voltage(code, LTC2991_DIFFERENTIAL_lsb);
+ ack |= ltc2->LTC2991_register_set_clear_bits(LTC2991_I2C_ADDRESS, LTC2991_CONTROL_V1234_REG, LTC2991_V1_V2_DIFFERENTIAL_ENABLE, LTC2991_V1_V2_TEMP_ENABLE);
+ ack |= ltc2->LTC2991_adc_read_new_data(LTC2991_I2C_ADDRESS, LTC2991_V2_MSB_REG, &code, &data_valid, LTC2991_TIMEOUT);
+ voltage = ltc2->LTC2991_code_to_differential_voltage(code, LTC2991_DIFFERENTIAL_lsb);
if (ack != 0) {
pc.printf("Error: No Acknowledge.\n");
} else {
