Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IS31FL3733 driver hardcoded to use STM32 mcu #3969

Closed
sonnius opened this issue Sep 24, 2018 · 22 comments
Closed

IS31FL3733 driver hardcoded to use STM32 mcu #3969

sonnius opened this issue Sep 24, 2018 · 22 comments
Labels
discussion question stale Issues or pull requests that have become inactive without resolution.

Comments

@sonnius
Copy link

sonnius commented Sep 24, 2018

Hello,

I'm trying to add LED support to the k_type and when I add the IS31FL3733 driver it pulls in 'drivers/arm/i2c_master.c', this library is only valid for STM32 #processors.

Is there any way to use the IS31FL3733 with different processors?

The k_type is using k20x mcu

#2964

@yiancar
@drashna

@drashna
Copy link
Member

drashna commented Sep 24, 2018

Dead giveaway:

/* This library is only valid for STM32 processors.

Basically, you'd need to find out what is the correct values, and .... maybe ifdef this stuff:

STM32_TIMINGR_PRESC(15U) |
STM32_TIMINGR_SCLDEL(4U) | STM32_TIMINGR_SDADEL(2U) |
STM32_TIMINGR_SCLH(15U) | STM32_TIMINGR_SCLL(21U),

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);

edited for permalinks – noroadsleft

@yiancar
Copy link
Contributor

yiancar commented Sep 24, 2018

Yep you can ifdef an i2c driver for k20x mcus I dont exactly remember which makefile is the correct one to do so but you can follow the flow and see where files get pulled in.

@dmgm
Copy link

dmgm commented Feb 10, 2019

This seems to be the only open issue for the k_type.
I would prefer to use qmk, because I can program CapsLock to be Ctrl and Escape on tap.
Unfortunately I dont seem to have any option for backlight, which I miss. I don't care if I cant have rainbows and fingerprints, I'd settle for backlight for might shine through keycaps.

Anyone working on this?

@drashna
Copy link
Member

drashna commented Mar 29, 2019

The controller driver was fixed. Now somebody just needs to convert the K_Type to the LED Matrix feature.

https://docs.qmk.fm/#/feature_led_matrix

@gogades
Copy link

gogades commented Apr 3, 2019

@drashna since the stock k-type firmware is also open source, I'm guessing the needed information could be found in https://github.com/kiibohd/controller ... I don't really know (yet) what to look for but I'll poke around.

@drashna
Copy link
Member

drashna commented Apr 5, 2019

I think so, yeah

@peterctl
Copy link

I tried to do some work on this but I have no experience with embedded development and so it failed. I did a fork with my progress under https://github.com/pottar/qmk_firmware if anyone wants to take a look at it and help me get it working.

What I could find is that the i2c driver in drivers/arm/i2c_master.c expects that only a single i2c driver will be used, with different i2c slave addresses for each is31 chip. However, the K-Type keyboard has 2 i2c buses and each is31 chip uses a different bus, all with the same i2c slave address. My fork has a modified version of the i2c_master.c file inside the keyboards/k_type folder but, again, that didn't work as I don't know much about embedded development.

@yiancar
Copy link
Contributor

yiancar commented Aug 13, 2019

drivers/arm/i2c_master.c has nothing to do with how many slaves you have. It can address all of them.

both is31fl3733.c and is31fl3731.c are capable of being multidriver.

As said above the only thing one should need to do here is map the led matrix correctly to the way the driver files expect it.

@peterctl
Copy link

It can address all of them as long as they are in the same bus. The K-Type uses a different bus for each ic31 chip. If you look at the signature for i2c_* funcions in i2c_master.c, they take uint8_t addr as a parameter and only use I2CD1 as the hardcoded driver.

At least this is my understanding from reading the code, but again I have little experience with embedded development.

@yiancar
Copy link
Contributor

yiancar commented Aug 14, 2019

AHHH I see, I didnt have a look on the schematic :)

@dmgm
Copy link

dmgm commented Jul 29, 2020

Is there still interest in this? I have three keyboards, 2 use qmk and one, the k-type relies on the input club configurator.
While I'll take the qmk functionality, it would be nice to at least be able to use the LED backlights.

@gogades
Copy link

gogades commented Jul 30, 2020

I'm definitely still interested. I took a crack at it but couldn't figure it out: the k-type uses ChibiOS so I couldn't figure out how to do it by looking at the Massdrop CTRL qmk code and the input club kiiboohd firmware.

@peterctl
Copy link

Still interested too, I also took a shot at it but I have zero experience with embedded development so I was never able to figure out why it wasnt working. My code is still in my cloned repo so feel free to take a look at it and see if you can come up with why it doesnt work. I would love to keep attempting but I'm a DevOps/SRE kinda guy and I have no idea how to do embedded.

@sonnius
Copy link
Author

sonnius commented Jul 30, 2020

I'm in the same boat, not enough knowledge and not enough time..

@fauxpark
Copy link
Member

fauxpark commented Aug 6, 2020

It turns out the K-Type has two 3733s, which is not usually a problem, except that they are on different I2C buses, which i2c_master currently does not support.
I have a PR open to clean up this board a bit. There is an experimental keymap with RGB matrix enabled: #9864
EDIT: whoops, that was already mentioned...

@Andrew-Fahmy
Copy link

I was able to take the existing drivers and make changes so that they support multiple i2c busses. I have opened up a PR #11551 that has those changes if anyone would like to try it on their k-type.

@gogades
Copy link

gogades commented Jan 22, 2021

@Andrew-Fahmy I tried it on my K-Type. I was able to load it and the keyboard seems to work ok, but I was unable to trigger any LED effect - they're all off. Idea? Thanks.

@Andrew-Fahmy
Copy link

@gogades What keymap are you using? Currently only my keymap (andrew-fahmy) and the rgb keymap have RGB support. It is also possible the lights are toggled off, you can toggle them with fn+print, and make sure the brightness is up (fn+pgup).

@dmgm
Copy link

dmgm commented Feb 1, 2021

I was able to take the existing drivers and make changes so that they support multiple i2c busses. I have opened up a PR #11551 that has those changes if anyone would like to try it on their k-type.

I've tried on my k_type which was previously running qmk. Well done. It works fine and it's lovely to have some LED prettiness back to compliment the qmk functionality. I just turn it on with Fn Print, and selected a mode where random keys light up.

Two things I have questions about;

  1. Does RGB also control the lighting strip around the base? I've not found a mode that uses those leds. It would be nice to have a white or blue light ring.
  2. Could the changes have affected my computer's ability to recognise the usb keyboard? I use a usb switch to share the computer and mouse between 4 computers. Was working fine, now mouse always works but sometimes I need to unplug and replug the k_type. This is new behavior since I flashed a new firmware image with the rgb changes. Happy to file a bug report but I can't reproduce it reliably, maybe it's just coincidence.

@Andrew-Fahmy
Copy link

Andrew-Fahmy commented Feb 2, 2021

@dmgm Glad you got them to work! You can look here for more of the shortcuts that change the lighting.

  1. The lighting around the base does work, make sure you have the latest changes pulled. They should work with whatever lighting animation, but you could probably manually set the colors if you dig into the code. (The LEDs around the base are numbers 88-119)
  2. Nothing was change other then the lighting, so the only thing I could think of would be that the increase in power needed to drive the LEDs might cause some weird behavior with the usb switch? I haven't run into this issue myself.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

@github-actions github-actions bot added the stale Issues or pull requests that have become inactive without resolution. label Jun 16, 2022
@tzarc
Copy link
Member

tzarc commented Jun 18, 2022

Closing due to inactivity.

@tzarc tzarc closed this as completed Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion question stale Issues or pull requests that have become inactive without resolution.
Projects
None yet
Development

No branches or pull requests

9 participants