Skip to content

Instantly share code, notes, and snippets.

View Staars's full-sized avatar

Christian Baars Staars

View GitHub Profile
@Staars
Staars / i2s__audio.ino
Created July 7, 2025 13:09
just some tries
/*
xdrv_42_i2s_audio.ino - Audio dac support for Tasmota
Copyright (C) 2021 Gerhard Mutz and Theo Arends
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@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 / p4.json
Last active June 25, 2025 19:07
p4 template
{"NAME":"ESP32P4-NANO","GPIO":[0,0,0,0,0,0,0,640,608,7776,7840,7872,7808,9376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5568,0,0,0,0,0,0,0,8864,8896,8928,8960,8832,8800,6720,0,0,0,0,0,5536,5600,0,0],"FLAG":0,"BASE":1,"CMND":"ethtype 1|ethaddress -1"}
@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
@Staars
Staars / chacha.ino
Created April 19, 2025 17:10
Test implementation chacha_poly
int32_t m_chacha20_poly_run(bvm *vm, int32_t _encrypt) {
int32_t argc = be_top(vm); // Get the number of arguments
if (argc >= 4 && be_isbytes(vm, 1) // secret_key - 32 bytes
&& be_isbytes(vm, 2) // iv/nonce - 12 bytes
&& be_isbytes(vm, 3) // data/cipher
&& be_isbytes(vm, 4) // mac/tag - 16 bytes
// optional: aad
) {
size_t key_len = 0;
@Staars
Staars / crypto_tests.be
Last active April 24, 2025 18:01
Crypto test vectors
import crypto
e = crypto.ED25519()
seed = bytes("9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60")
secret_key=e.secret_key(seed)
message = bytes()
public_key = secret_key[-32..]
_public_key = bytes("d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a")
assert(public_key == _public_key)
signature = e.sign(message, secret_key)
assert(signature == bytes("e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b"))