Browse Source

Additional details for I2C_SLAVE_ADDRESS

Scott Lahteine 8 years ago
parent
commit
d63b8e2b2b

+ 1
- 1
.travis.yml View File

@@ -209,7 +209,7 @@ script:
209 209
   #
210 210
   - restore_configs
211 211
   - opt_enable_adv BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS
212
-  - opt_set_adv I2C_SLAVE_ADDRESS 1
212
+  - opt_set_adv I2C_SLAVE_ADDRESS 63
213 213
   - build_marlin
214 214
   #
215 215
   # Enable COREXY

+ 1
- 1
Marlin/Configuration_adv.h View File

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

+ 1
- 1
Marlin/Marlin_main.cpp View File

@@ -5294,7 +5294,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
5294 5294
     }
5295 5295
   }
5296 5296
 
5297
-#endif //EXPERIMENTAL_I2CBUS
5297
+#endif // EXPERIMENTAL_I2CBUS
5298 5298
 
5299 5299
 /**
5300 5300
  * M200: Set filament diameter and set E axis units to cubic units

+ 11
- 0
Marlin/SanityCheck.h View File

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

+ 1
- 1
Marlin/example_configurations/Cartesio/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/Felix/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/Hephestos_2/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/K8200/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/K8400/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/RigidBot/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/SCARA/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/TAZ4/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/delta/generic/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/makibox/Configuration_adv.h View File

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

+ 1
- 1
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

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

+ 5
- 0
Marlin/twibus.cpp View File

@@ -43,6 +43,11 @@ void TWIBus::reset() {
43 43
 }
44 44
 
45 45
 void TWIBus::address(const uint8_t adr) {
46
+  if (adr < 8 || adr > 127) {
47
+    SERIAL_ECHO_START;
48
+    SERIAL_ECHOLNPGM("Bad I2C address (8-127)");
49
+  }
50
+
46 51
   this->addr = adr;
47 52
 
48 53
   #if ENABLED(DEBUG_TWIBUS)

Loading…
Cancel
Save