Skip to content

Instantly share code, notes, and snippets.

View Staars's full-sized avatar

Christian Baars Staars

View GitHub Profile
@Staars
Staars / ec_p256_m15.c
Created September 4, 2025 15:47
Playing with BIGINT ... just experiments
/*
* Copyright (c) 2017 Thomas Pornin <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@Staars
Staars / sha256_bench.be
Created August 21, 2025 12:57
Simple Benchmark for SHA256
# Tasmota Berry SHA-256 benchmark (multi-size)
# Uses crypto.SHA256 with update()/out()
# Timing via tasmota.millis()
# Compares hashes in uppercase
import crypto
# Hash utility: returns uppercase hex (native .tohex())
def sha256_hex(data)
var h = crypto.SHA256()
@Staars
Staars / _rom_idf53_sha.c
Last active September 7, 2025 04:58
sha rom functions
#include "t_inner.h"
#if defined(USE_SHA_ROM)
#if defined(ESP_PLATFORM) && !defined(ESP8266)
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
@Staars
Staars / mble.be
Last active September 16, 2025 14:25
Matter tests
#------------------------------------------------------------------------------
- Matter BLE
-------------------------------------------------------------------------------#
import BLE
import matter
var cbuf = bytes(-255)
class BTP_CONTROL_FLAGS
static var H_BIT = 6 # Handshake
static var M_BIT = 5 # Management Message
@Staars
Staars / daikin.be
Created July 3, 2025 20:08
Daikin AC driver for Tasmota
class DAIKIN_PARSER
static def to_list(buf)
import string
var result = {}
var msg = buf
if classof(buf) == bytes
msg = buf.asstring()
end
msg = string.split(msg,",")
var success = false
@Staars
Staars / tas5805.be
Created June 29, 2025 10:26
Tasmota DAC-Support for TAS5805m
# TAS5805M DAC Driver for Berry/Tasmota
# Based on: https://github.com/sonocotta/esp32-tas5805m-dac
class TAS5805M
# Louder-ESP32 I2S DAC Driver for TAS5805M
static i2c_addr = 0x2D # Default I2C address
static pdn_pin = 33 # Power Down Pin (GPIO 33)
static fault_pin = 34 # Fault Pin (GPIO 34, optional)
var i2c
@Staars
Staars / es8311.be
Last active June 26, 2025 19:28
ESP8311 Codec fro upcoming i2s driver of Tasmota
# ES8311 Audio Codec Driver for Berry
# HW: ESP32P4-Nano, may work with the ESP32P4-EV too
class ES8311
var i2c
def init()
import gpio
self.i2c = tasmota.wire_scan(0x18)
if self.i2c == nil
@Staars
Staars / es8311.be
Created June 20, 2025 04:52
WIP-Driver for ES8311
# ES8311 Audio Codec Driver - Complete Berry Implementation
# Converted from C implementation for Tasmota/ESP32
class ES8311
# Konstanten
# P4 Nano
static P4_NANO_PA_GPIO = 53
static ES8311_ADDR = 0x18
static FROM_MCLK_PIN = true
@Staars
Staars / mp3.be
Created June 13, 2025 11:31
Simple MP3-Player for upcoming i2s driver version
class PLAYER
var mp3s, mp3_index
def init()
import path
import string
var d = path.listdir("/")
self.mp3s = []
self.mp3_index = 0
for f:d
if string.endswith(f,".mp3")
#- Simple SSH server in Berry by Christian Baars
# this is demo code and not intended for production use
-#
#@ solidify:SSH_MSG
class SSH_MSG
static DISCONNECT = 1
static IGNORE = 2
static SERVICE_REQUEST = 5
static SERVICE_ACCEPT = 6