Is there a way to determine the Platform ID from firmware?

Is there an API to get the Platform ID from a device?

I would like to have 1 firmware that can be used on the P1 and the Electron

Thanks,

Have a look at how some of the more popular libraries implement this:
https://build.particle.io/libs/neopixel/0.0.13/tab/neopixel.cpp

thanks!