Skip to content

Instantly share code, notes, and snippets.

View grodansparadis's full-sized avatar
🤔
Thinking

Åke Hedman grodansparadis

🤔
Thinking
  • Grodans Paradis AB, Sweden
  • Los, Hälsingland, Sweden, Europe
  • 18:30 (UTC +02:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am grodansparadis on github.
  • I am grodansparadis (https://keybase.io/grodansparadis) on keybase.
  • I have a public key whose fingerprint is CC68 137E 5F27 3B53 E32F B070 07C7 39B5 ED74 864E

To claim this, I am signing this object:

@grodansparadis
grodansparadis / gist:246501a8a867f52cf1d9d29aeb336b41
Created October 13, 2021 21:13
Windows: blocking calls in VSCP helper lib to get events
// Enter receive loop
if (VSCP_ERROR_SUCCESS != (rv = vscphlp_enterReceiveLoop(handle1))) {
printf("Failed to enter receive loop rv = %d\n", rv);
}
//
while (true) {
vscpEventEx ex;
if (VSCP_ERROR_SUCCESS == (rv = vscphlp_blockingReceiveEventEx(handle1, &ex, 1000))) {
printf("Event received: Class=%ud Type=%d\n", ex.vscp_class, ex.vscp_type);
@grodansparadis
grodansparadis / gist:eba5385eddb861cbaa90025a5d85faf9
Created October 13, 2021 21:20
Windows: helper lib polling for events
while (true) {
if (VSCP_ERROR_SUCCESS != (rv = vscphlp_isDataAvailable(handle1, &count))) {
printf("Failed to get available data rv = %d\n", rv);
Sleep(5000);
continue;
}
if (count) {
printf("There is %ud events available\n", rv);
@grodansparadis
grodansparadis / esp32_aes_example.c
Created March 27, 2026 15:58 — forked from cnlohr/esp32_aes_example.c
Example of using hardware AES 256 Crypto in CBC mode on the ESP32 using ESP-IDF
#include <string.h>
#include <stdio.h>
#include <hwcrypto/aes.h>
/*
For Encryption time: 1802.40us (9.09 MB/s) at 16kB blocks.
*/
static inline int32_t _getCycleCount(void) {
int32_t ccount;
@grodansparadis
grodansparadis / gist:16e010326dc1ceedb0dcd162ac6c153e
Created April 20, 2026 12:37
Autostart socketcan channels using systemd on Linux
# Create service file
```bash
[Unit]
Description=can0
[Service]
ExecStartPre=/sbin/ip link set can0 type can bitrate 125000 restart-ms 100
ExecStart=/sbin/ip link set can0 up txqueuelen 128
Restart=on-failure
@grodansparadis
grodansparadis / gs_usb-protocol.rst
Created May 5, 2026 10:12 — forked from marckleinebudde/gs_usb-protocol.rst
gs_usb protocol definition
enum gs_usb_breq {
    GS_USB_BREQ_HOST_FORMAT = 0,
    GS_USB_BREQ_BITTIMING,
    GS_USB_BREQ_MODE,
    GS_USB_BREQ_BERR,
    GS_USB_BREQ_BT_CONST,
    GS_USB_BREQ_DEVICE_CONFIG,
    GS_USB_BREQ_TIMESTAMP,