commit c893321b67b28566d8c1885f8bbfa318415de44e Author: Daniil A. Smirnov Date: Fri May 12 22:24:35 2023 +0300 Первая версия diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f41fbe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/fw/out/ +/fw/obj/ diff --git a/GW_bat24.sal b/GW_bat24.sal new file mode 100644 index 0000000..3179010 Binary files /dev/null and b/GW_bat24.sal differ diff --git a/fw/Makefile b/fw/Makefile new file mode 100644 index 0000000..c7227db --- /dev/null +++ b/fw/Makefile @@ -0,0 +1,53 @@ +# Название проекта +PRG=greenworks24_batemulator +# МК +MCU=atmega16 +# Частота МК в герцах +FREQ=8000000UL +# GCC +CC=avr-gcc +# OBJCOPY +OBJCOPY= avr-objcopy +# SIZE +SIZE=avr-size +# Флаги GCC +CFLAGS= -Wall -Os -std=gnu99 -lm +# Флаги LD +LDFLAGS= -Wall -lm +# Папка с промежуточными файлами +OBJDIR=obj +# +OUTDIR=out + +# Cписок .c файлов +C_SRC= \ +perf.c + +# Список объектных файлов (формируется автоматически на основе списка .с файлов) +OBJS=$(C_SRC:.c=.o) +OBJ=$(addprefix $(OBJDIR)/, $(OBJS)) + +.PHONY: all LD DIR clean + +# Выполняем цели в указанном порядке +all: DIR $(C_SRC) $(OBJS) LD + +# Линковка +LD: $(OBJ) + $(CC) $^ -o $(OBJDIR)/$(PRG).elf $(LDFLAGS) -mmcu=$(MCU) + $(OBJCOPY) -O ihex -R .eeprom -R .fuse -R .lock $(OBJDIR)/$(PRG).elf $(OUTDIR)/$(PRG).hex + $(OBJCOPY) -O ihex -j .eeprom $(OBJDIR)/$(PRG).elf $(OUTDIR)/$(PRG).eep + $(SIZE) -C --format=avr --mcu=$(MCU) $(OBJDIR)/$(PRG).elf + +# +%.o: %.c + $(CC) $< -o $(OBJDIR)/$@ $(CFLAGS) -mmcu=$(MCU) -DF_CPU=$(FREQ) -c + +# Создание папок +DIR: + mkdir -p $(OBJDIR) + mkdir -p $(OUTDIR) + +# +clean: + rm -rf $(OBJDIR) $(OUTDIR) diff --git a/fw/perf.c b/fw/perf.c new file mode 100755 index 0000000..e27e6a9 --- /dev/null +++ b/fw/perf.c @@ -0,0 +1,544 @@ +#include +#include + +#define OmegaDDR DDRB +#define OmegaPIN PINB +#define OmegaPort PORTB +#define OmegaPINnum PB0 + +int main(void) +{ + OmegaDDR &= ~(1<