Search found 10 matches

by chukitoes
Tue Feb 15, 2022 2:33 am
Forum: Hardware
Topic: Measure time between signals with MCPWM capture
Replies: 6
Views: 10390

Re: Measure time between signals with MCPWM capture

Reviving an old topic, but as I'm currently looking into the Capture Module myself and reading the ESP32 Technical Reference Manual, this problem of using only one Hall sensor to measure the instantaneous RPM from a motor can be solved by attaching the GPIO Input pin to 2 separate Capture signals, o...
by chukitoes
Mon Feb 07, 2022 3:24 am
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

But, it actually does work Sorry, I think I was off the mark - I was mixed up with the common case where the header would have 'static' variables, in which case they would be 'duplicated' wherever that header is included. Don't be sorry, that was the final piece of the puzzle to solving the cpp han...
by chukitoes
Sun Feb 06, 2022 11:51 pm
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

So, it's now working as expected. There were a few things: For the files i posted here: I used the change proposed by boarchuz, but instead of using it in the main.c, it was the solution for one of the issues from the main.cpp. You could change uint32_t C_cnt; -> extern uint32_t C_cnt; in ANSI_Encod...
by chukitoes
Sun Feb 06, 2022 6:31 pm
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

By including ANSI_ENCODER.h in your main.c, you declare a C_cnt in that translation unit. This is not the same memory as the C_cnt in the ANSI_Encoder.c translation unit. main.c doesn't know about the other C_cnt in ANSI_Encoder.c, it just prints its own C_cnt which is never updated (ie. always 0)....
by chukitoes
Sun Feb 06, 2022 2:44 am
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

In `encoder_init`. You have `encoder_isr_config_t isr_args;`. thats on the stack and is no longer valid after the function returns. You need to declare that as static. You also need one for each interrupt, you're overwriting the first when you setup the second. You're right, thank you! Sadly, it do...
by chukitoes
Fri Feb 04, 2022 3:56 pm
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

I've tested it, and it also doesn't seem to work.

Printing the pointer value for both this->inside_class_isr_handler and RotaryEncoder::encoder::inside_class_isr_handler brings out the same value, so it seems like they're the same.
by chukitoes
Thu Feb 03, 2022 6:45 pm
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

Re: GPIO Interrupt from a class file

Thanks for your reply. I forgot to specify this, my bad. By "isn't working properly" I mean that the interrupts aren't being activated when there's a state change in the GPIO pins, but only when the function gpio_isr_handler_add is called inside the class file. When called from the main, it works as...
by chukitoes
Wed Feb 02, 2022 7:56 pm
Forum: General Discussion
Topic: GPIO Interrupt from a class file
Replies: 12
Views: 18189

GPIO Interrupt from a class file

I want to use GPIO Interrupts from a .cpp class file and so far, everything I've tested isn't working properly. Checking the return from the gpio_isr_handler_add function, it's always 0 (ESP_OK). I've tried: static function outside the class; static method inside the class; Here's the minimum workin...
by chukitoes
Wed Feb 02, 2022 6:30 pm
Forum: IDEs for ESP-IDF
Topic: Changing build configuration in Eclipse
Replies: 2
Views: 6629

Re: Changing build configuration in Eclipse

That's what I was looking for!

Thank you!
by chukitoes
Mon Jan 17, 2022 7:17 pm
Forum: IDEs for ESP-IDF
Topic: Changing build configuration in Eclipse
Replies: 2
Views: 6629

Changing build configuration in Eclipse

While trying to build a project from a git repository, I ran into the CCache error caused by long paths. ( https://esp32.com/viewtopic.php?t=14651 ) The error itself I managed to fix by the proposed solution (Change build directory) in that topic, but only on the esp-idf cmd. So my question is: How ...