Browse Source

make thresholds dynamic (on startup)

main
Hendrik Langer 8 years ago
parent
commit
ef320f4169
  1. 9
      src/keyboard.cpp

9
src/keyboard.cpp

@ -60,7 +60,13 @@ void Keyboard::init() {
touch_pad_read((touch_pad_t)i, &touch_value); touch_pad_read((touch_pad_t)i, &touch_value);
Serial.println(touch_value, DEC); Serial.println(touch_value, DEC);
} }
// set thresholds // ToDo: don't hardcode thresholds // set thresholds // ToDo: what if someone touches something on startup?
uint16_t touch_value;
for (int i=0; i<TOUCH_PAD_NUM; i++) {
touch_pad_read((touch_pad_t)i, &touch_value);
touch_pad_config((touch_pad_t)i, touch_value/2);
}
/*
threshold[0] = 50; threshold[0] = 50;
threshold[1] = 0; threshold[1] = 0;
threshold[2] = 0; threshold[2] = 0;
@ -72,6 +78,7 @@ void Keyboard::init() {
threshold[8] = 50; threshold[8] = 50;
threshold[9] = 50; threshold[9] = 50;
for (int i=0; i<TOUCH_PAD_NUM; i++) touch_pad_config((touch_pad_t)i, threshold[i]); for (int i=0; i<TOUCH_PAD_NUM; i++) touch_pad_config((touch_pad_t)i, threshold[i]);
*/
// interrupt handler // interrupt handler
touch_pad_isr_handler_register(tp_example_rtc_intr, NULL, 0, NULL); touch_pad_isr_handler_register(tp_example_rtc_intr, NULL, 0, NULL);

Loading…
Cancel
Save