Add ability to set I2C baud rate/clock speed

This commit is contained in:
Dale Whinham committed 2020-11-08 18:24:32 +00:00
1 parent a6e94126e9
commit ff060caabe
4 files changed
+26 -2

No files matched your search

+2
View File
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ability to invert the display orientation for SSD1306 (new configuration file option).
- Support for 64 pixel high SSD1306 OLED displays - many thanks to @ctrl_alt_rees for donating a screen!
- Ability to set I2C clock speed (new configuration file option).
* This is useful for allowing larger displays to refresh at a faster speed; see config file for details.
### Changed
+4
View File
@@ -13,6 +13,10 @@
#define END_SECTION
#endif
BEGIN_SECTION(system)
CFG(i2c_baud_rate, int, SystemI2CBaudRate, 400000 )
END_SECTION
BEGIN_SECTION(midi)
CFG(usb, bool, MIDIUSB, true )
CFG(gpio_baud_rate, int, MIDIGPIOBaudRate, 31250 )
+18
View File
@@ -9,6 +9,24 @@
# Default options are marked with an asterisk (*).
# -----------------------------------------------------------------------------
# System options
# -----------------------------------------------------------------------------
[system]
# Set the I2C baud rate/clock speed for all peripherals (Hz).
#
# Most peripherals will work fine at the default speed (400KHz "fast mode"),
# but larger LCD/OLED displays (e.g. 4-line I2C HD44780 and 64 pixel high
# SSD1306) won't be able to refresh at 60FPS at the default setting.
#
# Try increasing this value to 1000000 (1MHz) for a smoother LCD refresh rate.
# If your display doesn't work, try backing off the speed 100KHz at a time
# until it does.
#
# Values: 100000-1000000 (400000*)
i2c_baud_rate = 400000
# -----------------------------------------------------------------------------
# MIDI options
# -----------------------------------------------------------------------------
+2 -2
View File
@@ -92,8 +92,8 @@ bool CKernel::Initialize(void)
if (bSerialMIDIEnabled && !m_Serial.Initialize(m_Config.MIDIGPIOBaudRate))
return false;
if (!m_I2CMaster.Initialize())
return false;
// Init I2C; don't bother with Initialize() as it only sets the clock to 100/400KHz
m_I2CMaster.SetClock(m_Config.SystemI2CBaudRate);
if (!m_MT32Pi.Initialize(bSerialMIDIEnabled))
return false;