Skip to content

Instantly share code, notes, and snippets.

@hpwit
hpwit / test fastLedshow32
Last active October 15, 2023 20:18
FastLed.show on the second core esp32
#define FASTLED_SHOW_CORE 0
/ -- Task handles for use in the notifications
static TaskHandle_t FastLEDshowTaskHandle = 0;
static TaskHandle_t userTaskHandle = 0;
void FastLEDshowESP32()
{
if (userTaskHandle == 0) {
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
#define FASTLED_SHOW_CORE
static TaskHandle_t FastLEDshowTaskHandle = 0;
static TaskHandle_t userTaskHandle = 0;
void FastLEDshowESP32()
{
if (userTaskHandle == 0) {
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
// -- Store the handle of the current task, so that the show task can
@hpwit
hpwit / fastledsecondcorenowait
Last active May 11, 2018 17:41
FastLed on second core but with handing back the hand to the main loop
#define FASTLED_SHOW_CORE 0
static TaskHandle_t FastLEDshowTaskHandle2 = 0;
static TaskHandle_t userTaskHandle = 0;
void FastLEDshowESP322()
{
if (userTaskHandle == 0) {
const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
// -- Store the handle of the current task, so that the show task can
@hpwit
hpwit / turnpicaround
Created May 13, 2018 09:12
turn a picture around
//this is may pacman
int pacmab[256]={
9,9,9,9,9,9,9,9,
9,1,1,1,9,9,9,9,
1,1,1,1,1,9,9,9,
1,1,1,1,1,9,9,9,
1,1,1,1,1,9,9,9,
9,1,1,1,9,9,9,9,
9,9,9,9,9,9,9,9,
@hpwit
hpwit / streambmp.java
Created May 27, 2018 16:39
Stream bmp files
package com.company;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.io.*;
@hpwit
hpwit / transpose.c
Created July 27, 2018 12:06
transformation 24*1 and 32*1
void transpose24x1_noinline(unsigned char *A, uint32_t *B) {
uint32_t x, y, x1,y1,t,x2,y2;
// Load the array and pack it into x and y.
/* y = (*(unsigned char*)(A) & 0xffff ) | ((*(unsigned char*)(A+4) & 0xffffL )<<16) ;
x = (*(unsigned char*)(A+8)& 0xffff ) | ((*(unsigned char*)(A+12) & 0xffffL )<<16) ;
y1 = (*(unsigned char*)(A+2)& 0xffff ) | ((*(unsigned char*)(A+6) & 0xffffL )<<16);
x1 = (*(unsigned char*)(A+10)& 0xffff )| ((*(unsigned char*)(A+14) & 0xffffL )<<16);*/
//printf("%d\n",*(unsigned int*)(A+4));
@hpwit
hpwit / clockless_block_esp32.h
Created August 4, 2018 08:46
new version of the clock_block_esp32.h
#ifndef __INC_CLOCKLESS_BLOCK_ESP8266_H
#define __INC_CLOCKLESS_BLOCK_ESP8266_H
#define FASTLED_HAS_BLOCKLESS 1
#define PORT_MASK4 (((1<<USED_LANES_FIRST)-1) & 0x0000FFFFL) //on dit que l'ion va en faire 10
#define FIX_BITS(bits) ( ((bits & 0xE0L) << 17) | ((bits & 0x1FL)<<2) )
#define FIX_BITS2(bits) ( ((bits & 0xFF00L)<<4) | ((bits & 0xE0L) << 15) | ((bits & 0x1EL)<<1) | (bits & 0x1L) )
#define PORT_MASK3 (((1<<USED_LANES_SECOND )-1) & 0x0000FFFFL)
#define PORT_MASK2 FIX_BITS(PORT_MASK3)
@hpwit
hpwit / esp32 20180805.c
Created August 5, 2018 07:44
Revert to an old version of the esp32Block
#ifndef __INC_CLOCKLESS_BLOCK_ESP8266_H
#define __INC_CLOCKLESS_BLOCK_ESP8266_H
#define FASTLED_HAS_BLOCKLESS 1
#define PORT_MASK4 (((1<<USED_LANES_FIRST)-1) & 0x0000FFFFL) //on dit que l'ion va en faire 10
#define FIX_BITS(bits) ( ((bits & 0xE0L) << 17) | ((bits & 0x1FL)<<2) )
#define FIX_BITS2(bits) ( ((bits & 0xFF00L)<<4) | ((bits & 0xE0L) << 15) | ((bits & 0x1EL)<<1) | (bits & 0x1L) )
#define PORT_MASK3 (((1<<USED_LANES_SECOND )-1) & 0x0000FFFFL)
#define PORT_MASK2 FIX_BITS(PORT_MASK3)
@hpwit
hpwit / esp01.ino
Last active November 14, 2019 03:38
example of modification
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#define WSout1 2 // Pin GPIO2
#define WSout2 2
#define WSout3 2
#define WSout4 2
//#define WSout5 2
#define WSbit1 (1<<WSout1)
@hpwit
hpwit / test 31universes.ino
Last active December 28, 2018 23:12
Adaptation for up to 31 universes
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#define WSout1 2 // Pin GPIO2
#define WSout2 2
#define WSout3 2
#define WSout4 2
//#define WSout5 2
#define WSbit1 (1<<WSout1)