diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-12-25 18:09:33 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-12-25 18:09:33 +0100 |
commit | 35a98377f52caf5ac37c2e932b9f2d4c9196c195 (patch) | |
tree | d87920e581a25b3ef30b4cce967cd8842db5c1eb /include/arch/esp8266/driver | |
parent | 16b712e0233cfd7b60668927067885f7e3551b92 (diff) |
Remove esp8266 support in favor of ESP8266 RTOS SDK
Diffstat (limited to 'include/arch/esp8266/driver')
-rw-r--r-- | include/arch/esp8266/driver/counter.h | 46 | ||||
-rw-r--r-- | include/arch/esp8266/driver/gpio.h | 35 | ||||
-rw-r--r-- | include/arch/esp8266/driver/stdin.h | 29 | ||||
-rw-r--r-- | include/arch/esp8266/driver/stdout.h | 61 | ||||
-rw-r--r-- | include/arch/esp8266/driver/uptime.h | 34 |
5 files changed, 0 insertions, 205 deletions
diff --git a/include/arch/esp8266/driver/counter.h b/include/arch/esp8266/driver/counter.h deleted file mode 100644 index 8c2d22f..0000000 --- a/include/arch/esp8266/driver/counter.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 ©); - 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 diff --git a/include/arch/esp8266/driver/gpio.h b/include/arch/esp8266/driver/gpio.h deleted file mode 100644 index 29e7950..0000000 --- a/include/arch/esp8266/driver/gpio.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef GPIO_H -#define GPIO_H - -class GPIO { - private: - GPIO(const GPIO ©); - - 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 diff --git a/include/arch/esp8266/driver/stdin.h b/include/arch/esp8266/driver/stdin.h deleted file mode 100644 index 1085111..0000000 --- a/include/arch/esp8266/driver/stdin.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2020 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef STANDARDINPUT_H -#define STANDARDINPUT_H - -class StandardInput { - private: - StandardInput(const StandardInput ©); - 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 diff --git a/include/arch/esp8266/driver/stdout.h b/include/arch/esp8266/driver/stdout.h deleted file mode 100644 index 2484cee..0000000 --- a/include/arch/esp8266/driver/stdout.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2020 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef STANDARDOUTPUT_H -#define STANDARDOUTPUT_H - -class StandardOutput { - private: - StandardOutput(const StandardOutput ©); - 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 diff --git a/include/arch/esp8266/driver/uptime.h b/include/arch/esp8266/driver/uptime.h deleted file mode 100644 index f3e2f23..0000000 --- a/include/arch/esp8266/driver/uptime.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2020 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef UPTIME_H -#define UPTIME_H - -extern "C" { -#include "osapi.h" -#include "user_interface.h" -} -#include "c_types.h" - -class Uptime { - private: - Uptime(const Uptime ©); - - public: - Uptime () {} - inline uint32_t get_us() { return system_get_time(); } - inline uint32_t get_s() { return system_get_time() / 1000000; } - - inline uint32_t get_cycles() - { - uint32_t ccount; - asm volatile ("esync; rsr %0,ccount":"=a" (ccount)); - return ccount; - } -}; - -extern Uptime uptime; - -#endif |