====== Funksteckdosen Fernsteuern mit teensy ====== ====== aka Workshop: Mikrocontrollerprogrammierung mit teensy ====== ====== Vorbereitung ====== Es müssen folgende Pakete installiert werden: ~ % sudo apt-get install subversion gcc-avr avr-libc build-essential \ avrdude binutils-avr libusb-dev python-matplotlib Weiters ist es ratsam einen eigenen Ordner für den Workshop anzulegen. ~ % mkdir teensy_workshop ~ % cd teensy_workshop ====== hidrc ====== Mit hidrc kann man einen Linux-PC mit NEC-Fernbedienungen fernsteuern. Andere Protokolle wie RC5 oder RC6 werden derzeit nicht unterstützt. ===== Benötigte Bauteile ===== * Teensy * TSOP1838 ==== Pinbelegung ==== TSOP1838: D3: Data Gesamter Port D ist als Input konfiguriert. PC7 = VCC PC6 = GND Ansicht von vorne (Runde empfänger Teil sichtbar)
_________
|       |
|   O   |
|       |
---------
|   |   |
|   |   |
D  Gnd Vcc
==== Quellcode herunterladen ====
~/teensy_workshop % svn checkout https://krypta.wirdorange.org/svn/hidrc/trunk hidrc
~/teensy_workshop % cd hidrc
==== hidrc kompilieren ====
~/teensy_workshop/hidrc (svn)-[trunk:16] % cp keymap_example.h keymap.h
~/teensy_workshop/hidrc (svn)-[trunk:16] % make
~/teensy_workshop/hidrc (svn)-[trunk:16] % cd teensy_loader_cli
~/teensy_workshop/hidrc/teensy_loader_cli (svn)-[trunk:16] % make
~/teensy_workshop/hidrc/teensy_loader_cli (svn)-[trunk:16] % cd ../hid_listen
~/teensy_workshop/hidrc/hid_listen (svn)-[trunk:16] % make
==== udev-Regel kopieren ====
~/teensy_workshop/hidrc/hid_listen (svn)-[trunk:16] % cd ..
~/teensy_workshop/hidrc (svn)-[trunk:16] % sudo cp udev-rules/49-teensy.rules /etc/udev/rules.d/49-teensy.rules
~/teensy_workshop/hidrc (svn)-[trunk:16] % sudo /etc/init.d/udev reload
==== Programm auf teensy brennen ====
~/teensy_workshop/hidrc (svn)-[trunk:16] % make program
==== Kommandos lernen ====
~/teensy_workshop/hidrc (svn)-[trunk:16] % cd hid_listen
~/teensy_workshop/hidrc/hid_listen (svn)-[trunk:16] % ./hid_listen
Waiting for device:
Listening:
start
722EEDD1
722EEDD1
722EEDD1
722EEDD1
722EEDD1
^C
130 ~/teensy_workshop/hidrc/hid_listen (svn)-[trunk:16] % vim ../keymap.h
=== Keycode eintragen === Den vorher ausgelesenen Wert (hier 722EEDD1) trägt man in die Datei /hid_listen/keymap.h ein. 722EEDD1 -> 0x72,0x2E,0xED,0xD1 0x72,0x2E,0xED,0xD1,//Key//, //Modifier//, z.B.: 0x72,0x2E,0xED,0xD1, KEY_DELETE, KEY_ALT | KEY_CTRL, Gültige Werte für //Key// und //Modifier// stehen in der Datei **usb_keyboard_debug.h** ===== rf433ctl ===== ==== Quellcode herunterladen ==== homunkoloss@vidar ~/teensy_workshop % git clone https://github.com/realraum/rf433rcv homunkoloss@vidar ~/teensy_workshop % cd rf433rcv homunkoloss@vidar ~/teensy_workshop/rf433rcv (svn)-[rf433rcv:516] % cd pc homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % make ==== teensy_loader_cli verlinken ==== homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cd ~ homunkoloss@vidar ~ % ln -s teensy_workshop/hidrc/teensy_loader_cli homunkoloss@vidar ~ % ls -l [...] lrwxrwxrwx 1 homunkoloss homunkoloss 39 2012-04-18 23:39 teensy_loader_cli -> teensy_workshop/hidrc/teensy_loader_cli/ drwxr-xr-x 4 homunkoloss homunkoloss 4096 2012-04-18 23:37 teensy_workshop/ [...] homunkoloss@vidar ~ % cd - ~/teensy_workshop/rf433rcv/pc homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cd ../teensy homunkoloss@vidar ~/teensy_workshop/rf433rcv/teensy (svn)-[rf433rcv:516] % make homunkoloss@vidar ~/teensy_workshop/rf433rcv/teensy (svn)-[rf433rcv:516] % make program ../pc/reset || true ~/teensy_loader_cli/teensy_loader_cli -mmcu=atmega32u4 -w example.hex ===== Variante Easy ===== {{:workshop:rf-433-proto.jpg|}}
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./autotaste.sh 0 > taste.txt
/tmp/tmp.Kbk5QqjpWm
/tmp/tmp.Id0D1V7c7e
/tmp/tmp.UVg5C9GFzd
0:
1 47
2 
8 
9 
10 189
11 
12 2
27 
28 220
29 
30 10
31 
284 
285 17
286 
1:
1 
2 26
3 
4 
5 33
6 
7 
8 219
9 
10 15
11 
12 6
13 
14 6
15 
16 1
18 3
19 
20 2
21 
22 2
24 3
26 
27 170
28 
1173samples
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste.txt | ./compress | ./rawhid_test -
Clearing Buffer
Sending Buffer 63 bytes
66 04 96 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e0 3f 00 00 00 fc ff ff 1f 80 ff ff ff 03 f8 ff ff 3f 80 ff 01 00 00 e0 ff ff 
Sending Buffer 63 bytes
66 7f 00 fc 01 00 00 c0 ff ff ff 01 fc 07 00 00 80 ff ff ff 03 f0 ff ff 7f 00 fe ff ff 0f e0 3f 00 00 00 fc ff ff 0f 80 7f 00 00 00 f0 0f 00 00 00 fe 00 00 00 e0 1f 00 00 00 fe 03 00 00 80 7f 
Sending Buffer 23 bytes
66 00 00 00 f8 ff ff 3f 00 ff ff ff 03 f0 1f 00 00 00 fe 03 00 00 c0 3f 
Executing Send command

homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] %   
===== Beschreibung der einzelnen Schritte ===== Autotaste: Versucht eine Periode herauszufiltern, schneidet den Rest weg. ./rawhid_test: Rohes Signal aufnehmen, auf stdout ausgeben. Ohne Parameter: Empfangen, mit filename als Parameter: Sende File, mit "-" sende stdin. compress: string -> binörformat, mit parameter: kein längenfeld uncompress: binärformat -> string ./realraum_codes.pl: Bitmuster erzeugen.
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./rawhid_test
00000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111111111111111111111110000000001111111111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111111111111111111111100000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111110000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111100000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111110000000000000000000000000001111111111111111111111111111000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111110000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111110000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000001111111111111111111111111111000000000111111111111111111111111111100000000011111111111111111111111111100000000001111111110000000000000000000000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111111111111111111111111000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111100000000000000000000000000011111111111111111111111111110000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000011111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000111111111111111111111111111100000000011111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111111111111111111111111000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111111111111111111111100000000001111111110000000000000000000000000000111111110000000000000000000000000000011111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111111111111111111111100000000011111111111111111111111111100000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000001111111111111111111111111111000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111100000000000000000000000000011111111111111111111111111110000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111110000000000000000000000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111111111111111111111110000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000011111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111111111111111111111100000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111000000000000000000000000000111111111111111111111111111100000000011111111100000000000000000000000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000001111111100000000000000000000000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000000111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111110000000000000000000000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111111111111111111111111000000000111111111000000000000000000000000000011111111111111111111111111100000000001111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000011111111100000000000000000000000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111100000000000000000000000000001111111110000000000000000000000000000111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111100000000000000000000000000001111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111111111111111111111100000000011111111111111111111111111110000000001111111110000000000000000000000000000111111111111111111111111111000000000011111111000000000000000%                                                         homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./rawhid_test | ./plot.py
cat ^CTraceback (most recent call last):
  File "./plot.py", line 12, in 
    pylab.show()
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in show
    Tk.mainloop()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 328, in mainloop
    _default_root.tk.mainloop(n)
KeyboardInterrupt
1 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat autotaste.sh
#!/bin/sh

FN=`mktemp`
FN2=`mktemp`
FN3=`mktemp`
echo $FN >&2
echo $FN2 >&2 
echo $FN3 >&2
./rawhid_test > $FN
./decode.pl $FN $1 | xargs ./decode2.pl $FN > $FN2
if [ $1 -eq 1 ]; then
  ./swap.pl < $FN2 >$FN3
else
  cat $FN2 > $FN3
fi
./plot.py < $FN3
cat $FN3
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ll
insgesamt 388
-rwxr-xr-x 1 homunkoloss homunkoloss   261 2012-04-18 23:37 autotaste.sh*
-rw-r--r-- 1 homunkoloss homunkoloss   762 2012-04-18 23:37 codes
-rwxr-xr-x 1 homunkoloss homunkoloss  7332 2012-04-18 23:37 compress*
-rw-r--r-- 1 homunkoloss homunkoloss   640 2012-04-18 23:37 compress.c
-rwxr-xr-x 1 homunkoloss homunkoloss   274 2012-04-18 23:37 data2sample.pl*
-rwxr-xr-x 1 homunkoloss homunkoloss   182 2012-04-18 23:37 decode2.pl*
-rwxr-xr-x 1 homunkoloss homunkoloss  1173 2012-04-18 23:37 decode.pl*
-rw-r--r-- 1 homunkoloss homunkoloss   219 2012-04-18 23:37 hid.h
-rw-r--r-- 1 homunkoloss homunkoloss 11445 2012-04-18 23:37 hid_LINUX.c
-rw-r--r-- 1 homunkoloss homunkoloss 11770 2012-04-18 23:37 hid_MACOSX.c
-rw-r--r-- 1 homunkoloss homunkoloss  3660 2012-04-18 23:37 hid.o
-rw-r--r-- 1 homunkoloss homunkoloss  8537 2012-04-18 23:37 hid_WINDOWS.c
-rw-r--r-- 1 homunkoloss homunkoloss  1485 2012-04-18 23:37 Makefile
-rwxr-xr-x 1 homunkoloss homunkoloss    41 2012-04-18 23:37 plot_bin.sh*
-rwxr-xr-x 1 homunkoloss homunkoloss   258 2012-04-18 23:37 plot.py*
-rwxr-xr-x 1 homunkoloss homunkoloss  9688 2012-04-18 23:37 rawhid_test*
-rw-r--r-- 1 homunkoloss homunkoloss  2426 2012-04-18 23:37 rawhid_test.c
-rw-r--r-- 1 homunkoloss homunkoloss  2904 2012-04-18 23:37 rawhid_test.o
-rwxr-xr-x 1 homunkoloss homunkoloss  2263 2012-04-18 23:37 realraum_codes.pl*
-rwxr-xr-x 1 homunkoloss homunkoloss  9668 2012-04-18 23:37 reset*
-rw-r--r-- 1 homunkoloss homunkoloss   869 2012-04-18 23:37 reset.c
-rw-r--r-- 1 homunkoloss homunkoloss  1344 2012-04-18 23:37 reset.o
-rwxr-xr-x 1 homunkoloss homunkoloss   458 2012-04-18 23:37 sample2data.pl*
-rwxr-xr-x 1 homunkoloss homunkoloss    48 2012-04-18 23:37 send.sh*
-rwxr-xr-x 1 homunkoloss homunkoloss    73 2012-04-18 23:37 swap.pl*
-rw-r--r-- 1 homunkoloss homunkoloss  1174 2012-04-18 23:44 taste.txt
drwxr-xr-x 3 homunkoloss homunkoloss  4096 2012-04-18 23:37 testdata/
-rwxr-xr-x 1 homunkoloss homunkoloss  7336 2012-04-18 23:37 uncompress*
-rw-r--r-- 1 homunkoloss homunkoloss   518 2012-04-18 23:37 uncompress.c
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste.txt | ./plot.py
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste.txt | ./sample2data.pl
Base 9
011101010111010000001100%                                                                                                     homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste.txt | ./plot.py
^Z
[1]  + 4205 done       cat taste.txt | 
       4206 suspended  ./plot.py
20 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % bg
[1]  + 4205 done       cat taste.txt | 
       4206 continued  ./plot.py
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste.txt | ./sample2data.pl > taste-data
Base 9
homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste-data | ./data2sample.pl 5 | ./plot.py
^C
Traceback (most recent call last):
  File "./plot.py", line 12, in 
    pylab.show()
  File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in show
    Tk.mainloop()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 328, in mainloop
    _default_root.tk.mainloop(n)
KeyboardInterrupt
1 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % 
1 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % cat taste-data | ./data2sample.pl 5 | ./compress| ./rawhid_test -
Clearing Buffer
Sending Buffer 63 bytes
66 02 80 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1f 00 f0 ff 07 ff 7f f0 ff 07 1f 00 f0 ff 07 1f 00 f0 ff 07 1f 00 f0 ff 07 ff 7f f0 ff 07 1f 00 f0 ff 07 1f 00 f0 01 00 1f 
Sending Buffer 19 bytes
66 00 f0 01 00 1f 00 f0 01 00 ff 7f f0 ff 07 1f 00 f0 01 00 
Executing Send command

homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./realraum_codes.pl
Usage ./realraum_codes.pl {pollin,rsl336t,weiss,schwarz} remote parameters at ./realraum_codes.pl line 28.
255 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./realraum_codes.pl pollin
parameters 00000 {a|b|c|d} {0|1} at ./realraum_codes.pl line 74.
255 homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./realraum_codes.pl pollin 11111 b 1
000000000001000101010001%                                                                                                     homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./realraum_codes.pl pollin 11111 b 1 | ./data2sample.pl 5 | ./compress| ./rawhid_test -
Clearing Buffer
Sending Buffer 63 bytes
66 02 80 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 ff 07 1f 00 f0 01 00 1f 00 f0 ff 07 1f 
Sending Buffer 19 bytes
66 00 f0 ff 07 1f 00 f0 ff 07 1f 00 f0 01 00 1f 00 f0 ff 07 
Executing Send command

homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] % ./realraum_codes.pl pollin 11111 b 0 | ./data2sample.pl 5 | ./compress| ./rawhid_test -
Clearing Buffer
Sending Buffer 63 bytes
66 02 80 1f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 01 00 1f 00 f0 ff 07 1f 00 f0 01 00 1f 00 f0 ff 07 1f 
Sending Buffer 19 bytes
66 00 f0 ff 07 1f 00 f0 ff 07 1f 00 f0 ff 07 1f 00 f0 01 00 
Executing Send command

homunkoloss@vidar ~/teensy_workshop/rf433rcv/pc (svn)-[rf433rcv:516] %                                                       
===== Pinbelegung ===== USB-Stick am PC anstecken. Leitung auf D0 legen. Sender: Datenleitung auf F0, GND auf GND, Vcc auf Vcc. ===== Fehlersuche ===== ==== hidrc kompiliert nicht ==== === Fehler ===
~/teensy_workshop/hidrc (svn)-[trunk:16] % make
-------- begin --------
avr-gcc (GCC) 4.3.5
Copyright (C) 2008 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quellen. Es
gibt KEINE Garantie; auch nicht für MARKTGÄNGIGKEIT oder FÜR SPEZIELLE ZWECKE.


Compiling C: example.c
avr-gcc -c -mmcu=atmega32u4         -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./example.lst  -std=gnu99 -MMD -MP -MF .dep/example.o.d example.c -o example.o 
example.c:38:20: Fehler: keymap.h: Datei oder Verzeichnis nicht gefunden
example.c: In Funktion »__vector_23«:
example.c:110: Fehler: »mapping« nicht deklariert (erste Benutzung in dieser Funktion)
example.c:110: Fehler: (Jeder nicht deklarierte Bezeichner wird nur einmal aufgeführt
example.c:110: Fehler: für jede Funktion in der er auftritt.)
make: *** [example.o] Fehler 1
=== Lösung === ~/teensy_workshop/hidrc (svn)-[trunk:16] % cp keymap_example.h keymap.h ---- {{tag>workshop project}}