From 60b30c036397cb5627fa374bb930794b225daa29 Mon Sep 17 00:00:00 2001 From: Jack Humbert <jack.humb@gmail.com> Date: Fri, 7 Jul 2017 11:55:23 -0400 Subject: Squashed 'lib/lufa/' content from commit 385d40300 git-subtree-dir: lib/lufa git-subtree-split: 385d4030035dbaf41591309dbde47653bd03841b --- .../LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs | 131 ++ Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs | 115 + Projects/LEDNotifier/CPUUsageApp/CPUMonitor.csproj | 95 + Projects/LEDNotifier/CPUUsageApp/CPUMonitor.resx | 132 ++ Projects/LEDNotifier/CPUUsageApp/Program.cs | 21 + .../CPUUsageApp/Properties/AssemblyInfo.cs | 36 + .../CPUUsageApp/Properties/Resources.Designer.cs | 63 + .../CPUUsageApp/Properties/Resources.resx | 117 + .../CPUUsageApp/Properties/Settings.Designer.cs | 26 + .../CPUUsageApp/Properties/Settings.settings | 7 + Projects/LEDNotifier/Config/LUFAConfig.h | 93 + Projects/LEDNotifier/Descriptors.c | 245 ++ Projects/LEDNotifier/Descriptors.h | 110 + .../LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs | 149 ++ Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs | 75 + Projects/LEDNotifier/LEDMixerApp/LEDMixer.csproj | 95 + Projects/LEDNotifier/LEDMixerApp/LEDMixer.resx | 123 + Projects/LEDNotifier/LEDMixerApp/Program.cs | 21 + .../LEDMixerApp/Properties/AssemblyInfo.cs | 36 + .../LEDMixerApp/Properties/Resources.Designer.cs | 63 + .../LEDMixerApp/Properties/Resources.resx | 117 + .../LEDMixerApp/Properties/Settings.Designer.cs | 26 + .../LEDMixerApp/Properties/Settings.settings | 7 + Projects/LEDNotifier/LEDNotifier.c | 178 ++ Projects/LEDNotifier/LEDNotifier.h | 60 + Projects/LEDNotifier/LEDNotifier.txt | 63 + Projects/LEDNotifier/LUFA LED Notifier.inf | 66 + Projects/LEDNotifier/asf.xml | 51 + Projects/LEDNotifier/doxyfile | 2397 ++++++++++++++++++++ Projects/LEDNotifier/makefile | 43 + 30 files changed, 4761 insertions(+) create mode 100644 Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/CPUMonitor.csproj create mode 100644 Projects/LEDNotifier/CPUUsageApp/CPUMonitor.resx create mode 100644 Projects/LEDNotifier/CPUUsageApp/Program.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/Properties/Resources.resx create mode 100644 Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs create mode 100644 Projects/LEDNotifier/CPUUsageApp/Properties/Settings.settings create mode 100644 Projects/LEDNotifier/Config/LUFAConfig.h create mode 100644 Projects/LEDNotifier/Descriptors.c create mode 100644 Projects/LEDNotifier/Descriptors.h create mode 100644 Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/LEDMixer.csproj create mode 100644 Projects/LEDNotifier/LEDMixerApp/LEDMixer.resx create mode 100644 Projects/LEDNotifier/LEDMixerApp/Program.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/Properties/AssemblyInfo.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/Properties/Resources.Designer.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/Properties/Resources.resx create mode 100644 Projects/LEDNotifier/LEDMixerApp/Properties/Settings.Designer.cs create mode 100644 Projects/LEDNotifier/LEDMixerApp/Properties/Settings.settings create mode 100644 Projects/LEDNotifier/LEDNotifier.c create mode 100644 Projects/LEDNotifier/LEDNotifier.h create mode 100644 Projects/LEDNotifier/LEDNotifier.txt create mode 100644 Projects/LEDNotifier/LUFA LED Notifier.inf create mode 100644 Projects/LEDNotifier/asf.xml create mode 100644 Projects/LEDNotifier/doxyfile create mode 100644 Projects/LEDNotifier/makefile (limited to 'Projects/LEDNotifier') diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs new file mode 100644 index 0000000000..2b189943a7 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.Designer.cs @@ -0,0 +1,131 @@ +namespace CPUMonitor +{ + partial class frmCPU + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.serSerialPort = new System.IO.Ports.SerialPort(this.components); + this.tmrCPUTimer = new System.Windows.Forms.Timer(this.components); + this.cmbComPort = new System.Windows.Forms.ComboBox(); + this.pcCPUUsage = new System.Diagnostics.PerformanceCounter(); + this.lblCPU = new System.Windows.Forms.Label(); + this.nicoNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components); + this.btnMinimizeToTray = new System.Windows.Forms.Button(); + this.btnExit = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).BeginInit(); + this.SuspendLayout(); + // + // tmrCPUTimer + // + this.tmrCPUTimer.Enabled = true; + this.tmrCPUTimer.Interval = 1000; + this.tmrCPUTimer.Tick += new System.EventHandler(this.tmrCPUTimer_Tick); + // + // cmbComPort + // + this.cmbComPort.FormattingEnabled = true; + this.cmbComPort.Location = new System.Drawing.Point(48, 12); + this.cmbComPort.Name = "cmbComPort"; + this.cmbComPort.Size = new System.Drawing.Size(156, 21); + this.cmbComPort.TabIndex = 0; + this.cmbComPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged); + // + // pcCPUUsage + // + this.pcCPUUsage.CategoryName = "Processor"; + this.pcCPUUsage.CounterName = "% Processor Time"; + this.pcCPUUsage.InstanceName = "_Total"; + // + // lblCPU + // + this.lblCPU.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblCPU.Location = new System.Drawing.Point(44, 36); + this.lblCPU.Name = "lblCPU"; + this.lblCPU.Size = new System.Drawing.Size(160, 28); + this.lblCPU.TabIndex = 1; + this.lblCPU.Text = "0%"; + this.lblCPU.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // nicoNotifyIcon + // + this.nicoNotifyIcon.Text = "CPU Usage Monitor"; + this.nicoNotifyIcon.Visible = true; + // + // btnMinimizeToTray + // + this.btnMinimizeToTray.Location = new System.Drawing.Point(12, 67); + this.btnMinimizeToTray.Name = "btnMinimizeToTray"; + this.btnMinimizeToTray.Size = new System.Drawing.Size(111, 28); + this.btnMinimizeToTray.TabIndex = 2; + this.btnMinimizeToTray.Text = "Minimize to Tray"; + this.btnMinimizeToTray.UseVisualStyleBackColor = true; + this.btnMinimizeToTray.Click += new System.EventHandler(this.btnMinimizeToTray_Click); + // + // btnExit + // + this.btnExit.Location = new System.Drawing.Point(126, 67); + this.btnExit.Name = "btnExit"; + this.btnExit.Size = new System.Drawing.Size(111, 28); + this.btnExit.TabIndex = 3; + this.btnExit.Text = "Exit"; + this.btnExit.UseVisualStyleBackColor = true; + this.btnExit.Click += new System.EventHandler(this.btnExit_Click); + // + // frmCPU + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(249, 106); + this.Controls.Add(this.btnExit); + this.Controls.Add(this.btnMinimizeToTray); + this.Controls.Add(this.lblCPU); + this.Controls.Add(this.cmbComPort); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "frmCPU"; + this.Text = "CPU Usage Monitor"; + this.WindowState = System.Windows.Forms.FormWindowState.Minimized; + this.Load += new System.EventHandler(this.Form1_Load); + ((System.ComponentModel.ISupportInitialize)(this.pcCPUUsage)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.IO.Ports.SerialPort serSerialPort; + private System.Windows.Forms.Timer tmrCPUTimer; + private System.Windows.Forms.ComboBox cmbComPort; + private System.Diagnostics.PerformanceCounter pcCPUUsage; + private System.Windows.Forms.Label lblCPU; + private System.Windows.Forms.NotifyIcon nicoNotifyIcon; + private System.Windows.Forms.Button btnMinimizeToTray; + private System.Windows.Forms.Button btnExit; + } +} + diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs new file mode 100644 index 0000000000..32543fc59b --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Microsoft.Win32; + +namespace CPUMonitor +{ + public partial class frmCPU : Form + { + private RegistryKey AppRegKey; + + private const int LIGHT_MAX = 0x1F; + + public frmCPU() + { + InitializeComponent(); + + nicoNotifyIcon.Icon = this.Icon; + nicoNotifyIcon.MouseClick += new MouseEventHandler(TrayIconClick); + } + + private void Form1_Load(object sender, EventArgs e) + { + AppRegKey = Registry.CurrentUser.CreateSubKey("Software\\CPUMonitor"); + + String[] PortNames = System.IO.Ports.SerialPort.GetPortNames(); + Array.Sort<String>(PortNames, delegate(string strA, string strB) { return int.Parse(strA.Substring(3)).CompareTo(int.Parse(strB.Substring(3))); }); + cmbComPort.Items.Clear(); + cmbComPort.Items.AddRange(PortNames); + + cmbComPort.SelectedIndex = System.Convert.ToInt32(AppRegKey.GetValue("Port", "1")) - 1; + serSerialPort.PortName = cmbComPort.Text; + + Hide(); + } + + private void NotifyLight(int Red, int Green, int Blue) + { + byte[] buffer = new byte[3]; + buffer[0] = (byte)(0x80 | (Red & LIGHT_MAX)); + buffer[1] = (byte)(0x40 | (Green & LIGHT_MAX)); + buffer[2] = (byte)(0x20 | (Blue & LIGHT_MAX)); + + try + { + serSerialPort.PortName = cmbComPort.Text; + serSerialPort.Open(); + serSerialPort.Write(buffer, 0, buffer.Length); + serSerialPort.Close(); + } + catch (Exception e) + { + + } + } + + private void tmrCPUTimer_Tick(object sender, EventArgs e) + { + float CPUUsage = pcCPUUsage.NextValue(); + + int Red = 0; + int Green = 0; + int Blue = 0; + + if (CPUUsage < 25) + { + Green = (int)((LIGHT_MAX / 25) * CPUUsage); + } + else if (CPUUsage < 50) + { + Blue = (int)((LIGHT_MAX / 25) * (CPUUsage - 25)); + Green = LIGHT_MAX - Blue; + } + else if (CPUUsage < 75) + { + Red = (int)((LIGHT_MAX / 25) * (CPUUsage - 50)); + Blue = LIGHT_MAX - Red; + } + else + { + Red = LIGHT_MAX; + } + + NotifyLight(Red, Green, Blue); + lblCPU.Text = ((int)CPUUsage).ToString() + "%"; + } + + private void btnExit_Click(object sender, EventArgs e) + { + Application.Exit(); + } + + private void btnMinimizeToTray_Click(object sender, EventArgs e) + { + this.Hide(); + } + + private void TrayIconClick(object sender, MouseEventArgs e) + { + this.Show(); + this.WindowState = FormWindowState.Normal; + } + + private void cbPort_SelectedIndexChanged(object sender, EventArgs e) + { + AppRegKey.SetValue("Port", cmbComPort.SelectedIndex + 1); + serSerialPort.PortName = cmbComPort.Text; + } + } +} diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.csproj b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.csproj new file mode 100644 index 0000000000..d568a9dc48 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.csproj @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6040B049-4241-4FFD-B388-AACDA78D1469}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>CPUMonitor</RootNamespace> + <AssemblyName>CPUMonitor</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Xml.Linq"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data.DataSetExtensions"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Data" /> + <Reference Include="System.Deployment" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="CPUMonitor.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="CPUMonitor.Designer.cs"> + <DependentUpon>CPUMonitor.cs</DependentUpon> + </Compile> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <EmbeddedResource Include="CPUMonitor.resx"> + <DependentUpon>CPUMonitor.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + <SubType>Designer</SubType> + </EmbeddedResource> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Resources.resx</DependentUpon> + <DesignTime>True</DesignTime> + </Compile> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.resx b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.resx new file mode 100644 index 0000000000..c62b1b0203 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/CPUMonitor.resx @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="serSerialPort.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="tmrCPUTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>137, 17</value> + </metadata> + <metadata name="pcCPUUsage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>262, 17</value> + </metadata> + <metadata name="nicoNotifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>383, 17</value> + </metadata> +</root> \ No newline at end of file diff --git a/Projects/LEDNotifier/CPUUsageApp/Program.cs b/Projects/LEDNotifier/CPUUsageApp/Program.cs new file mode 100644 index 0000000000..cb4fd89f23 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace CPUMonitor +{ + static class Program + { + /// <summary> + /// The main entry point for the application. + /// </summary> + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new frmCPU()); + } + } +} diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..85d31fcba7 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CPUMonitor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("CPUMonitor")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3e4a61da-cdde-46de-848b-b5206d225e21")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs new file mode 100644 index 0000000000..bf80e05fc5 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.239 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace CPUMonitor.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // 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. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CPUMonitor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.resx b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.resx new file mode 100644 index 0000000000..af7dbebbac --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs new file mode 100644 index 0000000000..690fde3ba2 --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.239 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace CPUMonitor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.settings b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.settings new file mode 100644 index 0000000000..39645652af --- /dev/null +++ b/Projects/LEDNotifier/CPUUsageApp/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> diff --git a/Projects/LEDNotifier/Config/LUFAConfig.h b/Projects/LEDNotifier/Config/LUFAConfig.h new file mode 100644 index 0000000000..75713f94d0 --- /dev/null +++ b/Projects/LEDNotifier/Config/LUFAConfig.h @@ -0,0 +1,93 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * \brief LUFA Library Configuration Header File + * + * This header file is used to configure LUFA's compile time options, + * as an alternative to the compile time constants supplied through + * a makefile. + * + * For information on what each token does, refer to the LUFA + * manual section "Summary of Compile Tokens". + */ + +#ifndef _LUFA_CONFIG_H_ +#define _LUFA_CONFIG_H_ + + #if (ARCH == ARCH_AVR8) + + /* Non-USB Related Configuration Tokens: */ +// #define DISABLE_TERMINAL_CODES + + /* USB Class Driver Related Tokens: */ +// #define HID_HOST_BOOT_PROTOCOL_ONLY +// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} +// #define HID_USAGE_STACK_DEPTH {Insert Value Here} +// #define HID_MAX_COLLECTIONS {Insert Value Here} +// #define HID_MAX_REPORTITEMS {Insert Value Here} +// #define HID_MAX_REPORT_IDS {Insert Value Here} +// #define NO_CLASS_DRIVER_AUTOFLUSH + + /* General USB Driver Related Tokens: */ +// #define ORDERED_EP_CONFIG + #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) + #define USB_DEVICE_ONLY +// #define USB_HOST_ONLY +// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} +// #define NO_LIMITED_CONTROLLER_CONNECT +// #define NO_SOF_EVENTS + + /* USB Device Mode Driver Related Tokens: */ +// #define USE_RAM_DESCRIPTORS + #define USE_FLASH_DESCRIPTORS +// #define USE_EEPROM_DESCRIPTORS +// #define NO_INTERNAL_SERIAL + #define FIXED_CONTROL_ENDPOINT_SIZE 8 + #define DEVICE_STATE_AS_GPIOR 0 + #define FIXED_NUM_CONFIGURATIONS 1 +// #define CONTROL_ONLY_DEVICE +// #define INTERRUPT_CONTROL_ENDPOINT +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + + /* USB Host Mode Driver Related Tokens: */ +// #define HOST_STATE_AS_GPIOR {Insert Value Here} +// #define USB_HOST_TIMEOUT_MS {Insert Value Here} +// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} +// #define NO_AUTO_VBUS_MANAGEMENT +// #define INVERTED_VBUS_ENABLE_LINE + + #else + + #error Unsupported architecture for this LUFA configuration file. + + #endif +#endif diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c new file mode 100644 index 0000000000..31e6b44b64 --- /dev/null +++ b/Projects/LEDNotifier/Descriptors.c @@ -0,0 +1,245 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(1,1,0), + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_NoSpecificSubclass, + .Protocol = CDC_CSCP_NoSpecificProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, + .ProductID = 0x2044, + .ReleaseNumber = VERSION_BCD(0,0,1), + + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 2, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = (USB_CONFIG_ATTR_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .CDC_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_CCI, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(1,1,0), + }, + + .CDC_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = INTERFACE_ID_CDC_CCI, + .SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI, + }, + + .CDC_NotificationEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_NOTIFICATION_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_DCI, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_RX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + }, + + .CDC_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_TX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGUAGE_ID_ENG); + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LED Notifier"); + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + const void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = &DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case STRING_ID_Language: + Address = &LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + break; + case STRING_ID_Manufacturer: + Address = &ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + break; + case STRING_ID_Product: + Address = &ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} + diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h new file mode 100644 index 0000000000..b19682a2b6 --- /dev/null +++ b/Projects/LEDNotifier/Descriptors.h @@ -0,0 +1,110 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2017. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + whatsoever resulting from loss of use, data or profits, whether + in an action of contract, negligence or other tortious action, + arising out of or in connection with the use or performance of + this software. +*/ + +/** \file + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include <avr/pgmspace.h> + + #include <LUFA/Drivers/USB/USB.h> + + /* Macros: */ + /** Endpoint address of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) + + /** Endpoint address of the CDC device-to-host data IN endpoint. */ + #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) + + /** Endpoint address of the CDC host-to-device data OUT endpoint. */ + #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4) + + /** Size in bytes of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPSIZE 8 + + /** Size in bytes of the CDC data IN and OUT endpoints. */ + #define CDC_TXRX_EPSIZE 16 + + /* Type Defines: */ + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + + // CDC Command Interface + USB_Descriptor_Interface_t CDC_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + + // CDC Data Interface + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; + } USB_Descriptor_Configuration_t; + + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + }; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint16_t wIndex, + const void** const DescriptorAddress) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif + diff --git a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs new file mode 100644 index 0000000000..595083a4a8 --- /dev/null +++ b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.Designer.cs @@ -0,0 +1,149 @@ +namespace LEDMixer +{ + partial class LEDMixer + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.tbRed = new System.Windows.Forms.TrackBar(); + this.tbGreen = new System.Windows.Forms.TrackBar(); + this.tbBlue = new System.Windows.Forms.TrackBar(); + this.serSerialPort = new System.IO.Ports.SerialPort(this.components); + this.cbPort = new System.Windows.Forms.ComboBox(); + this.lblRed = new System.Windows.Forms.Label(); + this.lblBlue = new System.Windows.Forms.Label(); + this.lblGreen = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.tbRed)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).BeginInit(); + this.SuspendLayout(); + // + // tbRed + // + this.tbRed.Location = new System.Drawing.Point(54, 64); + this.tbRed.Maximum = 512; + this.tbRed.Name = "tbRed"; + this.tbRed.Size = new System.Drawing.Size(230, 45); + this.tbRed.TabIndex = 0; + this.tbRed.Scroll += new System.EventHandler(this.tbRed_Scroll); + // + // tbGreen + // + this.tbGreen.Location = new System.Drawing.Point(54, 115); + this.tbGreen.Maximum = 512; + this.tbGreen.Name = "tbGreen"; + this.tbGreen.Size = new System.Drawing.Size(230, 45); + this.tbGreen.TabIndex = 1; + this.tbGreen.Scroll += new System.EventHandler(this.tbGreen_Scroll); + // + // tbBlue + // + this.tbBlue.Location = new System.Drawing.Point(54, 163); + this.tbBlue.Maximum = 512; + this.tbBlue.Name = "tbBlue"; + this.tbBlue.Size = new System.Drawing.Size(230, 45); + this.tbBlue.TabIndex = 2; + this.tbBlue.Scroll += new System.EventHandler(this.tbBlue_Scroll); + // + // cbPort + // + this.cbPort.FormattingEnabled = true; + this.cbPort.Location = new System.Drawing.Point(97, 12); + this.cbPort.Name = "cbPort"; + this.cbPort.Size = new System.Drawing.Size(99, 21); + this.cbPort.TabIndex = 3; + this.cbPort.SelectedIndexChanged += new System.EventHandler(this.cbPort_SelectedIndexChanged); + // + // lblRed + // + this.lblRed.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblRed.Location = new System.Drawing.Point(3, 64); + this.lblRed.Name = "lblRed"; + this.lblRed.Size = new System.Drawing.Size(48, 29); + this.lblRed.TabIndex = 4; + this.lblRed.Text = "Red"; + this.lblRed.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblBlue + // + this.lblBlue.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblBlue.Location = new System.Drawing.Point(3, 115); + this.lblBlue.Name = "lblGreen"; + this.lblBlue.Size = new System.Drawing.Size(50, 27); + this.lblBlue.TabIndex = 5; + this.lblBlue.Text = "Green"; + this.lblBlue.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblGreen + // + this.lblGreen.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblGreen.Location = new System.Drawing.Point(3, 163); + this.lblGreen.Name = "lblBlue"; + this.lblGreen.Size = new System.Drawing.Size(50, 25); + this.lblGreen.TabIndex = 6; + this.lblGreen.Text = "Blue"; + this.lblGreen.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // LEDMixer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(284, 207); + this.Controls.Add(this.lblGreen); + this.Controls.Add(this.lblBlue); + this.Controls.Add(this.lblRed); + this.Controls.Add(this.cbPort); + this.Controls.Add(this.tbBlue); + this.Controls.Add(this.tbGreen); + this.Controls.Add(this.tbRed); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "LEDMixer"; + this.Text = "LED Mixer"; + this.Load += new System.EventHandler(this.LEDMixer_Load); + ((System.ComponentModel.ISupportInitialize)(this.tbRed)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbGreen)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbBlue)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TrackBar tbRed; + private System.Windows.Forms.TrackBar tbGreen; + private System.Windows.Forms.TrackBar tbBlue; + private System.IO.Ports.SerialPort serSerialPort; + private System.Windows.Forms.ComboBox cbPort; + private System.Windows.Forms.Label lblRed; + private System.Windows.Forms.Label lblBlue; + private System.Windows.Forms.Label lblGreen; + } +} + diff --git a/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs new file mode 100644 index 0000000000..dfaffed309 --- /dev/null +++ b/Projects/LEDNotifier/LEDMixerApp/LEDMixer.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace LEDMixer +{ + public partial class LEDMixer : Form + { + private const int LIGHT_MAX = 0x1F; + + public LEDMixer() + { + InitializeComponent(); + } + + private void LEDMixer_Load(object sender, EventArgs e) + { + String[] PortNames = System.IO.Ports.SerialPort.GetPortNames(); + Array.Sort<String>(PortNames, delegate(string strA, string strB) { return int.Parse(strA.Substring(3)).CompareTo(int.Parse(strB.Substring(3))); }); + cbPort.Items.Clear(); + cbPort.Items.AddRange(PortNames); + + cbPort.SelectedIndex = 0; + + tbRed.Maximum = LIGHT_MAX; + tbGreen.Maximum = LIGHT_MAX; + tbBlue.Maximum = LIGHT_MAX; + } + + private void tbRed_Scroll(object sender, EventArgs e) + { + NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value); + } + + private void tbGreen_Scroll(object sender, EventArgs e) + { + NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Value); + } + + private void tbBlue_Scroll(object sender, EventArgs e) + { + NotifyLight(tbRed.Value, tbGreen.Value, tbBlue.Valu