forked from mirror/qmk_firmware
add split_scomm.c/split_scomm.h into helix/rev1
This commit is contained in:
@@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#ifdef USE_MATRIX_I2C
|
#ifdef USE_MATRIX_I2C
|
||||||
# include "i2c.h"
|
# include "i2c.h"
|
||||||
#else // USE_SERIAL
|
#else // USE_SERIAL
|
||||||
# include "serial.h"
|
# include "split_scomm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEBOUNCE
|
#ifndef DEBOUNCE
|
||||||
@@ -178,7 +178,7 @@ i2c_error: // the cable is disconnceted, or something else went wrong
|
|||||||
int serial_transaction(void) {
|
int serial_transaction(void) {
|
||||||
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0;
|
||||||
|
|
||||||
if (serial_update_buffers()) {
|
if (serial_update_buffers(1)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
SRC += rev1/matrix.c \
|
SRC += rev1/matrix.c
|
||||||
rev1/split_util.c
|
SRC += rev1/split_util.c
|
||||||
|
SRC += rev1/split_scomm.c
|
||||||
|
|
||||||
BACKLIGHT_ENABLE = no
|
BACKLIGHT_ENABLE = no
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
#define SERIAL_PIN_MASK _BV(PD0)
|
#define SERIAL_PIN_MASK _BV(PD0)
|
||||||
#define SERIAL_PIN_INTERRUPT INT0_vect
|
#define SERIAL_PIN_INTERRUPT INT0_vect
|
||||||
|
|
||||||
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
|
||||||
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
|
||||||
|
|
||||||
/// #error rev1 serial config
|
/// #error rev1 serial config
|
||||||
|
|
||||||
#endif /* SOFT_SERIAL_CONFIG_H */
|
#endif /* SOFT_SERIAL_CONFIG_H */
|
||||||
|
|||||||
38
keyboards/helix/rev1/split_scomm.c
Normal file
38
keyboards/helix/rev1/split_scomm.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#ifdef USE_SERIAL
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <split_scomm.h>
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
|
uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0};
|
||||||
|
uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
||||||
|
uint8_t volatile status0 = 0;
|
||||||
|
|
||||||
|
SSTD_t transactions[] = {
|
||||||
|
|
||||||
|
#define WHOLE_MATRIX_EXCHANGE 0
|
||||||
|
{ (uint8_t *)&status0,
|
||||||
|
sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
|
||||||
|
sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void serial_master_init(void)
|
||||||
|
{
|
||||||
|
soft_serial_initiator_init(transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void serial_slave_init(void)
|
||||||
|
{
|
||||||
|
soft_serial_target_init(transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0 => no error
|
||||||
|
// 1 => slave did not respond
|
||||||
|
// 2 => checksum error
|
||||||
|
int serial_update_buffers(int master_update)
|
||||||
|
{
|
||||||
|
return soft_serial_transaction(WHOLE_MATRIX_EXCHANGE);
|
||||||
|
}
|
||||||
|
#endif /* USE_SERIAL */
|
||||||
15
keyboards/helix/rev1/split_scomm.h
Normal file
15
keyboards/helix/rev1/split_scomm.h
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef SPLIT_COMM_H
|
||||||
|
#define SPLIT_COMM_H
|
||||||
|
|
||||||
|
// Buffers for master - slave communication
|
||||||
|
#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2
|
||||||
|
#define SERIAL_MASTER_BUFFER_LENGTH 1
|
||||||
|
|
||||||
|
extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH];
|
||||||
|
extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH];
|
||||||
|
|
||||||
|
void serial_master_init(void);
|
||||||
|
void serial_slave_init(void);
|
||||||
|
int serial_update_buffers(int master_changed);
|
||||||
|
|
||||||
|
#endif /* SPLIT_COMM_H */
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifdef USE_MATRIX_I2C
|
#ifdef USE_MATRIX_I2C
|
||||||
# include "i2c.h"
|
# include "i2c.h"
|
||||||
#else
|
#else
|
||||||
# include "serial.h"
|
# include "split_scomm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
volatile bool isLeftHand = true;
|
volatile bool isLeftHand = true;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0};
|
|||||||
uint8_t volatile status0 = 0;
|
uint8_t volatile status0 = 0;
|
||||||
|
|
||||||
SSTD_t transactions[] = {
|
SSTD_t transactions[] = {
|
||||||
|
|
||||||
|
#define WHOLE_MATRIX_EXCHANGE 0
|
||||||
{ (uint8_t *)&status0,
|
{ (uint8_t *)&status0,
|
||||||
sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
|
sizeof(serial_master_buffer), (uint8_t *)serial_master_buffer,
|
||||||
sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
|
sizeof(serial_slave_buffer), (uint8_t *)serial_slave_buffer
|
||||||
@@ -31,6 +33,6 @@ void serial_slave_init(void)
|
|||||||
// 2 => checksum error
|
// 2 => checksum error
|
||||||
int serial_update_buffers(int master_update)
|
int serial_update_buffers(int master_update)
|
||||||
{
|
{
|
||||||
return soft_serial_transaction(0);
|
return soft_serial_transaction(WHOLE_MATRIX_EXCHANGE);
|
||||||
}
|
}
|
||||||
#endif /* USE_SERIAL */
|
#endif /* USE_SERIAL */
|
||||||
|
|||||||
Reference in New Issue
Block a user