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

Make quantum/split_common/serial.[ch] configurable #4419

Merged

Conversation

mtei
Copy link
Contributor

@mtei mtei commented Nov 13, 2018

quantum/split_common/serial.c change to helix-serial.c style serial configuration

This request does not change the compilation results.

reffer #3709, #4254.

SERIAL_PIN_PORT and other PIN define move to serial_backward_compatibility.h
SERIAL_BACKLIT_START move to split_util.h
@drashna
Copy link
Member

drashna commented Nov 13, 2018

Rather than changing all of the files, it may make more sense to add:

#ifndef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D0
#endif

// #define SOFT_SERIAL_PIN D0
// #endif

#ifndef SERIAL_SLAVE_BUFFER_LENGTH
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't this be added to serial.h, rather than using a separate file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do not worry, this serial_backward_compatibility.h will be deleted in the next phase.

// /////////////////////////////////////////////////////////////////
// ex.
// /* Configuration of lower interface with the lower layer(hardware) of serial.c */
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
Copy link
Member

Choose a reason for hiding this comment

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

Could define the default here:

Suggested change
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
#ifndef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D0 // D0,D1,D2,D3,E6, etc
#endif

This way, there is no reason to define it elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
//
// /* Configuration of upper interface with the upper layer of serial.c */
// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// #define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
#ifndef SERIAL_SLAVE_BUFFER_LENGTH
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
#define SERIAL_MASTER_BUFFER_LENGTH 1
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -7,6 +7,9 @@
#include <stdlib.h>
#include "eeconfig.h"

// backlight level store index in serial_master_buffer[] for slave to read
#define SERIAL_BACKLIT_START 0x00
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be left in serial.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -14,6 +14,59 @@

#ifndef USE_I2C
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be changed to something like

Suggested change
#ifndef USE_I2C
#if defined(USE_SERIAL) || (!defined(USE_I2C) && !defined(USE_SERIAL) )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The USE_I2C,USE_SERIAL problem can be discussed by me or someone else in the next next phase. I will not change it now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I posted #4522. This is the solution to this problem I thought.

@mtei
Copy link
Contributor Author

mtei commented Nov 14, 2018

Rather than changing all of the files, it may make more sense to add:

#ifndef SOFT_SERIAL_PIN
#define SOFT_SERIAL_PIN D0
#endif

Yes, I know that. But I chose to add the definition of SOFT_SERIAL_PIN to each config.h. Because other drivers do not have a default value, so I think that serial.c should also have no default value.
(quantum/quantum.c:BACKLIGHT_PIN, drivers/avr/ws2812.c:RGB_DI_PIN, quantum/audio/audio.c:??_AUDIO)

@drashna
Copy link
Member

drashna commented Nov 14, 2018

Yes, I know that. But I chose to add the definition of SOFT_SERIAL_PIN to each config.h. Because other drivers do not have a default value, so I think that serial.c should also have no default value.

If that's the case, we're getting to the point where we NEED documentation for the SPLIT code.

Though, on the flip side, for the boards that don't want to define a soft serial pin, and want to leave it using the same pin as i2c, this is essentially an added, unnecessary change for those boards. It also make porting new boards over more problematic (though, I think travis should catch that).

@mtei
Copy link
Contributor Author

mtei commented Nov 15, 2018

If that's the case, we're getting to the point where we NEED documentation for the SPLIT code.

Though, on the flip side, for the boards that don't want to define a soft serial pin, and want to leave it using the same pin as i2c, this is essentially an added, unnecessary change for those boards. It also make porting new boards over more problematic (though, I think travis should catch that).

Please do not do that discussion here. Let's discuss that in #4254
#4254 (comment).

In here, I want to talk about whether serial.c should have default value or not.

We can easily change it to have a default value at any time. However, If we want to explicitly define SOFT_SERIAL_PIN it is the easiest to do now. The more keyboards we add, the harder it is to work. So, now, I think that it is better to explicitly define SOFT_SERIAL_PIN.

@drashna drashna self-requested a review December 9, 2018 20:15
@nooges
Copy link
Member

nooges commented Dec 12, 2018

I do prefer that there be a default value for the serial pin to minimize overall code changes.

@drashna
Copy link
Member

drashna commented Dec 14, 2018

Thanks!

Now to phase 2?

@drashna drashna merged commit 155e931 into qmk:master Dec 14, 2018
@mtei
Copy link
Contributor Author

mtei commented Dec 15, 2018

Thank you.

I will start the next phase.

ishtob pushed a commit to ishtob/qmk_firmware that referenced this pull request Jan 1, 2019
* add temporary compile test shell script

* add 'CONFIG_H += serial_backward_compatibility.h' into common_features.mk:SPLIT_KEYBOARD block

* add quantum/split_common/serial_backward_compatibility.h

SERIAL_PIN_PORT and other PIN define move to serial_backward_compatibility.h
SERIAL_BACKLIT_START move to split_util.h

* quantum/split_common/serial.c change to helix-serial.c style serial configuration

* add temporary file quantum/split_common/split-keyboards-list.txt

* add '#define SOFT_SERIAL_PIN D0' to keyboards/6lit/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/divergetm2/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/ergotravel/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/foobar/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/dactyl_manuform/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/qc60/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/handwired/xealous/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/iris/rev*/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/lets_split_eh/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/levinson/rev*/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/miniaxe/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/nyquist/rev?/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/quefrency/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/qwertyydox/config.h,keyboards/qwertyydox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/redox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/rorschach/rev1/config.h

* remove '#define SOFT_SERIAL_PIN D0' from quantum/split_common/serial_backward_compatibility.h

* remove temporary file quantum/split_common/split-keyboards-list.txt

* remove temporary compile test shell script

* Revert "remove temporary compile test shell script"

This reverts commit 15b0021.

* update quantum/split_common/compile_split_test.sh for new keyboard test

* add '#define SOFT_SERIAL_PIN D0' to keyboards/diverge3/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/40percentclub/25/config.h

* remove temporary compile test shell script

* update docs/config_options.md, quantum/template/avr/config.h

* fix quantum/template/avr/config.h

* fix typo  docs/config_options.md
yeliu84 pushed a commit to yeliu84/qmk_firmware that referenced this pull request Jan 7, 2019
* add temporary compile test shell script

* add 'CONFIG_H += serial_backward_compatibility.h' into common_features.mk:SPLIT_KEYBOARD block

* add quantum/split_common/serial_backward_compatibility.h

SERIAL_PIN_PORT and other PIN define move to serial_backward_compatibility.h
SERIAL_BACKLIT_START move to split_util.h

* quantum/split_common/serial.c change to helix-serial.c style serial configuration

* add temporary file quantum/split_common/split-keyboards-list.txt

* add '#define SOFT_SERIAL_PIN D0' to keyboards/6lit/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/divergetm2/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/ergotravel/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/foobar/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/dactyl_manuform/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/qc60/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/handwired/xealous/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/iris/rev*/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/lets_split_eh/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/levinson/rev*/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/miniaxe/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/nyquist/rev?/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/quefrency/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/qwertyydox/config.h,keyboards/qwertyydox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/redox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/rorschach/rev1/config.h

* remove '#define SOFT_SERIAL_PIN D0' from quantum/split_common/serial_backward_compatibility.h

* remove temporary file quantum/split_common/split-keyboards-list.txt

* remove temporary compile test shell script

* Revert "remove temporary compile test shell script"

This reverts commit 15b0021.

* update quantum/split_common/compile_split_test.sh for new keyboard test

* add '#define SOFT_SERIAL_PIN D0' to keyboards/diverge3/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/40percentclub/25/config.h

* remove temporary compile test shell script

* update docs/config_options.md, quantum/template/avr/config.h

* fix quantum/template/avr/config.h

* fix typo  docs/config_options.md
@mtei mtei deleted the make-quantum_split_common_serial-h-configurable branch January 10, 2019 09:01
rseymour pushed a commit to rseymour/qmk_firmware that referenced this pull request Mar 13, 2019
* add temporary compile test shell script

* add 'CONFIG_H += serial_backward_compatibility.h' into common_features.mk:SPLIT_KEYBOARD block

* add quantum/split_common/serial_backward_compatibility.h

SERIAL_PIN_PORT and other PIN define move to serial_backward_compatibility.h
SERIAL_BACKLIT_START move to split_util.h

* quantum/split_common/serial.c change to helix-serial.c style serial configuration

* add temporary file quantum/split_common/split-keyboards-list.txt

* add '#define SOFT_SERIAL_PIN D0' to keyboards/6lit/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/divergetm2/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/ergotravel/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/foobar/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/dactyl_manuform/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/qc60/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/handwired/xealous/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/iris/rev*/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/lets_split_eh/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/levinson/rev*/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/miniaxe/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/nyquist/rev?/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/quefrency/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/qwertyydox/config.h,keyboards/qwertyydox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/redox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/rorschach/rev1/config.h

* remove '#define SOFT_SERIAL_PIN D0' from quantum/split_common/serial_backward_compatibility.h

* remove temporary file quantum/split_common/split-keyboards-list.txt

* remove temporary compile test shell script

* Revert "remove temporary compile test shell script"

This reverts commit 15b0021.

* update quantum/split_common/compile_split_test.sh for new keyboard test

* add '#define SOFT_SERIAL_PIN D0' to keyboards/diverge3/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/40percentclub/25/config.h

* remove temporary compile test shell script

* update docs/config_options.md, quantum/template/avr/config.h

* fix quantum/template/avr/config.h

* fix typo  docs/config_options.md
djthread pushed a commit to djthread/qmk_firmware that referenced this pull request Mar 17, 2019
* add temporary compile test shell script

* add 'CONFIG_H += serial_backward_compatibility.h' into common_features.mk:SPLIT_KEYBOARD block

* add quantum/split_common/serial_backward_compatibility.h

SERIAL_PIN_PORT and other PIN define move to serial_backward_compatibility.h
SERIAL_BACKLIT_START move to split_util.h

* quantum/split_common/serial.c change to helix-serial.c style serial configuration

* add temporary file quantum/split_common/split-keyboards-list.txt

* add '#define SOFT_SERIAL_PIN D0' to keyboards/6lit/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/divergetm2/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/ergotravel/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/foobar/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/dactyl_manuform/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/handwired/qc60/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/handwired/xealous/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/iris/rev*/config.h

* add '//#define SOFT_SERIAL_PIN D0' to keyboards/lets_split_eh/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/levinson/rev*/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/miniaxe/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/nyquist/rev?/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/quefrency/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/qwertyydox/config.h,keyboards/qwertyydox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/redox/rev1/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/rorschach/rev1/config.h

* remove '#define SOFT_SERIAL_PIN D0' from quantum/split_common/serial_backward_compatibility.h

* remove temporary file quantum/split_common/split-keyboards-list.txt

* remove temporary compile test shell script

* Revert "remove temporary compile test shell script"

This reverts commit 15b0021.

* update quantum/split_common/compile_split_test.sh for new keyboard test

* add '#define SOFT_SERIAL_PIN D0' to keyboards/diverge3/config.h

* add '#define SOFT_SERIAL_PIN D0' to keyboards/40percentclub/25/config.h

* remove temporary compile test shell script

* update docs/config_options.md, quantum/template/avr/config.h

* fix quantum/template/avr/config.h

* fix typo  docs/config_options.md
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.

4 participants