|
@@ -36,40 +36,7 @@ extern int millis();
|
36
|
36
|
|
37
|
37
|
//////////////////////////////////////////////////////////////////////////////////////
|
38
|
38
|
|
39
|
|
-// These two routines are exact copies of the lpc17xx_i2c.c routines. Couldn't link to
|
40
|
|
-// to the lpc17xx_i2c.c routines so had to copy them into this file & rename them.
|
41
|
|
-
|
42
|
|
-static uint32_t _I2C_Start(LPC_I2C_TypeDef *I2Cx) {
|
43
|
|
- // Reset STA, STO, SI
|
44
|
|
- I2Cx->I2CONCLR = I2C_I2CONCLR_SIC|I2C_I2CONCLR_STOC|I2C_I2CONCLR_STAC;
|
45
|
|
-
|
46
|
|
- // Enter to Master Transmitter mode
|
47
|
|
- I2Cx->I2CONSET = I2C_I2CONSET_STA;
|
48
|
|
-
|
49
|
|
- // Wait for complete
|
50
|
|
- while (!(I2Cx->I2CONSET & I2C_I2CONSET_SI));
|
51
|
|
- I2Cx->I2CONCLR = I2C_I2CONCLR_STAC;
|
52
|
|
- return (I2Cx->I2STAT & I2C_STAT_CODE_BITMASK);
|
53
|
|
-}
|
54
|
|
-
|
55
|
|
-static void _I2C_Stop (LPC_I2C_TypeDef *I2Cx) {
|
56
|
|
- /* Make sure start bit is not active */
|
57
|
|
- if (I2Cx->I2CONSET & I2C_I2CONSET_STA)
|
58
|
|
- I2Cx->I2CONCLR = I2C_I2CONCLR_STAC;
|
59
|
|
-
|
60
|
|
- I2Cx->I2CONSET = I2C_I2CONSET_STO|I2C_I2CONSET_AA;
|
61
|
|
- I2Cx->I2CONCLR = I2C_I2CONCLR_SIC;
|
62
|
|
-}
|
63
|
|
-
|
64
|
|
-//////////////////////////////////////////////////////////////////////////////////////
|
65
|
|
-
|
66
|
|
-#define I2CDEV_S_ADDR 0x78 // from SSD1306 //actual address is 0x3C - shift left 1 with LSB set to 0 to indicate write
|
67
|
|
-
|
68
|
|
-#define BUFFER_SIZE 0x1 // only do single byte transfers with LCDs
|
69
|
|
-
|
70
|
|
-I2C_M_SETUP_Type transferMCfg;
|
71
|
|
-
|
72
|
|
-#define I2C_status (LPC_I2C1->I2STAT & I2C_STAT_CODE_BITMASK)
|
|
39
|
+#define I2CDEV_S_ADDR 0x78 // From SSD1306 (actual address is 0x3C - shift left 1 with LSB set to 0 to indicate write)
|
73
|
40
|
|
74
|
41
|
// Send slave address and write bit
|
75
|
42
|
uint8_t u8g_i2c_start(const uint8_t sla) {
|
|
@@ -115,7 +82,6 @@ uint8_t u8g_i2c_send_byte(uint8_t data) {
|
115
|
82
|
void u8g_i2c_stop() {
|
116
|
83
|
}
|
117
|
84
|
|
118
|
|
-
|
119
|
85
|
#ifdef __cplusplus
|
120
|
86
|
}
|
121
|
87
|
#endif
|