From 6140a08d0f46af3fe5ebba50b4c49e09b56eb1d2 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 16 Jan 2024 11:04:04 -0800 Subject: [PATCH] Release 1.8.0 --- Source/CompositeDevices.sln | 70 +++++++---- .../Driver/Readme.md | 10 +- .../Relays.ElectromagneticRelayModule.csproj | 4 +- .../ElectronmagneticRelayModule_Sample.csproj | 2 +- .../MeadowApp.cs | 11 +- .../Datasheet/Readme.md | 0 .../Driver/PersonSensor.PersonFace.cs | 2 +- .../Driver/PersonSensor.cs | 9 +- .../Driver/PersonSensor.enums.cs | 2 +- .../Driver/PersonSensorResults.cs | 4 +- .../Driver/Readme.md | 14 +-- ....Camera.UsefulSensors.PersonSensor.csproj} | 10 +- .../Driver/meadow.config.yaml | 0 .../Samples/PersonSensor_Sample/MeadowApp.cs | 13 +- .../PersonSensor_Sample.csproj | 4 +- .../Driver/Readme.md | 63 ++++++++++ ...Camera.UsefulSensors.TinyCodeReader.csproj | 29 +++++ .../Driver/TinyCodeReader.cs | 113 ++++++++++++++++++ .../Driver/meadow.config.yaml | 55 +++++++++ .../TinyCodeReader_Sample/MeadowApp.cs | 53 ++++++++ .../TinyCodeReader_Sample.csproj | 12 ++ 21 files changed, 409 insertions(+), 71 deletions(-) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Datasheet/Readme.md (100%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/PersonSensor.PersonFace.cs (96%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/PersonSensor.cs (94%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/PersonSensor.enums.cs (97%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/PersonSensorResults.cs (86%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/Readme.md (80%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor/Driver/Sensors.Motion.UsefulSensors.PersonSensor.csproj => Sensors.Camera.UsefulSensors.PersonSensor/Driver/Sensors.Camera.UsefulSensors.PersonSensor.csproj} (78%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Driver/meadow.config.yaml (100%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Samples/PersonSensor_Sample/MeadowApp.cs (68%) rename Source/{Sensors.Motion.UsefulSensors.PersonSensor => Sensors.Camera.UsefulSensors.PersonSensor}/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj (72%) create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Readme.md create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Sensors.Camera.UsefulSensors.TinyCodeReader.csproj create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/TinyCodeReader.cs create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/meadow.config.yaml create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/MeadowApp.cs create mode 100644 Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/TinyCodeReader_Sample.csproj diff --git a/Source/CompositeDevices.sln b/Source/CompositeDevices.sln index ef80ce0..7b7351d 100644 --- a/Source/CompositeDevices.sln +++ b/Source/CompositeDevices.sln @@ -17,17 +17,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronmagneticRelayModule EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sensors", "Sensors", "{78203E26-CBDE-48BC-B8CF-617F8A863D65}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Motion", "Motion", "{7A284A89-FBA4-4E57-9357-B0F3AE9AE429}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PersonSensor", "PersonSensor", "{4A6B7EF6-7730-4570-A72F-6E4506227668}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsefulSensors", "UsefulSensors", "{B9A8627E-0A83-4FEB-B3CF-7772109C3F44}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{1B4743D8-E3B7-4466-9A66-266B91AB3676}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PersonSensor", "PersonSensor", "{4A6B7EF6-7730-4570-A72F-6E4506227668}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cameras", "Cameras", "{EFA4C1B3-5257-451E-908F-AF9EDA45F224}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Motion.UsefulSensors.PersonSensor", "Sensors.Motion.UsefulSensors.PersonSensor\Driver\Sensors.Motion.UsefulSensors.PersonSensor.csproj", "{773E12FF-A4F0-4835-9BAA-34454DB42E6B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsefulSensors", "UsefulSensors", "{72A32E4E-7492-4F7C-BF42-9CF2E664338B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{1B4743D8-E3B7-4466-9A66-266B91AB3676}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TinyCodeReader", "TinyCodeReader", "{FCD85A86-0779-4AC3-A12C-91F3C0C5D161}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{B155FD13-EEE6-40B3-9C3A-A0FEADCBE24F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Camera.UsefulSensors.PersonSensor", "Sensors.Camera.UsefulSensors.PersonSensor\Driver\Sensors.Camera.UsefulSensors.PersonSensor.csproj", "{D562BCD2-DDBC-483D-881A-72284A904184}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PersonSensor_Sample", "Sensors.Camera.UsefulSensors.PersonSensor\Samples\PersonSensor_Sample\PersonSensor_Sample.csproj", "{722B73EF-95E5-498F-8A95-FC2F62DF9B36}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sensors.Camera.UsefulSensors.TinyCodeReader", "Sensors.Camera.UsefulSensors.TinyCodeReader\Driver\Sensors.Camera.UsefulSensors.TinyCodeReader.csproj", "{D55D9CEE-0E03-43A5-8B8A-11B723C3D608}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PersonSensor_Sample", "Sensors.Motion.UsefulSensors.PersonSensor\Samples\PersonSensor_Sample\PersonSensor_Sample.csproj", "{6046728F-EFF4-4B77-8C15-7CB87B145395}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TinyCodeReader_Sample", "Sensors.Camera.UsefulSensors.TinyCodeReader\Samples\TinyCodeReader_Sample\TinyCodeReader_Sample.csproj", "{A0C0F999-2D2D-4674-BA32-E244CC53D937}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -47,18 +55,30 @@ Global {815E8496-8359-4D35-83EB-A1120D3AA404}.Release|Any CPU.ActiveCfg = Release|Any CPU {815E8496-8359-4D35-83EB-A1120D3AA404}.Release|Any CPU.Build.0 = Release|Any CPU {815E8496-8359-4D35-83EB-A1120D3AA404}.Release|Any CPU.Deploy.0 = Release|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Release|Any CPU.Build.0 = Release|Any CPU - {773E12FF-A4F0-4835-9BAA-34454DB42E6B}.Release|Any CPU.Deploy.0 = Release|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Release|Any CPU.Build.0 = Release|Any CPU - {6046728F-EFF4-4B77-8C15-7CB87B145395}.Release|Any CPU.Deploy.0 = Release|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Release|Any CPU.Build.0 = Release|Any CPU + {D562BCD2-DDBC-483D-881A-72284A904184}.Release|Any CPU.Deploy.0 = Release|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Release|Any CPU.Build.0 = Release|Any CPU + {722B73EF-95E5-498F-8A95-FC2F62DF9B36}.Release|Any CPU.Deploy.0 = Release|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Release|Any CPU.Build.0 = Release|Any CPU + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Release|Any CPU.Build.0 = Release|Any CPU + {A0C0F999-2D2D-4674-BA32-E244CC53D937}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -68,12 +88,16 @@ Global {BC092D17-F8D5-4BEA-ABE4-E98B44A04DA6} = {AE474B14-7388-421B-BB92-8700CD54BC57} {29CF3228-7907-4FD6-88E3-DB91023B6281} = {AE474B14-7388-421B-BB92-8700CD54BC57} {815E8496-8359-4D35-83EB-A1120D3AA404} = {BC092D17-F8D5-4BEA-ABE4-E98B44A04DA6} - {7A284A89-FBA4-4E57-9357-B0F3AE9AE429} = {78203E26-CBDE-48BC-B8CF-617F8A863D65} - {B9A8627E-0A83-4FEB-B3CF-7772109C3F44} = {7A284A89-FBA4-4E57-9357-B0F3AE9AE429} - {4A6B7EF6-7730-4570-A72F-6E4506227668} = {B9A8627E-0A83-4FEB-B3CF-7772109C3F44} - {773E12FF-A4F0-4835-9BAA-34454DB42E6B} = {4A6B7EF6-7730-4570-A72F-6E4506227668} + {4A6B7EF6-7730-4570-A72F-6E4506227668} = {72A32E4E-7492-4F7C-BF42-9CF2E664338B} {1B4743D8-E3B7-4466-9A66-266B91AB3676} = {4A6B7EF6-7730-4570-A72F-6E4506227668} - {6046728F-EFF4-4B77-8C15-7CB87B145395} = {1B4743D8-E3B7-4466-9A66-266B91AB3676} + {EFA4C1B3-5257-451E-908F-AF9EDA45F224} = {78203E26-CBDE-48BC-B8CF-617F8A863D65} + {72A32E4E-7492-4F7C-BF42-9CF2E664338B} = {EFA4C1B3-5257-451E-908F-AF9EDA45F224} + {FCD85A86-0779-4AC3-A12C-91F3C0C5D161} = {72A32E4E-7492-4F7C-BF42-9CF2E664338B} + {B155FD13-EEE6-40B3-9C3A-A0FEADCBE24F} = {FCD85A86-0779-4AC3-A12C-91F3C0C5D161} + {D562BCD2-DDBC-483D-881A-72284A904184} = {4A6B7EF6-7730-4570-A72F-6E4506227668} + {722B73EF-95E5-498F-8A95-FC2F62DF9B36} = {1B4743D8-E3B7-4466-9A66-266B91AB3676} + {D55D9CEE-0E03-43A5-8B8A-11B723C3D608} = {FCD85A86-0779-4AC3-A12C-91F3C0C5D161} + {A0C0F999-2D2D-4674-BA32-E244CC53D937} = {B155FD13-EEE6-40B3-9C3A-A0FEADCBE24F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BF2FC8CE-57C6-468C-B82D-D8204E6D9360} diff --git a/Source/Relays.ElectromagneticRelayModule/Driver/Readme.md b/Source/Relays.ElectromagneticRelayModule/Driver/Readme.md index 05b0193..36a4b56 100644 --- a/Source/Relays.ElectromagneticRelayModule/Driver/Readme.md +++ b/Source/Relays.ElectromagneticRelayModule/Driver/Readme.md @@ -17,7 +17,7 @@ private ElectromagneticRelayModule module; public override Task Initialize() { - Console.WriteLine("Initialize..."); + Resolver.Log.Info("Initialize..."); module = new ElectromagneticRelayModule(Device.CreateI2cBus(), ElectromagneticRelayModule.GetAddressFromPins(false, false, false)); @@ -28,26 +28,26 @@ public override Task Run() { for (int i = 0; i < 5; i++) { - Console.Write("All on (closed)"); + Resolver.Log.Info("All on (closed)"); module.SetAllOn(); Thread.Sleep(1000); - Console.Write("All off (open)"); + Resolver.Log.Info("All off (open)"); module.SetAllOff(); Thread.Sleep(1000); for (int j = 0; j < (int)RelayIndex.Relay4; j++) { - Console.Write($"{(RelayIndex)j} on (closed)"); + Resolver.Log.Info($"{(RelayIndex)j} on (closed)"); module.Relays[j].State = RelayState.Closed; Thread.Sleep(1000); } for (int j = 0; j < (int)RelayIndex.Relay4; j++) { - Console.Write($"{(RelayIndex)j} off (open)"); + Resolver.Log.Info($"{(RelayIndex)j} off (open)"); module.Relays[j].State = RelayState.Open; Thread.Sleep(1000); } diff --git a/Source/Relays.ElectromagneticRelayModule/Driver/Relays.ElectromagneticRelayModule.csproj b/Source/Relays.ElectromagneticRelayModule/Driver/Relays.ElectromagneticRelayModule.csproj index ddcecda..9cf646b 100644 --- a/Source/Relays.ElectromagneticRelayModule/Driver/Relays.ElectromagneticRelayModule.csproj +++ b/Source/Relays.ElectromagneticRelayModule/Driver/Relays.ElectromagneticRelayModule.csproj @@ -1,5 +1,6 @@ + 1.8.0 Readme.md 10.0 Apache-2.0 @@ -14,7 +15,6 @@ Meadow.Foundation.Relays.ElectromagneticRelayModule https://github.com/WildernessLabs/Meadow.Foundation Meadow.Foundation,Meadow,relay,eletromagetic,module - 1.7.0 true I2C 4 Channel Electromagnetic Relay Module enable @@ -24,6 +24,6 @@ - + diff --git a/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/ElectronmagneticRelayModule_Sample.csproj b/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/ElectronmagneticRelayModule_Sample.csproj index 76f5786..31afee6 100644 --- a/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/ElectronmagneticRelayModule_Sample.csproj +++ b/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/ElectronmagneticRelayModule_Sample.csproj @@ -6,7 +6,7 @@ App - + diff --git a/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/MeadowApp.cs b/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/MeadowApp.cs index 8bbf5d6..da67bdf 100644 --- a/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/MeadowApp.cs +++ b/Source/Relays.ElectromagneticRelayModule/Samples/ElectronmagneticRelayModule_Sample/MeadowApp.cs @@ -2,7 +2,6 @@ using Meadow.Devices; using Meadow.Foundation.Relays; using Meadow.Peripherals.Relays; -using System; using System.Threading; using System.Threading.Tasks; using static Meadow.Foundation.Relays.ElectromagneticRelayModule; @@ -17,7 +16,7 @@ public class MeadowApp : App public override Task Initialize() { - Console.WriteLine("Initialize..."); + Resolver.Log.Info("Initialize..."); module = new ElectromagneticRelayModule(Device.CreateI2cBus(), ElectromagneticRelayModule.GetAddressFromPins(false, false, false)); @@ -28,26 +27,26 @@ public override Task Run() { for (int i = 0; i < 5; i++) { - Console.Write("All on (closed)"); + Resolver.Log.Info("All on (closed)"); module.SetAllOn(); Thread.Sleep(1000); - Console.Write("All off (open)"); + Resolver.Log.Info("All off (open)"); module.SetAllOff(); Thread.Sleep(1000); for (int j = 0; j < (int)RelayIndex.Relay4; j++) { - Console.Write($"{(RelayIndex)j} on (closed)"); + Resolver.Log.Info($"{(RelayIndex)j} on (closed)"); module.Relays[j].State = RelayState.Closed; Thread.Sleep(1000); } for (int j = 0; j < (int)RelayIndex.Relay4; j++) { - Console.Write($"{(RelayIndex)j} off (open)"); + Resolver.Log.Info($"{(RelayIndex)j} off (open)"); module.Relays[j].State = RelayState.Open; Thread.Sleep(1000); } diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Datasheet/Readme.md b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Datasheet/Readme.md similarity index 100% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Datasheet/Readme.md rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Datasheet/Readme.md diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs similarity index 96% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs index 0b622e7..18a71df 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.PersonFace.cs @@ -1,4 +1,4 @@ -namespace Meadow.Foundation.Sensors; +namespace Meadow.Foundation.Sensors.Camera; public partial class PersonSensor { diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.cs b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.cs similarity index 94% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.cs rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.cs index 3dfe8b9..75e1822 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.cs +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -namespace Meadow.Foundation.Sensors; +namespace Meadow.Foundation.Sensors.Camera; /// /// Represents a Useful Sensor's Person Sensor @@ -29,13 +29,12 @@ public partial class PersonSensor : II2cPeripheral /// - /// Initializes a new instance of the ElectroMagneticRelayModule device + /// Initializes a new instance of the Useful Sensor's Person Sensor device /// /// The I2C bus the peripheral is connected to - /// The bus address of the peripheral - public PersonSensor(II2cBus i2cBus, byte address = 0x62) + public PersonSensor(II2cBus i2cBus) { - i2cComms = new I2cCommunications(i2cBus, address, DATA_LENGTH); + i2cComms = new I2cCommunications(i2cBus, DefaultI2cAddress, DATA_LENGTH); readBuffer = new byte[DATA_LENGTH]; } diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs similarity index 97% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs index fb55bff..1053983 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensor.enums.cs @@ -1,4 +1,4 @@ -namespace Meadow.Foundation.Sensors +namespace Meadow.Foundation.Sensors.Camera { public partial class PersonSensor { diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs similarity index 86% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs index 3382fa7..fc71f83 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/PersonSensorResults.cs @@ -1,6 +1,6 @@ -using static Meadow.Foundation.Sensors.PersonSensor; +using static Meadow.Foundation.Sensors.Camera.PersonSensor; -namespace Meadow.Foundation.Sensors; +namespace Meadow.Foundation.Sensors.Camera; /// /// Represents the structured results returned from the person sensor. diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Readme.md b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Readme.md similarity index 80% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Readme.md rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Readme.md index bd6b786..ca62130 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Readme.md +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Readme.md @@ -1,6 +1,6 @@ -# Meadow.Foundation.Sensors.PersonSensor +# Meadow.Foundation.Sensors.Camera.UsefulSensors.PersonSensor -**Useful Sensor's I2C optical person sensor** +**Useful Sensor's Person Sensor I2C optical person sensor** The **UsefulSensorsPersonSensor** library is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform and is part of [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/). @@ -17,7 +17,7 @@ PersonSensor personSensor; public override Task Initialize() { - Console.WriteLine("Initialize..."); + Resolver.Log.Info("Initialize..."); personSensor = new PersonSensor(Device.CreateI2cBus()); @@ -39,18 +39,14 @@ private void DisplaySensorData(PersonSensorResults sensorData) { if (sensorData.NumberOfFaces == 0) { - Console.WriteLine("No faces found"); + Resolver.Log.Info("No faces found"); return; } for (int i = 0; i < sensorData.NumberOfFaces; ++i) { var face = sensorData.FaceData[i]; - Console.Write($"Face #{i}: "); - Console.Write($"{face.BoxConfidence} confidence, "); - Console.Write($"({face.BoxLeft}, {face.BoxTop}), "); - Console.Write($"({face.BoxRight}, {face.BoxBottom}), "); - Console.WriteLine(face.IsFacing == 1 ? "facing" : "not facing"); + Resolver.Log.Info($"Face #{i}: {face.BoxConfidence} confidence, ({face.BoxLeft}, {face.BoxTop}), ({face.BoxRight}, {face.BoxBottom}), facing: {face.IsFacing}"); } } diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Sensors.Motion.UsefulSensors.PersonSensor.csproj b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Sensors.Camera.UsefulSensors.PersonSensor.csproj similarity index 78% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Sensors.Motion.UsefulSensors.PersonSensor.csproj rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Sensors.Camera.UsefulSensors.PersonSensor.csproj index c5e1662..572104e 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/Sensors.Motion.UsefulSensors.PersonSensor.csproj +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/Sensors.Camera.UsefulSensors.PersonSensor.csproj @@ -1,5 +1,6 @@ + 1.8.0 Readme.md 10.0 Apache-2.0 @@ -11,12 +12,11 @@ UsefulSensorsPersonSensor Wilderness Labs, Inc http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ - Meadow.Foundation.Sensors.PersonSensor + Meadow.Foundation.Sensors.Camera.UsefulSensors.PersonSensor https://github.com/WildernessLabs/Meadow.Foundation - Meadow.Foundation,Meadow,camera,person,sensor,AI - 1.7.0 + Meadow.Foundation,Meadow,camera,person,sensor,AI,useful,motion true - Useful Sensor's I2C optical person sensor + Useful Sensor's Person Sensor I2C optical person sensor enable @@ -24,6 +24,6 @@ - + diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/meadow.config.yaml b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/meadow.config.yaml similarity index 100% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Driver/meadow.config.yaml rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Driver/meadow.config.yaml diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs similarity index 68% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs index 7839c88..899de21 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/MeadowApp.cs @@ -1,7 +1,6 @@ using Meadow; using Meadow.Devices; -using Meadow.Foundation.Sensors; -using System; +using Meadow.Foundation.Sensors.Camera; using System.Threading; using System.Threading.Tasks; @@ -15,7 +14,7 @@ public class MeadowApp : App public override Task Initialize() { - Console.WriteLine("Initialize..."); + Resolver.Log.Info("Initialize..."); personSensor = new PersonSensor(Device.CreateI2cBus()); @@ -38,18 +37,14 @@ private void DisplaySensorData(PersonSensorResults sensorData) { if (sensorData.NumberOfFaces == 0) { - Console.WriteLine("No faces found"); + Resolver.Log.Info("No faces found"); return; } for (int i = 0; i < sensorData.NumberOfFaces; ++i) { var face = sensorData.FaceData[i]; - Console.Write($"Face #{i}: "); - Console.Write($"{face.BoxConfidence} confidence, "); - Console.Write($"({face.BoxLeft}, {face.BoxTop}), "); - Console.Write($"({face.BoxRight}, {face.BoxBottom}), "); - Console.WriteLine(face.IsFacing == 1 ? "facing" : "not facing"); + Resolver.Log.Info($"Face #{i}: {face.BoxConfidence} confidence, ({face.BoxLeft}, {face.BoxTop}), ({face.BoxRight}, {face.BoxBottom}), facing: {face.IsFacing}"); } } diff --git a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj similarity index 72% rename from Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj rename to Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj index 7179b92..efcff55 100644 --- a/Source/Sensors.Motion.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj +++ b/Source/Sensors.Camera.UsefulSensors.PersonSensor/Samples/PersonSensor_Sample/PersonSensor_Sample.csproj @@ -6,7 +6,7 @@ App - - + + diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Readme.md b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Readme.md new file mode 100644 index 0000000..b6424e1 --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Readme.md @@ -0,0 +1,63 @@ +# Meadow.Foundation.Sensors.Cameras.UsefulSensors.TinyCodeReader + +**Useful Sensor's Tiny Code Reader I2C optical QR code reader** + +The **UsefulSensorsTinyCodeReader** library is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform and is part of [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/). + +The **Meadow.Foundation** peripherals library is an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT application. + +For more information on developing for Meadow, visit [developer.wildernesslabs.co](http://developer.wildernesslabs.co/). + +To view all Wilderness Labs open-source projects, including samples, visit [github.com/wildernesslabs](https://github.com/wildernesslabs/). + +## Usage + +```csharp +TinyCodeReader tinyCodeReader; + +public override Task Initialize() +{ + Resolver.Log.Info("Initialize..."); + + tinyCodeReader = new TinyCodeReader(Device.CreateI2cBus()); + + return Task.CompletedTask; +} + +public override Task Run() +{ + //one time read + var qrCode = tinyCodeReader.ReadCode(); + + if (qrCode != null) + { + Resolver.Log.Info($"QR Code: {qrCode}"); + } + else + { + Resolver.Log.Info("No QR Code Found"); + } + + //continuous read + tinyCodeReader.CodeRead += TinyCodeReader_CodeRead; + tinyCodeReader.StartUpdating(TimeSpan.FromSeconds(1)); + + return Task.CompletedTask; +} + +private void TinyCodeReader_CodeRead(object sender, string e) +{ + Resolver.Log.Info($"QRCode message: {e} ({DateTime.Now})"); +} + +``` +## How to Contribute + +- **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues) +- Have a **feature idea or driver request?** [Open a new feature request](https://github.com/WildernessLabs/Meadow_Issues/issues) +- Want to **contribute code?** Fork the [Meadow.Foundation.CompositeDevices](https://github.com/WildernessLabs/Meadow.Foundation.CompositeDevices) repository and submit a pull request against the `develop` branch + + +## Need Help? + +If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/). diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Sensors.Camera.UsefulSensors.TinyCodeReader.csproj b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Sensors.Camera.UsefulSensors.TinyCodeReader.csproj new file mode 100644 index 0000000..42ef34b --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/Sensors.Camera.UsefulSensors.TinyCodeReader.csproj @@ -0,0 +1,29 @@ + + + 1.8.0 + Readme.md + 10.0 + Apache-2.0 + true + icon.png + Wilderness Labs, Inc + netstandard2.1 + Library + UsefulSensorsTinyCodeReader + Wilderness Labs, Inc + http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ + Meadow.Foundation.Sensors.Cameras.UsefulSensors.TinyCodeReader + https://github.com/WildernessLabs/Meadow.Foundation + Meadow.Foundation,Meadow,camera,tiny,code,reader,sensor,AI,QR + true + Useful Sensor's Tiny Code Reader I2C optical QR code reader + enable + + + + + + + + + diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/TinyCodeReader.cs b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/TinyCodeReader.cs new file mode 100644 index 0000000..349281c --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/TinyCodeReader.cs @@ -0,0 +1,113 @@ +using Meadow.Hardware; +using System; +using System.Threading.Tasks; + +namespace Meadow.Foundation.Sensors.Camera; + +/// +/// Represents a Useful Sensor's Tiny Code Reader +/// +public class TinyCodeReader : II2cPeripheral +{ + /// + /// Event raised when a QR code is read + /// + public event EventHandler CodeRead = default!; + + /// + /// Gets a value indicating whether the sensor is sampling/running + /// + public bool IsRunning { get; private set; } + + /// + /// The sample period of the sensor (default 200ms) + /// + public TimeSpan SamplePeriod { get; set; } = TimeSpan.FromMilliseconds(200); + + /// + public byte DefaultI2cAddress => 0x0C; + + private readonly int CONTENT_BYTE_COUNT = 254; + private readonly int CONTENT_BYTE_LENGTH_COUNT = 2; + private readonly int LED_REGISTER = 0x01; + + private readonly byte[] readBuffer; + private readonly II2cCommunications i2cComms; + + /// + /// Initializes a new instance of the ElectroMagneticRelayModule device + /// + /// The I2C bus the peripheral is connected to + public TinyCodeReader(II2cBus i2cBus) + { + i2cComms = new I2cCommunications(i2cBus, DefaultI2cAddress, CONTENT_BYTE_COUNT + CONTENT_BYTE_LENGTH_COUNT); + readBuffer = new byte[CONTENT_BYTE_COUNT + CONTENT_BYTE_LENGTH_COUNT]; + } + + /// + /// Sets the LED on the Tiny Code Reader + /// + /// enable if true, disable if false + public void SetLed(bool enable) + { + i2cComms.WriteRegister((byte)LED_REGISTER, (byte)(enable ? 0x01 : 0x00)); + } + + /// + /// Reads the string value of the QR code from the Tiny Code Reader + /// + /// the code as a string if avaliable, null if no code found + public string? ReadCode() + { + i2cComms.ReadRegister(0x00, readBuffer); + + if (readBuffer[0] == 0) + { + return null; + } + else + { + return System.Text.Encoding.UTF8.GetString(readBuffer, 2, readBuffer[0]); + } + } + + /// + /// Start sampling the sensor + /// + public void StartUpdating(TimeSpan? samplePeriod = null) + { + if (IsRunning) + { + return; + } + + IsRunning = true; + + if (samplePeriod != null) + { + SamplePeriod = samplePeriod.Value; + } + + Task.Run(async () => + { + while (IsRunning) + { + var code = ReadCode(); + if (code != null) + { + CodeRead?.Invoke(this, code); + } + + await Task.Delay(SamplePeriod); + } + }); + } + + /// + /// Stop sampling the sensor + /// + public void StopUpdating() + { + IsRunning = false; + } +} \ No newline at end of file diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/meadow.config.yaml b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/meadow.config.yaml new file mode 100644 index 0000000..9880162 --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Driver/meadow.config.yaml @@ -0,0 +1,55 @@ +# Uncommented these options as needed. +# To learn more about these config options, check out the OS & Device Configuration documentation. +# http://developer.wildernesslabs.co/Meadow/Meadow.OS/Configuration/OS_Device_Configuration/ + +# Device: +# # Name of the device on the network. +# Name: MeadowF7V2_ConfigSample +# +# # Uncomment if SD card hardware present on this hardware (e.g., Core-Compute module with SD add-on)? Optional; default value is `false`. +# SdStorageSupported: true +# # Control how the ESP coprocessor will start and operate. +# Coprocessor: +# # Should the ESP32 automatically attempt to connect to an access point at startup? +# # If set to true, wifi.config.yaml credentials must be stored in the device. +# AutomaticallyStartNetwork: true +# +# # Should the ESP32 automatically reconnect to the configured access point? +# AutomaticallyReconnect: true +# +# # Maximum number of retry attempts for connections etc. before an error code is returned. +# MaximumRetryCount: 7 +# # Network configuration. +# Network: +# Interfaces: +# - Name: Ethernet +# UseDHCP: false +# IPAddress: 192.168.1.60 +# NetMask: 255.255.255.0 +# Gateway: 192.168.1.254 +# - Name: WiFi +# UseDHCP: true +# IPAddress: +# NetMask: +# Gateway: +# +# # Which interface should be used? +# DefaultInterface: WiFi +# +# # Automatically attempt to get the time at startup? +# GetNetworkTimeAtStartup: true +# +# # Time synchronization period in seconds. +# NtpRefreshPeriodSeconds: 600 +# +# # Name of the NTP servers. +# NtpServers: +# - 0.pool.ntp.org +# - 1.pool.ntp.org +# - 2.pool.ntp.org +# - 3.pool.ntp.org +# +# # IP addresses of the DNS servers. +# DnsServers: +# - 1.1.1.1 +# - 8.8.8.8 \ No newline at end of file diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/MeadowApp.cs b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/MeadowApp.cs new file mode 100644 index 0000000..09f0a29 --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/MeadowApp.cs @@ -0,0 +1,53 @@ +using Meadow; +using Meadow.Devices; +using Meadow.Foundation.Sensors.Camera; +using System; +using System.Threading.Tasks; + +namespace Sensors.TinyCodeReader_Sample +{ + public class MeadowApp : App + { + // + TinyCodeReader tinyCodeReader; + + + public override Task Initialize() + { + Resolver.Log.Info("Initialize..."); + + tinyCodeReader = new TinyCodeReader(Device.CreateI2cBus()); + + + return Task.CompletedTask; + } + + public override Task Run() + { + //one time read + var qrCode = tinyCodeReader.ReadCode(); + + if (qrCode != null) + { + Resolver.Log.Info($"QR Code: {qrCode}"); + } + else + { + Resolver.Log.Info("No QR Code Found"); + } + + //continuous read + tinyCodeReader.CodeRead += TinyCodeReader_CodeRead; + tinyCodeReader.StartUpdating(TimeSpan.FromSeconds(1)); + + return Task.CompletedTask; + } + + private void TinyCodeReader_CodeRead(object sender, string e) + { + Resolver.Log.Info($"QRCode message: {e} ({DateTime.Now})"); + } + + // + } +} \ No newline at end of file diff --git a/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/TinyCodeReader_Sample.csproj b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/TinyCodeReader_Sample.csproj new file mode 100644 index 0000000..030df73 --- /dev/null +++ b/Source/Sensors.Camera.UsefulSensors.TinyCodeReader/Samples/TinyCodeReader_Sample/TinyCodeReader_Sample.csproj @@ -0,0 +1,12 @@ + + + netstandard2.1 + true + Library + App + + + + + +