Fix Helix i2c wrong bit rate (#3207)
This commit is contained in:
parent
f5109c93dd
commit
0f3a73025c
@ -34,7 +34,7 @@ void i2c_delay(void) {
|
|||||||
// _delay_us(100);
|
// _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) {
|
void i2c_master_init(void) {
|
||||||
// no prescaler
|
// no prescaler
|
||||||
TWSR = 0;
|
TWSR = 0;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#define SLAVE_BUFFER_SIZE 0x10
|
#define SLAVE_BUFFER_SIZE 0x10
|
||||||
|
|
||||||
// i2c SCL clock frequency
|
// i2c SCL clock frequency 400kHz
|
||||||
#define SCL_CLOCK 400000L
|
#define SCL_CLOCK 400000L
|
||||||
|
|
||||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "lufa.h"
|
#include "lufa.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#endif
|
#endif
|
||||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
@ -479,7 +478,6 @@ void matrix_init_user(void) {
|
|||||||
#endif
|
#endif
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
|
||||||
iota_gfx_init(!has_usb()); // turns on the display
|
iota_gfx_init(!has_usb()); // turns on the display
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "lufa.h"
|
#include "lufa.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#endif
|
#endif
|
||||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
@ -413,7 +412,6 @@ void matrix_init_user(void) {
|
|||||||
#endif
|
#endif
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
|
||||||
iota_gfx_init(!has_usb()); // turns on the display
|
iota_gfx_init(!has_usb()); // turns on the display
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "lufa.h"
|
#include "lufa.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#endif
|
#endif
|
||||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
@ -435,7 +434,6 @@ void matrix_init_user(void) {
|
|||||||
#endif
|
#endif
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
|
||||||
iota_gfx_init(!has_usb()); // turns on the display
|
iota_gfx_init(!has_usb()); // turns on the display
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "lufa.h"
|
#include "lufa.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
#endif
|
#endif
|
||||||
#include "LUFA/Drivers/Peripheral/TWI.h"
|
|
||||||
#ifdef AUDIO_ENABLE
|
#ifdef AUDIO_ENABLE
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#endif
|
#endif
|
||||||
@ -477,7 +476,6 @@ void matrix_init_user(void) {
|
|||||||
#endif
|
#endif
|
||||||
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
//SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
|
||||||
#ifdef SSD1306OLED
|
#ifdef SSD1306OLED
|
||||||
TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000));
|
|
||||||
iota_gfx_init(!has_usb()); // turns on the display
|
iota_gfx_init(!has_usb()); // turns on the display
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ static int8_t capture_sendchar(uint8_t c) {
|
|||||||
bool iota_gfx_init(bool rotate) {
|
bool iota_gfx_init(bool rotate) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
|
i2c_master_init();
|
||||||
send_cmd1(DisplayOff);
|
send_cmd1(DisplayOff);
|
||||||
send_cmd2(SetDisplayClockDiv, 0x80);
|
send_cmd2(SetDisplayClockDiv, 0x80);
|
||||||
send_cmd2(SetMultiPlex, DisplayHeight - 1);
|
send_cmd2(SetMultiPlex, DisplayHeight - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user