Merge pull request #4608 from thinkyhead/rc_more_twibus_tweaks

Additional details for I2C_SLAVE_ADDRESS
2.0.x
Scott Lahteine 8 years ago committed by GitHub
commit 464d594450

@ -209,7 +209,7 @@ script:
#
- restore_configs
- opt_enable_adv BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS
- opt_set_adv I2C_SLAVE_ADDRESS 1
- opt_set_adv I2C_SLAVE_ADDRESS 63
- build_marlin
#
# Enable COREXY

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -747,3 +747,14 @@
#if ENABLED(EMERGENCY_PARSER) && defined(USBCON)
#error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
#endif
/**
* I2C bus
*/
#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
#if I2C_SLAVE_ADDRESS < 8
#error "I2C_SLAVE_ADDRESS can't be less than 8. (Addresses 0 - 7 are reserved.)"
#elif I2C_SLAVE_ADDRESS > 127
#error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
#endif
#endif

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -801,6 +801,6 @@ const unsigned int dropsegments = 2; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -803,6 +803,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -796,6 +796,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -801,6 +801,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus
//#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H

@ -43,6 +43,11 @@ void TWIBus::reset() {
}
void TWIBus::address(const uint8_t adr) {
if (adr < 8 || adr > 127) {
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Bad I2C address (8-127)");
}
this->addr = adr;
#if ENABLED(DEBUG_TWIBUS)

Loading…
Cancel
Save