Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Max7219, quad encoder, better modularity w.r.t. clock ISRs #4

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

larsimmisch
Copy link
Contributor

Hi Ben,

this adds:

  • support for the Max7219 (good for 8x8 LED matrices)
  • support for Quadrature encoders
  • better modularity for clock ISRs

The clock ISR modularity thingy works like this: if you #define CLOCK_NO_ISR before including the clock header, you write the ISR yourself, but get to reuse the clock16 ISR.

With the quad encoder, I've used it like this:

#define CLOCK_NO_ISR
#include <clock16.h>
#include <quadrature.h>

typedef _Quadrature<Pin::D5, Pin::D6, 0, 127> Quadrature;

ISR(TIMER0_OVF_vect)
{
    Quadrature::update();
    clock16_isr();
}

Oh yeah, we need a quad encoder example in arduino--.

The clock ISRs are functions now, also #define CLOCK_NO_ISR suppresses
the generation of an ISR. This way, user code can extend the clock ISR as it
needs.
Naming convention compliance.
Added a test case for the wait queue.
This was mainly done to make it easier to use arduino-- in other projects.

Previously, avr-ports.h was generated depending on the MCU, now, all supported
MCU port definitions are available upon checkout, which simplifies the Makefile
in projects depending upon arduino--

Also reworked was the logic for the Timer0 prescaler. The Timer0 prescaler
can now optionally be set in Makefile.local and the Timer::micros function
should work correctly across all possible values.
(and delete-trailing-whitespace)
@benlaurie
Copy link
Owner

Wow, I suck. I should check this is safe to merge - I notice you removed the NullPin class, not sure if that breaks stuff?

Also, why the change on the ports header?

@larsimmisch
Copy link
Contributor Author

Ghosts from the past.

The NullPin class still exists - it's currently in spi.h. I think that was because that was the only place that used it. It could go back into arduino--.h

The ports header was changed to support more than just the ATMega328 - it was moved to defs/ports_mx8.h. There is now also defs/ports_tnx5.h.

I meant to setup a simulator based test chain to verify that the ATTiny platforms behaved as expected, but didn't get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants