Author Topic: Mini OS emulator for Digispark  (Read 2007 times)

jaromaz

  • Newbie
  • *
  • Posts: 5
Mini OS emulator for Digispark
« on: January 22, 2019, 02:29:16 am »
My sketch allows you to log in to Digispark, execute several commands, and then log out. It works on the default Digispark with micronucleus bootloader installed, and uses the DigiCDC module to emulate USB communication, because Digispark itself does not have any additional USB chip and everything is done in the AtTiny85 software.

When powering the Digispark via the VIN pin, you can connect to it via USB at any time, and after performing the commands, disconnect the terminal and the device – Digispark will continue to execute the code taking into account to sent commands - as in the video below:



https://www.youtube.com/watch?v=Ns_7tm4fF6s

Available commands:
p[0–2] [on|off] - sends HIGH and LOW signals to individual pins (from 0 to 2)
uptime - displays the time from launching the Digispark in the linux format uptime pretty
vcc - gives the power supply voltage of Digispark in millivolts
reboot - software restart of Digispark
clear - clears a display
ls - it displays GPIO status list in the small table
temp - specifies the temperature of the chip
login - prompts you to enter your password
clock [0–7] - reduces clock timing (energy saving); values: 1 – 8mHz, 2 – 4mHz, 3 – 2mHz, 4 – 1mHz, 5 – 500kHz, 6 – 250kHz, 7 – 125kHz, 0 – 16,5 mHz
help - displays the help screen
logout, exit - logs out the user

Sketch was intended to take up as little space as possible – instead of strings I used character arrays, instead of pinMode/digitalWrite registers and bit operations, thanks to which it was possible to push so many functions on such a small device. All three components together occupy almost 100% of Digispark’s memory, but to increase the amount of available space for your own code, it is enough to remove the reference to unnecessary functions (e.g. temp, uptime, vcc). These references are marked in a special code block – after deleting them, more than 30% of the memory will be available (excluding bootloader).

More information: https://jm.iq.pl/mini-os-emulator-for-digispark/

There is also a DigiLx version with a login window and a Linux-style prompt ;) https://github.com/jaromaz/DigiOS
« Last Edit: January 30, 2019, 12:22:34 pm by jaromaz »

granzeier

  • Jr. Member
  • **
  • Posts: 73
Re: Mini operating system for Digispark
« Reply #1 on: January 22, 2019, 03:44:54 am »
jaromaz,
Wow, just WOW! This is great.
I had to watch that video over and over, so much to see. I downloaded your code and will check it out later on today.
BTW, I really wish I had an extra few hundred pounds, I love that Gemini PDA.  ;)

jaromaz

  • Newbie
  • *
  • Posts: 5
Re: Mini OS emulator for Digispark
« Reply #2 on: January 24, 2019, 01:13:03 pm »
thanks :)

I added a new command "ls" - it displays GPIO status list in the small table.
Sketch already occupies 99% of the Digispark memory and is now complete - it will not be further developed.
« Last Edit: January 25, 2019, 11:25:47 am by jaromaz »