diff --git a/FT232H.sln b/FT232H.sln
new file mode 100644
index 0000000..33a639a
--- /dev/null
+++ b/FT232H.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35818.85 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FT232H", "FT232H\FT232H.vbproj", "{86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {090511F9-77B5-440F-911F-014C1070ED9B}
+ EndGlobalSection
+EndGlobal
diff --git a/FT232H/App.config b/FT232H/App.config
new file mode 100644
index 0000000..5c9509c
--- /dev/null
+++ b/FT232H/App.config
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FT232H/FT232H.vbproj b/FT232H/FT232H.vbproj
new file mode 100644
index 0000000..552c2c4
--- /dev/null
+++ b/FT232H/FT232H.vbproj
@@ -0,0 +1,242 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {86A59897-E612-4EB1-A4BC-0BB1DBF7E23B}
+ WinExe
+ FT232H.My.MyApplication
+ FT232H
+ FT232H
+ 512
+ WindowsForms
+ v4.7.2
+ true
+ true
+
+
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ bin\Debug\
+ FT232H.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ AnyCPU
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ FT232H.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+ ..\packages\Autofac.4.8.1\lib\net45\Autofac.dll
+
+
+ ..\packages\HidSharp.2.1.0\lib\net35\HidSharp.dll
+
+
+ ..\packages\Iot.Device.Bindings.3.2.0\lib\netstandard2.0\Iot.Device.Bindings.dll
+
+
+ ..\packages\LibreHardwareMonitorLib.0.9.4\lib\net472\LibreHardwareMonitorLib.dll
+
+
+ ..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.3\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
+
+
+ ..\packages\Microsoft.Bcl.HashCode.6.0.0\lib\net462\Microsoft.Bcl.HashCode.dll
+
+
+
+ ..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.9.0.3\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll
+
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.9.0.3\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+ ..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll
+
+
+ ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\Powell.Devices.1.0.6\lib\netstandard2.0\Powell.Devices.dll
+
+
+ ..\packages\Powell.Devices.Things.ADS111x.1.0.2\lib\netstandard2.0\Powell.Devices.Things.ADS111x.dll
+
+
+ ..\packages\Powell.Shared.1.0.0\lib\netstandard2.0\Powell.Shared.dll
+
+
+
+ ..\packages\System.Buffers.4.6.1\lib\net462\System.Buffers.dll
+
+
+ ..\packages\System.CodeDom.9.0.3\lib\net462\System.CodeDom.dll
+
+
+
+
+ ..\packages\System.Device.Gpio.3.2.0\lib\netstandard2.0\System.Device.Gpio.dll
+
+
+ ..\packages\System.Diagnostics.DiagnosticSource.9.0.3\lib\net462\System.Diagnostics.DiagnosticSource.dll
+
+
+
+ ..\packages\System.Drawing.Common.9.0.3\lib\net462\System.Drawing.Common.dll
+
+
+ ..\packages\System.IO.Pipelines.9.0.3\lib\net462\System.IO.Pipelines.dll
+
+
+ ..\packages\System.IO.Ports.9.0.3\lib\net462\System.IO.Ports.dll
+
+
+
+ ..\packages\System.Memory.4.6.2\lib\net462\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.6.1\lib\net462\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll
+ True
+ True
+
+
+ ..\packages\System.Reflection.TypeExtensions.4.5.1\lib\net461\System.Reflection.TypeExtensions.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.1.1\lib\net462\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Security.AccessControl.6.0.1\lib\net461\System.Security.AccessControl.dll
+
+
+ ..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll
+
+
+
+ ..\packages\System.Text.Encodings.Web.9.0.3\lib\net462\System.Text.Encodings.Web.dll
+
+
+ ..\packages\System.Text.Json.9.0.3\lib\net462\System.Text.Json.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.6.2\lib\net462\System.Threading.Tasks.Extensions.dll
+
+
+
+
+
+
+
+
+
+ ..\packages\UnitsNet.5.73.0\lib\netstandard2.0\UnitsNet.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.vb
+ Form
+
+
+
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ Form1.vb
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
+
+
+
+
+
+
+ Questo progetto fa riferimento a uno o più pacchetti NuGet che non sono presenti in questo computer. Usare lo strumento di ripristino dei pacchetti NuGet per scaricarli. Per altre informazioni, vedere http://go.microsoft.com/fwlink/?LinkID=322105. Il file mancante è {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FT232H/Form1.Designer.vb b/FT232H/Form1.Designer.vb
new file mode 100644
index 0000000..049e73b
--- /dev/null
+++ b/FT232H/Form1.Designer.vb
@@ -0,0 +1,85 @@
+
+Partial Class Form1
+ Inherits System.Windows.Forms.Form
+
+ 'Form esegue l'override del metodo Dispose per pulire l'elenco dei componenti.
+
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Richiesto da Progettazione Windows Form
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTA: la procedura che segue è richiesta da Progettazione Windows Form
+ 'Può essere modificata in Progettazione Windows Form.
+ 'Non modificarla mediante l'editor del codice.
+
+ Private Sub InitializeComponent()
+ Me.components = New System.ComponentModel.Container()
+ Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
+ Me.TextBox1 = New System.Windows.Forms.TextBox()
+ Me.Button1 = New System.Windows.Forms.Button()
+ Me.Button2 = New System.Windows.Forms.Button()
+ Me.SuspendLayout()
+ '
+ 'Timer1
+ '
+ Me.Timer1.Interval = 1000
+ '
+ 'TextBox1
+ '
+ Me.TextBox1.BackColor = System.Drawing.SystemColors.MenuHighlight
+ Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel, CType(0, Byte))
+ Me.TextBox1.ForeColor = System.Drawing.SystemColors.Window
+ Me.TextBox1.Location = New System.Drawing.Point(25, 24)
+ Me.TextBox1.MaxLength = 80
+ Me.TextBox1.Multiline = True
+ Me.TextBox1.Name = "TextBox1"
+ Me.TextBox1.Size = New System.Drawing.Size(417, 141)
+ Me.TextBox1.TabIndex = 0
+ '
+ 'Button1
+ '
+ Me.Button1.Location = New System.Drawing.Point(479, 24)
+ Me.Button1.Name = "Button1"
+ Me.Button1.Size = New System.Drawing.Size(75, 23)
+ Me.Button1.TabIndex = 1
+ Me.Button1.Text = "Button1"
+ Me.Button1.UseVisualStyleBackColor = True
+ '
+ 'Button2
+ '
+ Me.Button2.Location = New System.Drawing.Point(479, 53)
+ Me.Button2.Name = "Button2"
+ Me.Button2.Size = New System.Drawing.Size(75, 23)
+ Me.Button2.TabIndex = 2
+ Me.Button2.Text = "Button2"
+ Me.Button2.UseVisualStyleBackColor = True
+ '
+ 'Form1
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(800, 450)
+ Me.Controls.Add(Me.Button2)
+ Me.Controls.Add(Me.Button1)
+ Me.Controls.Add(Me.TextBox1)
+ Me.Name = "Form1"
+ Me.Text = "Form1"
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents Timer1 As Timer
+ Friend WithEvents TextBox1 As TextBox
+ Friend WithEvents Button1 As Button
+ Friend WithEvents Button2 As Button
+End Class
diff --git a/FT232H/Form1.resx b/FT232H/Form1.resx
new file mode 100644
index 0000000..d0d99f4
--- /dev/null
+++ b/FT232H/Form1.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/FT232H/Form1.vb b/FT232H/Form1.vb
new file mode 100644
index 0000000..edd042e
--- /dev/null
+++ b/FT232H/Form1.vb
@@ -0,0 +1,153 @@
+Imports System.ComponentModel
+Imports System.Management
+Imports Iot.Device.Ads1115
+Imports UnitsNet
+Public Class Form1
+ Dim lcd As LCD_i2c
+ Dim ads As Ads1115
+ Dim config As Byte()
+ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ 'Module1.Main()
+ Dim dis = Modulo_ft232H.SelezionaDispositivo("FTAI6ATR")
+ Dim lista = Modulo_ft232H.ElencoDispositivi(dis)
+ Dim result As String = String.Join(",", lista)
+ Console.WriteLine(result)
+ 'Dim lcd_i2c = Modulo_ft232H.SelezionaDispositivo("FTAI6ATR", &H27)
+
+ Dim lcd_i2c = Modulo_ft232H.SelezionaDispositivo(dis, &H27)
+ lcd = New LCD_i2c(lcd_i2c)
+ lcd.lcdSetCursor(0, 0)
+ lcd.lcdPrint("dispositivi address:")
+ lcd.lcdSetCursor(1, 0)
+ lcd.lcdPrint(result)
+ TextBox1.Font = New Font("5x8 LCD HD44780U A02", 20, FontStyle.Regular)
+
+ ' Misura la larghezza di un singolo carattere
+ Dim characterWidth As Single = TextBox1.CreateGraphics().MeasureString("A", TextBox1.Font).Width
+
+ ' Calcola la larghezza desiderata per 20 caratteri
+ Dim desiredWidth As Integer = CInt(characterWidth * 14)
+
+ ' Aggiungi un margine extra per i bordi (ad esempio 10px per lato)
+ Dim margin As Integer = 10
+ TextBox1.Width = desiredWidth
+
+
+
+ ' Seleziona ADS1115 su indirizzo 0x48
+ 'ads = Modulo_ft232H.SelezionaDispositivo(dis, &H48)
+
+ ads = New Ads1115(Modulo_ft232H.SelezionaDispositivo(dis, &H48), MeasuringRange.FS6144)
+ ' CONFIG: AIN0 rispetto a GND, ±4.096V, Continuous Mode, 128 SPS
+ '
+ Dim config As Byte() = {&H81, &H0}
+ ' AIN0 rispetto a GND, PGA ±6.144V, Continuous Mode, 128 SPS
+ 'ads.Write(config)
+
+
+
+
+ ' Verifica la configurazione
+ 'ads.Write({&H1}) ' Seleziona il registro CONFIG
+ 'Dim configData As Byte() = New Byte(1) {}
+ 'ads.Read(configData)
+ ' Legge dal canale AIN0 rispetto a GND in modalità single-shot
+ Dim valore As Double = LeggiADC()
+ Console.WriteLine("Valore ADC: " & valore.ToString("F4") & " V")
+ Threading.Thread.Sleep(500)
+ Threading.Thread.Sleep(10) ' Attendi almeno 10ms prima di leggere
+ Timer1.Interval = 500
+ Timer1.Start()
+ lcd.lcdClear()
+ End Sub
+
+ Private Sub Form1_Closed(sender As Object, e As EventArgs) Handles Me.Closed
+
+ End Sub
+
+ Private Sub Form1_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
+ Timer1.Stop()
+ lcd.lcdClear()
+ lcd.lcdPrint("programma chiuso")
+ End Sub
+ Dim testo = "ads"
+ Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
+ ' Ottieni l'ora corrente
+ Dim oraCorrente As String = DateTime.Now.ToString("HH:mm:ss")
+ Select Case testo
+ Case "ads"
+ AggiornaTextBoxConPosizione("valore: " + LeggiADC().ToString("F2"), 3)
+ Case "temp"
+ Dim reader As New TemperatureReader()
+ AggiornaTextBoxConPosizione(reader.GetCpuTemperature(), 3)
+ End Select
+ AggiornaTextBoxConPosizione(oraCorrente, 2)
+ End Sub
+ Sub temperatura()
+ Try
+ Dim searcher As New ManagementObjectSearcher("root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature")
+
+ For Each queryObj As ManagementObject In searcher.Get()
+ Dim tempKelvin As Double = CDbl(queryObj("CurrentTemperature"))
+ Dim tempCelsius As Double = (tempKelvin - 2732) / 10.0
+ AggiornaTextBoxConPosizione("Temperatura CPU: " & tempCelsius.ToString("0.0") & "°C", 3)
+ Next
+ Catch ex As Exception
+ Console.WriteLine("Errore: " & ex.Message)
+ End Try
+ End Sub
+ Public Function LeggiADC() As Double
+ ' Legge dal canale AIN0 rispetto a GND in modalità single-shot e converte in Double
+ Dim valore As ElectricPotential = ads.ReadVoltage(InputMultiplexer.AIN0)
+ Return valore.Volts ' Estrai il valore in Volt
+ End Function
+ ' Variabile globale per evitare aggiornamenti ricorsivi
+ Private aggiornamentoInCorso As Boolean = False
+
+ Private Sub AggiornaTextBoxConPosizione(nuovoTesto As String, riga As Integer)
+ Dim lines As List(Of String) = TextBox1.Lines.ToList()
+
+ ' Salva la posizione attuale del cursore
+ Dim posizione As Integer = TextBox1.SelectionStart
+
+ ' Se la TextBox è vuota, iniziamo con una riga vuota
+ If lines.Count = 0 Then
+ lines.Add("")
+ End If
+
+ ' Assicuriamoci che la riga esista (aggiungiamo righe vuote se necessario)
+ While lines.Count <= riga
+ lines.Add("")
+ End While
+
+ ' Modifica la riga specificata
+ lines(riga) = nuovoTesto.Substring(0, Math.Min(nuovoTesto.Length, 20)).PadRight(20)
+
+ ' Imposta il nuovo contenuto nella TextBox
+ TextBox1.Lines = lines.ToArray()
+
+ ' Ripristina la posizione del cursore
+ posizione = Math.Min(posizione, TextBox1.Text.Length)
+ TextBox1.SelectionStart = posizione
+ End Sub
+
+ Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
+ Dim lines = TextBox1.Lines
+ Dim i = 0
+ For i = 0 To 3
+
+ lcd.lcdSetCursor(i, 0)
+ lcd.lcdPrint(lines(i).PadRight(20))
+ Next
+
+
+ End Sub
+
+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
+ testo = "ads"
+ End Sub
+
+ Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
+ testo = "temp"
+ End Sub
+End Class
diff --git a/FT232H/ILLink/ILLink.Descriptors.LibraryBuild.xml b/FT232H/ILLink/ILLink.Descriptors.LibraryBuild.xml
new file mode 100644
index 0000000..a42d7f0
--- /dev/null
+++ b/FT232H/ILLink/ILLink.Descriptors.LibraryBuild.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/FT232H/LCD_i2c.vb b/FT232H/LCD_i2c.vb
new file mode 100644
index 0000000..ffa298d
--- /dev/null
+++ b/FT232H/LCD_i2c.vb
@@ -0,0 +1,58 @@
+Imports System.Device.I2c
+Imports System.Text
+
+Public Class LCD_i2c
+
+ Dim i2cDeviceConnect As I2cDevice
+ Public Sub New(i2cDeviceConnect As I2cDevice)
+ Me.i2cDeviceConnect = i2cDeviceConnect
+ InitializeLCD()
+ End Sub
+
+ Sub InitializeLCD()
+ ' Modalità 4-bit
+ lcdWrite(&H33, 0) ' Inizializza a 4-bit
+ lcdWrite(&H32, 0) ' Conferma modalità 4-bit
+ lcdWrite(&H28, 0) ' 2 righe, font 5x8
+ lcdWrite(&HC, 0) ' Display ON, cursore OFF
+ lcdWrite(&H6, 0) ' Scrittura da sinistra a destra
+ lcdWrite(&H1, 0) ' Pulisce il display
+ Threading.Thread.Sleep(5) ' Pausa per completare l'operazione di clear display
+ End Sub
+ Sub lcdClear()
+ lcdWrite(&H1, 0)
+ Threading.Thread.Sleep(5) ' Pausa
+ End Sub
+ Sub lcdWrite(value As Byte, mode As Byte)
+ ' Calcola la parte alta e bassa del comando
+ Dim high As Byte = (value And &HF0) Or &H8 Or mode
+ Dim low As Byte = ((value << 4) And &HF0) Or &H8 Or mode
+
+ ' Scrivi la parte alta (E alta, E bassa)
+ i2cDeviceConnect.Write(New Byte() {high})
+ i2cDeviceConnect.Write(New Byte() {high Or &H4}) ' Imposta E alta
+ i2cDeviceConnect.Write(New Byte() {high}) ' E bassa
+
+ ' Scrivi la parte bassa (E alta, E bassa)
+ i2cDeviceConnect.Write(New Byte() {low})
+ i2cDeviceConnect.Write(New Byte() {low Or &H4}) ' Imposta E alta
+ i2cDeviceConnect.Write(New Byte() {low}) ' E bassa
+ End Sub
+
+ Sub lcdSetCursor(line As Integer, Optional pos As Integer = 0)
+ Dim addresses As Byte() = New Byte() {&H80, &HC0, &H94, &HD4} ' Indirizzi per LCD 4 righe
+ If line >= 0 And line <= 3 Then
+ lcdWrite(addresses(line) + CByte(pos), 0) ' Aggiungi la posizione al comando di indirizzo
+ End If
+ Threading.Thread.Sleep(5) ' Pausa
+ End Sub
+ Sub lcdPrint(Message As String)
+ ' Scrive l'intero messaggio in un'unica operazione
+ Dim messageBytes As Byte() = Encoding.ASCII.GetBytes(Message)
+ For i As Integer = 0 To messageBytes.Length - 1
+ lcdWrite(messageBytes(i), 1) ' Invia i caratteri come dati
+ Next
+ End Sub
+
+
+End Class
diff --git a/FT232H/Module1.vb b/FT232H/Module1.vb
new file mode 100644
index 0000000..c31d28f
--- /dev/null
+++ b/FT232H/Module1.vb
@@ -0,0 +1,127 @@
+'Imports Iot.Device.Board
+'Imports Iot.Device.Ft232H
+'Imports Iot.Device.FtCommon
+'Imports System.Device.I2c
+'Imports System.IO
+'Imports System.Text
+'Imports System.Threading
+
+'Module Module1
+' Dim i2cDevice As I2cDevice
+' Dim modeBit As Integer = 8
+
+' Sub Main()
+' ' Disabilita la stampa degli errori sulla console
+
+' ' Ottieni i dispositivi connessi
+' Dim devices = FtCommon.GetDevices()
+' Console.WriteLine($"{devices.Count} available device(s)")
+
+' ' Verifica se ci sono dispositivi
+' If devices.Count = 0 Then
+' Console.WriteLine("No device connected")
+' Return
+' End If
+
+' ' Seleziona il primo dispositivo FT232H
+' Dim ftDevice As FtDevice = devices(0)
+' Dim ft232h As New Ft232HDevice(ftDevice)
+
+' ' Crea il bus I2C
+' Dim i2c = ft232h.CreateOrGetI2cBus(0)
+' Dim foundAddresses = i2c.PerformBusScan()
+
+' ' Stampa gli indirizzi trovati
+' If foundAddresses.Count > 0 Then
+' ' Se il dispositivo è trovato all'indirizzo 0x27 (ad esempio per un LCD I2C)
+' Dim deviceAddress As Byte = &H27
+' Console.WriteLine($"Dispositivo trovato all'indirizzo: {deviceAddress:X2}")
+
+' ' Crea il dispositivo I2C
+' i2cDevice = i2c.CreateDevice(deviceAddress)
+
+' ' Inizializzazione del display LCD I2C
+' Try
+' modeBit = 4
+' ' Inizializza l'LCD
+' InitializeLCDxx()
+
+' ' Imposta il cursore su una posizione
+' 'lcdSetCursor(1, 0) ' Posizione (1, 0) nella prima riga
+' 'lcdSetCursor(4)
+' ' Scrivi un messaggio
+' Dim message As String = "Controllo:"
+' ' Scrive l'intero messaggio in un'unica operazione
+' Dim messageBytes As Byte() = Encoding.ASCII.GetBytes(message)
+' For i As Integer = 0 To messageBytes.Length - 1
+' lcdWritexx(messageBytes(i), 1) ' Invia i caratteri come dati
+' Next
+' Catch ex As Exception
+' Console.WriteLine($"Errore durante la scrittura o l'inizializzazione: {ex.Message}")
+' End Try
+' Else
+' Console.WriteLine("Nessun dispositivo trovato")
+' End If
+' End Sub
+
+' Sub InitializeLCDxx()
+' If modeBit = 4 Then
+' ' Modalità 4-bit
+' lcdWritexx(&H33, 0) ' Inizializza a 4-bit
+' lcdWritexx(&H32, 0) ' Conferma modalità 4-bit
+' lcdWritexx(&H28, 0) ' 2 righe, font 5x8
+' lcdWritexx(&HC, 0) ' Display ON, cursore OFF
+' lcdWritexx(&H6, 0) ' Scrittura da sinistra a destra
+' lcdWritexx(&H1, 0) ' Pulisce il display
+' Threading.Thread.Sleep(5) ' Pausa per completare l'operazione di clear display
+' ElseIf modeBit = 8 Then
+' ' Inizializzazione display (modalità 8 bit)
+' lcdWritexx(&H38, 0) ' Funzione: modalità 8-bit, 2 righe, font 5x8
+' lcdWritexx(&HC, 0) ' Display On, cursore OFF
+' lcdWritexx(&H6, 0) ' Scrittura da sinistra a destra
+' lcdWritexx(&H1, 0) ' Clear display
+' Threading.Thread.Sleep(5) ' Pausa per completare l'operazione di clear display
+' lcdWritexx(&HE, 0) ' Cursore lampeggiante
+' Threading.Thread.Sleep(5)
+' End If
+' End Sub
+
+' Sub lcdWritexx(value As Byte, mode As Byte)
+' If modeBit = 4 Then
+' ' Calcola la parte alta e bassa del comando
+' Dim high As Byte = (value And &HF0) Or &H8 Or (mode << 0)
+' Dim low As Byte = ((value << 4) And &HF0) Or &H8 Or (mode << 0)
+
+' ' Scrivi la parte alta (E alta, E bassa)
+' i2cDevice.Write(New Byte() {high})
+' i2cDevice.Write(New Byte() {high Or &H4}) ' Imposta E alta
+' i2cDevice.Write(New Byte() {high}) ' E bassa
+
+' ' Scrivi la parte bassa (E alta, E bassa)
+' i2cDevice.Write(New Byte() {low})
+' i2cDevice.Write(New Byte() {low Or &H4}) ' Imposta E alta
+' i2cDevice.Write(New Byte() {low}) ' E bassa
+' ElseIf modeBit = 8 Then
+' ' Scrittura a 8 bit
+' Dim byteToSend As Byte = (value And &HFF) Or &H8 Or (mode << 0)
+
+' ' Scrivi il comando/dato (byte a 8 bit)
+' i2cDevice.Write(New Byte() {byteToSend})
+
+' ' Aggiungi una pausa dopo la scrittura (tempo di abilitazione E)
+' i2cDevice.Write(New Byte() {byteToSend Or &H4}) ' Imposta E alta
+' Threading.Thread.Sleep(1) ' Breve ritardo per stabilizzare
+' i2cDevice.Write(New Byte() {byteToSend}) ' Imposta E bassa per completare la scrittura
+
+' ' Attendere un breve periodo per garantire che il display elabori il comando
+' Threading.Thread.Sleep(2)
+' End If
+' End Sub
+
+' Sub lcdSetCursor(line As Integer, Optional pos As Integer = 0)
+' Dim addresses As Byte() = New Byte() {&H80, &HC0, &H94, &HD4} ' Indirizzi per LCD 4 righe
+' If line >= 1 And line <= 4 Then
+' lcdWritexx(addresses(line - 1) + CByte(pos), 0) ' Aggiungi la posizione al comando di indirizzo
+' End If
+' End Sub
+'End Module
diff --git a/FT232H/Modulo_ft232H.vb b/FT232H/Modulo_ft232H.vb
new file mode 100644
index 0000000..1006c0e
--- /dev/null
+++ b/FT232H/Modulo_ft232H.vb
@@ -0,0 +1,74 @@
+Imports System.Device.I2c
+Imports Iot.Device.Board
+Imports Iot.Device.Ft232H
+Imports Iot.Device.FtCommon
+
+Module Modulo_ft232H
+ Public Function ElencoDispositivi() As List(Of FtDevice)
+ Return FtCommon.GetDevices()
+ End Function
+
+ Public Function SelezionaDispositivo(x As Integer) As I2cBus
+ ' Seleziona il primo dispositivo FT232H
+ Dim ftDevice As FtDevice = ElencoDispositivi()(x)
+ Dim ft232h As New Ft232HDevice(ftDevice)
+
+ ' Crea il bus I2C
+ Return ft232h.CreateOrGetI2cBus(0)
+ End Function
+ Public Function SelezionaDispositivo(dispositivo As I2cBus, i2c_address As Byte) As I2cDevice
+ Return dispositivo.CreateDevice(i2c_address)
+ End Function
+ Public Function SelezionaDispositivo(NumeroSerie As String, i2c_address As Byte) As I2cDevice
+ Dim i2c = SelezionaDispositivo(NumeroSerie)
+ Return SelezionaDispositivo(i2c, i2c_address)
+
+ End Function
+ '''
+ ''' Seleziona il dispositivo principale ft232H con numero di serie
+ '''
+ ''' numero di serie
+ '''
+ Public Function SelezionaDispositivo(numerioSerie As String) As I2cBus
+ ' Seleziona il primo dispositivo FT232H
+ For Each ftDevice In ElencoDispositivi()
+ If ftDevice.SerialNumber = numerioSerie Then
+ Dim ft232h As New Ft232HDevice(ftDevice)
+ ' Crea il bus I2C
+ Return ft232h.CreateOrGetI2cBus(0)
+ End If
+ Next
+ Return Nothing
+ End Function
+ Public Function ElencoDispositivi(dispositivo As I2cBus) As List(Of String)
+ ' Esegui la scansione dei dispositivi sul bus I2C
+ Dim dispositiviTrovati As List(Of Integer) = dispositivo.PerformBusScan()
+
+ ' Crea una nuova lista per memorizzare i risultati in formato esadecimale
+ Dim dispositiviEsadecimali As New List(Of String)
+
+ ' Aggiungi i dispositivi alla lista, formattati come stringhe esadecimali
+ For Each dispositivox In dispositiviTrovati
+ dispositiviEsadecimali.Add("&H" + dispositivox.ToString("X2")) ' "X2" formatta in esadecimale con 2 cifre
+ Next
+
+ ' Restituisci la lista dei dispositivi come stringhe esadecimali
+ Return dispositiviEsadecimali
+ End Function
+ Public Function ScansionaDispositivo_byte(dispositivo As I2cBus) As List(Of Byte)
+ ' Esegui la scansione dei dispositivi sul bus I2C
+ Dim dispositiviTrovati As List(Of Integer) = dispositivo.PerformBusScan()
+
+ ' Crea una nuova lista per memorizzare i risultati come byte
+ Dim dispositiviByte As New List(Of Byte)
+
+ ' Aggiungi i dispositivi alla lista come byte
+ For Each dispositivox In dispositiviTrovati
+ dispositiviByte.Add(CByte(dispositivox)) ' Converte il numero intero in byte
+ Next
+
+ ' Restituisci la lista dei dispositivi come byte
+ Return dispositiviByte
+ End Function
+
+End Module
diff --git a/FT232H/My Project/Application.Designer.vb b/FT232H/My Project/Application.Designer.vb
new file mode 100644
index 0000000..0cf7a81
--- /dev/null
+++ b/FT232H/My Project/Application.Designer.vb
@@ -0,0 +1,38 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
+ ' or if you encounter build errors in this file, go to the Project Designer
+ ' (go to Project Properties or double-click the My Project node in
+ ' Solution Explorer), and make changes on the Application tab.
+ '
+ Partial Friend Class MyApplication
+
+ _
+ Public Sub New()
+ MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
+ Me.IsSingleInstance = false
+ Me.EnableVisualStyles = true
+ Me.SaveMySettingsOnExit = true
+ Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
+ End Sub
+
+ _
+ Protected Overrides Sub OnCreateMainForm()
+ Me.MainForm = Global.FT232H.Form1
+ End Sub
+ End Class
+End Namespace
diff --git a/FT232H/My Project/Application.myapp b/FT232H/My Project/Application.myapp
new file mode 100644
index 0000000..1243847
--- /dev/null
+++ b/FT232H/My Project/Application.myapp
@@ -0,0 +1,11 @@
+
+
+ true
+ Form1
+ false
+ 0
+ true
+ 0
+ 0
+ true
+
diff --git a/FT232H/My Project/AssemblyInfo.vb b/FT232H/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..1ed8939
--- /dev/null
+++ b/FT232H/My Project/AssemblyInfo.vb
@@ -0,0 +1,32 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' Le informazioni generali relative a un assembly sono controllate dal seguente
+' set di attributi. Modificare i valori di questi attributi per modificare le informazioni
+' associate a un assembly.
+
+' Controllare i valori degli attributi degli assembly
+
+
+
+
+
+
+
+
+
+
+'Se il progetto viene esposto a COM, il GUID seguente verrà usato come ID del typelib
+
+
+' Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
+'
+' Versione principale
+' Versione secondaria
+' Numero di build
+' Revisione
+'
+
+
+
diff --git a/FT232H/My Project/Resources.Designer.vb b/FT232H/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..c8a4530
--- /dev/null
+++ b/FT232H/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("FT232H.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/FT232H/My Project/Resources.resx b/FT232H/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/FT232H/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/FT232H/My Project/Settings.Designer.vb b/FT232H/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..3e238f9
--- /dev/null
+++ b/FT232H/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.FT232H.My.MySettings
+ Get
+ Return Global.FT232H.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/FT232H/My Project/Settings.settings b/FT232H/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/FT232H/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/FT232H/TemperatureReader.vb b/FT232H/TemperatureReader.vb
new file mode 100644
index 0000000..ec1e8d1
--- /dev/null
+++ b/FT232H/TemperatureReader.vb
@@ -0,0 +1,68 @@
+Imports LibreHardwareMonitor.Hardware
+
+Public Class TemperatureReader
+ Private Class UpdateVisitor
+ Implements IVisitor
+
+ Public Sub VisitHardware(hardware As IHardware) Implements IVisitor.VisitHardware
+ hardware.Update()
+ For Each sensor In hardware.Sensors
+ sensor.Accept(Me)
+ Next
+ For Each subHardware In hardware.SubHardware
+ subHardware.Accept(Me)
+ Next
+ End Sub
+
+ Public Sub VisitSensor(sensor As ISensor) Implements IVisitor.VisitSensor
+ End Sub
+
+ Public Sub VisitParameter(parameter As IParameter) Implements IVisitor.VisitParameter
+ End Sub
+
+ Public Sub VisitComputer(computer As IComputer) Implements IVisitor.VisitComputer
+ For Each hardware In computer.Hardware
+ hardware.Accept(Me)
+ Next
+ End Sub
+ End Class
+
+ Public Function GetCpuTemperature() As String
+ Dim computer As New Computer() With {
+ .IsCpuEnabled = True
+ }
+ computer.Open()
+
+ Dim visitor As New UpdateVisitor()
+ computer.Accept(visitor) ' Aggiorna tutte le informazioni hardware
+
+ Dim temperature As String = "N/A"
+
+ ' Ciclo per trovare i sensori della CPU e leggere la temperatura
+ For Each hardware In computer.Hardware
+ If hardware.HardwareType = HardwareType.Cpu Then
+ hardware.Update() ' Aggiorna i dati della CPU
+ Console.WriteLine(SensorType.Temperature)
+ For Each sensor In hardware.Sensors
+ Console.WriteLine(sensor.SensorType)
+ If sensor.SensorType = SensorType.Temperature Then
+ If sensor.Value IsNot Nothing Then
+ temperature = sensor.Value.ToString() & "°C"
+ End If
+ End If
+ Next
+ End If
+ Next
+
+ computer.Close()
+ Return temperature
+ End Function
+End Class
+
+Module Program
+ Sub Main()
+ Dim reader As New TemperatureReader()
+ Console.WriteLine("Temperatura CPU: " & reader.GetCpuTemperature())
+ Console.ReadLine()
+ End Sub
+End Module
diff --git a/FT232H/packages.config b/FT232H/packages.config
new file mode 100644
index 0000000..4e50792
--- /dev/null
+++ b/FT232H/packages.config
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file