Where to pose questions about Kaleidoscope code

I’ve been reading through Kaleidoscope in an attempt to understand the code, and I’ve got lots of little questions (e.g. “Where is KALEIDOSCOPE_HARDWARE_H defined? I can’t find that anywhere…”). I don’t feel like it’s appropriate to bring all those little questions up here, but I would like to get some enlightenment from @jesse, @algernon, and/or anyone else who understands it well enough. I’d also like to add lots of comments to that code as I go, and offer those up as pull requests to the repository (probably with a few actual code changes, too), to benefit people (myself included) who are trying to do the same in the future.

How should I go about doing this without constantly distracting the people who are most critical to real improvements to Kaleidoscope?


I’ve been asking questions on the IRC channel (#keyboardio on irc.freenode.net), personally.

1 Like

Either IRC, or these forums, I’d sya. As long as the questions are in a single thread, it’s not a distraction. The forums have the advantage of being perhaps a little friendlier and easier to search back, and may prove more educational for others. We’ve had great success on IRC too, mind you. Only thing about IRC is that it is only really useful if you have a client that can stay there without disconnecting, because in a lot of cases, we can only answer a few hours later (depending on timezone, or babies, or whatever).


Definitely a good idea to write your discoveries too — I’ve been trying to do the same as well so the next person to come along doesn’t need to spend a day reading source & asking Algernon & Jesse (my current crowning achievement being making the README for Ranges longer than the source :stuck_out_tongue:) .


I think here is fine. @jesse indicated in another thread that he’d like to see this forum become searchable living documentation:

1 Like

To answer this question in particular - it’s a tricky one, it’s actually defined by the Arduino build system based on which platform you’re compiling for. (In the Arduino IDE, this is controlled by the Tools->Board option.) So, every file is compiled with -DKALEIDOSCOPE_HARDWARE_H=foo for some value of foo.


I figured it was some such magic. Do you know what it gets evaluated to in the case of the Model01?

I think I’d feel more comfortable asking trivial questions like that on the forum in a suitable subcategory. It would be better than IRC, in my opinion, for the aforementioned reasons.

Under linux you could use

grep -R <search_string>

to search recursively in code. Or

grep -R --include \*.cpp <search string>

to search only in files of a particular type, e.g. C++ implementation files.

Yep, it’s “Kaleidoscope-Hardware-Model01.h” (a file provided by the plugin Kaleidoscope-Hardware-Model01). Highly related is the plugin Kaleidoscope-Hardware, which provides a base class which defines the interface between Kaleidoscope and each of the hardware plugins (like Hardware-Model01).

Naturally. Go ahead and do that recursive grep, and you’ll see why I was unable to find it. =)

Can’t do that right now as I am far away from any source code. My post was directed to all those that are new to exploring source code. That’s why I skipped all regex magic for more sophisticated search queries. :wink:

FWIW, the IRC channel is publicly logged too: “Public channel logs at http://irc.madhouse-project.org/freenode/keyboardio/”, per the /topic.

Also, if you’re doing lots of source code diving, you should totally install https://github.com/ggreer/the_silver_searcher – it gives you a command called ag, which is like grep, but a) recursive by default and b) aware of git and most importantly, .gitignore files, so a bunch of false positive noise you get with grep is eliminated.


I will absolutely check that out! Sounds like something I might find myself using at work, too. I find myself really missing a lot of IntelliJ IDEA’s features when looking for header files (day job is mostly java), but haven’t been willing to spring for the subscription that includes CLion. At risk of derailing this thread - @Javaru, I know you’re a huge IntelliJ fan - do you have the ultimate license?

1 Like

That, I can do!

jesse@szx:~/git/Arduino-Boards (master)$ grep -ri KALEIDOSCOPE_HARDWARE_H *
boards.txt:model01.build.extra_flags={build.usb_flags} -DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Model01.h"
boards.txt:shortcut.build.extra_flags={build.usb_flags} -DKALEIDOSCOPE_HARDWARE_H="Kaleidoscope-Hardware-Shortcut.h"
libraries/Kaleidoscope/src/layers.h:#include KALEIDOSCOPE_HARDWARE_H
libraries/Kaleidoscope/src/Kaleidoscope.h:#include KALEIDOSCOPE_HARDWARE_H
libraries/Kaleidoscope/src/key_events.h:#include KALEIDOSCOPE_HARDWARE_H
libraries/Kaleidoscope-Hardware/src/Kaleidoscope-Hardware.h: * KALEIDOSCOPE_HARDWARE_H - filename of the file Kaleidoscope should include for

The Arduino-Boards repo is our Arduino hardware definition package, including libraries. If you’re going to go grepping, it’s more likely to be a good starting point, since it includes Kaleidoscope, plugins AND our arduino board and platform files.

I did! Almost. I searched the whole libraries directory from the Arduino GUI build system, but I didn’t back up one level, so I missed boards.txt


@kajsa.anderson I assume you mean the All Products Pack? Yes I have that, so I have a license for CLion. (Keep in mind you can also buy it individually for USD $89 for a personal license).

I have Kaleidoscope (mostly) configured in it so I can play around and easily navigate through the code. I like the code browsing benefits of a good IDE. I still have nightmares of writing code on a green screen VAX terminal in my youth :scream: This is a bit nicer:


Besides, given that I have not touched C or C++ in over 20 years, I need all the help I can get. After all, my avatar is Javaru and not Cguru for a reason.


Oh man. We only had amber screens for the terminals connected to the VAX. It used to be the case that Jetbrains did free licenses for OSS projects.

If that’s still a thing, and folks would find it useful, I’m happy to jump through the hoops.

I took a look at that, actually, and there’s a “non-commercial” requirement for their free license, so I’m not sure Kaleidoscope would qualify, though it might since the firmware itself isn’t a commercial product. IANAL, etc. Keyboardio would qualify for their 50% pricing for startups, though, unless you formed the company longer ago than I realize.

@Javaru - I’ve already got a personal subscription for IntelliJ, which is why I wondered about the All Products pack. Looking at it, I’d be ahead to do a separate CLion subscription rather than take the hit for the first year of the other option. I’ve got a query in to their sales folks to see if they have any discount available, though.

1 Like

Lemme drop them a line and ask. (I did this before with IntelliJ for K-9 Mail for Android)

1 Like

@kajsa.anderson - I dropped them a line asking if they’d be willing to consider an opensource license for kaleidoscope, with an explicit exception that it’s not usable by anyone who’s paid to hack on the project. I’ll report back.

1 Like