Commit 2056d0e396140d62517be4b90a2db0b97cecad97
1 parent
99eaf848
MAJ Capteur
Showing
4 changed files
with
27 additions
and
3 deletions
Show diff stats
site/fichiersRPI/Makefile
@@ -7,8 +7,8 @@ export CFLAGS = -Wall -I. -DF_CPU=16000000 -Os #-pedantic -std=c99#-g | @@ -7,8 +7,8 @@ export CFLAGS = -Wall -I. -DF_CPU=16000000 -Os #-pedantic -std=c99#-g | ||
7 | export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections # -Os | 7 | export LDFLAGS = -g $(TARGET_ARCH) -lm -Wl,--gc-sections # -Os |
8 | 8 | ||
9 | TARGET = main | 9 | TARGET = main |
10 | -TERM0 = /dev/ttyACM0 | ||
11 | -TERM1 = /dev/ttyACM1 | 10 | +TERM0 = /dev/ttyPR0 |
11 | +TERM1 = /dev/ttyPR1 | ||
12 | CPPFLAGS = -mmcu=$(MCU) | 12 | CPPFLAGS = -mmcu=$(MCU) |
13 | #PGMER = -c stk500v1 -b 57600 -P $(TERM) | 13 | #PGMER = -c stk500v1 -b 57600 -P $(TERM) |
14 | 14 |
site/fichiersRPI/Rpi_to_server.py
@@ -22,7 +22,7 @@ file.close() | @@ -22,7 +22,7 @@ file.close() | ||
22 | 22 | ||
23 | num_capteur = int(os.path.abspath(".")[-3]) | 23 | num_capteur = int(os.path.abspath(".")[-3]) |
24 | 24 | ||
25 | -port = "/dev/ttyACM"+str(num_capteur-1) | 25 | +port = "/dev/ttyPR"+str(num_capteur-1) |
26 | ser = serial.Serial(port, 9600, timeout=1) | 26 | ser = serial.Serial(port, 9600, timeout=1) |
27 | value = ser.readline() | 27 | value = ser.readline() |
28 | 28 |
site/fichiersRPI/fichiersRPI.zip
No preview for this file type
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +#!/bin/bash | ||
2 | + | ||
3 | +data=$(dmesg | grep ttyACM | cut -f 7 -d " " | cut -f 1 -d : ) | ||
4 | +code=$(echo $data | cut -f 1 -d " ") | ||
5 | +#echo $code | ||
6 | +port=$(pwd | cut -c 17) | ||
7 | +let port-- | ||
8 | +#echo $port | ||
9 | +dev="/dev/ttyACM" | ||
10 | +name="$dev$port" | ||
11 | +commande=$(udevadm info --name=$name --attribute-walk | egrep "idVendor|idProduct|serial") | ||
12 | +idProduct=$(echo $commande | cut -f 1 -d " ") | ||
13 | +idVendor=$(echo $commande | cut -f 2 -d " ") | ||
14 | +serial=$(echo $commande | cut -f 3 -d " ") | ||
15 | +#echo $idProduct | ||
16 | +#echo $idVendor | ||
17 | +#echo $serial | ||
18 | +newdev="ttyPR" | ||
19 | +newname="$newdev$port" | ||
20 | +#echo $newname | ||
21 | +rule="SUBSYSTEM==\"tty\", $serial, $idVendor, $idProduct, SYMLINK+=\"$newname\"" | ||
22 | +#echo $rule | ||
23 | +echo $rule > /etc/udev/rules.d/usb-serial.rules | ||
24 | +udevadm trigger |