Skip to content
This repository was archived by the owner on Dec 9, 2018. It is now read-only.

Support system modes #16

Open
dbrgn opened this issue Jun 17, 2017 · 2 comments
Open

Support system modes #16

dbrgn opened this issue Jun 17, 2017 · 2 comments

Comments

@dbrgn
Copy link
Contributor

dbrgn commented Jun 17, 2017

Is there already a way to support system modes?

https://docs.particle.io/reference/firmware/photon/#system-modes

I tried to add bindings, but this is a bit above my knowledge level since it seems to set global state.

@japaric
Copy link
Contributor

japaric commented Jun 23, 2017

Hmm, I think the global variable is just there to prevent calling SYSTEM_MODE(AUTOMATIC); and also SYSTEM_MODE(MANUAL); from the same program. You could start by directly trying to call the set_system_mode function from main. If that works then we can add a Rusty mechanism to prevent calling that function twice.

@japaric
Copy link
Contributor

japaric commented Jun 23, 2017

Thinking about this a bit more. Since this is C++ this global state may also be being used to call set_system_mode before main runs. If that's the case then we can use something like .init_array to do the same from Rust. Better to look at the disassembly to figure out when set_system_mode is called.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants