Skip to content

Instantly share code, notes, and snippets.

@mdevaev
mdevaev / rpi-cpuinfo-dt.md
Created August 1, 2020 14:52 — forked from jperkin/rpi-cpuinfo-dt.md
raspberry pi cpuinfo vs device-tree

Raspberry Pi cpuinfo vs device-tree

My attempt at gathering information on how to detect exactly which Raspberry Pi model we are running on for https://github.com/jperkin/node-rpio. The goal is to come up with an optimal way of detecting the host across a wide range of hardware and OS.

Data

Name (Rev) cpuinfo /proc/device-tree/model device-tree/soc/ranges OS
B (1.0) 0002 Raspberry Pi Model B 7e000000 20000000 01000000 7
B (1.0) 0002 Raspberry Pi Model B Rev 1 7e000000 20000000 02000000 10
@mdevaev
mdevaev / usb_hid_keys.h
Created July 4, 2020 15:00 — forked from MightyPork/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
import sys
import asyncio
import json
import aiohttp.web
async def run_script(url: str, user: str, passwd: str, script_path: str) -> None:
with open(script_path) as script_file:
record = json.loads(script_file.read())
author {
name "John Doe"
email "jd@example.com"
active true
}
contents [
{
lst 1 2 3
}
#!mkcmd
# $Mkcmd(*): ${mkcmd-mkcmd} %f
#
from '<sys/types.h>'
from '<sys/time.h>'
from '<sys/socket.h>'
from '<sys/ioctl.h>'
from '<netinet/in.h>'
from '<fcntl.h>'
from '<signal.h>'
from urllib.request import BaseHandler
from urllib.request import Request
from urllib.response import addinfo
from urllib.response import addinfourl
import gzip
from typing import Union
#include <Arduino.h>
#include <Rotary.h>
// http://techdocs.altium.com/display/FPGA/PS2+Keyboard+Scan+Codes
const int KBD_CLOCK_PIN = A1;
const int KBD_DATA_PIN = A2;
const unsigned char K_PFX = 0xE0;
const unsigned char K_SEP = 0xFF;
func uint32 main(str[] argv):
keyval<unt32:str> kv;
for uint32 i = 0; i < 10; i++:
kv.append("Number: {}".fmt(i))
for (uint32 k, str v) in kv.items():
print(k, v)
return 0
from RPi import GPIO
import time
CLOCK_PIN = 4
DATA_PIN = 15
DELAY = 0.00020
def send_bit(bit):
FROM mdevaev/archlinux
MAINTAINER Devaev Maxim <mdevaev@gmail.com>
RUN pacman --noconfirm -Syy \
&& pacman --noconfirm -S \
python-setuptools \
python-mako \
lighttpd \
php \
php-cgi \