/* Compile: /bin/bash && avr-gcc -Wall -Wextra -mmcu=attiny13a -Os ./main.c -o ./main.o && avr-objcopy -j .text -j .data -O ihex ./main.o ./main.hex * Write to chip: avrdude -p t13 -c usbasp -U f:w:main.hex * Update Fuses: avrdude -p t13 -c usbasp -U lfuse:w:0x79:m -U hfuse:w:0xFF:m */ #define F_CPU 1000000UL // 1Mhz Core Clock #define __AVR_ATtiny13A__ // Chip Part #define HEAT_KEY PINB3 // 'Heat-ON' Button #define POWER_SELECT_KEY PINB4 // Power selector (cycle) #define HEAT_ON TCCR0B |= (1< #include #include #include #include uint8_t vChar = 0; // 'Vram' uint8_t power = 0; // Run-time selected power (this var reloaded automatically after RST signal) const uint8_t tableDefs [10] PROGMEM = { 0x03, 0x9F, 0x25, 0x0D, 0x99, 0x49, 0x41, 0x1F, 0x01, 0x19 }; // Table of characters (For COMMON_ANODE display (for COMMON_____CATHODE_____ - please invert this chars with INV (add ~)) /* LFUSE: 0b01111001 <- 0x79 * HFUSE: 0xFF */ /* * 0 = A + B + C + D + E + F (0x3F) * 1 = B + C (0x03) * 2 = A + B + E + G + D (0x5B) * 3 = A + B + C + G + D (0x4F) * 4 = B + C + F + G (0x66) * 5 = A + C + D + F + G (0x79) * 6 = A + C + D + E + F + G (0x7D) * 7 = A + B + C (0x07) * 8 = A + B + C + D + E + F + G (0x7F) * 9 = A + B + C + F + G (0x67) * * * A = 1000 0000 (0x80) * B = 0100 0000 (0x40) * C = 0010 0000 (0x20) * D = 0001 0000 (0x10) * E = 0000 1000 (0x08) * F = 0000 0100 (0x04) * G = 0000 0010 (0x02) * DP = 0000 0001 (0x01) */ void updateCharOnDisplay (void) { uint8_t temp = 0; temp = pgm_read_byte(&(tableDefs[vChar])); // Load bitmap of char /* Software SPI WRITE implementation */ for (uint8_t z = 0; z<8; z++) { if (temp & 0x01) { PORTB |= (1<>1; } } void initPCINT (void) { PCMSK |= (1<