Closed martenjacobs closed 5 years ago
Not the repo owner, but I have looked through the firmware previously and have talked to the developers about where they are heading.
At the moment there is no implementation for such features. But it should be pretty easy to build on top of this firmware. Everything you have said should be possible.
An example of implementing a custom command can be seen in my unofficial and now obsolete powersave code: https://github.com/rohfle/balena-fin-coprocessor-firmata/commit/e796b1942cdd9d0fa63669cf30945aec0ce88cc1
Basically it consisted of 3 parts:
powersaveInit
which configured the delay variablespowersaveRun
which would handle delays and state changes and ultimately turn the CM3 power off@Bucknalla's implementation uses timers as he is heading towards putting the Artik into low power modes eventually. So spinning in a while loop will probably not work in the future. But good enough for now and for learning how things work.
There should be a way to power off the CM3 indefinitely
The CM3 should be powered up based on a GPIO input (a power button being pushed)
The CM3 should be powered down based on a GPIO input (holding down the power button for about 5 seconds is an often-seen way of forcing a device to shut down)
There should be a GPIO output to indicate the current power status (to use for a power LED)
It might be nice to have some way to determine the power state of the CM3, so the firmware can switch off power once the CM3 looks to be powered off for a certain amount of time
I used the compiler as part of Simplicity Studio to compile the firmware (didn't use the IDE). The chip is an Artik 020 (https://media.digikey.com/pdf/Data%20Sheets/Samsung%20PDFs/Artik_020_DS.pdf) and inside that the microcontroller is an EFM32 (https://www.silabs.com/documents/public/reference-manuals/efm32hg-rm.pdf) and (https://www.silabs.com/documents/public/application-notes/an0012-efm32-gpio.pdf)
Don't forget to work on a git branch so you can keep rebasing off master as @Bucknalla updates things.
Good luck!
Thanks for your guidance. I'll get to work ASAP
From the documentation for this repo it seems the only way to switch off power to the CM3 using this firmware will be to send a sleep command. In my use case, I'd like to build a power button into the product. This requires a few things:
Is it possible to implement these things using the firmware in this repo or do I need to look in to building my own?