Skip to content

Instantly share code, notes, and snippets.

// Colemak symbols for xkb on X.Org Server 7.x
// 2006-01-01 Shai Coleman, http://colemak.com/ . Public domain.
// 2017-12-09 Modified to support Level5 switch
partial default alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "Colemak";
// Alphanumeric section
key.type[Group1] = "EIGHT_LEVEL"; // allows using Level5 switch
#define OPTION 1 // 1, 2, 3, 4, 5
typedef long res_t; // long, float
#if OPTION == 1
// use Arduino.h's `round`
#elif OPTION == 2
// use template function returning long
template<typename T> long Round(T x) { return x>=0 ? x+0.5 : x-0.5; }
#undef round
#define round(x) Round(x)
/*
* Struct to handle bits in registers
*/
typedef struct {
uint8_t b0:1;
uint8_t b1:1;
uint8_t b2:1;
uint8_t b3:1;
uint8_t b4:1;
uint8_t b5:1;
struct MyPrintable : Printable {
const char *p;
MyPrintable(const char *p) : p(p) {}
size_t printTo(Print &P) const {int i; for (i=0; p[i]; i++) P.write(p[i]); return i;}
};
void setup() {
#define FSH F("Flash string")
String S("String");
char arr[] = "char array";