Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

delay for x86 too, README fixed

  • Loading branch information...
commit fa3757dba846d1a98192cef9ad5ec642a5ef21f0 1 parent 8d44a75
@modul authored
Showing with 22 additions and 11 deletions.
  1. +13 −6 README.md
  2. +1 −5 shelly_avr.c
  3. +8 −0 shelly_extra.c
View
19 README.md
@@ -41,22 +41,29 @@ These features can be turned off by defining 'strict'.
So far:
* `:` -- print cell value (decimal)
* `;` -- read number to current memory cell (decimal)
-* `@` -- write a random integer in current memory cell
+* `0`..`255` -- any decimal number is directly put into the current cell
+* `_` -- delay for the current cell value in milliseconds
* `(` -- binary shift left current memory cell
* `)` -- binary shift right current memory cell
* `{` -- decimal shift left current memory cell
* `}` -- decimal shift right current memory cell
-
-Any decimal number in the code is directly read into the
-current memory cell, so `128+` sets the current value to 129,
-`0` zeroes a cell and so on.
+* `@` -- write a random integer in current memory cell
AVR Instructions - `shelly_avr.c`
-------------------------------
So far:
-* `_` -- delay for the current cell value in milliseconds
+* `o` -- set digital outputs to bitmask in current cell
+* `p` -- set PWM1 to cell value
+* `P` -- set PWM2 to cell value
+* `a` -- current cell selects the analog channel to be read, ADC
+ value is then written to the current cell
If there is a pending `$` on the input line between two instructions,
the execution stops (because CTRL-C or CTRL-D won't work).
+These are all just some ideas and can be completely changed, removed,
+rewritten or whatever, to fit your needs. Shelly should only give
+some kind of a foundation. One that can be shaped to anything you
+need - that’s the idea.
+
View
6 shelly_avr.c
@@ -23,11 +23,7 @@ extern uint8_t tape[SHELLY_TAPESIZE];
#ifdef __AVR_ARCH__
int shelly_avr(const char **ip)
{
- if (**ip == '_') {
- unsigned tmp;
- for (tmp=0; tmp<tape[tp]; tmp++, _delay_ms(1));
- }
- else if (**ip == 'o')
+ if (**ip == 'o')
PORTD = (tape[tp]<<2)&0xFC;
else if (**ip == 'a') {
ADMUX = (tape[tp]&3)|(1<<REFS1)|(1<<REFS0);
View
8 shelly_extra.c
@@ -38,6 +38,14 @@ int shelly_extra(const char **ip)
--(*ip);
tape[tp] = num;
}
+ else if (i == '_') {
+ unsigned tmp;
+#ifdef __AVR_ARCH__
+ for (tmp=0; tmp<tape[tp]; tmp++, _delay_ms(1));
+#else
+ for (tmp=0; tmp<tape[tp]; tmp++, usleep(1000));
+#endif
+ }
else if (i == '(') tape[tp] <<= 1;
else if (i == ')') tape[tp] >>= 1;
else if (i == '{') tape[tp] *= 10;
Please sign in to comment.
Something went wrong with that request. Please try again.