Skip to content

Commit f5e220e

Browse files
author
letherman255
committed
Signed-off-by: letherman255 <[email protected]>
1 parent e9f3217 commit f5e220e

21 files changed

+1029
-28
lines changed

Arduino USBSerial.inf

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
;************************************************************
2+
; Windows USB CDC ACM Setup File
3+
; Copyright (c) 2000 Microsoft Corporation
4+
5+
6+
[Version]
7+
Signature="$Windows NT$"
8+
Class=Ports
9+
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
10+
Provider=%MFGNAME%
11+
LayoutFile=layout.inf
12+
CatalogFile=%MFGFILENAME%.cat
13+
DriverVer=11/15/2007,5.1.2600.0
14+
15+
[Manufacturer]
16+
%MFGNAME%=DeviceList, NTamd64
17+
18+
[DestinationDirs]
19+
DefaultDestDir=12
20+
21+
22+
;------------------------------------------------------------------------------
23+
; Windows 2000/XP/Vista-32bit Sections
24+
;------------------------------------------------------------------------------
25+
26+
[DriverInstall.nt]
27+
include=mdmcpq.inf
28+
CopyFiles=DriverCopyFiles.nt
29+
AddReg=DriverInstall.nt.AddReg
30+
31+
[DriverCopyFiles.nt]
32+
usbser.sys,,,0x20
33+
34+
[DriverInstall.nt.AddReg]
35+
HKR,,DevLoader,,*ntkern
36+
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
37+
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
38+
39+
[DriverInstall.nt.Services]
40+
AddService=usbser, 0x00000002, DriverService.nt
41+
42+
[DriverService.nt]
43+
DisplayName=%SERVICE%
44+
ServiceType=1
45+
StartType=3
46+
ErrorControl=1
47+
ServiceBinary=%12%\%DRIVERFILENAME%.sys
48+
49+
;------------------------------------------------------------------------------
50+
; Vista-64bit Sections
51+
;------------------------------------------------------------------------------
52+
53+
[DriverInstall.NTamd64]
54+
include=mdmcpq.inf
55+
CopyFiles=DriverCopyFiles.NTamd64
56+
AddReg=DriverInstall.NTamd64.AddReg
57+
58+
[DriverCopyFiles.NTamd64]
59+
%DRIVERFILENAME%.sys,,,0x20
60+
61+
[DriverInstall.NTamd64.AddReg]
62+
HKR,,DevLoader,,*ntkern
63+
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
64+
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
65+
66+
[DriverInstall.NTamd64.Services]
67+
AddService=usbser, 0x00000002, DriverService.NTamd64
68+
69+
[DriverService.NTamd64]
70+
DisplayName=%SERVICE%
71+
ServiceType=1
72+
StartType=3
73+
ErrorControl=1
74+
ServiceBinary=%12%\%DRIVERFILENAME%.sys
75+
76+
77+
;------------------------------------------------------------------------------
78+
; Vendor and Product ID Definitions
79+
;------------------------------------------------------------------------------
80+
; When developing your USB device, the VID and PID used in the PC side
81+
; application program and the firmware on the microcontroller must match.
82+
; Modify the below line to use your VID and PID. Use the format as shown below.
83+
; Note: One INF file can be used for multiple devices with different VID and PIDs.
84+
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
85+
;------------------------------------------------------------------------------
86+
[SourceDisksFiles]
87+
[SourceDisksNames]
88+
[DeviceList]
89+
%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_003B
90+
91+
[DeviceList.NTamd64]
92+
%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_003B
93+
94+
95+
;------------------------------------------------------------------------------
96+
; String Definitions
97+
;------------------------------------------------------------------------------
98+
;Modify these strings to customize your device
99+
;------------------------------------------------------------------------------
100+
[Strings]
101+
MFGFILENAME="CDC_vista"
102+
DRIVERFILENAME ="usbser"
103+
MFGNAME="Arduino LLC (www.arduino.cc)"
104+
INSTDISK="Arduino USBSerial Driver Installer"
105+
DESCRIPTION="Arduino UNO"
106+
SERVICE="USB RS-232 Emulation Driver"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/com/
2+
/fr/
Binary file not shown.
-6 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+56-27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fr.mcnanotech.gpio;
22

33
import java.io.IOException;
4+
import java.util.Random;
45

56
import com.pi4j.io.i2c.I2CBus;
67
import com.pi4j.io.i2c.I2CDevice;
@@ -13,23 +14,20 @@ public class I2CTransfer
1314
private static I2CDevice arduino;
1415
private static boolean isI2Cinit = false;
1516
private static Lcd lcd;
16-
1717
public static void initI2C(String raspberry) throws IOException
1818
{
1919
if(raspberry.equals("true"))
2020
{
2121
final I2CBus bus = I2CFactory.getInstance(I2CBus.BUS_1);
22-
23-
if(bus != null)
24-
{
25-
arduino = bus.getDevice(1);
26-
}
27-
else
28-
{
29-
System.err.println("Arduino not found on the i2c bus.");
30-
}
31-
isI2Cinit = true;
32-
22+
23+
if(bus != null)
24+
{
25+
arduino = bus.getDevice(10);
26+
}
27+
else
28+
{
29+
System.err.println("Arduino not found on the i2c bus.");
30+
}
3331

3432
try
3533
{
@@ -40,16 +38,18 @@ public static void initI2C(String raspberry) throws IOException
4038
{
4139
e.printStackTrace();
4240
}
43-
41+
System.out.println("l'écran est null ? " + Boolean.valueOf(lcd == null));
42+
isI2Cinit = true;
4443
}
4544
else
4645
{
4746
System.out.println("The server is not launched on a raspberry pi, disabling the I2C");
4847
}
4948
}
5049

51-
public static void setState(int arduinoAddress, int controller, boolean state) throws IOException
50+
public static void setState(int offset, int controller, boolean state) throws IOException
5251
{
52+
offset = offset * 10;
5353
if(isI2Cinit)
5454
{
5555
switch(controller)
@@ -58,47 +58,47 @@ public static void setState(int arduinoAddress, int controller, boolean state) t
5858
{
5959
if(state)
6060
{
61-
arduino.write((byte)10);
61+
arduino.write((byte)(offset + 20));
6262
}
6363
else
6464
{
65-
arduino.write((byte)0);
65+
arduino.write((byte)(offset + 21));
6666
}
6767
break;
6868
}
6969
case 1:
7070
{
7171
if(state)
7272
{
73-
arduino.write((byte)11);
73+
arduino.write((byte)(offset + 22));
7474
}
7575
else
7676
{
77-
arduino.write((byte)1);
77+
arduino.write((byte)(offset + 23));
7878
}
7979
break;
8080
}
8181
case 2:
8282
{
8383
if(state)
8484
{
85-
arduino.write((byte)12);
85+
arduino.write((byte)(offset + 24));
8686
}
8787
else
8888
{
89-
arduino.write((byte)2);
89+
arduino.write((byte)(offset + 25));
9090
}
9191
break;
9292
}
9393
case 3:
9494
{
9595
if(state)
9696
{
97-
arduino.write((byte)13);
97+
arduino.write((byte)(offset + 26));
9898
}
9999
else
100100
{
101-
arduino.write((byte)3);
101+
arduino.write((byte)(offset + 27));
102102
}
103103
break;
104104
}
@@ -107,20 +107,49 @@ public static void setState(int arduinoAddress, int controller, boolean state) t
107107
}
108108
}
109109

110-
public static void writeName()
110+
public static void initLCD()
111111
{
112112
if(isI2Cinit)
113113
{
114+
lcd.setBacklight(Lcd.BACKLIGHT_RED);
114115
lcd.write(" GAM ");
115116
}
116117
}
117118

119+
public static void updateSignal(SystemStatus st)
120+
{
121+
try
122+
{
123+
arduino.write((byte)10);
124+
}
125+
catch(IOException e)
126+
{
127+
e.printStackTrace();
128+
}
129+
}
130+
118131
public static void updateLcd(SystemStatus st)
119132
{
120-
// lcd.clear();
121-
// lcd.write(" Utilisation : ");
122-
// lcd.setCursorPosition(0, 2);
123-
// lcd.write(Integer.toString(st.getSystemUsage()));
133+
lcd.setCursorHome();
134+
lcd.clear();
135+
lcd.write("credit : " + String.valueOf(st.getDailyCredit()));
136+
lcd.setCursorPosition(1, 0);
137+
lcd.write("suivant : " + String.valueOf(st.getNextSystem()));
138+
139+
}
124140

141+
public static void systemOnline()
142+
{
143+
if(isI2Cinit)
144+
{
145+
try
146+
{
147+
arduino.write((byte)1);
148+
}
149+
catch(IOException e)
150+
{
151+
e.printStackTrace();
152+
}
153+
}
125154
}
126155
}

pro/src/fr/mcnanotech/main/SystemThread.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public void run()
3131
systemparam = settingsloader.loadParams(systemparam);
3232
settingsloader.saveParamChanges(systemparam);
3333

34+
System.out.println("démarrage ....................");
3435
try
3536
{
3637
I2CTransfer.initI2C(systemparam.getRaspberry());
@@ -46,7 +47,9 @@ public void run()
4647
long t = (System.currentTimeMillis() / TIME_BASE);
4748
long tp = t + 1;
4849

49-
I2CTransfer.writeName();
50+
I2CTransfer.initLCD();
51+
52+
I2CTransfer.systemOnline();
5053

5154
while(true)
5255
{
@@ -63,6 +66,7 @@ public void run()
6366
SystemClock.fullTick(st, userDao);
6467
}
6568
I2CTransfer.updateLcd(st);
69+
I2CTransfer.updateSignal(st);
6670
tp = t + 1;
6771
}
6872

v2/banc de démo/Assemblage1.SLDASM

-34.5 KB
Binary file not shown.

v2/banc de démo/rambarde.SLDPRT

-16 KB
Binary file not shown.

0 commit comments

Comments
 (0)