|
| 1 | +#ifndef ARDUINO_H |
| 2 | +#define ARDUINO_H |
| 3 | +#include <stdint.h> |
| 4 | +#include <stdio.h> |
| 5 | +#include <string.h> |
| 6 | +#include <stdlib.h> |
| 7 | +#define PROGMEM |
| 8 | +#define pgm_read_byte(addr) (*(const uint8_t*)(addr)) |
| 9 | +#define pgm_read_word(addr) (*(const uint16_t*)(addr)) |
| 10 | +#define pgm_read_dword(addr) (*(const uint32_t*)(addr)) |
| 11 | +#define pgm_get_far_address(addr) ((uintptr_t)(addr)) |
| 12 | +#define HIGH 1 |
| 13 | +#define LOW 0 |
| 14 | +#define INPUT 0 |
| 15 | +#define OUTPUT 1 |
| 16 | +#define bitSet(value, bit) ((value) |= (1UL << (bit))) |
| 17 | +#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) |
| 18 | +#define PORTB (*((volatile uint8_t*)0)) |
| 19 | +#define PORTD (*((volatile uint8_t*)0)) |
| 20 | +#define ESP32 1 |
| 21 | +#define __malloc_heap_start ((char*)0) |
| 22 | +inline long random(long max) { return rand() % max; } |
| 23 | +inline long random(long min, long max) { return min + rand() % (max - min); } |
| 24 | +inline char* dtostrf(double val, signed char width, unsigned char prec, char* buf) { sprintf(buf, "%*.*f", width, prec, val); return buf; } |
| 25 | +inline void strcpy_P(char* dest, const char* src) { strcpy(dest, src); } |
| 26 | +class HardwareSerial { |
| 27 | +public: |
| 28 | + int available() { return 0; } |
| 29 | + int availableForWrite() { return 0; } |
| 30 | + int read() { return 0; } |
| 31 | + size_t write(uint8_t) { return 1; } |
| 32 | + size_t write(const char* s) { return printf("%s", s); } |
| 33 | + size_t write(const char* s, size_t) { return printf("%s", s); } |
| 34 | + void begin(long) {} |
| 35 | + operator bool() const { return true; } |
| 36 | +}; |
| 37 | +static HardwareSerial Serial; |
| 38 | +inline void pinMode(int, int) {} |
| 39 | +inline void digitalWrite(int, int) {} |
| 40 | +inline void delay(int) {} |
| 41 | +inline uint32_t millis() { static uint32_t t = 0; return t += 16; } |
| 42 | +#endif // ARDUINO_H |
0 commit comments