kapraran / FreqCountESP

A frequency counter library for esp32
https://kapraran.github.io/FreqCountESP/
MIT License
31 stars 7 forks source link

Errors compiling your sample program #6

Open Macguiwer opened 1 year ago

Macguiwer commented 1 year ago

Hello , Nikos when compiling the example of your library with sending data via serial I get the following error

`/Users/bernat/Documents/Arduino/libraries/FreqCountESP-master/src/FreqCountESP.cpp: In function 'intr_handle_data_t setupPcnt(uint8_t, volatile uint32_t)': /Users/bernat/Documents/Arduino/libraries/FreqCountESP-master/src/FreqCountESP.cpp:36:17: error: 'PCNT_CHANNEL_EDGE_ACTION_INCREASE' was not declared in this scope .pos_mode = PCNT_CHANNEL_EDGE_ACTION_INCREASE, ^ /Users/bernat/Documents/Arduino/libraries/FreqCountESP-master/src/FreqCountESP.cpp:37:17: error: 'PCNT_CHANNEL_EDGE_ACTION_HOLD' was not declared in this scope .neg_mode = PCNT_CHANNEL_EDGE_ACTION_HOLD, ^ /Users/bernat/Documents/Arduino/libraries/FreqCountESP-master/src/FreqCountESP.cpp: In function 'void teardownPcnt(pcnt_isr_handle_t)': /Users/bernat/Documents/Arduino/libraries/FreqCountESP-master/src/FreqCountESP.cpp:75:32: error: 'pcnt_isr_unregister' was not declared in this scope pcnt_isr_unregister(isrHandle); ^

exit status 1

Compilation error: exit status 1

I am using the latest version of the Arduino IDE for MacOS. I guess the latter shouldn't be a problem.

masmoe commented 1 year ago

same issue...

ESP-O-MAT commented 1 year ago

Hello, the pulsecounter has been redesigned: https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32/migration-guides/release-5.x/peripherals.html

You can change the following in FreqCountESP.cpp: PCNT_COUNT_INC = PCNT_CHANNEL_EDGE_ACTION_INCREASE PCNT_COUNT_DIS = PCNT_CHANNEL_EDGE_ACTION_HOLD

but then there's still the missing pcnt_isr_unregister function:

pcnt_isr_register and pcnt_isr_unregister are removed. Register of the ISR handler from user’s code is no longer permitted. Users should register event callbacks instead by calling pcnt_unit_register_event_callbacks().

You can comment out the line with "pcnt_isr_unregister(isrHandle);" to test the library.