From 408361402385ea938575956e9368b5f373edc629 Mon Sep 17 00:00:00 2001 From: yiancar Date: Sat, 10 Nov 2018 12:26:39 -0800 Subject: I2C driver docs (#4298) * I2C driver docs - Added I2C driver docs. - Changed arm master i2c driver to have a weak i2c_init as it is impossible to account for all possible port configuration in the STM32 world. * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * Update docs/i2c_driver.md Co-Authored-By: yiancar * GPIO release fix --- drivers/arm/i2c_master.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/arm/i2c_master.c') diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index 2a7badd351..de58438392 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -26,6 +26,7 @@ */ #include "i2c_master.h" +#include "quantum.h" #include #include @@ -41,9 +42,11 @@ static const I2CConfig i2cconfig = { 0 }; +__attribute__ ((weak)) void i2c_init(void) { - palSetGroupMode(GPIOB, GPIOB_PIN6 | GPIOB_PIN7, 0, PAL_MODE_INPUT); // Try releasing special pins for a short time + setPinInput(B6); // Try releasing special pins for a short time + setPinInput(B7); chThdSleepMilliseconds(10); palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); -- cgit v1.2.3 From 4099536c0e7a099b181a80e483b4b95f389b5a7e Mon Sep 17 00:00:00 2001 From: ishtob Date: Tue, 4 Dec 2018 11:04:57 -0500 Subject: adding Hadron v3 keyboard, QWIIC devices support, haptic feedback support (#4462) * add initial support for hadron ver3 * add initial support for hadron ver3 * pull qwiic support for micro_led to be modified for use in hadron's 64x24 ssd1306 oled display * initial work on OLED using qwiic driver * early work to get 128x32 oled working by redefining qwiic micro oled parameters. Currently working, but would affect qwiic's micro oled functionality * moved oled defines to config.h and added ifndef to micro_oled driver * WORKING :D - note, still work in progress to get the start location correct on the 128x32 display. * added equation to automatically calculate display offset based on screen width * adding time-out timer to oled display * changed read lock staus via read_led_state * lock indications fixes * Added scroll lock indication to oled * add support for DRV2605 haptic driver * Improve readabiity of DRV2605 driver. -added typedef for waveform library -added unions for registers * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob * Update keyboards/hadron/ver2/keymaps/default/config.h Co-Authored-By: ishtob * Fixes for PR * PR fixes * fix old persistent layer function to use new set_single_persistent_default_layer * fix issues with changing makefile defines that broken per-key haptic pulse * Comment fixes * Add definable parameter and auto-calibration based on motor choice --- drivers/arm/i2c_master.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/arm/i2c_master.c') diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index de58438392..ab962ea959 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -32,7 +32,7 @@ static uint8_t i2c_address; -// This configures the I2C clock to 400Mhz assuming a 72Mhz clock +// This configures the I2C clock to 400khz assuming a 72Mhz clock // For more info : https://www.st.com/en/embedded-software/stsw-stm32126.html static const I2CConfig i2cconfig = { STM32_TIMINGR_PRESC(15U) | @@ -45,10 +45,14 @@ static const I2CConfig i2cconfig = { __attribute__ ((weak)) void i2c_init(void) { - setPinInput(B6); // Try releasing special pins for a short time - setPinInput(B7); - chThdSleepMilliseconds(10); + //palSetGroupMode(GPIOB, GPIOB_PIN6 | GPIOB_PIN7, 0, PAL_MODE_INPUT); + + // Try releasing special pins for a short time + palSetPadMode(GPIOB, 6, PAL_MODE_INPUT); + palSetPadMode(GPIOB, 7, PAL_MODE_INPUT); + chThdSleepMilliseconds(10); + palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); -- cgit v1.2.3 From df33618b26bb7ff0c0eff619b2d638490c514ce4 Mon Sep 17 00:00:00 2001 From: yiancar Date: Wed, 19 Dec 2018 13:56:44 +0000 Subject: Minor STM32 i2c driver cleanup --- drivers/arm/i2c_master.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/arm/i2c_master.c') diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index ab962ea959..4417dc9851 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -45,8 +45,6 @@ static const I2CConfig i2cconfig = { __attribute__ ((weak)) void i2c_init(void) { - //palSetGroupMode(GPIOB, GPIOB_PIN6 | GPIOB_PIN7, 0, PAL_MODE_INPUT); - // Try releasing special pins for a short time palSetPadMode(GPIOB, 6, PAL_MODE_INPUT); palSetPadMode(GPIOB, 7, PAL_MODE_INPUT); -- cgit v1.2.3 From b13162f7fd5a4c09dff15ff6f9713526622925a7 Mon Sep 17 00:00:00 2001 From: yiancar Date: Wed, 19 Dec 2018 13:59:58 +0000 Subject: Also fix use of weak stm32 internal pullup --- drivers/arm/i2c_master.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/arm/i2c_master.c') diff --git a/drivers/arm/i2c_master.c b/drivers/arm/i2c_master.c index 4417dc9851..385bd97cb8 100644 --- a/drivers/arm/i2c_master.c +++ b/drivers/arm/i2c_master.c @@ -51,8 +51,8 @@ void i2c_init(void) chThdSleepMilliseconds(10); - palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); - palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); + palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); + palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN); //i2cInit(); //This is invoked by halInit() so no need to redo it. } -- cgit v1.2.3