{"action":"created","issue":{"url":"https://api.github.com/repos/qmk/qmk_firmware/issues/3709","repository_url":"https://api.github.com/repos/qmk/qmk_firmware","labels_url":"https://api.github.com/repos/qmk/qmk_firmware/issues/3709/labels{/name}","comments_url":"https://api.github.com/repos/qmk/qmk_firmware/issues/3709/comments","events_url":"https://api.github.com/repos/qmk/qmk_firmware/issues/3709/events","html_url":"https://github.com/qmk/qmk_firmware/issues/3709","id":352086384,"node_id":"MDU6SXNzdWUzNTIwODYzODQ=","number":3709,"title":"Make quantum/split_common/serial.h configurable.","user":{"login":"mtei","id":2170248,"node_id":"MDQ6VXNlcjIxNzAyNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/2170248?v=4","gravatar_id":"","url":"https://api.github.com/users/mtei","html_url":"https://github.com/mtei","followers_url":"https://api.github.com/users/mtei/followers","following_url":"https://api.github.com/users/mtei/following{/other_user}","gists_url":"https://api.github.com/users/mtei/gists{/gist_id}","starred_url":"https://api.github.com/users/mtei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtei/subscriptions","organizations_url":"https://api.github.com/users/mtei/orgs","repos_url":"https://api.github.com/users/mtei/repos","events_url":"https://api.github.com/users/mtei/events{/privacy}","received_events_url":"https://api.github.com/users/mtei/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-20T11:01:45Z","updated_at":"2018-12-15T04:47:50Z","closed_at":"2018-12-15T04:47:50Z","author_association":"CONTRIBUTOR","body":"I would suggest separating port definitions from `quantum/split_common/serial.h` .\r\n \r\nMany keyboards use `PD0`, but some keyboards use `PD2`  as follows.\r\n\r\n```\r\n% find quantum keyboards -name 'ser*.h' | xargs grep  SERIAL_PIN_MASK  | grep PD2\r\nkeyboards/crkbd/serial.h:#define SERIAL_PIN_MASK _BV(PD2)\r\nkeyboards/ergoinu/serial_config.h:#define SERIAL_PIN_MASK _BV(PD2)\r\nkeyboards/fortitude60/serial.h:#define SERIAL_PIN_MASK _BV(PD2)\r\nkeyboards/helix/pico/serial_config.h:#define SERIAL_PIN_MASK _BV(PD2)\r\nkeyboards/helix/rev2/serial_config.h:#define SERIAL_PIN_MASK _BV(PD2)\r\nkeyboards/mint60/serial_config.h:#define SERIAL_PIN_MASK _BV(PD2)\r\n```\r\n\r\nTherefore, I think it's better to move the port definitions from `quantum/split_common/serial.h` to a new file, `quantum/split_common/serial_config.h`\r\n\r\nI think these changes would be beneficial to QMK. I would be glad to submit a pull request with these changes. Let me know your thoughts and opinions.\r\n \r\nChange `quantum/split_common/serial.h`  as follows.\r\n```c\r\n#ifndef SOFT_SERIAL_H\r\n#define SOFT_SERIAL_H\r\n\r\n#include <stdbool.h>\r\n\r\n// Each keyboard can override serial_config.h\r\n//\r\n// serial_config.h search sequence:\r\n//   keyboards/KEYBOARD_NAME/keymaps/MAP_NAME/serial_config.h\r\n//   keyboards/KEYBOARD_NAME[/rev?]/serial_config.h\r\n//   quantum/split_common/serial_config.h\r\n#include <serial_config.h>\r\n\r\n// Buffers for master - slave communication\r\nextern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];\r\nextern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];\r\n\r\nvoid serial_master_init(void);\r\nvoid serial_slave_init(void);\r\nint serial_update_buffers(void);\r\nbool serial_slave_data_corrupt(void);\r\n\r\n#endif\r\n```\r\n\r\nCreate `quantum/split_common/serial_config.h` as follows.\r\n```c\r\n#ifndef SOFT_SERIAL_CONFIG_H\r\n#define SOFT_SERIAL_CONFIG_H\r\n\r\n// Soft Serial defines\r\n#define SERIAL_PIN_DDR DDRD\r\n#define SERIAL_PIN_PORT PORTD\r\n#define SERIAL_PIN_INPUT PIND\r\n#define SERIAL_PIN_MASK _BV(PD0)\r\n#define SERIAL_PIN_INTERRUPT INT0_vect\r\n\r\n#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2\r\n#define SERIAL_MASTER_BUFFER_LENGTH 1\r\n\r\n// Address location defines\r\n#define SERIAL_BACKLIT_START   0x00\r\n\r\n#endif // SOFT_SERIAL_CONFIG_H\r\n```\r\n\r\nWithin `quantum/split_common/serial.c` change `void serial_slave_init (void)` as follows.\r\n```c\r\nvoid serial_slave_init(void) {\r\n    serial_input();\r\n\r\n#if SERIAL_PIN_MASK == _BV(PD0)\r\n  // Enable INT0\r\n  EIMSK |= _BV(INT0);\r\n  // Trigger on falling edge of INT0\r\n  EICRA &= ~(_BV(ISC00) | _BV(ISC01));\r\n#elif SERIAL_PIN_MASK == _BV(PD2)\r\n  // Enable INT2\r\n  EIMSK |= _BV(INT2);\r\n  // Trigger on falling edge of INT2\r\n  EICRA &= ~(_BV(ISC20) | _BV(ISC21));\r\n#else\r\n #error unknown SERIAL_PIN_MASK value\r\n#endif\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/qmk/qmk_firmware/issues/comments/447537270","html_url":"https://github.com/qmk/qmk_firmware/issues/3709#issuecomment-447537270","issue_url":"https://api.github.com/repos/qmk/qmk_firmware/issues/3709","id":447537270,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzUzNzI3MA==","user":{"login":"mtei","id":2170248,"node_id":"MDQ6VXNlcjIxNzAyNDg=","avatar_url":"https://avatars3.githubusercontent.com/u/2170248?v=4","gravatar_id":"","url":"https://api.github.com/users/mtei","html_url":"https://github.com/mtei","followers_url":"https://api.github.com/users/mtei/followers","following_url":"https://api.github.com/users/mtei/following{/other_user}","gists_url":"https://api.github.com/users/mtei/gists{/gist_id}","starred_url":"https://api.github.com/users/mtei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtei/subscriptions","organizations_url":"https://api.github.com/users/mtei/orgs","repos_url":"https://api.github.com/users/mtei/repos","events_url":"https://api.github.com/users/mtei/events{/privacy}","received_events_url":"https://api.github.com/users/mtei/received_events","type":"User","site_admin":false},"created_at":"2018-12-15T04:47:50Z","updated_at":"2018-12-15T04:47:50Z","author_association":"CONTRIBUTOR","body":"#4419 was merged. Thank you."}}
{"actor":{"display_login":"mtei"}}