From f90e6f1b09b0f5cf224216a6f71d25933908f2f2 Mon Sep 17 00:00:00 2001 From: "Daniil A. Smirnov" Date: Fri, 12 May 2023 23:40:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=20?= =?UTF-8?q?=D0=BD=D0=B0=20ATtiny13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fw/Makefile | 4 ++-- fw/perf.c | 41 +++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/fw/Makefile b/fw/Makefile index c7227db..5ec4aee 100644 --- a/fw/Makefile +++ b/fw/Makefile @@ -1,9 +1,9 @@ # Название проекта PRG=greenworks24_batemulator # МК -MCU=atmega16 +MCU=attiny13 # Частота МК в герцах -FREQ=8000000UL +FREQ=9600000UL # GCC CC=avr-gcc # OBJCOPY diff --git a/fw/perf.c b/fw/perf.c index abe9e4e..1d2ae97 100755 --- a/fw/perf.c +++ b/fw/perf.c @@ -1,5 +1,6 @@ #include #include +#include #define OmegaDDR DDRB #define OmegaPIN PINB @@ -12,11 +13,11 @@ #define impLo1 206 #define impLo2 107 -uint8_t code1[imp] = {0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}; -uint8_t code2[imp] = {0,1,2,1,2,2,2,2,2,2,1,1,2,2,2,2,2,1,1,2,1,2,2,2,2}; -uint8_t code3[imp] = {0,2,1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2}; -uint8_t code4[imp] = {0,2,2,1,1,2,2,2,2,1,2,1,1,2,1,2,2,1,2,2,1,1,1,2,2}; -uint8_t code5[imp] = {0,1,1,1,2,2,2,2,2,1,2,2,1,1,2,2,2,2,2,2,2,2,1,2,2}; +const PROGMEM uint8_t code1[imp] = {0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}; +const PROGMEM uint8_t code2[imp] = {0,1,2,1,2,2,2,2,2,2,1,1,2,2,2,2,2,1,1,2,1,2,2,2,2}; +const PROGMEM uint8_t code3[imp] = {0,2,1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,2,2}; +const PROGMEM uint8_t code4[imp] = {0,2,2,1,1,2,2,2,2,1,2,1,1,2,1,2,2,1,2,2,1,1,1,2,2}; +const PROGMEM uint8_t code5[imp] = {0,1,1,1,2,2,2,2,2,1,2,2,1,1,2,2,2,2,2,2,2,2,1,2,2}; int main(void) { @@ -30,21 +31,21 @@ int main(void) _delay_ms(3); for(uint8_t i = 0; i < imp; i++) { - if(code1[i] == 1) + if(pgm_read_byte(&code1[i]) == 1) { OmegaPort &= ~(1<