# Where to look for electron cellular functions in firmware

**URL:** <https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365>\
**Category:** Firmware\
**Created:** [June 1, 2016, 9:51am UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365 "2016-06-01T09:51:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![riforifo](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@riforifo](https://community.particle.io/u/riforifo)\
**Post date:** [June 1, 2016, 9:51am UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/1 "2016-06-01T09:51:07Z")

</div>

Hello,

I am looking for the cellular command source codes (linked below) in electron firmware. Can you please point me to the correct location in the firmware?

[https://docs.particle.io/reference/firmware/electron/#cellular](https://docs.particle.io/reference/firmware/electron/#cellular)

Basically, I am trying to my photon to keep sending data to my server even when there is no wifi, hence I have connected the same ublox modem to it.

Thanks a lot for your help  
rifo

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 1, 2016, 12:11pm UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/2 "2016-06-01T12:11:25Z")

</div>

Looking for this?  
[https://github.com/spark/firmware/blob/develop/wiring/inc/spark\_wiring\_cellular.h](https://github.com/spark/firmware/blob/develop/wiring/inc/spark_wiring_cellular.h)  
[https://github.com/spark/firmware/blob/develop/wiring/src/spark\_wiring\_cellular.cpp](https://github.com/spark/firmware/blob/develop/wiring/src/spark_wiring_cellular.cpp)  
[https://github.com/spark/firmware/blob/develop/hal/src/electron/cellular\_hal.cpp](https://github.com/spark/firmware/blob/develop/hal/src/electron/cellular_hal.cpp)  
[https://github.com/spark/firmware/tree/develop/hal/src/electron/modem](https://github.com/spark/firmware/tree/develop/hal/src/electron/modem)

---

<div class="post-metadata">

**Author:** ![riforifo](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@riforifo](https://community.particle.io/u/riforifo)\
**Post date:** [June 1, 2016, 3:01pm UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/3 "2016-06-01T15:01:50Z")

</div>

yep, I think this is where I should be 😄  
thank you very much @ScruffR

Ideally, I believe that I should delve into the firmware and find the corresponding compile switches so that both Electron and Photon functions exist in the firmware. However I am not sure if I’ll be able to succeed in doing that 😕

so I thought of modifying and adding the functions in the firmware to my application code for a quick hack.

I would be happy if you can comment on my approach 😄

thanks one more time  
rifo

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 1, 2016, 3:30pm UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/4 "2016-06-01T15:30:43Z")

</div>

What do you mean?  
If you want to have one application code base that you can flash to Electron or Photon without adaption then _conditional compiling_ would be the way.  
Like this

```cpp
    #if (PLATFORM_ID == PLATFORM_ELECTRON_PRODUCTION)
      Cellular.on();
      Cellular.connect();
    #else
      WiFi.on();
      WiFi.connect();
    #endif

```

Or do you intend to create a device that has cellular **_and_** WiFi on board?

---

<div class="post-metadata">

**Author:** ![riforifo](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@riforifo](https://community.particle.io/u/riforifo)\
**Post date:** [June 2, 2016, 4:01am UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/5 "2016-06-02T04:01:29Z")

</div>

Hello,

Sorry for not being able to explain my use case clear enough.

Yes I am working on creating a device that has cellular and Wifi on board. I have connected the same ublox modem (that electron uses) to my photon. When there is no available Wifi, I switch to cellular communication.

I planned to delve into firmware and make some changes to it so that I can use both wifi and modem classes in my design. Regarding this changes, I wanted to ask you opinion whether it would make sense to do this or not.

thanks a lot  
rifo

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [June 2, 2016, 5:50am UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/6 "2016-06-02T05:50:10Z")

</div>

In that case I’d rather refere you to the Particle Gurus @mdma & @jvanier

---

<div class="post-metadata">

**Author:** ![riforifo](https://avatars.discourse-cdn.com/v4/letter/r/a698b9/32.png) [@riforifo](https://community.particle.io/u/riforifo)\
**Post date:** [June 2, 2016, 6:02am UTC](https://community.particle.io/t/where-to-look-for-electron-cellular-functions-in-firmware/23365/7 "2016-06-02T06:02:23Z")

</div>

Hello @ScruffR

Thanks a lot for your help again 🙂
