29 #ifndef _SSD1306_MINGW_IO_H_ 30 #define _SSD1306_MINGW_IO_H_ 33 #define CONFIG_PLATFORM_I2C_AVAILABLE 34 #define CONFIG_PLATFORM_SPI_AVAILABLE 36 #if defined(SDL_EMULATION) // SDL Emulation mode includes 59 static inline int digitalRead(
int pin) {
return sdl_read_digital(pin); };
60 static inline void delay(
unsigned long ms) { Sleep(ms); };
61 static inline void delayMicroseconds(
unsigned long us) { Sleep((us+500)/1000); };
62 static inline uint32_t millis(
void)
64 return GetTickCount();
67 static inline uint32_t micros(
void)
69 return GetTickCount()*1000;
72 #if defined(SDL_EMULATION) 73 static inline int analogRead(
int pin) {
return sdl_read_analog(pin); };
74 static inline void digitalWrite(
int pin,
int level) { sdl_write_digital(pin, level); };
75 static inline void pinMode(
int pin,
int mode) { };
78 static inline void randomSeed(
int seed) { };
79 static inline void attachInterrupt(
int pin,
void (*interrupt)(
void),
int level) { };
80 static inline uint8_t pgm_read_byte(
const void *ptr) {
return *((
const uint8_t *)ptr); };
81 static inline uint16_t eeprom_read_word(
const void *ptr) {
return 0; };
82 static inline void eeprom_write_word(
const void *ptr, uint16_t val) { };
84 static inline char *utoa(
unsigned int num,
char *str,
int radix)
94 int digit = (
unsigned int)num % radix;
96 temp[temp_loc++] = digit +
'0';
98 temp[temp_loc++] = digit - 10 +
'A';
99 num = ((
unsigned int)num) / radix;
100 }
while ((
unsigned int)num > 0);
106 while ( temp_loc >=0 ) {
107 str[str_loc++] = temp[temp_loc--];
120 static inline long random(
long v)
125 static inline long random(
long min,
long max)
127 return rand() % (max - min + 1) + min;