Hello,
nRF52840, SDK17.2, keil5, EC11 codec button
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void MY_QDEC_INTERRUPT(nrfx_qdec_event_t event)
{
static uint8_t flag=0;;
static int cnt = 0;
if(NRF_QDEC_EVENT_REPORTRDY == event.type)
{
nrfx_qdec_disable();
//int8_t dat = nrf_qdec_sample_get();
int16_t p_acc = event.data.report.acc;
uint16_t p_accdbl = event.data.report.accdbl;
nrfx_qdec_enable();
if(0==p_accdbl)
{
if(p_acc<0)
cnt++;
else
cnt--;
}
Output the same log in the positive and negative directions,
Turn one space: <info> app: cnt=-1 acc=1 accdbl=0
Turn one more: <info> app: cnt=0 acc=-1 accdbl=0
Unable to distinguish positive and negative directions.
Best regards