Unverified Commit 35a98377 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Remove esp8266 support in favor of ESP8266 RTOS SDK

parent 16b712e0
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -4,16 +4,6 @@ stages:
  - build
  - test

build_esp8266:
  stage: build
  before_script:
  - export TOOLCHAIN_BASE=/opt/xtensa-lx106-elf/bin
  - export SDK_BASE=/opt/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr
  script:
  - curl -s https://ess.cs.uos.de/static/.gitlab-ci/xtensa-lx106-elf.tar.xz | tar -C /opt -xJf -
  - mkdir -p build
  - sh -x tests/build-esp8266

build_posix:
  stage: build
  script:
+0 −46
Original line number Diff line number Diff line
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#ifndef COUNTER_H
#define COUNTER_H

extern "C" {
#include "osapi.h"
#include "user_interface.h"
}
#include "c_types.h"

typedef uint32_t counter_value_t;
typedef uint32_t counter_overflow_t;

class Counter {
	private:
		Counter(const Counter &copy);
		uint32_t start_cycles;

	public:
		uint32_t value;
		uint32_t overflow;

		Counter() : start_cycles(0), value(0), overflow(0) {}

		inline void start() {
			asm volatile ("esync; rsr %0,ccount":"=a" (start_cycles));
		}

		inline void stop() {
			uint32_t stop_cycles;
			asm volatile ("esync; rsr %0,ccount":"=a" (stop_cycles));
			if (stop_cycles > start_cycles) {
				value = stop_cycles - start_cycles;
			} else {
				overflow = 1;
			}
		}
};

extern Counter counter;

#endif
+0 −35
Original line number Diff line number Diff line
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#ifndef GPIO_H
#define GPIO_H

class GPIO {
	private:
		GPIO(const GPIO &copy);

	public:
		GPIO () {}

		enum Pin : unsigned char {
			d3 = 0, tx, d4, rx, d2, d1,
			d6 = 12, d7, d5, d8,
			d0 = 16
		};

		void setup();
		void led_on(unsigned char id = 0);
		void led_off(unsigned char id = 0);
		void led_toggle(unsigned char id = 0);
		void input(unsigned char const pin);
		void input(unsigned char const pin, bool pullup);
		void output(unsigned char const pin);
		unsigned char read(unsigned char const pin);
		void write(unsigned char const pin, unsigned char value);
};

extern GPIO gpio;

#endif
+0 −29
Original line number Diff line number Diff line
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#ifndef STANDARDINPUT_H
#define STANDARDINPUT_H

class StandardInput {
	private:
		StandardInput(const StandardInput &copy);
		char buffer[8];
		unsigned char write_pos, read_pos;

	public:
		StandardInput() : write_pos(0), read_pos(0) {}
		void setup();
		bool hasKey();
		char getKey();

		inline void addKey(char key) {
			buffer[write_pos++] = key;
			write_pos %= 8;
		}
};

extern StandardInput kin;

#endif
+0 −61
Original line number Diff line number Diff line
/*
 * Copyright 2020 Daniel Friesel
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */
#ifndef STANDARDOUTPUT_H
#define STANDARDOUTPUT_H

class StandardOutput {
	private:
		StandardOutput(const StandardOutput &copy);
		char digit_buffer[sizeof(long long) * 8];
		unsigned char base;

	public:
		StandardOutput() : base(10) {};
		void setup();

		void put(char c);
		void write(const char *s);
		void flush() {}
		void printf_uint8(unsigned char num);
		void printf_float(float num);

		StandardOutput & operator<<(char c);
		StandardOutput & operator<<(unsigned char c);
		StandardOutput & operator<<(unsigned short number);
		StandardOutput & operator<<(short number);
		StandardOutput & operator<<(unsigned int number);
		StandardOutput & operator<<(int number);
		StandardOutput & operator<<(unsigned long number);
		StandardOutput & operator<<(long number);
		StandardOutput & operator<<(unsigned long long number);
		StandardOutput & operator<<(long long number);
		StandardOutput & operator<<(float number);
		StandardOutput & operator<<(double number);
		StandardOutput & operator<<(void *pointer);
		StandardOutput & operator<<(const char *text);
		StandardOutput & operator<<(StandardOutput & (*fun) (StandardOutput &));

		void setBase(unsigned char b);
};


StandardOutput & endl(StandardOutput & os);

StandardOutput & bin(StandardOutput & os);

StandardOutput & oct(StandardOutput & os);

StandardOutput & dec(StandardOutput & os);

StandardOutput & hex(StandardOutput & os);

StandardOutput & flush(StandardOutput & os);

StandardOutput & term(StandardOutput & os);

extern StandardOutput kout;

#endif
Loading