Skip to content

Commit

Permalink
Add KEY_ARRAY_TYPE_{NONE,VECTOR,MATRIX} in the newly added module/mod…
Browse files Browse the repository at this point in the history
…ule.h
  • Loading branch information
mondalaci committed Dec 30, 2019
1 parent 9b78297 commit 2ee803f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
3 changes: 2 additions & 1 deletion keycluster/src/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Includes:

#include "module/module.h"
#include "key_vector.h"
#include "slave_protocol.h"

Expand All @@ -21,7 +22,7 @@
#define TEST_LED_CLOCK kCLOCK_PortB
#define TEST_LED_PIN 1

#define KEY_ARRAY_TYPE 1
#define KEY_ARRAY_TYPE KEY_ARRAY_TYPE_VECTOR
#define KEYBOARD_VECTOR_ITEMS_NUM 6

// Variables:
Expand Down
4 changes: 2 additions & 2 deletions keycluster/src/slave_protocol_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ void SlaveTxHandler(void)
break;
}
case SlaveCommand_RequestKeyStates: {
#if KEY_ARRAY_TYPE == 1
#if KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_VECTOR
BoolBytesToBits(keyVector.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#elif KEY_ARRAY_TYPE == 2
#elif KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_MATRIX
BoolBytesToBits(keyMatrix.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#endif
uint8_t messageLength = BOOL_BYTES_TO_BITS_COUNT(MODULE_KEY_COUNT);
Expand Down
3 changes: 2 additions & 1 deletion left/src/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Includes:

#include "module/module.h"
#include "key_matrix.h"
#include "slave_protocol_handler.h"

Expand All @@ -21,7 +22,7 @@
#define TEST_LED_CLOCK kCLOCK_PortB
#define TEST_LED_PIN 13

#define KEY_ARRAY_TYPE 2
#define KEY_ARRAY_TYPE KEY_ARRAY_TYPE_MATRIX
#define KEYBOARD_MATRIX_COLS_NUM 7
#define KEYBOARD_MATRIX_ROWS_NUM 5

Expand Down
4 changes: 2 additions & 2 deletions left/src/slave_protocol_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ void SlaveTxHandler(void)
break;
}
case SlaveCommand_RequestKeyStates: {
#if KEY_ARRAY_TYPE == 1
#if KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_VECTOR
BoolBytesToBits(keyVector.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#elif KEY_ARRAY_TYPE == 2
#elif KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_MATRIX
BoolBytesToBits(keyMatrix.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#endif
uint8_t messageLength = BOOL_BYTES_TO_BITS_COUNT(MODULE_KEY_COUNT);
Expand Down
10 changes: 10 additions & 0 deletions shared/module/module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef __SHARED_MODULE_H__
#define __SHARED_MODULE_H__

// Macros:

#define KEY_ARRAY_TYPE_NONE 0
#define KEY_ARRAY_TYPE_VECTOR 1
#define KEY_ARRAY_TYPE_MATRIX 2

#endif
3 changes: 2 additions & 1 deletion trackball/src/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// Includes:

#include "module/module.h"
#include "key_vector.h"
#include "slave_protocol_handler.h"

Expand All @@ -21,7 +22,7 @@
#define TEST_LED_CLOCK kCLOCK_PortB
#define TEST_LED_PIN 2

#define KEY_ARRAY_TYPE 1
#define KEY_ARRAY_TYPE KEY_ARRAY_TYPE_VECTOR
#define KEYBOARD_VECTOR_ITEMS_NUM 2

// Variables:
Expand Down
4 changes: 2 additions & 2 deletions trackball/src/slave_protocol_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ void SlaveTxHandler(void)
break;
}
case SlaveCommand_RequestKeyStates: {
#if KEY_ARRAY_TYPE == 1
#if KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_VECTOR
BoolBytesToBits(keyVector.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#elif KEY_ARRAY_TYPE == 2
#elif KEY_ARRAY_TYPE == KEY_ARRAY_TYPE_MATRIX
BoolBytesToBits(keyMatrix.keyStates, TxMessage.data, MODULE_KEY_COUNT);
#endif
uint8_t messageLength = BOOL_BYTES_TO_BITS_COUNT(MODULE_KEY_COUNT);
Expand Down

0 comments on commit 2ee803f

Please sign in to comment.