PLATFORM_ID values for all Particle products

I need the PLATFORM_ID for the following Particle products: Tracker One, Tracker SOM, B Series SOM, Photon 2, P2, Photon, Electron, and E Series. I want to use it to differentiate between those products that have a built-in LED on D7, and those that do not.

For the current devices

for legacy devices you'd need to check a previous repo version

1 Like

Will the following function accurately differentiate products (Boron, Argon, Photon 2, Photon, Electron, Core) with the built-in LED on D7?

bool deviceHasLedOnD7() {
  // Returns TRUE if the device has a built-in LED on D7:
  //  Boron, Argon, Photon 2, Photon, Electron, Core
  // 8: P1
  switch (PLATFORM_ID) {
    case PLATFORM_BORON:
      return TRUE;
    case PLATFORM_ARGON:
      return TRUE;
    case 0:
      // Core
      return TRUE;
    case 6:
      // Photon  (PLATFORM_PHOTON_PRODUCTION)
      return TRUE;
    case 10:
      // Electron  (PLATFORM_ELECTRON_PRODUCTION)
      return TRUE;
    default:
      return FALSE;
  }
} // deviceHasLedOnD7()

I'd think so - although with fall-through it can be written shorter

bool deviceHasLedOnD7() {
  // Returns TRUE if the device has a built-in LED on D7:
  //  Boron, Argon, Photon 2, Photon, Electron, Core
  // 8: P1
  switch (PLATFORM_ID) {
    case 0:      // Core
    case PLATFORM_PHOTON_PRODUCTION:
    case PLATFORM_ELECTRON_PRODUCTION:
    case PLATFORM_ARGON:
    case PLATFORM_BORON:
      return TRUE;
    default:
      return FALSE;
  }
} // deviceHasLedOnD7()
1 Like

What about Photon2 value in switch case?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.