From ac3dfa742a92de541f86846b94269aab87d55d3c Mon Sep 17 00:00:00 2001 From: yulei Date: Sun, 23 Aug 2020 04:45:06 +0800 Subject: [Keyboard] added matrix 8xv2.0 additional (#9470) * added matrix 8xv2.0 additional keyboard * Apply suggestions from code review Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> * add copyright and speed up the matrix scanning * Update keyboards/matrix/m20add/rules.mk Co-authored-by: Drashna Jaelre Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com> Co-authored-by: Drashna Jaelre --- keyboards/matrix/m20add/m20add.c | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 keyboards/matrix/m20add/m20add.c (limited to 'keyboards/matrix/m20add/m20add.c') diff --git a/keyboards/matrix/m20add/m20add.c b/keyboards/matrix/m20add/m20add.c new file mode 100644 index 0000000000..b38dad27cd --- /dev/null +++ b/keyboards/matrix/m20add/m20add.c @@ -0,0 +1,80 @@ +/** + * m20add.c + */ + +#include "m20add.h" +#include "tca6424.h" +#include "rgb_ring.h" +#include "i2c_master.h" + +void set_pin(uint16_t pin) +{ + uint8_t data = tca6424_read_port(GET_PORT(pin)); + data |= ( 1 << GET_PIN(pin)); + tca6424_write_port(GET_PORT(pin), data); +} + +void clear_pin(uint16_t pin) +{ + uint8_t data = tca6424_read_port(GET_PORT(pin)); + data &= ~( 1 << GET_PIN(pin)); + tca6424_write_port(GET_PORT(pin), data); +} + +uint8_t read_pin(uint16_t pin) +{ + uint8_t data = tca6424_read_port(GET_PORT(pin)); + return (data & (1<BKP0R)) = REBOOT_MAGIC; +} -- cgit v1.2.1