first commit

This commit is contained in:
valeh
2020-12-22 14:30:09 +02:00
commit 26b0ba5954
1832 changed files with 17777948 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
CC = avr-gcc
OBJCPY = avr-objcopy
SIZE = avr-size
MCU = atmega328p
F_CPU = 16000000
U8G2_SRC = ../../../../csrc
CFLAGS = \
-mmcu=$(MCU) \
-DF_CPU=$(F_CPU)UL \
-Os \
-std=gnu99 \
-Werror \
-ffunction-sections \
-fdata-sections \
-I$(U8G2_SRC)/ \
-I../lib/ \
-DAVR_USE_HW_I2C
LDFLAGS = \
-Wl,--gc-sections \
-mmcu=$(MCU)
AVRDUDE=avrdude
PORT=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A4008fhY-if00-port0
SRC = $(shell ls $(U8G2_SRC)/*.c) $(shell ls ../lib/*.c) $(shell ls ../lib/avr-hw-i2c/*.c) $(shell ls ./*.c)
OBJ = $(SRC:.c=.o)
main.hex: main.elf
$(OBJCPY) -O ihex -R .eeprom -R .fuse -R .lock -R .signature main.elf main.hex
main.elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o $@
size: main.elf
$(SIZE) --mcu=$(MCU) --format=avr main.elf
clean:
rm -f $(OBJ) main.elf main.hex
# Example for Arduino Duemilanove
upload: main.hex
$(AVRDUDE) -p$(MCU) -carduino -P$(PORT) -b57600 -D -Uflash:w:main.hex:i

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 KiB

View File

@@ -0,0 +1,27 @@
#include <avr/io.h>
#include <util/delay.h>
#include <u8g2.h>
#include <u8x8_avr.h>
#define SSD1306_ADDR 0x78
u8g2_t u8g2;
int main (void)
{
u8g2_Setup_ssd1306_i2c_128x32_univision_f(&u8g2, U8G2_R0, u8x8_byte_avr_hw_i2c, u8x8_avr_delay);
u8g2_SetI2CAddress(&u8g2, SSD1306_ADDR);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
while(1){
u8g2_ClearBuffer(&u8g2);
u8g2_SetFont(&u8g2, u8g2_font_smart_patrol_nbp_tr);
u8g2_SetFontRefHeightText(&u8g2);
u8g2_SetFontPosTop(&u8g2);
u8g2_DrawStr(&u8g2, 0, 0, "u8g2 AVR HW I2C");
u8g2_SendBuffer(&u8g2);
}
}