/* Fumot Digital Box 12000 vape charlieplex led display driver, 22.12.2024 --- i do not use vapes, and do not suggest anyone to buy or try --- how does it work? a timer regulary calls a interrupt routine, lighting up one of 24 segments every cycle. the displaybuffer is a 32bit int as binary (24 bit used), containing following (from LSB): 7 bits of second 7 segment digit (ones) 7 bits of first 7 segment digit (tens) 1 bit for flash symbol 1 bit for percent symbol 5 bits for level container 4 bits for rgb level segments FPS can be set between ca. 50Hz (flicker when shaken) up to 8kHz. brightness is good with 100Ohms on each of the 6 lanes, independend from speed. everything is controlled by precalculated and direct register manipulation, while the slower digits calculation is only done once per change. */ #include "Arduino.h" // esp32c3, ACM-native usb, usb_cdc enabled uint8_t seg[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; // 7 segment font uint8_t clo[25]={0,1,0,2,0,3,4,1,2,3,3,4,4,4,2,1,3,4,0,1,2,3,2,1,0}; // charlieplex lowpin uint8_t chi[25]={1,0,2,0,3,0,0,2,1,2,1,1,2,3,3,3,5,5,5,5,5,4,4,4,4}; // .. and highpin hw_timer_t *t=NULL;int32_t b,port; // buffers nstuff uint8_t i,s,pin[6]={4,5,6,7,20,21}; // *** CHANGE THIS *** // display io pins void set(uint8_t n){b=seg[n%10]|seg[n/10]<<7|0x1FFC000;} // generate display buffer void IRAM_ATTR isr(){ REG_WRITE(GPIO_ENABLE_W1TC_REG,port); // set display ports to input if(bitRead(b,s)){ // if segment should be lit.. REG_WRITE(GPIO_ENABLE_W1TS_REG,1<25)s=0;} // iterate through segments void setup(){ for(i=0;i< 6;i++){pinMode(pin[i],INPUT);port|=1<99)i=0;set(i); delay(100);}