Adding configurable DebounceDivThreshold

Can be specified from any .kll file

DebounceDivThreshold = 0xFFFFFFFF
Sets to max debounce, default is 0xFFFF.
The 0xFFFFFFFF is about a 2x longer debounce
The max requires more ram (as it uses 32 bit variables instead of 16).

Added support for submodule capabilities files.
This commit is contained in:
Jacob Alexander 2015-02-28 22:13:17 -08:00
parent 0ec5e6d9c2
commit a9c5898ba5
5 changed files with 63 additions and 23 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2014 by Jacob Alexander
/* Copyright (C) 2014-2015 by Jacob Alexander
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -24,6 +24,23 @@
// ----- Includes -----
// KLL Generated Defines
#include <kll_defs.h>
// ----- Defines -----
#if ( DebounceDivThreshold_define < 0xFF + 1 )
#define DebounceCounter uint8_t
#elif ( DebounceDivThreshold_define < 0xFFFF + 1 )
#define DebounceCounter uint16_t
#elif ( DebounceDivThreshold_define < 0xFFFFFFFF + 1 )
#define DebounceCounter uint32_t
#else
#error "Debounce threshold is too high... 32 bit max. Check .kll defines."
#endif
// ----- Enums -----
@ -110,10 +127,10 @@ typedef struct GPIO_Pin {
// Debounce Element
typedef struct KeyState {
KeyPosition prevState;
KeyPosition curState;
uint16_t activeCount;
uint16_t inactiveCount;
KeyPosition prevState;
KeyPosition curState;
DebounceCounter activeCount;
DebounceCounter inactiveCount;
} KeyState;