Skip to content

Commit

Permalink
Remove some definitions from global namespace
Browse files Browse the repository at this point in the history
Names like kB, MB and kHz are likely to collide with variable names in user sketches.
Nowadays this should be implemented using c++14 user-defined literals (http://en.cppreference.com/w/cpp/language/user_literal)
  • Loading branch information
igrr committed Apr 30, 2015
1 parent cdd2fed commit 7e40b9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 0 additions & 12 deletions hardware/esp8266com/esp8266/cores/esp8266/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ void yield(void);
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))

#define kHz (1000L)
#define MHz (1000L*kHz)
#define GHz (1000L*MHz)

#define kBit (1024L)
#define MBit (1024L*kBit)
#define GBit (1024L*MBit)

#define kB (1024L)
#define MB (1024L*kB)
#define GB (1024L*MB)

void ets_intr_lock();
void ets_intr_unlock();

Expand Down
11 changes: 11 additions & 0 deletions hardware/esp8266com/esp8266/cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ extern "C" {
#include "user_interface.h"
}

#define kHz (1000L)
#define MHz (1000L*kHz)
#define GHz (1000L*MHz)

#define kBit (1024L)
#define MBit (1024L*kBit)
#define GBit (1024L*MBit)

#define kB (1024L)
#define MB (1024L*kB)
#define GB (1024L*MB)

//extern "C" void ets_wdt_init(uint32_t val);
extern "C" void ets_wdt_enable(void);
Expand Down

0 comments on commit 7e40b9f

Please sign in to comment.