login

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - pabloxid

Pages: [1]
1
Core/Cross-platform Library Questions / Re: WHardwareTimer.h
« on: November 15, 2014, 01:39:07 AM »
Hi Brett, thank you for your response.

I think the only thing missing from this library is a set of #defines for modes and output modes, as there exist for prescalers and interrupts. For example, in my application I used the following:

Timer2.setClockSource (CLOCK_NO_PRESCALE);
Timer1.setClockSource (CLOCK_PRESCALE_8);
Timer1.attachInterrupt (INTERRUPT_COMPARE_MATCH_A, timer1IntHandler);

Timer2.setMode (0b0100);   // CTC mode
Timer1.setMode (0);        // Normal counting mode (0->2^16)
Timer2.setOutputMode (CHANNEL_A, 1);
etc.

These values I obtained by looking into the Wiring code, at sections where WHardwareTimer.h was used. Then I could define:

#define MODE_CTC              0b0100
#define MODE_NORMAL_COUNTING  0
#define OUTPUTMODE_ENABLE     1
etc.

But I really don't feel fully qualified to complete this work and to remain consistent with the style of the rest of the library.

Regards,
P.G.
2
Core/Cross-platform Library Questions / WHardwareTimer.h
« on: October 08, 2014, 11:19:21 AM »
I've spent years programming in Arduino/Wiring environments, and every time I have to do something that involves the use of timers/counters, I ended up losing hours looking at the Atmega datasheet and implementing the same code over and over again.

Recently I decided to use WHardwareTimer.h which is, in fact, the only library that exists worldwide to handle AVR timers.

The problem is that it lacks documentation, it's not even commented the code itself, which is a real shame.

My question then is: how to use setMode and setOutputMode methods? What is supposed to pass as parameters?

Thank you in advance.

Regards,
P.G.
Pages: [1]