particle-iot / cloud

A place to discuss issues, enhancements, features for: API, Cloud Compiler, Web IDE (Build), Webhooks, Console, and Device Setup
2 stars 0 forks source link

[Mesh] Building against mesh devices fails on Arduino compatibility #57

Open ScruffR opened 5 years ago

ScruffR commented 5 years ago

Building this against Gen1&2 devices works fine

#include <Arduino.h>
volatile uint32_t *clkportreg;
void setup() {
  clkportreg = portOutputRegister(digitalPinToPort(D2));
}

But for mesh devices this results in

__test.ino:5:54: error: 'digitalPinToPort' was not declared in this scope
__test.ino:5:55: error: 'portOutputRegister' was not declared in this scope

Obviously the Arduino compatibility layer is not correctly applied for mesh devices, but several of the more recent library ports rely on that compatibility.

(Tested against 0.8.0-rc.27 for mesh and 0.7.0 for Gen1&2)

Reason: https://github.com/particle-iot/firmware/blob/1b1805fb4afcb93b0e92fbecfd28c082d6310285/user/inc/Arduino.h#L100

#if PLATFORM_ID == PLATFORM_SPARK_CORE || PLATFORM_ID == PLATFORM_PHOTON_PRODUCTION || PLATFORM_ID == PLATFORM_P1 || PLATFORM_ID == PLATFORM_ELECTRON_PRODUCTION
 // pin mapping macros declared here
#endif
ScruffR commented 5 years ago

F_CPU is also not defined but used by other Arduino macros (e.g. in SdFat for SPI_HALF_SPEED calculation)