Commit 7c52c7ea authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add posix stdin → ssd1306 app

parent 7ec9a3d7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
# Copyright 2021 Daniel Friesel
#
# SPDX-License-Identifier: CC0-1.0

prompt "POSIX stdin to SSD1306"
depends on arch_posix && driver_ssd1306
+14 −0
Original line number Diff line number Diff line
# vim:ft=make
#
# Copyright 2021 Daniel Friesel
#
# SPDX-License-Identifier: CC0-1.0

ifdef app
	loop = 1
	override arch_drivers += ,i2c
	CONFIG_driver_ssd1306 = y
	COMMON_FLAGS += -DCONFIG_driver_ssd1306
	CONFIG_driver_ssd1306_width = 128
	CONFIG_driver_ssd1306_height = 64
endif
+42 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#include "arch.h"
#include "driver/stdout.h"
#if defined(MULTIPASS_ARCH_HAS_I2C) && !defined(CONFIG_driver_softi2c)
#include "driver/i2c.h"
#else
#include "driver/soft_i2c.h"
#endif
#include "driver/ssd1306.h"
#include "object/framebuffer.h"
#include "lib/pixelfont/pixeloperator_mirrored.h"

#include <stdio.h>

char buf[32];

void loop()
{
}

int main(void)
{
	arch.setup();
	kout.setup();
	i2c.setup();
	ssd1306.init();

	fb.clear();
	ssd1306.showImage(fb.data, fb.width * fb.height / 8);
	fb.setFont(pixeloperator_mirrored);

	while (fgets(buf, 32, stdin)) {
		fb << buf;
		ssd1306.showImage(fb.data, fb.width * fb.height / 8);
	}

	return 0;
}