Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ LORA = 1
# Display dimensions
DISPLAY_WIDTH = 320
DISPLAY_HEIGHT = 240
# 1 = BGR, 0 = RGB
BGR = 0
# true = BGR, false = RGB
BGR = true
# Invert color
INVERT = 1
INVERT = true
# Flip image
HFLIP = 1
VFLIP = 0
HFLIP = true
VFLIP = false

ifndef RFM
override RFM = 0
Expand All @@ -34,8 +34,7 @@ override LORA = 1
endif

MAIN = avrrfm.c
SRC = bitmaps.c colorspace.c dejavu.c display.c font.c i2c.c mcp9808.c \
spi.c tft.c unifont.c usart.c rfm.c sdc.c
SRC = bitmaps.c dejavu.c i2c.c mcp9808.c spi.c usart.c rfm.c tft.c sdc.c

CC = avr-gcc
OBJCOPY = avr-objcopy
Expand All @@ -58,14 +57,13 @@ CFLAGS += -std=gnu99

TARGET = $(strip $(basename $(MAIN)))
SRC += $(TARGET).c
SRC += librfm$(RFM).a libsdc.a
SRC += librfm$(RFM).a libtft.a libsdc.a

OBJ = $(SRC:.c=.o)
OBJ = $(SRC:.S=.o)

$(TARGET).elf: bitmaps.h colorspace.h dejavu.h display.h font.h i2c.h \
mcp9808.h pins.h spi.h tft.h types.h unifont.h usart.h utils.h \
librfm$(RFM).h libsdc.h Makefile
$(TARGET).elf: dejavu.h i2c.h mcp9808.h pins.h spi.h types.h unifont.h usart.h \
utils.h librfm$(RFM).h libtft.h libsdc.h Makefile

all: $(TARGET).hex

Expand Down
40 changes: 32 additions & 8 deletions avrrfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
#include "spi.h"
#include "utils.h"
#include "librfm95.h"
#include "libtft.h"
#include "libsdc.h"
#include "mcp9808.h"
#include "tft.h"
#include "display.h"
#include "dejavu.h"
#include "unifont.h"

Expand Down Expand Up @@ -73,6 +72,30 @@
#define RECEIVER 1
#endif

#ifndef DISPLAY_WIDTH
#define DISPLAY_WIDTH 320
#endif

#ifndef DISPLAY_HEIGHT
#define DISPLAY_HEIGHT 240
#endif

#ifndef BGR
#define BGR false
#endif

#ifndef INVERT
#define INVERT false
#endif

#ifndef HFLIP
#define HFLIP false
#endif

#ifndef VFLIP
#define VFLIP false
#endif

static volatile uint16_t watchdogInts = 0;

/* Temp. label coordinates */
Expand Down Expand Up @@ -227,17 +250,17 @@ static void displayTemp(uint8_t rssi, bool crc, Temperature *temp) {
snprintf(buf, sizeof (buf), "RSSI: %4d dBm, CRC: %d, PA: %s dBm",
-rssi, crc, crc ? paf : "---");
const __flash Font *unifont = &unifontFont;
writeString(0, 0, unifont, buf, BLACK, WHITE);
tftWriteString(0, 0, unifont, buf, BLACK, WHITE);

// display temperature (floating, red if CRC failed)
snprintf(buf, sizeof (buf), "%c%d.%d°", tempx10 < 0 ? '-' : ' ',
abs(tdiv.quot), abs(tdiv.rem));
const __flash Font *dejaVu = &dejaVuFont;
if (width > 0) fillArea(xo, yo, width, dejaVu->height, WHITE);
if (width > 0) tftFillArea(xo, yo, width, dejaVu->height, WHITE);
if (yl == 0) yl = unifont->height;
// FIXME required space should be calculated before writing the text
// i.e. 9.9° -> 10.0° can go wrong
width = writeString(xl, yl, dejaVu, buf, WHITE, crc ? BLACK : RED);
width = tftWriteString(xl, yl, dejaVu, buf, WHITE, crc ? BLACK : RED);
xo = xl;
yo = yl;
xl += LABEL_OFFSET;
Expand Down Expand Up @@ -360,9 +383,10 @@ int main(void) {
}

if (RECEIVER) {
initDisplay();
setFrame(WHITE);
fillArea(0, 0, DISPLAY_WIDTH, 16, BLACK);
tftInit(DISPLAY_WIDTH, DISPLAY_HEIGHT, HFLIP, VFLIP, BGR, INVERT);
tftSetFrame(WHITE);
tftFillArea(0, 0, DISPLAY_WIDTH, 16, BLACK);
tftWriteBitmap(0, 176, 0, 0xffff, 0x0000);
// initial rx mode
if (radio) {
if (LORA) {
Expand Down
78 changes: 69 additions & 9 deletions bitmaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,78 @@
* File: bitmaps.c
* Author: torsten.roemer@luniks.net
*
* Created on 6. November 2023, 18:45
* Created on 06/07/2023, 23:28
*/

#include "bitmaps.h"
#include "font.h"

const __flash uint8_t SOME_DATA[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
const __flash uint8_t TUX_DATA[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0xff, 0x80, 0x00, 0x00,
0x00, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x0f, 0xf9, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x0c, 0xf0, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x08, 0x60, 0x78, 0x00, 0x00,
0x00, 0x00, 0x0a, 0x66, 0x70, 0x00, 0x00,
0x00, 0x00, 0x0b, 0x6e, 0x70, 0x00, 0x00,
0x00, 0x00, 0x0b, 0x06, 0x70, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x02, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x00, 0x78, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x00,
0x00, 0x00, 0x0e, 0x04, 0xfc, 0x00, 0x00,
0x00, 0x00, 0x0b, 0x10, 0x7e, 0x00, 0x00,
0x00, 0x00, 0x19, 0xe0, 0x3e, 0x00, 0x00,
0x00, 0x00, 0x30, 0x00, 0x3f, 0x00, 0x00,
0x00, 0x00, 0x30, 0x00, 0x1f, 0x80, 0x00,
0x00, 0x00, 0x60, 0x00, 0x1f, 0xc0, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x1f, 0xc0, 0x00,
0x00, 0x01, 0xe0, 0x00, 0x0f, 0xe0, 0x00,
0x00, 0x03, 0xe0, 0x00, 0x0f, 0xf0, 0x00,
0x00, 0x03, 0xc0, 0x00, 0x07, 0xf0, 0x00,
0x00, 0x03, 0xc0, 0x00, 0x07, 0x78, 0x00,
0x00, 0x07, 0x80, 0x00, 0x03, 0x78, 0x00,
0x00, 0x07, 0x80, 0x00, 0x03, 0xbc, 0x00,
0x00, 0x0f, 0x80, 0x00, 0x03, 0xbc, 0x00,
0x00, 0x0f, 0x00, 0x00, 0x03, 0xbc, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x03, 0xbc, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x03, 0xbe, 0x00,
0x00, 0x3f, 0x00, 0x00, 0x03, 0xbe, 0x00,
0x00, 0x3b, 0x00, 0x00, 0x02, 0x3e, 0x00,
0x00, 0x3d, 0x00, 0x00, 0x01, 0xfe, 0x00,
0x00, 0x26, 0x00, 0x00, 0x03, 0xfe, 0x00,
0x00, 0x03, 0x00, 0x00, 0x07, 0xfe, 0x00,
0x00, 0x01, 0xc0, 0x00, 0x03, 0xf9, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x01, 0xf1, 0x00,
0x00, 0x40, 0x70, 0x00, 0x00, 0xe1, 0x00,
0x06, 0x00, 0x78, 0x00, 0x00, 0x01, 0x00,
0x08, 0x00, 0x3c, 0x00, 0x08, 0x01, 0x00,
0x00, 0x00, 0x3c, 0x00, 0x08, 0x00, 0x80,
0x04, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x20,
0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10,
0x04, 0x00, 0x08, 0x00, 0x68, 0x00, 0x10,
0x00, 0x00, 0x04, 0x00, 0xe8, 0x00, 0x60,
0x08, 0x00, 0x05, 0x03, 0xf8, 0x01, 0x80,
0x08, 0x00, 0x05, 0xff, 0xf8, 0x06, 0x00,
0x07, 0x00, 0x07, 0xff, 0xf8, 0x08, 0x00,
0x00, 0x38, 0x06, 0x00, 0x18, 0x30, 0x00,
0x00, 0x03, 0x0c, 0x00, 0x0c, 0x60, 0x00,
0x00, 0x00, 0x70, 0x00, 0x07, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

const __flash Bitmap bitmaps[] = {
{16, 16, SPACE_MONO1, SOME_DATA}
};
{56, 64, SPACE_MONO1, TUX_DATA}
};
34 changes: 0 additions & 34 deletions bitmaps.h

This file was deleted.

89 changes: 0 additions & 89 deletions colorspace.c

This file was deleted.

36 changes: 0 additions & 36 deletions colorspace.h

This file was deleted.

Loading