From b6850bc043b1d129042f47501f0a1dc1e196f962 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Tue, 9 Apr 2019 08:58:11 -0700 Subject: remove all keyboards but ergodox and planck --- keyboards/fc980c/actuation_point.c | 87 -------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 keyboards/fc980c/actuation_point.c (limited to 'keyboards/fc980c/actuation_point.c') diff --git a/keyboards/fc980c/actuation_point.c b/keyboards/fc980c/actuation_point.c deleted file mode 100644 index 5f4cb16f40..0000000000 --- a/keyboards/fc980c/actuation_point.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 2017 Balz Guenat -based on work by Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "actuation_point.h" -#include "i2c.h" - -/////////////////////////////////////////////////////////////////////////////// -// -// AD5258 I2C digital potentiometer -// http://www.analog.com/media/en/technical-documentation/data-sheets/AD5258.pdf -// -#define AD5258_ADDR 0b0011000 -#define AD5258_INST_RDAC 0x00 -#define AD5258_INST_EEPROM 0x20 - -uint8_t read_rdac(void) { - // read RDAC register - i2c_start_write(AD5258_ADDR); - i2c_master_write(AD5258_INST_RDAC); - i2c_start_read(AD5258_ADDR); - uint8_t ret = i2c_master_read(I2C_NACK); - i2c_master_stop(); - return ret; -}; - -uint8_t read_eeprom(void) { - i2c_start_write(AD5258_ADDR); - i2c_master_write(AD5258_INST_EEPROM); - i2c_start_read(AD5258_ADDR); - uint8_t ret = i2c_master_read(I2C_NACK); - i2c_master_stop(); - return ret; -}; - -void write_rdac(uint8_t rdac) { - // write RDAC register: - i2c_start_write(AD5258_ADDR); - i2c_master_write(AD5258_INST_RDAC); - i2c_master_write(rdac & 0x3F); - i2c_master_stop(); -}; - -void actuation_point_up(void) { - // write RDAC register: lower value makes actuation point shallow - uint8_t rdac = read_rdac(); - if (rdac == 0) - write_rdac(0); - else - write_rdac(rdac-1); -}; - -void actuation_point_down(void) { - // write RDAC register: higher value makes actuation point deep - uint8_t rdac = read_rdac(); - if (rdac == 63) - write_rdac(63); - else - write_rdac(rdac+1); -}; - -void adjust_actuation_point(int offset) { - i2c_master_init(); - uint8_t rdac = read_eeprom() + offset; - if (rdac > 63) { // protects from under and overflows - if (offset > 0) - write_rdac(63); - else - write_rdac(0); - } else { - write_rdac(rdac); - } -} -- cgit v1.2.3