Wow - sorry, I'm in a bit of a rush today so can't look through this properly.
It'd be well worth posting separate questions in future though, as I doubt other people will be able to find the info they need in here ;)
I'm wondering how to have 3 different SPI devices connected
They can all share SCK/MOSI/MISO - it's just that each needs its own CS pin.
"deep sleep" functionality, a hint ?
setDeepSleep(1)? You only have to call it once, and that's good enough.
Is it possible the "reset" the Espruino without losing all previously saved stuff
Not sure I understand, you just use save()? Or you can call load() to do a soft-reset to the previously saved state?
is it possible to save stuff to flash without re-initiating
No, save() has to re-initialise. But you can use the Flash module to write directly to flash memory - you just have to use an area of Flash memory that isn't used for anything else. On the Pico there's an 'undocumented' page after 384kB.
Am I right to think 'save()' re-init but doesn't reboot ?
Yes, it's not a full reboot - but it still changes the pin states back to inputs and then starts again.
For B0/FET: when you talk about "monitoring the battery charge via software", have you an example of how to do so ?
There were some posts here, but you just need two equal resistors to divide the voltage down to a level suitable for Espruino, then you use analogRead(thePinYouConnected)*3.3*2
Still for B0/FET: we can have our own battery charging circuit* before VUSB with B0/FET shorted & no software-based battery charge monitoring, right ?
Yes, if you don't use the battery input for a battery you can use it as you want. It's just that the FET input for the battery means you don't get a voltage drop - and otherwise you'd have to add a diode if you planned to use a battery and USB.
I've seen some 555-based circuit that 'd charge a battery when it's below a certain threshold ( not that I implemented one yet :| )
For LiPo batteries I'd strongly recommend you just buy a charger chip- they're cheap, easy, and won't blow your battery up :)
Circuits...
Yes, to me it looks like that'd work. Keeping the Pico running via a capacitor would work fine, and using a zener to limit the voltage to 3.6v would work fine too.
HOWEVER: While you can put 12v on the Pico's 5V/VCC/VUSB pins and it won't cause problems, the B0 FET will only work when the Pico is powered from 5v or less. Any more and the FET will be constantly on.
It would be significantly easier to use a separate amplifier in that case.
Audio amp
I don't really know - pretty much anything would work I imagine. The PAM8403 boards on eBay look good?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Wow - sorry, I'm in a bit of a rush today so can't look through this properly.
It'd be well worth posting separate questions in future though, as I doubt other people will be able to find the info they need in here ;)
They can all share SCK/MOSI/MISO - it's just that each needs its own CS pin.
setDeepSleep(1)
? You only have to call it once, and that's good enough.Not sure I understand, you just use
save()
? Or you can callload()
to do a soft-reset to the previously saved state?No,
save()
has to re-initialise. But you can use theFlash
module to write directly to flash memory - you just have to use an area of Flash memory that isn't used for anything else. On the Pico there's an 'undocumented' page after 384kB.Yes, it's not a full reboot - but it still changes the pin states back to inputs and then starts again.
There were some posts here, but you just need two equal resistors to divide the voltage down to a level suitable for Espruino, then you use
analogRead(thePinYouConnected)*3.3*2
Yes, if you don't use the battery input for a battery you can use it as you want. It's just that the FET input for the battery means you don't get a voltage drop - and otherwise you'd have to add a diode if you planned to use a battery and USB.
For LiPo batteries I'd strongly recommend you just buy a charger chip- they're cheap, easy, and won't blow your battery up :)
Yes, to me it looks like that'd work. Keeping the Pico running via a capacitor would work fine, and using a zener to limit the voltage to 3.6v would work fine too.
HOWEVER: While you can put 12v on the Pico's 5V/VCC/VUSB pins and it won't cause problems, the B0 FET will only work when the Pico is powered from 5v or less. Any more and the FET will be constantly on.
It would be significantly easier to use a separate amplifier in that case.
I don't really know - pretty much anything would work I imagine. The PAM8403 boards on eBay look good?