Hi. I am trying to get a capacitive sensor library using a button ( 2 plates, one to ground, one to the AIN, separated).
It's going crazy, sometimes it just get tones of callbacks, sometimes not. The docs algorithm diagram is not clear regarding the callback, when it's being called, and how to extract values.
I read this.
I was playing with the threshold value and the timer between measurements, but there are 2 problems :
-
The "release" function will always happen, so if I put my finger on the sensor and not remove it, it will call "press" and then "release" over and over (every measurement), which is a strange way to use "release" function, because it has no meaning like that (unless the timer is too large), it should call release only when i remove my finger.
-
So I want to do my own DSP, so I need to read the actual values from the callbacks - I couldn't learn from the docs how to extract the measured value .
void nrf_csense_handler(nrf_csense_evt_t * p_evt) { switch (p_evt->nrf_csense_evt_type) { //****this is the press callback extract from here the value case NRF_CSENSE_BTN_EVT_PRESSED: if (p_evt->p_instance == (&m_button)) { //uint16_t * btn_cnt = ((uint16_t*)p_evt->p_instance->p_context);
In general the sensor requires a lot of DSP work to be able to act as a reliable button, I was thinking that the library already did all of that for me.