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

Next set of split_common changes #4974

Merged
merged 7 commits into from
Mar 12, 2019
Merged

Next set of split_common changes #4974

merged 7 commits into from
Mar 12, 2019

Conversation

pelrun
Copy link
Contributor

@pelrun pelrun commented Jan 28, 2019

Description

Right now this PR does the following things with the split_common code:

  1. Eliminate the BACKLIT_DIRTY/RGB_DIRTY flags in favour of detecting value changes implicitly.
  2. Port the i2c transport over to the standard i2c_master.c/i2c_slave.c
  3. Eliminate the MATRIX_COLS<=8 restriction for i2c splits

Types of changes

  • Core
  • Bugfix
  • New Feature
  • Enhancement/Optimization
  • Keyboard (addition or update)
  • Keymap/Layout/Userspace (addition or update)
  • Documentation

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document. (https://docs.qmk.fm/#/contributing)
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@drashna
Copy link
Member

drashna commented Jan 28, 2019

3. Eliminate the MATRIX_COLS<=8 restriction for i2c splits

Ooooh, wait, this means that boards with 9+ columns can be posted over?
Eg, I can finally port the orthodox over, and the BFO9000?

2. Port the i2c transport over to the standard i2c_master.c/i2c_slave.c

Woooooo

@pelrun
Copy link
Contributor Author

pelrun commented Jan 28, 2019

The only reason it was restricted was because it sent 1 byte per row. I just made it pay attention to sizeof(matrix_row_t).

Of course, as I don't actually have an AVR split kb, all these changes are done essentially blind. Testing needed!

@drashna
Copy link
Member

drashna commented Jan 28, 2019

Well, I can confirm that it works over serial on the Orthodox (9 columns).

@pelrun
Copy link
Contributor Author

pelrun commented Jan 28, 2019

Ha! Serial always worked.

@drashna
Copy link
Member

drashna commented Jan 28, 2019

Not with more than 8 columns. :)

But I'd like to see somebody with i2c test this out, before merging it.

@nooges ?

@pelrun
Copy link
Contributor Author

pelrun commented Jan 28, 2019

Well, it had absolutely nothing to do with my changes (I've not changed serial at all), it must have been fixed with #4669.

@drashna
Copy link
Member

drashna commented Jan 28, 2019

Ah, it was a couple of changes, actually. But either way... it should work on both i2c and serial now.

@drashna drashna mentioned this pull request Jan 28, 2019
13 tasks
@drashna
Copy link
Member

drashna commented Jan 28, 2019

@mtei With #4984 merged, any other feedback on this?

@drashna
Copy link
Member

drashna commented Jan 30, 2019

@nooges Would you mind testing this?

It affects i2c, and I have no i2c boards to test and verify.

@Lenbok
Copy link
Contributor

Lenbok commented Jan 30, 2019

I just tested this on my i2c redox split and it doesn't work for me. I'm using EE_HANDS and only the side that the USB is plugged into works.

As a side note, I flashed back to master (0.6.263) and both sides are working, however I notice that compared to my previous working firmware (based on 0.6.233) RGB underglow animations are now playing on both sides -- when did that happen? It's a bit buggy in terms of the sides getting out of sync and animations cause dropped keypresses. Is there an issue / PR tracking progress on i2c split animations?

@pelrun
Copy link
Contributor Author

pelrun commented Jan 30, 2019

Okay. I'll bite the bullet and set up some hardware to debug this properly.

@drashna
Copy link
Member

drashna commented Jan 30, 2019

To make sure, you flashed both sides when testing?

if not, you may need to.

@Lenbok
Copy link
Contributor

Lenbok commented Jan 30, 2019

@drashna yep, I flashed both.

@pelrun
Copy link
Contributor Author

pelrun commented Feb 23, 2019

Hmm. I finally found time to set up a couple of pro-micros on breadboard and flashed them with redox:default, and the slave is working fine.

@Lenbok
Copy link
Contributor

Lenbok commented Feb 23, 2019

@pelrun redox:default uses serial, did you change it to i2c? (Mine is wired/configured for i2c.)

@pelrun
Copy link
Contributor Author

pelrun commented Feb 23, 2019

Whoops, been away from this a bit too long, I think. Adding USE_I2C breaks it, at least now I can debug.


# ifdef RGBLIGHT_ENABLE
static uint32_t prev_rgb = ~0;
uint32_t rgb = eeconfig_read_rgblight();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be read out of eeprom rather than directly using the rgblight_config struct that the master is currently running?

I've recently implemented an inactivity timeout for rgb underglow like this:
https://gist.github.com/Lenbok/603c66903c048f6879ee0860b37f8a7b
Ideally I'd like to use rgblight_toggle_noeeprom() when the idle timer is responsible for toggling things (both to avoid eeprom writes and also as the inactivity based status probably shouldn't be written to eeprom anyway), but found that I could only get the toggle to get sent to the slave side by using the regular/eeprom version of rgblight_toggle().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's nothing requiring eeprom access, in fact I'd rather there be none. If there's a function to get the config directly (I don't want to be reaching into variables directly) then that can go in without issue... it's just not something I'm concerned with right now.

@pelrun
Copy link
Contributor Author

pelrun commented Mar 8, 2019

11 columns on the right side, and 7 on the left

Yikes. The code expects the matrix to be identically sized on both sides. You'll have to post your configuration.

@Gimly
Copy link
Contributor

Gimly commented Mar 9, 2019

@pelrun I made it identically sized by adding 4 fake columns on the left, which I added to the UNUSED_PINS array.

I have to compile two different versions because the left and right side don't use the same pins on the microcontroller.

Also because I've used Teensy 2 and the master / slave detection doesn't work for teensy.

You can check my code there https://github.com/Gimly/qmk_firmware/tree/gimly-split/keyboards/gimly_split

I've rebased my branch upon the one used for this pr.

@nooges
Copy link
Member

nooges commented Mar 9, 2019

@Gimly You can use MATRIX_ROW_PINS_RIGHT/MATRIX_COL_PINS_RIGHTto define different pinouts for each half as seen here: https://github.com/qmk/qmk_firmware/blob/master/keyboards/keebio/quefrency/rev1/config.h#L37-L40

@Lenbok
Copy link
Contributor

Lenbok commented Mar 9, 2019

Since the Teensy master/slave stuff seems out of the scope of this PR and there similarly wasn't any expectation you could have different MATRIX_COLS size on each side, it sounds like this PR is actually fine with regard to the issues @Gimly had. Perhaps once @nooges has a chance to test and sign off we're good to merge?

@nooges
Copy link
Member

nooges commented Mar 10, 2019

@drashna @pelrun Okay, finally got time to test things out with serial and I2C, and verified that LED and RGB changes work properly over each half. Guess I can dust off my work on splitting RGB LEDs between the halves for animations now.

@nooges
Copy link
Member

nooges commented Mar 10, 2019

Whoops, one thing I did notice is that the RGB mode does not sync between halves in serial mode. Can't remember if that's a regression or if it hadn't been done before, I'm guessing probably the latter.

@mtei
Copy link
Contributor

mtei commented Mar 10, 2019

From July 2018 until now, I think that implementation has not been completed for rgblight.

a012113#diff-2615833595f67363eda3c008b8f3f690

@drashna
Copy link
Member

drashna commented Mar 11, 2019

@mtei You're right. IIRC, we've talked about it elsewhere about it not being implemented fully, and moving to implement it.

@nooges Awesome. If serial isn't working, it wasn't working before, and I don't think that this PR changes that behavior.

Unless there is any objections, I'd like to merge this PR "as is", and the next set of changes can be worked on, including getting RGB Light working on serial properly, rgb animations over i2c/serial, and ARM support. As well as whatever else.

And again, thanks all for all of the work! You all are awesome!

@nooges
Copy link
Member

nooges commented Mar 11, 2019

I'm good with that.

@drashna drashna merged commit 37932c2 into qmk:master Mar 12, 2019
@pelrun pelrun deleted the split_enhance branch March 13, 2019 11:29
Shinichi-Ohki added a commit to Shinichi-Ohki/qmk_firmware that referenced this pull request Mar 15, 2019
* 'master' of https://github.com/qmk/qmk_firmware: (48 commits)
  [Keymap] Added Boy_314's layout for half n half keyboard (qmk#5373)
  Align use of atmega32a program script (qmk#5259)
  [Keyboard] new keyboard lovelive9 (qmk#5266)
  [Keyboard] Inital port of xd96 (qmk#5401)
  Fix ascii art (qmk#5407)
  [Keyboard] Georgi Support (qmk#5384)
  fresh commit for a new fork for PR to upstream/master (qmk#5406)
  Added info.json for mt980 keyboard and fixes to walker keymap (qmk#5391)
  Add support for THE60 (qmk#5385)
  Added 1up60rgb keymap: mdyevimnav (qmk#5386)
  Fix i2c calls for HotDox keyboard (qmk#5387)
  Sleep until USB port becomes writable before running avrdude (qmk#5393)
  [Keymap] Some more improvements to keymap, currency symbols.. (qmk#5395)
  [Keymap] Add atreus, ergotravel and org60 keymaps (qmk#5381)
  archetype keymap for jj50 (qmk#5397)
  Wheat Field Peripherals mt980 (FC980M Layout) PCB Support (qmk#5374)
  Minor readme fix (qmk#5389)
  Add new keyboard Plaid and ATMEGA328p support (qmk#5379)
  Next set of split_common changes (qmk#4974)
  [Keyboard] Lily58 Add info.json file (qmk#5354)
  ...
chie4hao pushed a commit to chie4hao/qmk_firmware that referenced this pull request Mar 28, 2019
* Update split_common to use standard i2c drivers

* Eliminate RGB_DIRTY/BACKLIT_DIRTY

* Fix avr i2c_master error handling

* Fix i2c_slave addressing

* Remove unneeded timeout on i2c_stop()

* Fix RGB I2C transfers

* Remove incorrect comment
zer09 pushed a commit to zer09/qmk_firmware that referenced this pull request Mar 31, 2019
* Update split_common to use standard i2c drivers

* Eliminate RGB_DIRTY/BACKLIT_DIRTY

* Fix avr i2c_master error handling

* Fix i2c_slave addressing

* Remove unneeded timeout on i2c_stop()

* Fix RGB I2C transfers

* Remove incorrect comment
danielo515 pushed a commit to danielo515/qmk_firmware that referenced this pull request May 15, 2019
* Update split_common to use standard i2c drivers

* Eliminate RGB_DIRTY/BACKLIT_DIRTY

* Fix avr i2c_master error handling

* Fix i2c_slave addressing

* Remove unneeded timeout on i2c_stop()

* Fix RGB I2C transfers

* Remove incorrect comment
Timbus pushed a commit to Timbus/qmk_firmware that referenced this pull request Jun 23, 2019
* Update split_common to use standard i2c drivers

* Eliminate RGB_DIRTY/BACKLIT_DIRTY

* Fix avr i2c_master error handling

* Fix i2c_slave addressing

* Remove unneeded timeout on i2c_stop()

* Fix RGB I2C transfers

* Remove incorrect comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants