]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Fix Helix i2c wrong bit rate (#3207)
authorMakotoKurauchi <pluis@me.com>
Thu, 21 Jun 2018 17:44:33 +0000 (02:44 +0900)
committerDrashna Jaelre <drashna@live.com>
Thu, 21 Jun 2018 17:44:33 +0000 (10:44 -0700)
keyboards/helix/i2c.c
keyboards/helix/i2c.h
keyboards/helix/rev2/keymaps/default/keymap.c
keyboards/helix/rev2/keymaps/five_rows/keymap.c
keyboards/helix/rev2/keymaps/froggy/keymap.c
keyboards/helix/rev2/keymaps/led_test/keymap.c
keyboards/helix/ssd1306.c

index 084c890c405fa6f7ebfc1be7a699e3d120e5c482..4bee5c63982960b0793df01a975633d16e1ce19e 100644 (file)
@@ -34,7 +34,7 @@ void i2c_delay(void) {
   // _delay_us(100);
 }
 
-// Setup twi to run at 100kHz
+// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
 void i2c_master_init(void) {
   // no prescaler
   TWSR = 0;
index c15b6bc5065eaf14c11c9d2667078c6f102c6227..47cf6bd1b2c9acc32439901048eae18c32a03de0 100644 (file)
@@ -15,7 +15,7 @@
 
 #define SLAVE_BUFFER_SIZE 0x10
 
-// i2c SCL clock frequency
+// i2c SCL clock frequency 400kHz
 #define SCL_CLOCK  400000L
 
 extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
index 1a268b32d54bd10f5615679acd3ae95c55fadbef..8c0fd8d9f85803c1113d4b97c375224a7f262cf7 100644 (file)
@@ -6,7 +6,6 @@
 #include "lufa.h"
 #include "split_util.h"
 #endif
-#include "LUFA/Drivers/Peripheral/TWI.h"
 #ifdef AUDIO_ENABLE
   #include "audio.h"
 #endif
@@ -479,7 +478,6 @@ void matrix_init_user(void) {
     #endif
     //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
     #ifdef SSD1306OLED
-        TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
         iota_gfx_init(!has_usb());   // turns on the display
     #endif
 }
index d4fabd5a2491837e17a40f475c3a9783359d894c..05767efc0cd6278eb8f41767b1216e08418014ea 100644 (file)
@@ -6,7 +6,6 @@
 #include "lufa.h"
 #include "split_util.h"
 #endif
-#include "LUFA/Drivers/Peripheral/TWI.h"
 #ifdef AUDIO_ENABLE
   #include "audio.h"
 #endif
@@ -413,7 +412,6 @@ void matrix_init_user(void) {
     #endif
     //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
     #ifdef SSD1306OLED
-        TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
         iota_gfx_init(!has_usb());   // turns on the display
     #endif
 }
index 69c41856b55c41ce28a0d2061fcbdef65becbf6b..c4f4c1fe28e86813a9e6026b3d1d164bf520e5ef 100644 (file)
@@ -6,7 +6,6 @@
 #include "lufa.h"
 #include "split_util.h"
 #endif
-#include "LUFA/Drivers/Peripheral/TWI.h"
 #ifdef AUDIO_ENABLE
   #include "audio.h"
 #endif
@@ -435,7 +434,6 @@ void matrix_init_user(void) {
     #endif
     //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
     #ifdef SSD1306OLED
-        TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
         iota_gfx_init(!has_usb());   // turns on the display
     #endif
 }
index d597020d87509854b48a49a79db51a3c55b9d0cd..f28db665728bc7033000c739f1f897318f0d30a7 100644 (file)
@@ -6,7 +6,6 @@
 #include "lufa.h"
 #include "split_util.h"
 #endif
-#include "LUFA/Drivers/Peripheral/TWI.h"
 #ifdef AUDIO_ENABLE
   #include "audio.h"
 #endif
@@ -477,7 +476,6 @@ void matrix_init_user(void) {
     #endif
     //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
     #ifdef SSD1306OLED
-        TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
         iota_gfx_init(!has_usb());   // turns on the display
     #endif
 }
index b13060ef733b90ea2315e2f74d59b43725be2bac..b3e55a67c201f45385da4142a1755941fbea36fc 100644 (file)
@@ -127,6 +127,7 @@ static int8_t capture_sendchar(uint8_t c) {
 bool iota_gfx_init(bool rotate) {
   bool success = false;
 
+  i2c_master_init();
   send_cmd1(DisplayOff);
   send_cmd2(SetDisplayClockDiv, 0x80);
   send_cmd2(SetMultiPlex, DisplayHeight - 1);