Mult-tasking on SPI, 1-Wire and I2C #4336
Replies: 1 comment
-
Posted at 2015-01-15 by DrAzzy As long as you don't need to be simultaneously sending data on multiple interfaces, sure - but in most cases, you can, say, update the screen, then use some sensor, then duo something else. Posted at 2015-01-15 by @gfwilliams As @drazzy says, Espruino will let you use those peripherals (and many more) in the same program . What it can't do is transmit on all of them at the same time. Having said that, it depends what you want to use I2C for. Espruino can act as an I2C master (so controlling other things), but not as a client. If you want a nice way of sending data to it I'd recommend the USART - which uses IRQs so can work concurrently. Posted at 2015-01-15 by HerrLinder USART will work since I have 2 on the master board. The program will read the 1-wire, run some code, change the PWM on the fans, then display the results on the SPI Display. Posted at 2015-01-15 by @allObjects Because Espruino works interrupt driven, caches incoming interrupts, and is very fast, it is looking like 'quasi simultaneously'. The typical 'Arduino loop' is kind of in the Espruino firmware: if an interrupt comes in, Espruino firmware 'calls' application part - callback - as you write in JavaScript and pass to the firmware. Take for example the receipt of data from any of the type of connections you mention - even for internet connection. When setting up the connection with connect or operations such as request operations on a connection, application callback/s is/are passed. On successful / failed receipt, the callback is invoked with the received data / error. A good example you can find in the BMP085/BMP180 DIGITAL PRESSURE SENSOR module documentation: With the request an application callback is passed, which on data receipt is called with the data. In the example, the application just does log the data to the console. After the callback completes, Espruino goes to either idle and 'waiting' for the next interrupt, or takes on the pending interrupts as queued. The architectural decision to make all interrupt driven enables the low power consumption not achievable easily with any other boards. Arduino even lets control the state after completing busy down to even deep sleep, and with that to almost be outlived by the battery it lives of - depending on the self-discharge of the battery and of course the power consumption when doing something. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-01-15 by HerrLinder
Hello,
I will be using Espruino in my solar heating project. The plan is that the Master controller sends out updates on the solar LUX readings and some temperature readings via I2C. The SPI will update the display on the Espruino and the 1-wire will take temperature reading from its local area.
Will Espruino allow the i2c, SPI and 1-wire to concurrently work together ?
Thanks,
Robert
Beta Was this translation helpful? Give feedback.
All reactions