luni
Reaction score
15

Latest activity Postings About

    • luni
      The library is pretty imune against any bouncing as long as bounces don't overlap. I.e., if your encoder bounces so badly that one switch still bounces while the other switch changes transition you might get wrong counts. The same might happen if...
      • 1713593786665.png
      • 1713593889589.png
    • luni
      If your Teensy is already in bootloader mode you can read out the USB-HID usage constant with (probably) any HID library. The HID-Usage then defines the Board. See here for a list...
    • luni
      Thanks for spotting it. I just published v3.2.2 on GitHub which fixes the issue. May take a few hours until the Arduino & PlO library managers detect the changed version.
    • luni
      Sorry, it is in your library folder `EncoderTool/src/Single/Encoder.h` https://github.com/luni64/EncoderTool/blob/master/src/Single/Encoder.h
    • luni
      OK, I can reproduce the issue with powercycling. During the `begin()` function the library sets the pinmode of the input pins to the required value and immediately after that reads in the starting values of the A/B pins. For some reason I don't...
    • luni
      The datasheet is a bit unclear, can it be that this encoder has only half a quadrature period per detent? You can try by setting it to CountMode::full and see how much the count value increases if you rotate the encoder by one detent. I tested...
    • luni
      I tested your code with a directly connected encoder (common GND) without any additional stuff. It works without issue here.
    • luni
      Looks like it doesn't read the pinlevels at startup correctly. How did you connect the encoder?
    • luni
      Thats not an error in your code but some glitch in the Arduino IDE. Seems like deleting the files in your temp folder fixes ist: https://forum.arduino.cc/t/internal-error-in-mingw32-gt-pch-use-address/1107884
    • luni
      If you switch the standard library from the default newlib to newlib-nano your size difference shrinks down to a few 100 bytes. Here some info about the two versions of the standard library...
    • luni
      I recently stumbled over std::optional which comes in handy for such situations. Of course, changing an already published API is a no-go, but std::optional seems to be a nice tool for the toolbox... #include <optional> std::optional<unsigned>...
    • luni
      luni replied to the thread Very high code RAM usage.
      Instead of SMALLEST_CODE you could also try to add --specs=nano.specs which will switch to newlib-nano (same as SMALLEST_CODE does) but keeps the optimization level.
    • luni
      luni replied to the thread Very high code RAM usage.
      Looks like you don't compile for gnu++17. Make sure -std=gnu++17 is set in your build options
    • luni
      You are right of course. To be on the save side one should use DMAMEM alignas(A) uint8_t buf[sizeof (A)]; // statically allocate memory for an object of type A to allocate the buffer.
    • luni
      Here a quick test which shows that the compiler relys on initialization during startup. class A { public: int i = 42; const int c = 17; void print() { Serial.printf("i=%d &i=%p\n", i, &i); Serial.printf("c=%d...
    • luni
      luni replied to the thread Help with Teensy Loader.
      I have successfully worked on a proof of concept to upload ehex files with TeensySharp. However, I haven't integrated it into the library yet. Anyway, the purpose of TeensySharp is to allow users to integrate Teensy detection and firmware upload...
    • luni
      Actually isPressed() returns the debounced state of the button. So, replacing pressed() by isPressed() in @japreja s code should work. Here an example showing the behaviour of isPressed() #include "Bounce2.h" Button b1; void setup() {...
      • 1708066844442.png
    • luni
      luni replied to the thread Lightweight C++ callbacks.
      Thanks, I'll fix that. However, CallbackHelper was just an experiment to understand how those things work. Please note that since the new TD1.59, the core contains teensy::Inplace_function which is a much better solution.
    • luni
      luni replied to the thread Encoder Tester.
      Thanks for spotting this. I'll have a look
    • luni
      You can't. For frequency measurements see here: https://www.pjrc.com/teensy/td_libs_FreqCount.htm For pulse height you need to use analogRead, but that will be difficult if you have short pulses For pulse width see here...
    • luni
      Paul gave you the link to the documentation of the library in #13 above. It contains all information how to use it. However, it does not contain a "simple list of commands". I can give you examples if you tell us what you want to achieve with...
    • luni
      You didn't specify how precice you need that pulse. If you only need something roughly 10ns you can use the following code. It will generate a pulse of about 13ns every 50ms. IntervalTimer timer; void pulse() { digitalWriteFast(0,HIGH)...
    • luni
      luni replied to the thread using DMAMEM.
      Technically you'd put the objects in DMAMEM, not the class. Here an example: c1 lives in ITCM, c2 lives in DMAMEM and c3 in FLASHMEM class myClass { public: unsigned i = 42; }; myClass c1; DMAMEM myClass c2; FLASHMEM const myClass c3; void...
    • luni
      luni replied to the thread WebUSB on teensy.
      I just gave WebSerial a try. This is also very simple to use: Here a simple test web page: <!DOCTYPE html> <html> <head> <title>Page Title2</title> </head> <body> <h1>WebSerial Tester</h1> <button type="button"...
      • 1707060105643.png
    • luni
      luni replied to the thread WebUSB on teensy.
      @PaulS, Maybe I didn't understand this correctly, but I always thought WebUSB is a low level API where you directly communicate to endpoints / interfaces etc. Thus, wouldn't you need a corresponding driver on the Teensy side to make this work...
    • luni
      Actully accelstepper::run() is not very expensive and the T4.1 processor is quite fast. Here a simple test which moves 4 steppers with random parameters. tick() calls the run() functions of the steppers in a timer interrupt every 100µs. During...
      • 1707038076195.png
    • luni
      Did you try to simply call the accelstepper::run() functions from a timer interrupt?
    • luni
      luni replied to the thread WebUSB on teensy.
      In case WebHID is sufficient: I did try it some time ago, it worked nicely with minimal code: https://forum.pjrc.com/index.php?threads/making-webusb-work-with-the-teensy-what-is-pluggableusb.60782/post-247184. I just tried it, it still compiles...
    • luni
      If resetting the device would do what you need, you could use tyCommander:
      • 1706877386304.png
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      Yes, I'll never understand why the Arduino IDE doesn't have a simple "clean all". Anyway, the note is issued during compiling, not linking. So, in this case forcing a rebuild doesn't help.
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      I can reproduce that with @PaulStoffregen s code. I also saw that the warning/note is generated by the compiler, not the linker. So, opposed to what was written in the StackOverflow link it doesn't help doing a clean recompile. Anyway, you can...
    • luni
      If you post the hex file I can try to reproduce the issue.
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      The warning seems to be about linking code compiled with an older compiler to code compiled with a newer compiler. See here for details: https://stackoverflow.com/a/48149400/1842762. Are you sure that you are doing a clean rebuild? Are you...
    • luni
      luni replied to the thread Teensyduino 1.59 Beta #5.
      There still is a leftover from the old code in intervaltimer.h: https://github.com/PaulStoffregen/cores/blob/c5e716375532ae0d8b912d7034707c0859b68801/teensy4/IntervalTimer.h#L73C2-L78C3 here the corresponding PR...
    • luni
      Registering an interrupt service routine (ISR) is usually done by storing its address in a table (often called the "vector table"). The IntervalTimer.begin() function does this for you. If an interrupt wtih number n occurs, the processor...
  • Loading…
  • Loading…
Back
Top