Forum Rule: Always post complete source code & details to reproduce any issue!

Search:

Type: Posts; User: PieterP

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Indeed, if you need to handle out-of-memory...

    Indeed, if you need to handle out-of-memory conditions on a microcontroller with exceptions disabled, use new(std::nothrow).


    I think that's a good idea. Returning null is not allowed and does...
  2. It's just the optimizer doing its job. The...

    It's just the optimizer doing its job. The standard requires that `new` always returns a non-null pointer, so the optimizer can just throw away the entire `else` branch.

    See it for yourself on...
  3. Replies
    4
    Views
    460

    Some general comments: Don't use goto...

    Some general comments:


    Don't use goto, use human-readable control structures like if, while, do-while, for, function calls, etc. instead:

    do {
    currentState = digitalRead(BUTTON_PIN);
    ...
  4. But that doesn't solve the issue, you can shift...

    But that doesn't solve the issue, you can shift it to the left as much as you like, in the end you have to represent everything in a finite number of bits, and no amount of filtering or shifting is...
  5. I think this is an inherent problem with...

    I think this is an inherent problem with quantization, not necessarily because of the implementation of the filter (although different rounding/quantization methods might reveal it more easily than...
  6. This might be useful:...

    This might be useful: https://github.com/tttapa/Control-Surface/issues/241#issuecomment-660960589
    It does roughly the same as the code you're using now (except the 3-way and 4-way switches), but...
  7. Replies
    10
    Views
    1,501

    There is a wrapper...

    There is a wrapper, but you don't need it, Control Surface supports MIDI over hardware serial out of the box. For example:

    HardwareSerialMIDI_Interface serialmidi = Serial1;
    This line replaces...
  8. Replies
    3
    Views
    406

    I don't think you're supposed to make copies of...

    I don't think you're supposed to make copies of the serial ports. Not sure why the HardwareSerial copy constructor isn't deleted.
    If you want to declare the serial ports separately, use references...
  9. Replies
    10
    Views
    1,501

    You might be interested in the Control Surface...

    You might be interested in the Control Surface library for Arduino and Teensy that I maintain. It comes with many building blocks for creating MIDI controllers and control surfaces and has support...
  10. Replies
    41
    Views
    2,417

    Changing the Interrupt Threshold Control value...

    Changing the Interrupt Threshold Control value seems to alter the timing and might expose some data races.
    Occasionally, packets seem to be dropped when sending very long SysEx messages using my...
  11. Replies
    41
    Views
    2,417

    What exactly is the problem with the...

    What exactly is the problem with the USBDriverTimer class? Is there anything you could use help with?
  12. Replies
    41
    Views
    2,417

    You would inherit from the MIDI_Callback class...

    You would inherit from the MIDI_Callback class and implement its onChannelMessage method. Then attach the callback to the MIDI interface using setCallbacks.
    For example:

    #include...
  13. Replies
    41
    Views
    2,417

    Sure, the code for the T4.0 simply discards any...

    Sure, the code for the T4.0 simply discards any incoming MIDI USB data (compiled with USB type “MIDI”, of course):

    void setup() {
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN,...
  14. Replies
    41
    Views
    2,417

    I've been working on a more efficient...

    I've been working on a more efficient implementation of the USB host MIDI driver. It uses alternating transmit buffers and disables interrupts only for a minimal amount of time, which allows for high...
  15. Replies
    215
    Views
    28,312

    On a related note: Raspberry Pi also boasts about...

    On a related note: Raspberry Pi also boasts about the SWD debugging support on the Pico. A $4 SWD debugger sounds pretty nice.

    I've tried their “Picoprobe” firmware and their fork of OpenOCD to...
  16. Replies
    215
    Views
    28,312

    Maybe it was because I already had some of the...

    Maybe it was because I already had some of the necessary dependencies and tools installed, but for me it was as simple as installing the PlatformIO extension in VSCode and clicking the “new project”...
  17. Replies
    215
    Views
    28,312

    IIRC, the Arduino Pro IDE is based on Eclipse...

    IIRC, the Arduino Pro IDE is based on Eclipse Theia, which is an open-source VSCode alternative. The problem with VSCode is that it's not really open-source. It's built on open-source and large parts...
  18. The Teensy 4.0 is a 3.3V device, connecting...

    The Teensy 4.0 is a 3.3V device, connecting analog pins to 5V will destroy it. Your potentiometers should be wired to 3.3V, not 5V.

    Pieter
  19. You could use a lambda function: ...

    You could use a lambda function:

    OLEDIntervalTimer.begin(+[]{ enableCyclePointer(&currentGlobals); }, 6);

    Pieter
  20. I've been using Teensy on Ubuntu 20.04 since it...

    I've been using Teensy on Ubuntu 20.04 since it came out in April (and on 19.10, 18.04 and 16.04 before that), and I've never had any problems with the serial monitor.

    When selecting the 'Serial'...
  21. MIDI uses a current loop, not voltage. It's...

    MIDI uses a current loop, not voltage. It's normal that you don't measure any voltage at the output of your circuit, it only needs to source current. By adding some kind of pull-up network (e.g. by...
  22. Thread: teensy midi

    by PieterP
    Replies
    9
    Views
    1,353

    I posted a working example for a MIDI controller...

    I posted a working example for a MIDI controller with buttons and an encoder. Did it not work for you?

    If you want to write your own code from scratch, you'll have to learn some basics about the...
  23. Thread: teensy midi

    by PieterP
    Replies
    9
    Views
    1,353

    The MCU::PLAY constant is for the Mackie Control...

    The MCU::PLAY constant is for the Mackie Control Universal protocol specifically. If you don't use that protocol, the controller numbers don't really have any meaning apart for the MIDI mapping you...
  24. Thread: teensy midi

    by PieterP
    Replies
    9
    Views
    1,353

    You have to write code, there's no way around...

    You have to write code, there's no way around that. You have to tell the Teensy what MIDI messages to send and when, and how it should react to the incoming MIDI messages it receives.

    I'm the...
  25. There are very few circumstances where you should...

    There are very few circumstances where you should be using “new” in modern C++.
    The code you linked to uses “new” and owning raw pointers, and leaks memory as a result.

    For example here:
    ...
  26. Replies
    6
    Views
    652

    A quick glance at the source seems to reveal that...

    A quick glance at the source seems to reveal that the default constructor copies the contents of a pre-allocated “zero” constant BigNumber. This constant is created when calling BigNumber::begin(),...
  27. Replies
    6
    Views
    652

    Something like this, perhaps? class Foo { ...

    Something like this, perhaps?

    class Foo {
    public:
    static BigNumber* getBarPtr() {
    static BigNumber bar; // Costructed when this function is first called
    return &bar;
    ...
  28. Replies
    6
    Views
    652

    You cannot create a BigNumber before calling...

    You cannot create a BigNumber before calling BigNumber::begin(), otherwise the BigNumber constructor will dereference a null pointer and crash your program.

    Pieter
  29. You can use the “usb_string_midi_port1” through...

    You can use the “usb_string_midi_port1” through “usb_string_midi_port16” constants. By default, the names used are “Port *”, see usb_desc.c#L1686.

    You can define these names as shown here, for...
  30. I don't have too much time to look into it right...

    I don't have too much time to look into it right now, but here are a couple of things you could try:

    - Try using doubles instead of floats. If it's a numerical issue, there should be a difference....
  31. I'm not familiar with “denormalisation” in...

    I'm not familiar with “denormalisation” in digital filters. In analog filter design, there seems to be a technique called denormalisation, but I'm not familiar with it.
    In all floating point...
  32. I maintain this Arduino-Filters...

    I maintain this Arduino-Filters library.
    It supports Butterworth filters out of the box, as you can see in this example: Butterworth.ino
    Ideally, this example is all you need to filter some sensor...
  33. Replies
    2
    Views
    586

    I don't use Ableton myself, but in my experience,...

    I don't use Ableton myself, but in my experience, DAWs will usually send all relevant MIDI data when you start the application, when you open a new project, or when you configure the control surface....
  34. Replies
    7
    Views
    1,238

    Don't bother with the powf and pow C functions,...

    Don't bother with the powf and pow C functions, use the C++ function std::pow from the <cmath> header, it'll always select the right version: double if the arguments are doubles, float if the...
  35. Replies
    8
    Views
    1,076

    Basically it just reads the states of all the...

    Basically it just reads the states of all the pins, and for each pair of pins, it compares them to the previous states. This is done by combining the two new states and the two old states as a 4-bit...
  36. Replies
    8
    Views
    1,076

    Here's what I use:...

    Here's what I use: https://github.com/tttapa/Arduino-Helpers/blob/master/src/AH/Hardware/MCP23017Encoders.hpp

    See this example:...
  37. Replies
    8
    Views
    1,076

    I see you've edited your reply, glad you got it...

    I see you've edited your reply, glad you got it working.

    If you have multiple chips, you could tie all of their interrupt pins together (use open-drain output on the MCPs and input pull-up enabled...
  38. Replies
    8
    Views
    1,076

    When a pin of the MCP changes state, the...

    When a pin of the MCP changes state, the interrupt output goes low. This should trigger an interrupt on the Teensy. In the ISR, you read the MCP input register, and this read request causes the MPC...
  39. Replies
    8
    Views
    1,076

    The MCP will keep the interrupt pin low until you...

    The MCP will keep the interrupt pin low until you read the input register of the port that caused the interrupt, so you have to read the data in your ISR.
    This also implies that the correct...
  40. Replies
    4
    Views
    870

    A latency of 27ms doesn't seem right at all. I'm...

    A latency of 27ms doesn't seem right at all. I'm not familiar with the Adafruit libraries you mention, but I did write a MIDI BLE library for ESP32. The way I handle it there is by buffering the...
  41. Replies
    4
    Views
    870

    What exactly do you need a queue for? Usually,...

    What exactly do you need a queue for? Usually, you want to keep the latency as low as possible, so you'd avoid queuing up any MIDI data. The serial port or USB MIDI code you're using already has its...
  42. For my purposes, and as a beginner-friendly...

    For my purposes, and as a beginner-friendly Arduino/Teensy sketch, using the same size for the state as for the input is a perfectly sensible default.
    You can still supply your own types as a...
  43. Agreed, I added a check and more comments on the...

    Agreed, I added a check and more comments on the page:...
  44. For truly random inputs, it probably doesn't...

    For truly random inputs, it probably doesn't matter, but the problem with truncation is that it makes it impossible to reach zero again (assuming non-negative inputs).

    Using a rectangular input...
  45. Ah, I see what you mean. The difference is of...

    Ah, I see what you mean.
    The difference is of course that both 'Decay' and 'Exponential' use floating point states and operations, whereas the C++ implementation uses only integer arithmetic, so...
  46. Indeed, @xenington where did you get that code...

    Indeed, @xenington where did you get that code from? The pages you linked to seem to list the correct code...
  47. Replies
    10
    Views
    1,207

    You're right, I didn't double-check my version, I...

    You're right, I didn't double-check my version, I meant 1.52, 1.53 does indeed seem to include the change.
  48. Replies
    10
    Views
    1,207

    The .ARM.exidx section was added just 25 days...

    The .ARM.exidx section was added just 25 days ago, it's not yet included in the latest official release of Teensyduino.

    I ran into the same problem a couple of weeks ago, trying to copy the...
  49. Replies
    19
    Views
    3,445

    I've used CMake extensively for cross-compiling...

    I've used CMake extensively for cross-compiling on Linux, but never tried it on Windows, so I might be wrong but here are at least some things I could think of:

    The default CMake generator for...
  50. Here's what I use:...

    Here's what I use: https://github.com/tttapa/Arduino-Helpers/blob/ea926d30f64916cbe9d9c5a14b2b0f23e6a6d40a/src/AH/Hardware/ButtonMatrix.ipp#L16-L49
    Should be simple enough to translate that to C, or...
Results 1 to 50 of 65
Page 1 of 2 1 2