summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--src/storage.cc10
-rw-r--r--src/system.cc20
-rw-r--r--utilities/blinkenrocket.py19
-rwxr-xr-xutilities/modem_transmit4
5 files changed, 32 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index cace064..cd41a0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/build/
/doc/
+/utilities/*.pyc
diff --git a/src/storage.cc b/src/storage.cc
index 8b725be..b15c55d 100644
--- a/src/storage.cc
+++ b/src/storage.cc
@@ -168,9 +168,9 @@ uint8_t Storage::i2c_write(uint8_t addrhi, uint8_t addrlo, uint8_t len, uint8_t
* All other error conditions (even though they should never happen[tm])
* are handled the same way.
*/
- for (num_tries = 0; num_tries < 16; num_tries++) {
+ for (num_tries = 0; num_tries < 32; num_tries++) {
if (num_tries > 0)
- _delay_ms(1);
+ _delay_us(500);
if (i2c_start_write() != I2C_OK)
continue; // EEPROM is busy writing
@@ -205,9 +205,9 @@ uint8_t Storage::i2c_read(uint8_t addrhi, uint8_t addrlo, uint8_t len, uint8_t *
/*
* See comments in i2c_write.
*/
- for (num_tries = 0; num_tries < 16; num_tries++) {
+ for (num_tries = 0; num_tries < 32; num_tries++) {
if (num_tries > 0)
- _delay_ms(1);
+ _delay_us(500);
if (i2c_start_write() != I2C_OK)
continue; // EEPROM is busy writing
@@ -232,8 +232,6 @@ uint8_t Storage::i2c_read(uint8_t addrhi, uint8_t addrlo, uint8_t len, uint8_t *
void Storage::reset()
{
first_free_page = 0;
- num_anims = 0xff;
- i2c_write(0, 0, 1, &num_anims); // pretend the EEPROM was never written to
num_anims = 0;
}
diff --git a/src/system.cc b/src/system.cc
index aa21b00..5729c57 100644
--- a/src/system.cc
+++ b/src/system.cc
@@ -33,16 +33,16 @@ void System::initialize()
modem.enable();
storage.enable();
- storage.reset();
- storage.save((uint8_t *)"\x10\x0a\x11\x00nootnoot");
- storage.save((uint8_t *)"\x10\x09\x20\x00" "fnordor");
- storage.save((uint8_t *)"\x10\x05\x20\x00 \x01 ");
- storage.save((uint8_t *)"\x20\x22\x08\x02"
- "\x00\x04\x22\x02\x22\x04\x00\x00"
- "\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x00\x04\x22\x02\x22\x04\x00\x00"
- "\x00\x00\x00\x00");
- storage.append((uint8_t *)"\x00\x00\x00\x00");
+ //storage.reset();
+ //storage.save((uint8_t *)"\x10\x0a\x11\x00nootnoot");
+ //storage.save((uint8_t *)"\x10\x09\x20\x00" "fnordor");
+ //storage.save((uint8_t *)"\x10\x05\x20\x00 \x01 ");
+ //storage.save((uint8_t *)"\x20\x22\x08\x02"
+ // "\x00\x04\x22\x02\x22\x04\x00\x00"
+ // "\x00\x00\x00\x00\x00\x00\x00\x00"
+ // "\x00\x04\x22\x02\x22\x04\x00\x00"
+ // "\x00\x00\x00\x00");
+ //storage.append((uint8_t *)"\x00\x00\x00\x00");
sei();
diff --git a/utilities/blinkenrocket.py b/utilities/blinkenrocket.py
index 01c7d73..c4cb488 100644
--- a/utilities/blinkenrocket.py
+++ b/utilities/blinkenrocket.py
@@ -91,6 +91,7 @@ class modem:
sound += self.modemcode(ord(byte))
self.cnt += 1
if self.cnt == 10:
+ sound += self.silence(256) # TODO determine required amount of silence
sound += self.generateSyncSignal(2)
self.cnt = 0
# add some sync signals in the end
@@ -219,9 +220,19 @@ class blinkenrocket():
if __name__ == '__main__':
- m = modem(parity=True)
- #print list(open(sys.argv[1]).read())
- m.setData(list(open(sys.argv[1]).read()))
- m.saveAudio(sys.argv[2])
+ m = modem(parity=True, frequency=16000)
+ b = blinkenrocket()
+
+ b.addFrame(textFrame("Test Foo eins zwei drei"))
+ b.addFrame(textFrame("mrew? "))
+ b.addFrame(textFrame("Und so weiter \x01 "))
+ b.addFrame(animationFrame(map(lambda x : chr(x), [0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255])))
+ #for i in xrange(10):
+ # b.addFrame(textFrame(str(100*i)))
+
+ m.setData(b.getMessage())
+ m.saveAudio(sys.argv[1])
+
+ #print b.getMessage()
diff --git a/utilities/modem_transmit b/utilities/modem_transmit
index 8f85c78..362bc4d 100755
--- a/utilities/modem_transmit
+++ b/utilities/modem_transmit
@@ -2,7 +2,7 @@
OUT="$(mktemp)"
-python blinkenrocket.py =(echo -n "$1"$'\0') $OUT
+python blinkenrocket.py $OUT
case "$(uname -s)" in
Darwin)
@@ -13,4 +13,4 @@ Darwin)
;;
esac
-rm $OUT \ No newline at end of file
+rm $OUT