Maybe something with the interrupts. Wild guess: the T2 doesn't use interrupts on the pins you are using. T3 and T4 do. I don't know if the MIDI stuff also uses interrupts. Maybe some T3 specific clash?.
Just add your midi code to the example I...
To check if the hardware works you might use a simple test program which only checks the encoder part. I just tested the following on a Teensy 3.2 and it works without issue (note: it uses the EncoderTool library)
#include "Arduino.h"
#include...
This https://github.com/manitou48/teensy4 is always a good starting point if you need to do some low level programming. It contains some examples for input capture using the GPT module
Sorry, didn't mention that the library lives on GitHub. https://github.com/luni64/TeensyTimerTool,
And here an instructiion on how to install if from there: https://roboticsbackend.com/install-arduino-library-from-github/
I'll update the...
Actually you can by using anonymous namespaces. Here an example:
test.h
#pragma once
namespace someNamespace
{
extern int getVar();
extern int publicVar;
}
test.cpp
namespace someNamespace
{
namespace // anonymous/private namespace...
@joepasquariello. Yes this is a lambda expression. Here some explanation about the origin of the name: https://www.baeldung.com/cs/lambda-functions .
Actually the c++ syntax for lambdas is quite simple and logical. Here the full (AFAIK) syntax...
Sorry, that was a bug. Can you try version 1.4.3?
The following code correctly generates 500kHz signals on pin 0 and 1 using the PIT and GPT1 modules. It works for 24Mhz and 150MHz clock frequency settings.
#include "TeensyTimerTool.h"
using...
... or, if you don't like std::function / std::bind you can simply use a lambda:
void timeit(void(*f)())
{
elapsedMillis time;
f();
printf("took %d\n", (unsigned)time);
}
void g1(){
delay(120);
}
void g2(int x){
delay(x);
}...
You can also use std::function and std::bind to achieve this without macros:
#include <functional>
void timeit(std::function<void()> f)
{
elapsedMillis time;
f();
printf("took %d\n", (unsigned)time);
}
void g1(){
delay(120);
}...