nabaztag_hack_kit 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nabaztag Hack Kit
2
2
 
3
- Everything you need to hack the Rabbit: a sinatra server including simple api framework to run custom bytecode on Nabaztag v1/v2. Sources + Compiler included (linux only)
3
+ Everything you need to hack the Rabbit: a sinatra server including simple api framework to run custom bytecode on Nabaztag v1/v2. Includes original compiler sources for linux.
4
4
 
5
5
  ![](http://travis-ci.org/rngtng/NabaztagHackKit.png)
6
6
 
@@ -25,7 +25,7 @@ Runs a `*.mtl` file. It calls `mtl_merge` before, and fallbacks to remote simula
25
25
 
26
26
  ### Understanding the Bytecode
27
27
 
28
- The bytecode is written in a custom language by Sylvain Huet. Its referenced as _Metal_ and files end with `.mtl`. Unfortunately documentation is very poor (and in french). Check directory `ext/bytecode/` which contains a basic overview & documentaion as well as a list of (common) commands. A good reference is the original bytecode, included in the directory as well. Major parts got extracted into seperate files, found in `lib/` directory and ready to be included in your code.
28
+ The bytecode is written in a custom language by Sylvain Huet. It is referenced as _Metal_ and files end with `.mtl`. Unfortunately documentation is very poor (and in french). Check directory `ext/bytecode/` which contains a basic overview & documentaion as well as a list of (common) commands. A good reference is the original bytecode, included in the directory as well. Major parts got extracted into seperate files, found in `lib/` directory and ready to be included in your code.
29
29
 
30
30
  ### Testing
31
31
 
@@ -39,8 +39,8 @@ The kit includes a simple test framework to test custom bytecode. See `test/byte
39
39
  0);
40
40
  ```
41
41
 
42
- The framework offers assertions similar to ruby tunit stile. Mind that the variable type has to be given
43
- explicit. Convertion is:
42
+ The framework offers assertions similar to [Ruby Test::Unit](http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit.html) style. Mind that the variable type has to be given
43
+ explicit. Convention is:
44
44
 
45
45
  * I = interger
46
46
  * S = string
@@ -93,7 +93,7 @@ Buffers 10 - 13, where 10 & 11 are used for onetime, and 12 & 13 for loop playba
93
93
 
94
94
  ## Disclamer
95
95
 
96
- The server party was heavily inspired by [Trudy.rb](https://github.com/quimarche/trudy/blob/master/trudy.rb), compiler code copied from OpenJabNab.
96
+ The server part was heavily inspired by [Trudy.rb](https://github.com/quimarche/trudy/blob/master/trudy.rb), compiler code copied from OpenJabNab.
97
97
  Thanks!
98
98
 
99
99
 
data/bytecode/main.mtl CHANGED
@@ -104,7 +104,7 @@ fun loop=
104
104
  wifiRun;
105
105
  wifiCheck;
106
106
 
107
- //checkRFID;
107
+ checkRFID;
108
108
  checkButton;
109
109
  setLeds;
110
110
  earRead 0;
data/ext/bytecode/Docs.md CHANGED
@@ -435,16 +435,15 @@ Random notes of stuff I came accross while developing
435
435
  ### Leds
436
436
  Thank god it's RGB: Led 0 - 4, Color RGB
437
437
 
438
- ```
439
- led 0 0x000000; //black
440
- led 0 0x0000FF; //blue
441
- led 0 0x00FF00; //green
442
- led 0 0xFF0000; //red
443
- led 0 0xFFFF00; //yellow
444
- led 0 0xFF00FF; //lila
445
- led 0 0x00FFFF; //cyan
446
- led 0 0xFFFFFF; //white
447
- ```
438
+ led 0 0x000000; //black
439
+ led 0 0x0000FF; //blue
440
+ led 0 0x00FF00; //green
441
+ led 0 0xFF0000; //red
442
+ led 0 0xFFFF00; //yellow
443
+ led 0 0xFF00FF; //lila
444
+ led 0 0x00FFFF; //cyan
445
+ led 0 0xFFFFFF; //white
446
+
448
447
 
449
448
  ### Ears
450
449
 
@@ -457,32 +456,33 @@ Thank god it's RGB: Led 0 - 4, Color RGB
457
456
  `proto main 0;;` needs to be declared on top
458
457
 
459
458
  Minimal func:
460
- ```
461
- fun main=
462
- confInit;
463
- wifiInit 0;
464
- loopcb #loop; // 20 p. second
465
-
466
- netstart;
467
- srand time_ms;
468
- 0
469
- ;;
470
- ```
459
+
460
+
461
+ fun main=
462
+ confInit;
463
+ wifiInit 0;
464
+ loopcb #loop; // 20 p. second
465
+
466
+ netstart;
467
+ srand time_ms;
468
+ 0
469
+ ;;
470
+
471
471
 
472
472
  ### Metal Examples
473
+
473
474
  Example:
474
475
 
475
- ```
476
- type MySum= Zero | Const _ | Add _ | Mul _ ;;
476
+ type MySum= Zero | Const _ | Add _ | Mul _ ;;
477
+
478
+ fun eval z=
479
+ match z with
480
+ ( Zero -> 0)
481
+ |( Const a -> a)
482
+ |( Add [x y] -> (eval x)+(eval y))
483
+ |( Mul [x y] -> (eval x)*(eval y)) ;;
477
484
 
478
- fun eval z=
479
- match z with
480
- ( Zero -> 0)
481
- |( Const a -> a)
482
- |( Add [x y] -> (eval x)+(eval y))
483
- |( Mul [x y] -> (eval x)*(eval y)) ;;
485
+ Iecholn eval Add [Const 1 Mul [Const 2 Const 3]]; // -> 1 + 2 * 3 -> 7
484
486
 
485
- Iecholn eval Add [Const 1 Mul [Const 2 Const 3]]; // -> 1 + 2 * 3 -> 7
486
- ```
487
487
 
488
488
  See test for more.
@@ -36,4 +36,4 @@ module NabaztagHackKit
36
36
 
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -34,6 +34,25 @@ module NabaztagHackKit
34
34
  (led3+10) => [0,0,0] + [0,0,0] + data
35
35
  }
36
36
  end
37
+
38
+ def stop
39
+ {
40
+ LED_0 => 0,
41
+ LED_1 => 0,
42
+ LED_2 => 0,
43
+ LED_3 => 0,
44
+ LED_4 => 0,
45
+ LED_L0 => 0,
46
+ LED_L1 => 0,
47
+ LED_L2 => 0,
48
+ LED_L3 => 0,
49
+ LED_L4 => 0,
50
+ EAR_L => 0,
51
+ EAR_R => 0,
52
+ EAR_LL => 0,
53
+ EAR_LR => 0,
54
+ }
55
+ end
37
56
  end
38
57
  end
39
58
  end
@@ -1,3 +1,3 @@
1
1
  module NabaztagHackKit
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nabaztag_hack_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-30 00:00:00.000000000Z
12
+ date: 2012-02-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70107235050200 !ruby/object:Gem::Requirement
16
+ requirement: &70260847353020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70107235050200
24
+ version_requirements: *70260847353020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70107235049680 !ruby/object:Gem::Requirement
27
+ requirement: &70260847352500 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70107235049680
35
+ version_requirements: *70260847352500
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70107235049220 !ruby/object:Gem::Requirement
38
+ requirement: &70260847376360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70107235049220
46
+ version_requirements: *70260847376360
47
47
  description: Sinatra server api framework to run custom bytecode on Nabaztag v1/v2.
48
48
  Sources + Compiler included (linux only)
49
49
  email: