Browse Source

Still use SWI2C on RAMBo10a boards

The wiring for the PAT9125 on RAMBo10a boards is not directly connected
to the SCL pin and requires the sw mode.

Detect this requirement by checking the definition for the SWI2C_SCL pin
in the board definition.

Remove SWI2C_SCL/SDA from the other boards to use the HW mode.
Yuri D'Elia 3 years ago
parent
commit
6d476d7144
4 changed files with 7 additions and 10 deletions
  1. 4 1
      Firmware/config.h
  2. 0 6
      Firmware/pins_Einsy_1_0.h
  3. 0 3
      Firmware/pins_Rambo_1_3.h
  4. 3 0
      Firmware/swi2c.c

+ 4 - 1
Firmware/config.h

@@ -31,8 +31,11 @@
 
 //PAT9125 configuration
 //#define PAT9125_SWSPI // software SPI mode (incomplete)
-//#define PAT9125_SWI2C // software I2C mode
+#ifdef SWI2C_SCL
+#define PAT9125_SWI2C   // software I2C mode
+#else
 #define PAT9125_I2C     // hardware I2C mode
+#endif
 
 #define PAT9125_I2C_ADDR  0x75  //ID=LO
 //#define PAT9125_I2C_ADDR  0x79  //ID=HI

+ 0 - 6
Firmware/pins_Einsy_1_0.h

@@ -18,12 +18,6 @@
 #define W25X20CL                 // external 256kB flash
 #define BOOTAPP                  // bootloader support
 
-
-#define SWI2C_SDA      20 //SDA on P3
-#define SWI2C_SCL      21 //SCL on P3
-
-
-
 #define X_TMC2130_CS           41
 #define X_TMC2130_DIAG         64 // !!! changed from 40 (EINY03)
 #define X_STEP_PIN             37

+ 0 - 3
Firmware/pins_Rambo_1_3.h

@@ -11,9 +11,6 @@
 
 #define PINDA_THERMISTOR
 
-#define SWI2C_SDA      20 //SDA on P3
-#define SWI2C_SCL      21 //SCL on P3
-
 #ifdef MICROMETER_LOGGING
 #define D_DATACLOCK		24	//Y_MAX (green)
 #define D_DATA			30	//X_MAX (blue)

+ 3 - 0
Firmware/swi2c.c

@@ -7,6 +7,7 @@
 #include "pins.h"
 #include "io_atmega2560.h"
 
+#ifdef SWI2C_SCL
 
 #define SWI2C_RMSK   0x01 //read mask (bit0 = 1)
 #define SWI2C_WMSK   0x00 //write mask (bit0 = 0)
@@ -187,3 +188,5 @@ uint8_t swi2c_writeByte_A16(uint8_t dev_addr, unsigned short addr, uint8_t* pbyt
 }
 
 #endif //SWI2C_A16
+
+#endif //SWI2C_SCL