Coder Social home page Coder Social logo

Comments (6)

jackhumbert avatar jackhumbert commented on May 11, 2024

Yeah! I was meaning to reply on reddit, but this is much better :)

By default, I believe Timer 1 Timer 0 is always running, so you should be able to grab TCNT1 TCNT0 to use for that. You could also set up 0 1, 3, or 4 as well! There's some nice info on the timers here - the chip on the PCB/Teensy 2.0 is the Atmega32u4 if you need to find any specific info about it.

This is pretty awesome, though - let us know what happens!

from qmk_firmware.

mecanogrh avatar mecanogrh commented on May 11, 2024

Timer0 is already in use in tmk code maybe not the best idea to use it.
See timer_avr.h and timer.c in tmk_core/common/avr.

from qmk_firmware.

jackhumbert avatar jackhumbert commented on May 11, 2024

Sorry, that's the one I meant! I believe it's safe to read from TCNT0 without affecting anything that's going on.

from qmk_firmware.

cbbrowne avatar cbbrowne commented on May 11, 2024

I'm grabbing the bottom 8 bits of TCNT1, and am finding it populated, for what it's worth.
I shut off my linear congruential RNG bit, and just used values from TCNT1, and was getting decently variable keystrokes, so it seems as though TCNT1 is being turned on.

With the combination of both RNGs (linear congruential, and XOR in bits from the counter), I'm certainly getting stuff looking random.

Here's some digits... 471074697342030825391029594704832

Here's some letters... xczqlozosvuslrmxcsbctuwtujsszbrwdzieoeegxssvqvecegszwaavkf

Looking good! Thanks, very helpful!

from qmk_firmware.

jackhumbert avatar jackhumbert commented on May 11, 2024

That's great! Feel free to open a PR when you get things finalised :)

from qmk_firmware.

mecanogrh avatar mecanogrh commented on May 11, 2024

Was looking at your code cbbrowne and wondered where you put the timer init, looks like Timer1 is used by the backlight sleep code. But as you only need a read (thought you wanted to tailor the timer as well) you could have use Timer0 as well I guess. Sorry for the misunderstanding and noise guys.

from qmk_firmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.