Community
cancel
Showing results for 
Search instead for 
Did you mean: 
COkon
New Contributor I
903 Views

ISR on PWM Class

I want to implement an ISR on a PWM pin using a PWM class and I tried something like this

mraa_gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;

mraa_gpio_isr(x, edge, &interrupt, NULL);

 

I get this error " Cannot convert 'mraa::pwm*' to mraa_gpio_context{aka_gpio*}' for argument '1' to 'mraa_result_t mraa_gpio_isr(mraa_gpio_context, mraa_gpio_edge_t, void(*)(void*), void*)"

 

Any help or pointing me to the right direction will be greatly appreciated.

 

Thank you in Advance.

 

 

3 Replies
Pedro_M_Intel
Employee
40 Views

Hello dunex_1,

Why do you want to implement an ISR on a PWM pin?

I mean, ISRs are used on input pins when a specific action takes place and it triggers certain interruption. Why do you want to use it on a PWM pin? I mean if you set a pin as PWM it is an output pin.

Peter.

COkon
New Contributor I
40 Views

Hi Intel_Peter,

I am trying to implement a timer in the intel edison on eclipse. I want to have two functions running, one reading an I2C value continuously and the other, gets the value from the I2C every 10 seconds and then send it to a PWM pin which controls my motor speed. I thought that the only way to do that is to invoke an interrupt on the PWM pin every 10 seconds. Is there a way to implement the CPU timer/RTOS of the edison to call the PWM function every 10 seconds?

Pedro_M_Intel
Employee
40 Views

Why don't you use a timer instead of using interruptions, check this document about the same subject: https://madalanarayana.wordpress.com/2014/01/25/create-your-own-timer-routine-in-linux/ Create your own timer routine in Linux | My Linux and Telecom Experiences I believe it may be able to help you achieve your project.

Peter.