Skip to content

Commit

Permalink
format code according to conventions [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
qmk-bot authored and lorenzoernesto committed May 15, 2020
1 parent 73447ec commit ad3ca66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
10 changes: 5 additions & 5 deletions quantum/debounce/eager_pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ static bool matrix_need_update;
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)

static uint8_t wrapping_timer_read(void) {
static uint16_t time = 0;
static uint16_t time = 0;
static uint8_t last_result = 0;
uint16_t new_time = timer_read();
uint16_t diff = new_time - time;
time = new_time;
last_result = (last_result + diff) % (MAX_DEBOUNCE + 1);
uint16_t new_time = timer_read();
uint16_t diff = new_time - time;
time = new_time;
last_result = (last_result + diff) % (MAX_DEBOUNCE + 1);
return last_result;
}

Expand Down
10 changes: 5 additions & 5 deletions quantum/debounce/eager_pr.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ static bool counters_need_update;
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)

static uint8_t wrapping_timer_read(void) {
static uint16_t time = 0;
static uint16_t time = 0;
static uint8_t last_result = 0;
uint16_t new_time = timer_read();
uint16_t diff = new_time - time;
time = new_time;
last_result = (last_result + diff) % (MAX_DEBOUNCE + 1);
uint16_t new_time = timer_read();
uint16_t diff = new_time - time;
time = new_time;
last_result = (last_result + diff) % (MAX_DEBOUNCE + 1);
return last_result;
}

Expand Down
5 changes: 1 addition & 4 deletions tmk_core/common/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "avr/timer_avr.h"
#endif

#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a)-(b))) : ( \
(max == UINT16_MAX) ? ((uint16_t)((a)-(b))) : ( \
(max == UINT32_MAX) ? ((uint32_t)((a)-(b))) : ( \
(a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a) ))))
#define TIMER_DIFF(a, b, max) ((max == UINT8_MAX) ? ((uint8_t)((a) - (b))) : ((max == UINT16_MAX) ? ((uint16_t)((a) - (b))) : ((max == UINT32_MAX) ? ((uint32_t)((a) - (b))) : ((a) >= (b) ? (a) - (b) : (max) + 1 - (b) + (a)))))
#define TIMER_DIFF_8(a, b) TIMER_DIFF(a, b, UINT8_MAX)
#define TIMER_DIFF_16(a, b) TIMER_DIFF(a, b, UINT16_MAX)
#define TIMER_DIFF_32(a, b) TIMER_DIFF(a, b, UINT32_MAX)
Expand Down

0 comments on commit ad3ca66

Please sign in to comment.