Skip to content

Instantly share code, notes, and snippets.

View jef-sure's full-sized avatar

Anton Petrusevich jef-sure

  • Germany
View GitHub Profile

jef-sure

this is esp32-c3 mcu. OutpuEnablePin is pulled up with 10kohm resistor. why after reset during mcu initialisation for short time there's 0 on that pin?

GitHub Copilot

This behavior is expected on ESP32-C3 (and most ESP32 chips) due to the default state of GPIOs during reset and boot:

GPIOs are configured as inputs by default after reset. If you have a 10k pull-up resistor on OutputEnablePin (GPIO0), the pin should be high when floating.

#include "spi_shiftout.h"
#include "driver/gpio.h"
#include "esp_log.h"
#include <stdlib.h>
#include <string.h>
static const char *TAG = "spi_shiftout";
spi_shiftout_t *spi_shiftout_init(int32_t frequency, gpio_num_t data_pin, gpio_num_t clock_pin, gpio_num_t latch_pin,
gpio_num_t output_enable_pin, spi_host_device_t host, uint8_t shift_out_length)
from itertools import permutations
perm = permutations([*range(0,10)], 7)
f, u, s, b, a, l, c = [1,2,3,4,5,6,7]
def fp():
return f + b == c or (u + a > 9 and f + b + 1 == c) or (s+l > 9 and u + a + 1> 9 and f + b + 1 == c)
def up():
return ((s+l+1) % 10) == u and (u + a + 1) % 10 == l
{
"cod": "200",
"message": 0,
"cnt": 40,
"list": [
{
"dt": 1727384400,
"main": {
"temp": 15.51,
"feels_like": 15.34,
@jef-sure
jef-sure / main.dart
Last active February 16, 2024 13:00
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
final class SwitchState {
static const on = 1;
static const enabled = 2;
final int state;
const SwitchState(this.state);
@jef-sure
jef-sure / esp32_perf_test.c
Last active December 29, 2022 09:54
ESP32 Indirect function call performance test
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <unistd.h>
#include <limits.h>
#include "esp_timer.h"
#include "esp_task_wdt.h"
#define TEST_COUNT 10000000
function clamp(rgb) {
return rgb < 0 ? 0 : rgb > 255 ? 255 : parseInt(rgb);
}
function weatherTempToRGB(temp) {
let r, g, b;
if (temp >= 23) {
let t = (temp - 23) / 27.0;
g = (1 - t) * 200;
r = 200 + t * 50;
#include <Arduino.h>
#include <Wire.h>
#include <math.h>
#include "SPI.h"
#include "TFT_eSPI.h"
#define TFT_GREY 0x7BEF
#include "esp_log.h"
#include "nvs_flash.h"
/* BLE */
#include "esp_nimble_hci.h"
#include "nimble/nimble_port.h"
#include "nimble/nimble_port_freertos.h"
#include "host/ble_hs.h"
#include "host/util/util.h"
#include "console/console.h"
#include "services/gap/ble_svc_gap.h"
import glob
import os
import re
spath = os.path.dirname(os.path.realpath(__file__))
all_fonts = [fon[len(spath)+1:] for fon in glob.glob(spath + '/fonts/*.c')]
all_headers = [re.sub(r"\.c$", ".h", f) for f in all_fonts]
root = spath + "/../../..";
used = {}
for cdir, subdirs, files in os.walk(root):