├── software ├── GroundStation │ ├── obj │ │ └── Debug │ │ │ ├── MyJoyGui.csproj.CopyComplete │ │ │ ├── GroundStation.csproj.CopyComplete │ │ │ ├── Drone_Ground_Station.csproj.CopyComplete │ │ │ ├── MyJoyGui.csproj.CoreCompileInputs.cache │ │ │ ├── GroundStation.csproj.CoreCompileInputs.cache │ │ │ ├── Drone_Ground_Station.csproj.CoreCompileInputs.cache │ │ │ ├── MyJoyGui.exe │ │ │ ├── MyJoyGui.pdb │ │ │ ├── myjoygui.exe.licenses │ │ │ ├── GroundStation.Form1.resources │ │ │ ├── MyJoyGui.csproj.GenerateResource.cache │ │ │ ├── MyJoyGui.csprojAssemblyReference.cache │ │ │ ├── DesignTimeResolveAssemblyReferences.cache │ │ │ ├── MyJoyGui.Properties.Resources.resources │ │ │ ├── GroundStation.csproj.GenerateResource.cache │ │ │ ├── GroundStation.csprojAssemblyReference.cache │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache │ │ │ ├── Ground_Station.csprojAssemblyReference.cache │ │ │ ├── Drone_Ground_Station.csproj.GenerateResource.cache │ │ │ ├── Drone_Ground_Station.csprojAssemblyReference.cache │ │ │ ├── .NETFramework,Version=v4.7.2.AssemblyAttributes.cs │ │ │ ├── MyJoyGui.csproj.FileListAbsolute.txt │ │ │ ├── GroundStation.csproj.FileListAbsolute.txt │ │ │ └── Drone_Ground_Station.csproj.FileListAbsolute.txt │ ├── .vs │ │ └── MyJoyGui │ │ │ └── v16 │ │ │ └── .suo │ ├── bin │ │ └── Debug │ │ │ ├── SharpDX.dll │ │ │ ├── SharpDX.pdb │ │ │ ├── MyJoyGui.exe │ │ │ ├── MyJoyGui.pdb │ │ │ ├── SharpDX.DirectInput.dll │ │ │ ├── SharpDX.DirectInput.pdb │ │ │ └── MyJoyGui.exe.config │ ├── packages.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── licenses.licx │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── ErrorControls │ │ ├── ControlTimer.cs │ │ └── Kontrol.cs │ ├── Program.cs │ ├── Drone │ │ └── Crc8.cs │ ├── App.config │ ├── Controller │ │ └── InitilizeDevice.cs │ ├── GroundStation.csproj │ ├── View │ │ └── Form1.resx │ └── Model │ │ └── InitilizeSerialComm.cs ├── .vs │ ├── MyJoyGui │ │ └── v16 │ │ │ └── .suo │ └── GroundStation │ │ └── v16 │ │ └── .suo ├── packages │ ├── SharpDX.4.2.0 │ │ ├── .signature.p7s │ │ ├── SharpDX.4.2.0.nupkg │ │ └── lib │ │ │ ├── net40 │ │ │ ├── SharpDX.dll │ │ │ └── SharpDX.pdb │ │ │ ├── net45 │ │ │ ├── SharpDX.dll │ │ │ └── SharpDX.pdb │ │ │ ├── uap10.0 │ │ │ ├── SharpDX.dll │ │ │ ├── SharpDX.pdb │ │ │ └── SharpDX.pri │ │ │ └── netstandard1.1 │ │ │ ├── SharpDX.dll │ │ │ └── SharpDX.pdb │ └── SharpDX.DirectInput.4.2.0 │ │ ├── .signature.p7s │ │ ├── SharpDX.DirectInput.4.2.0.nupkg │ │ └── lib │ │ ├── net40 │ │ ├── SharpDX.DirectInput.dll │ │ └── SharpDX.DirectInput.pdb │ │ ├── net45 │ │ ├── SharpDX.DirectInput.dll │ │ └── SharpDX.DirectInput.pdb │ │ └── netstandard1.3 │ │ ├── SharpDX.DirectInput.dll │ │ └── SharpDX.DirectInput.pdb ├── obj │ └── Debug │ │ └── .NETFramework,Version=v4.7.2.AssemblyAttributes.cs └── GroundStation.sln ├── firmware ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F1xx │ │ │ │ └── Include │ │ │ │ ├── stm32f103xb.h │ │ │ │ ├── stm32f1xx.h │ │ │ │ └── system_stm32f1xx.h │ │ └── Include │ │ │ ├── cmsis_version.h │ │ │ └── tz_context.h │ └── STM32F1xx_HAL_Driver │ │ ├── Src │ │ └── stm32f1xx_hal_gpio_ex.c │ │ └── Inc │ │ └── stm32f1xx_hal_def.h ├── Middlewares │ └── Third_Party │ │ └── FreeRTOS │ │ └── Source │ │ ├── CMSIS_RTOS │ │ ├── cmsis_os.c │ │ └── cmsis_os.h │ │ ├── include │ │ ├── projdefs.h │ │ ├── stack_macros.h │ │ ├── StackMacros.h │ │ ├── portable.h │ │ └── deprecated_definitions.h │ │ └── list.c ├── README.md ├── .settings │ ├── stm32cubeıde.project.prefs │ └── language.settings.xml ├── Core │ ├── Inc │ │ ├── crc8.h │ │ ├── stm32f1xx_it.h │ │ ├── drone_infos.h │ │ ├── circular_buffers.h │ │ ├── main.h │ │ └── FreeRTOSConfig.h │ ├── Src │ │ ├── Motor │ │ │ ├── motor_functions.c │ │ │ └── motor_functions.h │ │ ├── freertos.c │ │ ├── sysmem.c │ │ ├── syscalls.c │ │ ├── crc8.c │ │ ├── circular_buffers.c │ │ ├── stm32f1xx_hal_timebase_tim.c │ │ └── stm32f1xx_it.c │ ├── Tasks │ │ ├── Controls.c │ │ └── Sensors.c │ ├── NEO_6M_GPS │ │ ├── gps_conf.h │ │ └── gps.h │ └── MPU9250 │ │ └── mpu9250.h ├── .project ├── Tests Scripts │ └── mpu9250Test.py ├── STM32F103C8TX_FLASH.ld └── drone_f1_ea.launch └── README.md /software/GroundStation/obj/Debug/MyJoyGui.csproj.CopyComplete: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.csproj.CopyComplete: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Drone_Ground_Station.csproj.CopyComplete: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 880d41355fefcd7b8a4ccd2e6124f5e8688cf727 2 | -------------------------------------------------------------------------------- /software/.vs/MyJoyGui/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/.vs/MyJoyGui/v16/.suo -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 56f73f5a2f7128075ee10f76857d420ef48c045b 2 | -------------------------------------------------------------------------------- /software/.vs/GroundStation/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/.vs/GroundStation/v16/.suo -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Drone_Ground_Station.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 56f73f5a2f7128075ee10f76857d420ef48c045b 2 | -------------------------------------------------------------------------------- /software/GroundStation/.vs/MyJoyGui/v16/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/.vs/MyJoyGui/v16/.suo -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/SharpDX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/SharpDX.dll -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/SharpDX.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/SharpDX.pdb -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/MyJoyGui.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/MyJoyGui.exe -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/MyJoyGui.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/MyJoyGui.pdb -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/MyJoyGui.exe -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/MyJoyGui.pdb -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/.signature.p7s -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/SharpDX.4.2.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/SharpDX.4.2.0.nupkg -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/myjoygui.exe.licenses: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/myjoygui.exe.licenses -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/net40/SharpDX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/net40/SharpDX.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/net40/SharpDX.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/net40/SharpDX.pdb -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/net45/SharpDX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/net45/SharpDX.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/net45/SharpDX.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/net45/SharpDX.pdb -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/SharpDX.DirectInput.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/SharpDX.DirectInput.dll -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/SharpDX.DirectInput.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/bin/Debug/SharpDX.DirectInput.pdb -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.pdb -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/uap10.0/SharpDX.pri -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/.signature.p7s -------------------------------------------------------------------------------- /firmware/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/firmware/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h -------------------------------------------------------------------------------- /firmware/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/firmware/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.Form1.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/GroundStation.Form1.resources -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/netstandard1.1/SharpDX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/netstandard1.1/SharpDX.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.4.2.0/lib/netstandard1.1/SharpDX.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.4.2.0/lib/netstandard1.1/SharpDX.pdb -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/firmware/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/firmware/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/MyJoyGui.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/MyJoyGui.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/DesignTimeResolveAssemblyReferences.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/DesignTimeResolveAssemblyReferences.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.Properties.Resources.resources: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/MyJoyGui.Properties.Resources.resources -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/GroundStation.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/GroundStation.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/SharpDX.DirectInput.4.2.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/SharpDX.DirectInput.4.2.0.nupkg -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Ground_Station.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/Ground_Station.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/net40/SharpDX.DirectInput.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/net40/SharpDX.DirectInput.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/net40/SharpDX.DirectInput.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/net40/SharpDX.DirectInput.pdb -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/net45/SharpDX.DirectInput.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/net45/SharpDX.DirectInput.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/net45/SharpDX.DirectInput.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/net45/SharpDX.DirectInput.pdb -------------------------------------------------------------------------------- /firmware/README.md: -------------------------------------------------------------------------------- 1 | # STM32 Codes 2 | 3 | An Open Source Hobby Drone project with STM32F103C8T6 (BluePill) 4 | 5 | Used IDE: STM32CubeIDE 6 | Init codes are generated with CubeMX. 7 | 8 | Any suggestions are welcome. 9 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Drone_Ground_Station.csproj.GenerateResource.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/Drone_Ground_Station.csproj.GenerateResource.cache -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Drone_Ground_Station.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/GroundStation/obj/Debug/Drone_Ground_Station.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/netstandard1.3/SharpDX.DirectInput.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/netstandard1.3/SharpDX.DirectInput.dll -------------------------------------------------------------------------------- /software/packages/SharpDX.DirectInput.4.2.0/lib/netstandard1.3/SharpDX.DirectInput.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EmbeddedArea/drone_stm32/HEAD/software/packages/SharpDX.DirectInput.4.2.0/lib/netstandard1.3/SharpDX.DirectInput.pdb -------------------------------------------------------------------------------- /software/GroundStation/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /firmware/.settings/stm32cubeıde.project.prefs: -------------------------------------------------------------------------------- 1 | 2F62501ED4689FB349E356AB974DBE57=0DC169682EA3DD8E878496BCEE64C763 2 | 8DF89ED150041C4CBC7CB9A9CAA90856=0DC169682EA3DD8E878496BCEE64C763 3 | DC22A860405A8BF2F2C095E5B6529F12=100E705BFDDE392632536E90B73EFB04 4 | eclipse.preferences.version=1 5 | -------------------------------------------------------------------------------- /software/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] 5 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] 5 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /software/GroundStation/ErrorControls/ControlTimer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Forms; 7 | 8 | namespace GroundStation.ErrorControls 9 | { 10 | class ControlTimer 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /software/GroundStation/ErrorControls/Kontrol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GroundStation.ErrorControls 8 | { 9 | class Kontrol 10 | { 11 | public bool stop_bool = true; 12 | public int ms = 50; 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # drone_stm32f1 2 | 3 | An Open Source Hobby Drone project with STM32F103C8T6 (BluePill) 4 | 5 | You will find all firmwares for STM32, software codes for ground station GUI, related code and how-to documents, PCB & Schematics (including BOM list) and mechanical drawings in this repo. 6 | 7 | Any suggestions are welcome.. 8 | 9 | Ground Station Software 10 | ![WhatsApp Image 2022-01-11 at 12 08 52](https://user-images.githubusercontent.com/43602725/148967667-b79ef9f8-8e99-4bad-9d48-aec3e93eda48.jpeg) 11 | -------------------------------------------------------------------------------- /software/GroundStation/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace GroundStation 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/licenses.licx: -------------------------------------------------------------------------------- 1 | DevExpress.XtraReports.UserDesigner.XRDesignDockManager, DevExpress.XtraReports.v20.1.Extensions, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 2 | DevExpress.XtraEditors.Repository.RepositoryItemProgressBar, DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 3 | DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 4 | DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox, DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 5 | DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit, DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 6 | DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v20.1, Version=20.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a 7 | -------------------------------------------------------------------------------- /software/GroundStation.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30517.126 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GroundStation", "GroundStation\GroundStation.csproj", "{88E2A23B-A975-4404-BB95-A9E04BA1CCBB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {88E2A23B-A975-4404-BB95-A9E04BA1CCBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {88E2A23B-A975-4404-BB95-A9E04BA1CCBB}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {88E2A23B-A975-4404-BB95-A9E04BA1CCBB}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {88E2A23B-A975-4404-BB95-A9E04BA1CCBB}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {3D212228-E732-403F-BE06-AA60CDECCBC5} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GroundStation.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /firmware/Core/Inc/crc8.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file crc8.h 4 | * @author Embedded Area 5 | * @date Jan 26, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef INC_CRC8_H_ 11 | #define INC_CRC8_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | #include 21 | #include 22 | 23 | /************************************ 24 | * MACROS AND DEFINES 25 | ************************************/ 26 | 27 | /************************************ 28 | * TYPEDEFS 29 | ************************************/ 30 | 31 | /************************************ 32 | * EXPORTED VARIABLES 33 | ************************************/ 34 | 35 | /************************************ 36 | * GLOBAL FUNCTION PROTOTYPES 37 | ************************************/ 38 | 39 | /**crc8 40 | * @brief Calculates the crc of the message 41 | * @param message: address of message 42 | * @param len: length of the message 43 | * @return CRC value 44 | */ 45 | uint8_t crc8(const char *message, uint16_t len); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /software/GroundStation/Drone/Crc8.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GroundStation 8 | { 9 | public static class Crc8 10 | { 11 | static byte[] table = new byte[256]; 12 | // x8 + x7 + x6 + x4 + x2 + 1 13 | const byte poly = 0x07; 14 | 15 | public static byte ComputeChecksum(params byte[] bytes) 16 | { 17 | byte crc = 0; 18 | if (bytes != null && bytes.Length > 0) 19 | { 20 | foreach (byte b in bytes) 21 | { 22 | crc = table[crc ^ b]; 23 | } 24 | } 25 | return crc; 26 | } 27 | 28 | static Crc8() 29 | { 30 | for (int i = 0; i < 256; ++i) 31 | { 32 | int temp = i; 33 | for (int j = 0; j < 8; ++j) 34 | { 35 | if ((temp & 0x80) != 0) 36 | { 37 | temp = (temp << 1) ^ poly; 38 | } 39 | else 40 | { 41 | temp <<= 1; 42 | } 43 | } 44 | table[i] = (byte)temp; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /firmware/Core/Src/Motor/motor_functions.c: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file motor_functions.c 4 | * @author Embedded Area 5 | * @date Feb 24, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | /************************************ 11 | * INCLUDES 12 | ************************************/ 13 | 14 | /************************************ 15 | * EXTERN VARIABLES 16 | ************************************/ 17 | 18 | /************************************ 19 | * PRIVATE MACROS AND DEFINES 20 | ************************************/ 21 | 22 | /************************************ 23 | * PRIVATE TYPEDEFS 24 | ************************************/ 25 | 26 | /************************************ 27 | * STATIC VARIABLES 28 | ************************************/ 29 | 30 | /************************************ 31 | * GLOBAL VARIABLES 32 | ************************************/ 33 | 34 | /************************************ 35 | * STATIC FUNCTION PROTOTYPES 36 | ************************************/ 37 | 38 | /************************************ 39 | * STATIC FUNCTIONS 40 | ************************************/ 41 | 42 | /************************************ 43 | * GLOBAL FUNCTIONS 44 | ************************************/ 45 | 46 | -------------------------------------------------------------------------------- /firmware/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | drone_f1_ea 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | com.st.stm32cube.ide.mcu.MCUProjectNature 23 | com.st.stm32cube.ide.mcu.MCUCubeProjectNature 24 | org.eclipse.cdt.core.cnature 25 | com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature 26 | com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature 27 | com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature 28 | com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature 29 | com.st.stm32cube.ide.mcu.MCURootProjectNature 30 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 31 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 32 | 33 | 34 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/MyJoyGui.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.exe.config 2 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.exe 3 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.dll 4 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.dll 5 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.pdb 6 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.pdb 7 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.xml 8 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.csprojAssemblyReference.cache 9 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.Form1.resources 10 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.Properties.Resources.resources 11 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.csproj.GenerateResource.cache 12 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.exe.licenses 13 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.csproj.CoreCompileInputs.cache 14 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.csproj.CopyComplete 15 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.exe 16 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.pdb 17 | C:\Users\sona\source\repos\Form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.pdb 18 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Drone_Ground_Station")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Drone_Ground_Station")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("88e2a23b-a975-4404-bb95-a9e04ba1ccbb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /firmware/Tests Scripts/mpu9250Test.py: -------------------------------------------------------------------------------- 1 | import serial, time 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | import matplotlib.animation as animation 5 | 6 | serialPort = serial.Serial(port = "COM7", baudrate=115200, 7 | bytesize=8, timeout=2, stopbits=serial.STOPBITS_ONE) 8 | 9 | serialData = "" # Used to hold data coming over UART 10 | received_data = [] 11 | 12 | # Create figure for plotting 13 | fig = plt.figure() 14 | ax = fig.add_subplot(2, 1, 1) 15 | ax2 = fig.add_subplot(2, 1, 2) 16 | xs = [] 17 | ys = [] 18 | zs = [] 19 | 20 | 21 | # This function is called periodically from FuncAnimation 22 | def animate(i, xs, ys, zs): 23 | if(serialPort.in_waiting > 0): 24 | # Read data out of the buffer until a carraige return / new line is found 25 | serialData = serialPort.readline() # Read 10 bytes 26 | s = serialData.decode("utf-8") .split(':') 27 | roll = int(s[1]) 28 | pitch = int(s[3]) 29 | #print(roll, pitch) 30 | # Add x and y to lists 31 | xs.append(i) 32 | ys.append(pitch) 33 | zs.append(roll) 34 | # Limit x and y lists to 20 items 35 | xs = xs[-100:] 36 | ys = ys[-100:] 37 | zs = zs[-100:] 38 | 39 | # Draw x and y lists 40 | ax.plot(xs, ys, color='blue', label='Pitch') 41 | 42 | ax2.plot(xs, zs, color='red', label='Roll') 43 | 44 | 45 | 46 | # Set up plot to call animate() function periodically 47 | ani = animation.FuncAnimation(fig, animate, fargs=(xs, ys, zs), interval=10) 48 | 49 | plt.show() 50 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/GroundStation.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.exe.config 2 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.exe 3 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.pdb 4 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.dll 5 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.dll 6 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.pdb 7 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.pdb 8 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.xml 9 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.csprojAssemblyReference.cache 10 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.Form1.resources 11 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.Properties.Resources.resources 12 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.csproj.GenerateResource.cache 13 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.exe.licenses 14 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.csproj.CoreCompileInputs.cache 15 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.csproj.CopyComplete 16 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.exe 17 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.pdb 18 | -------------------------------------------------------------------------------- /firmware/Drivers/CMSIS/Include/cmsis_version.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file cmsis_version.h 3 | * @brief CMSIS Core(M) Version definitions 4 | * @version V5.0.2 5 | * @date 19. April 2017 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef __CMSIS_VERSION_H 32 | #define __CMSIS_VERSION_H 33 | 34 | /* CMSIS Version definitions */ 35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ 36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ 37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ 38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ 39 | #endif 40 | -------------------------------------------------------------------------------- /firmware/Core/Tasks/Controls.c: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file Controls.c 4 | * @author Embedded Area 5 | * @date 2021 6 | * @brief Contains tasks related with LORA communication 7 | ******************************************************************************** 8 | */ 9 | 10 | /************************************ 11 | * INCLUDES 12 | ************************************/ 13 | #include "main.h" 14 | #include "cmsis_os.h" 15 | 16 | /************************************ 17 | * EXTERN VARIABLES 18 | ************************************/ 19 | extern osThreadId periodicTaskHandle, motorControlTasHandle; 20 | 21 | /************************************ 22 | * PRIVATE MACROS AND DEFINES 23 | ************************************/ 24 | 25 | /************************************ 26 | * PRIVATE TYPEDEFS 27 | ************************************/ 28 | 29 | /************************************ 30 | * STATIC VARIABLES 31 | ************************************/ 32 | 33 | /************************************ 34 | * GLOBAL VARIABLES 35 | ************************************/ 36 | 37 | /************************************ 38 | * STATIC FUNCTION PROTOTYPES 39 | ************************************/ 40 | 41 | /************************************ 42 | * STATIC FUNCTIONS 43 | ************************************/ 44 | 45 | /************************************ 46 | * GLOBAL FUNCTIONS 47 | ************************************/ 48 | 49 | /** 50 | * @brief Function implementing the periodicTask thread. 51 | * @param argument: Not used 52 | * @retval None 53 | */ 54 | void PeriodicTask(void const * argument) 55 | { 56 | osThreadTerminate(periodicTaskHandle); 57 | for(;;) 58 | { 59 | osDelay(1); 60 | } 61 | } 62 | 63 | 64 | /** 65 | * @brief Function implementing the motorControlTas thread. 66 | * @param argument: Not used 67 | * @retval None 68 | */ 69 | void MotorControlTask(void const * argument) 70 | { 71 | osThreadTerminate(motorControlTasHandle); 72 | for(;;) 73 | { 74 | osDelay(1); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /software/GroundStation/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | Skin/DevExpress Dark Style 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | UseTahoma 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /firmware/Core/NEO_6M_GPS/gps_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file gps_conf.h 4 | * @author Embedded Area 5 | * @date Jan 9, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef INC_GPS_CONF_H_ 11 | #define INC_GPS_CONF_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | 21 | /************************************ 22 | * MACROS AND DEFINES 23 | ************************************/ 24 | #define GPRMC_FRAME_PARSE_ON_DEFINED 25 | #ifdef GPRMC_FRAME_PARSE_ON_DEFINED 26 | #define GPRMC_FRAME_PARSE_ON 1 27 | #else 28 | #define GPRMC_FRAME_PARSE_ON 0 29 | #endif 30 | 31 | #define GPVTG_FRAME_PARSE_ON_DEFINED 32 | #ifdef GPVTG_FRAME_PARSE_ON_DEFINED 33 | #define GPVTG_FRAME_PARSE_ON 1 34 | #else 35 | #define GPVTG_FRAME_PARSE_ON 0 36 | #endif 37 | 38 | #define GPGGA_FRAME_PARSE_ON_DEFINED 39 | #ifdef GPGGA_FRAME_PARSE_ON_DEFINED 40 | #define GPGGA_FRAME_PARSE_ON 1 41 | #else 42 | #define GPGGA_FRAME_PARSE_ON 0 43 | #endif 44 | 45 | #define GPGSA_FRAME_PARSE_ON_DEFINED 46 | #ifdef GPGSA_FRAME_PARSE_ON_DEFINED 47 | #define GPGSA_FRAME_PARSE_ON 1 48 | #else 49 | #define GPGSA_FRAME_PARSE_ON 0 50 | #endif 51 | 52 | #define GPGSV_FRAME_PARSE_ON_DEFINED 53 | #ifdef GPGSV_FRAME_PARSE_ON_DEFINED 54 | #define GPGSV_FRAME_PARSE_ON 1 55 | #else 56 | #define GPGSV_FRAME_PARSE_ON 0 57 | #endif 58 | 59 | #define GPGLL_FRAME_PARSE_ON_DEFINED 60 | #ifdef GPGLL_FRAME_PARSE_ON_DEFINED 61 | #define GPGLL_FRAME_PARSE_ON 1 62 | #else 63 | #define GPGLL_FRAME_PARSE_ON 0 64 | #endif 65 | 66 | /************************************ 67 | * TYPEDEFS 68 | ************************************/ 69 | 70 | /************************************ 71 | * EXPORTED VARIABLES 72 | ************************************/ 73 | 74 | /************************************ 75 | * GLOBAL FUNCTION PROTOTYPES 76 | ************************************/ 77 | 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /software/GroundStation/bin/Debug/MyJoyGui.exe.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | Skin/DevExpress Dark Style 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | UseTahoma 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /firmware/Core/Src/Motor/motor_functions.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file motor_functions.h 4 | * @author Embedded Area 5 | * @date Feb 24, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef SRC_MOTOR_MOTOR_FUNCTIONS_H_ 11 | #define SRC_MOTOR_MOTOR_FUNCTIONS_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | #include "drone_infos.h" 21 | #include "main.h" 22 | 23 | /************************************ 24 | * MACROS AND DEFINES 25 | ************************************/ 26 | //todo: Explain these macros 27 | #define MAX_THRUST_VALUE 115 //255-140 = 115 28 | #define THRUST_UNITY_COEFF (255/MAX_THRUST_VALUE) 29 | 30 | #define MAX_DIRECTION_VALUE 125.0 //255-140 = 115 31 | #define FULL_GAZ 180.0 32 | #define LEFT_RIGHT_LIMIT 25.0 // 50/2 33 | #define YAW_OFFSET 15.0 34 | #define MINIMUM_TICK 98.0 35 | #define MAXIMUM_TICK 218.0 36 | #define MS_TO_TICK_CONST 0.91 37 | 38 | /************************************ 39 | * TYPEDEFS 40 | ************************************/ 41 | 42 | /************************************ 43 | * EXPORTED VARIABLES 44 | ************************************/ 45 | 46 | /************************************ 47 | * GLOBAL FUNCTION PROTOTYPES 48 | ************************************/ 49 | 50 | /** 51 | * Hold the drone still. 52 | */ 53 | void motor_stay_still(void); 54 | 55 | /** 56 | * Set PWM values to rotate drone right. 57 | */ 58 | void motor_turn_right(void); 59 | 60 | /** 61 | * Set PWM values to rotate drone left. 62 | */ 63 | void motor_turn_left(void); 64 | 65 | /** 66 | * Set motor PWM values according to incoming speed and orientation values 67 | * @param motor_thrust: motor thrust value 68 | * @param motor_x_axis: motor movement in X axis 69 | * @param motor_y_axis: motor movement in Y axis 70 | */ 71 | void motor_active_movement(uint8_t motor_thrust, uint8_t motor_x_axis, uint8_t motor_y_axis); 72 | 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /firmware/Core/Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_IT_H 23 | #define __STM32F1xx_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Private includes ----------------------------------------------------------*/ 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN ET */ 36 | 37 | /* USER CODE END ET */ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* USER CODE BEGIN EC */ 41 | 42 | /* USER CODE END EC */ 43 | 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* USER CODE BEGIN EM */ 46 | 47 | /* USER CODE END EM */ 48 | 49 | /* Exported functions prototypes ---------------------------------------------*/ 50 | void HardFault_Handler(void); 51 | void DMA1_Channel3_IRQHandler(void); 52 | void DMA1_Channel5_IRQHandler(void); 53 | void DMA1_Channel6_IRQHandler(void); 54 | void DMA1_Channel7_IRQHandler(void); 55 | void TIM4_IRQHandler(void); 56 | void I2C1_EV_IRQHandler(void); 57 | void USART1_IRQHandler(void); 58 | void USART2_IRQHandler(void); 59 | /* USER CODE BEGIN EFP */ 60 | 61 | /* USER CODE END EFP */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F1xx_IT_H */ 68 | 69 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 70 | -------------------------------------------------------------------------------- /firmware/Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2017 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /** @addtogroup CMSIS 21 | * @{ 22 | */ 23 | 24 | /** @addtogroup stm32f10x_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef __SYSTEM_STM32F10X_H 32 | #define __SYSTEM_STM32F10X_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32F10x_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32F10x_System_Exported_types 48 | * @{ 49 | */ 50 | 51 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 52 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 53 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /firmware/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /software/GroundStation/Controller/InitilizeDevice.cs: -------------------------------------------------------------------------------- 1 | using SharpDX.DirectInput; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Security.Cryptography.X509Certificates; 7 | using System.Text; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace GroundStation.Model 13 | { 14 | public class InitilizeDevice 15 | { 16 | //nuget:sharp.dx direct input 17 | 18 | DirectInput directInput = new DirectInput(); 19 | Guid joystickGuid = Guid.Empty; 20 | public Joystick joystick; 21 | 22 | bool startup = false; 23 | 24 | public string getName() 25 | { 26 | return joystick.Properties.ProductName; 27 | } 28 | public bool Disconnect() 29 | { 30 | joystick = null; 31 | return false; 32 | } 33 | public bool Setup() 34 | { 35 | 36 | // Initialize DirectInput 37 | // Find a Joystick Guid 38 | 39 | foreach (var deviceInstance in directInput.GetDevices(DeviceType.Gamepad, DeviceEnumerationFlags.AllDevices)) 40 | joystickGuid = deviceInstance.InstanceGuid; 41 | 42 | 43 | // If Gamepad not found, look for a Joystick 44 | if (joystickGuid == Guid.Empty) 45 | foreach (var deviceInstance in directInput.GetDevices(DeviceType.Joystick, 46 | DeviceEnumerationFlags.AllDevices)) 47 | joystickGuid = deviceInstance.InstanceGuid; 48 | 49 | // If Joystick not found, throws an error 50 | if (joystickGuid == Guid.Empty) 51 | { 52 | Debug.WriteLine("No joystick/Gamepad found."); 53 | } 54 | 55 | 56 | // Instantiate joystick 57 | try 58 | { 59 | 60 | joystick = new Joystick(directInput, joystickGuid); 61 | // Query all suported ForceFeedback effects 62 | var allEffects = joystick.GetEffects(); 63 | foreach (var effectInfo in allEffects) 64 | Console.WriteLine("Effect available {0}", effectInfo.Name); 65 | 66 | // Set BufferSize in order to use buffered data. BufferSize = arabellek boyutu, bufferd = korumak 67 | joystick.Properties.BufferSize = 128; 68 | 69 | // Acquire the joystick , Acquire = elde etmek 70 | joystick.Acquire(); 71 | 72 | startup = true; 73 | } 74 | catch (Exception ex) 75 | { 76 | return false; 77 | //TODO : hata mesajı controller bulunamadı 78 | } 79 | return true; 80 | } 81 | 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /firmware/Drivers/CMSIS/Include/tz_context.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file tz_context.h 3 | * @brief Context Management for Armv8-M TrustZone 4 | * @version V1.0.1 5 | * @date 10. January 2018 6 | ******************************************************************************/ 7 | /* 8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved. 9 | * 10 | * SPDX-License-Identifier: Apache-2.0 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the License); you may 13 | * not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT 20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #if defined ( __ICCARM__ ) 26 | #pragma system_include /* treat file as system include file for MISRA check */ 27 | #elif defined (__clang__) 28 | #pragma clang system_header /* treat file as system include file */ 29 | #endif 30 | 31 | #ifndef TZ_CONTEXT_H 32 | #define TZ_CONTEXT_H 33 | 34 | #include 35 | 36 | #ifndef TZ_MODULEID_T 37 | #define TZ_MODULEID_T 38 | /// \details Data type that identifies secure software modules called by a process. 39 | typedef uint32_t TZ_ModuleId_t; 40 | #endif 41 | 42 | /// \details TZ Memory ID identifies an allocated memory slot. 43 | typedef uint32_t TZ_MemoryId_t; 44 | 45 | /// Initialize secure context memory system 46 | /// \return execution status (1: success, 0: error) 47 | uint32_t TZ_InitContextSystem_S (void); 48 | 49 | /// Allocate context memory for calling secure software modules in TrustZone 50 | /// \param[in] module identifies software modules called from non-secure mode 51 | /// \return value != 0 id TrustZone memory slot identifier 52 | /// \return value 0 no memory available or internal error 53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); 54 | 55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S 56 | /// \param[in] id TrustZone memory slot identifier 57 | /// \return execution status (1: success, 0: error) 58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); 59 | 60 | /// Load secure context (called on RTOS thread context switch) 61 | /// \param[in] id TrustZone memory slot identifier 62 | /// \return execution status (1: success, 0: error) 63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); 64 | 65 | /// Store secure context (called on RTOS thread context switch) 66 | /// \param[in] id TrustZone memory slot identifier 67 | /// \return execution status (1: success, 0: error) 68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); 69 | 70 | #endif // TZ_CONTEXT_H 71 | -------------------------------------------------------------------------------- /firmware/Core/Src/freertos.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : freertos.c 5 | * Description : Code for freertos applications 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "FreeRTOS.h" 23 | #include "task.h" 24 | #include "main.h" 25 | 26 | /* Private includes ----------------------------------------------------------*/ 27 | /* USER CODE BEGIN Includes */ 28 | 29 | /* USER CODE END Includes */ 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* USER CODE BEGIN PTD */ 33 | 34 | /* USER CODE END PTD */ 35 | 36 | /* Private define ------------------------------------------------------------*/ 37 | /* USER CODE BEGIN PD */ 38 | 39 | /* USER CODE END PD */ 40 | 41 | /* Private macro -------------------------------------------------------------*/ 42 | /* USER CODE BEGIN PM */ 43 | 44 | /* USER CODE END PM */ 45 | 46 | /* Private variables ---------------------------------------------------------*/ 47 | /* USER CODE BEGIN Variables */ 48 | 49 | /* USER CODE END Variables */ 50 | 51 | /* Private function prototypes -----------------------------------------------*/ 52 | /* USER CODE BEGIN FunctionPrototypes */ 53 | 54 | /* USER CODE END FunctionPrototypes */ 55 | 56 | /* GetIdleTaskMemory prototype (linked to static allocation support) */ 57 | void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ); 58 | 59 | /* USER CODE BEGIN GET_IDLE_TASK_MEMORY */ 60 | static StaticTask_t xIdleTaskTCBBuffer; 61 | static StackType_t xIdleStack[configMINIMAL_STACK_SIZE]; 62 | 63 | void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) 64 | { 65 | *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer; 66 | *ppxIdleTaskStackBuffer = &xIdleStack[0]; 67 | *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; 68 | /* place for user code */ 69 | } 70 | /* USER CODE END GET_IDLE_TASK_MEMORY */ 71 | 72 | /* Private application code --------------------------------------------------*/ 73 | /* USER CODE BEGIN Application */ 74 | 75 | /* USER CODE END Application */ 76 | 77 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GroundStation.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MyJoyGui.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /firmware/Core/Src/sysmem.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file sysmem.c 4 | * @author Generated by STM32CubeIDE 5 | * @brief STM32CubeIDE System Memory calls file 6 | * 7 | * For more information about which C functions 8 | * need which of these lowlevel functions 9 | * please consult the newlib libc manual 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© Copyright (c) 2020 STMicroelectronics. 14 | * All rights reserved.

15 | * 16 | * This software component is licensed by ST under BSD 3-Clause license, 17 | * the "License"; You may not use this file except in compliance with the 18 | * License. You may obtain a copy of the License at: 19 | * opensource.org/licenses/BSD-3-Clause 20 | * 21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes */ 25 | #include 26 | #include 27 | 28 | /** 29 | * Pointer to the current high watermark of the heap usage 30 | */ 31 | static uint8_t *__sbrk_heap_end = NULL; 32 | 33 | /** 34 | * @brief _sbrk() allocates memory to the newlib heap and is used by malloc 35 | * and others from the C library 36 | * 37 | * @verbatim 38 | * ############################################################################ 39 | * # .data # .bss # newlib heap # MSP stack # 40 | * # # # # Reserved by _Min_Stack_Size # 41 | * ############################################################################ 42 | * ^-- RAM start ^-- _end _estack, RAM end --^ 43 | * @endverbatim 44 | * 45 | * This implementation starts allocating at the '_end' linker symbol 46 | * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack 47 | * The implementation considers '_estack' linker symbol to be RAM end 48 | * NOTE: If the MSP stack, at any point during execution, grows larger than the 49 | * reserved size, please increase the '_Min_Stack_Size'. 50 | * 51 | * @param incr Memory size 52 | * @return Pointer to allocated memory 53 | */ 54 | void *_sbrk(ptrdiff_t incr) 55 | { 56 | extern uint8_t _end; /* Symbol defined in the linker script */ 57 | extern uint8_t _estack; /* Symbol defined in the linker script */ 58 | extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */ 59 | const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size; 60 | const uint8_t *max_heap = (uint8_t *)stack_limit; 61 | uint8_t *prev_heap_end; 62 | 63 | /* Initalize heap end at first call */ 64 | if (NULL == __sbrk_heap_end) 65 | { 66 | __sbrk_heap_end = &_end; 67 | } 68 | 69 | /* Protect heap from growing into the reserved MSP stack */ 70 | if (__sbrk_heap_end + incr > max_heap) 71 | { 72 | errno = ENOMEM; 73 | return (void *)-1; 74 | } 75 | 76 | prev_heap_end = __sbrk_heap_end; 77 | __sbrk_heap_end += incr; 78 | 79 | return (void *)prev_heap_end; 80 | } 81 | -------------------------------------------------------------------------------- /firmware/Core/Inc/drone_infos.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file drone_infos.h 4 | * @author Embedded Area 5 | * @date Jan 1, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | #ifndef INC_DRONE_INFOS_H_ 10 | #define INC_DRONE_INFOS_H_ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | /************************************ 17 | * INCLUDES 18 | ************************************/ 19 | #include "stdint.h" 20 | 21 | /************************************ 22 | * MACROS AND DEFINES 23 | ************************************/ 24 | /* 25 | * Message Format and Indices 26 | * |address|type|control=CTRL_MOTOR_PWM_VALUES|motorSolAnalog|motorSa�AnalogDikey|motorSa�AnalogYatay|crc(2 byte) 27 | * |address|type|control=CTRL_SPECIAL_MOTOR_MOVEMENT|TURN_RIGHT|crc(2 byte) 28 | * |address|type|control=CTRL_OTHER_MESSAGES|OTONOM|crc(2 byte) 29 | * 0x49 0x0A 0x00 30 | */ 31 | #define LORA_RX_MSG_ADDRESS_IDX 0 32 | #define LORA_RX_MSG_TYPE_IDX 1 33 | 34 | //CONTROL VALUES FOR MOTOR PWM VALUES 35 | #define LORA_RX_MOT_SOL_CONTROL_IDX 2 // Sol analog dikey eksen - sadece motor thrust 36 | #define LORA_RX_MOT_SAG_Y_CONTROL_IDX 3 // Sag analog dikey eksen 37 | #define LORA_RX_MOT_SAG_D_CONTROL_IDX 4 // Sag analog yatay eksen 38 | #define LORA_RX_MOT_L1 5 // Sol analog dikey eksen - sadece motor thrust 39 | #define LORA_RX_MOT_R1 6 // Sag analog dikey eksen 40 | #define LORA_RX_MOT_A 7 // Sag analog yatay eksen 41 | 42 | //DRONE ID ADDRESS 43 | #define DRONE_ID 0x49 // First byte of the incoming message is drone ID (ADDRESS BYTE) 44 | 45 | /************************************ 46 | * TYPEDEFS 47 | ************************************/ 48 | //LORA MESSAGE FORMATS 49 | typedef enum{ 50 | ADVERTISING_DATA = 0x00, 51 | PERIODIC_DATA = 0x0A, // Normal remote controller and sensor data 52 | CRITICAL_DATA = 0x0B 53 | }lora_msg_type_t; 54 | 55 | typedef enum{ 56 | CTRL_MOTOR_PWM_VALUES = 0, 57 | CTRL_SPECIAL_MOTOR_MOVEMENT = 1, 58 | CTRL_OTHER_MESSAGES = 2 59 | }lora_msg_cntrl_t; 60 | 61 | typedef enum{ 62 | STAY_STILL = 0, 63 | TURN_RIGHT = 1, 64 | TURN_LEFT = 2, 65 | TAKLA_AT = 3 66 | }lora_special_motor_movement_t; 67 | 68 | /************************************* 69 | * DRONE STATES 70 | *************************************/ 71 | typedef enum{ 72 | STATE_INITIAL, 73 | STATE_MOTORS_OFF, 74 | STATE_ACTIVELY_CONTROLLED_BY_USER, 75 | STATE_STAYING_STILL, 76 | STATE_TURNING_RIGHT, 77 | STATE_TURNING_LEFT, 78 | STATE_RETURNING_HOME 79 | }drone_current_state_t; 80 | 81 | typedef struct{ 82 | uint8_t current_state; 83 | uint8_t thrust; 84 | volatile uint32_t *mot1_pwm; 85 | volatile uint32_t *mot2_pwm; 86 | volatile uint32_t *mot3_pwm; 87 | volatile uint32_t *mot4_pwm; 88 | }Drone; 89 | 90 | /************************************ 91 | * EXPORTED VARIABLES 92 | ************************************/ 93 | 94 | /************************************ 95 | * GLOBAL FUNCTION PROTOTYPES 96 | ************************************/ 97 | 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /software/GroundStation/obj/Debug/Drone_Ground_Station.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.exe.config 2 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.exe 3 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\MyJoyGui.pdb 4 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.dll 5 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.dll 6 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.pdb 7 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.pdb 8 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\bin\Debug\SharpDX.DirectInput.xml 9 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.Form1.resources 10 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.Properties.Resources.resources 11 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.GenerateResource.cache 12 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.exe.licenses 13 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.CoreCompileInputs.cache 14 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.CopyComplete 15 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.exe 16 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\MyJoyGui.pdb 17 | C:\Users\sona\source\repos\form\MyJoyGui\MyJoyGui\obj\Debug\Drone_Ground_Station.csprojAssemblyReference.cache 18 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\Drone_Ground_Station.csprojAssemblyReference.cache 19 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.Properties.Resources.resources 20 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.GenerateResource.cache 21 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.exe.licenses 22 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.CoreCompileInputs.cache 23 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.exe 24 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\MyJoyGui.pdb 25 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.exe.config 26 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.exe 27 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\MyJoyGui.pdb 28 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.dll 29 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.dll 30 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.pdb 31 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.pdb 32 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\bin\Debug\SharpDX.DirectInput.xml 33 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\Drone_Ground_Station.csproj.CopyComplete 34 | C:\Users\sona\source\repos\form\Drone_Ground_Station\MyJoyGui\obj\Debug\GroundStation.Form1.resources 35 | -------------------------------------------------------------------------------- /firmware/Core/Inc/circular_buffers.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file circular_buffers.h.h 4 | * @author Embedded Area 5 | * @date 2020 6 | * @brief Contains circular buffer implementation and related functions 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef INC_CIRCULAR_BUFFERS_H_ 11 | #define INC_CIRCULAR_BUFFERS_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | 21 | /************************************ 22 | * MACROS AND DEFINES 23 | ************************************/ 24 | 25 | /************************************ 26 | * TYPEDEFS 27 | ************************************/ 28 | 29 | /** 30 | * Circular buffer result types 31 | */ 32 | typedef enum { 33 | CIRC_WRITE_SUCCESS = 1, 34 | CIRC_WRITE_ERR_NO_SPACE, 35 | CIRC_READ_SUCCESS, 36 | CIRC_READ_FAILED 37 | } circular_status_t; 38 | 39 | 40 | /** 41 | * Struct type for the circular buffers (will be used for LORA, PC and maybe GPS) 42 | */ 43 | typedef struct { 44 | uint32_t size; /** message length */ 45 | uint32_t head; /** writing point */ 46 | uint32_t tail; /** reading point */ 47 | uint32_t remaining_length; /** remaining empty buffer size */ 48 | uint8_t *data; /** address of the array used for storing data*/ 49 | } circular_buffers_t; 50 | 51 | /************************************ 52 | * EXPORTED VARIABLES 53 | ************************************/ 54 | 55 | /************************************ 56 | * GLOBAL FUNCTION PROTOTYPES 57 | ************************************/ 58 | /** 59 | * @brief This function writes the given buffer to the circular buffer at a number of size 60 | * Writing starts from head 61 | * @param circular address of circular buffer 62 | * @param source_buffer address of source buffer where the data is copied 63 | * @param size length of data to be written in bytes 64 | * @retval 1 for successful writing 65 | */ 66 | circular_status_t circular_write(circular_buffers_t *circular, const uint8_t *source_buffer, uint32_t size); 67 | 68 | /** 69 | * @brief This function reads the circular buffer and copies to the dest buffer at a number of size 70 | * Reading starts from tail 71 | * @param circular address of circular buffer 72 | * @param dest_buffer address of destination buffer where the data is copied 73 | * @param size length of data to be copied in bytes 74 | * @retval 1 for successful reading 75 | */ 76 | circular_status_t circular_read(circular_buffers_t *circular, uint8_t *dest_buffer, uint32_t size); 77 | 78 | /** 79 | * @brief This function reads the circular buffer from the given index and copies to the dest buffer at a number of size 80 | * Reading starts from given index 81 | * @param circular address of circular buffer 82 | * @param dest_buffer address of destination buffer where the data is copied 83 | * @param starting_index index of destination buffer where the data copying starts 84 | * @param size length of data to be copied in bytes 85 | * @retval 1 for successful reading 86 | */ 87 | circular_status_t circular_read_from(circular_buffers_t *circular, uint8_t *dest_buffer, uint32_t starting_index, uint32_t size); 88 | 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /firmware/Core/Src/syscalls.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file syscalls.c 4 | * @author Auto-generated by STM32CubeIDE 5 | * @brief STM32CubeIDE Minimal System calls file 6 | * 7 | * For more information about which c-functions 8 | * need which of these lowlevel functions 9 | * please consult the Newlib libc-manual 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© Copyright (c) 2020 STMicroelectronics. 14 | * All rights reserved.

15 | * 16 | * This software component is licensed by ST under BSD 3-Clause license, 17 | * the "License"; You may not use this file except in compliance with the 18 | * License. You may obtain a copy of the License at: 19 | * opensource.org/licenses/BSD-3-Clause 20 | * 21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes */ 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | 35 | /* Variables */ 36 | //#undef errno 37 | extern int errno; 38 | extern int __io_putchar(int ch) __attribute__((weak)); 39 | extern int __io_getchar(void) __attribute__((weak)); 40 | 41 | register char * stack_ptr asm("sp"); 42 | 43 | char *__env[1] = { 0 }; 44 | char **environ = __env; 45 | 46 | 47 | /* Functions */ 48 | void initialise_monitor_handles() 49 | { 50 | } 51 | 52 | int _getpid(void) 53 | { 54 | return 1; 55 | } 56 | 57 | int _kill(int pid, int sig) 58 | { 59 | errno = EINVAL; 60 | return -1; 61 | } 62 | 63 | void _exit (int status) 64 | { 65 | _kill(status, -1); 66 | while (1) {} /* Make sure we hang here */ 67 | } 68 | 69 | __attribute__((weak)) int _read(int file, char *ptr, int len) 70 | { 71 | int DataIdx; 72 | 73 | for (DataIdx = 0; DataIdx < len; DataIdx++) 74 | { 75 | *ptr++ = __io_getchar(); 76 | } 77 | 78 | return len; 79 | } 80 | 81 | __attribute__((weak)) int _write(int file, char *ptr, int len) 82 | { 83 | int DataIdx; 84 | 85 | for (DataIdx = 0; DataIdx < len; DataIdx++) 86 | { 87 | __io_putchar(*ptr++); 88 | } 89 | return len; 90 | } 91 | 92 | int _close(int file) 93 | { 94 | return -1; 95 | } 96 | 97 | 98 | int _fstat(int file, struct stat *st) 99 | { 100 | st->st_mode = S_IFCHR; 101 | return 0; 102 | } 103 | 104 | int _isatty(int file) 105 | { 106 | return 1; 107 | } 108 | 109 | int _lseek(int file, int ptr, int dir) 110 | { 111 | return 0; 112 | } 113 | 114 | int _open(char *path, int flags, ...) 115 | { 116 | /* Pretend like we always fail */ 117 | return -1; 118 | } 119 | 120 | int _wait(int *status) 121 | { 122 | errno = ECHILD; 123 | return -1; 124 | } 125 | 126 | int _unlink(char *name) 127 | { 128 | errno = ENOENT; 129 | return -1; 130 | } 131 | 132 | int _times(struct tms *buf) 133 | { 134 | return -1; 135 | } 136 | 137 | int _stat(char *file, struct stat *st) 138 | { 139 | st->st_mode = S_IFCHR; 140 | return 0; 141 | } 142 | 143 | int _link(char *old, char *new) 144 | { 145 | errno = EMLINK; 146 | return -1; 147 | } 148 | 149 | int _fork(void) 150 | { 151 | errno = EAGAIN; 152 | return -1; 153 | } 154 | 155 | int _execve(char *name, char **argv, char **env) 156 | { 157 | errno = ENOMEM; 158 | return -1; 159 | } 160 | -------------------------------------------------------------------------------- /firmware/Core/Src/crc8.c: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file crc8.c 4 | * @author Embedded Area 5 | * @date Jan 26, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | /************************************ 11 | * INCLUDES 12 | ************************************/ 13 | #include "crc8.h" 14 | 15 | /************************************ 16 | * EXTERN VARIABLES 17 | ************************************/ 18 | 19 | /************************************ 20 | * PRIVATE MACROS AND DEFINES 21 | ************************************/ 22 | 23 | /************************************ 24 | * PRIVATE TYPEDEFS 25 | ************************************/ 26 | 27 | /************************************ 28 | * STATIC VARIABLES 29 | ************************************/ 30 | static const uint8_t crcTable[] = { 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D, 31 | 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, 32 | 0xE0, 0xE7, 0xEE, 0xE9, 0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, 33 | 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, 0xA8, 0xAF, 0xA6, 0xA1, 0xB4, 0xB3, 0xBA, 0xBD, 34 | 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, 35 | 0xB7, 0xB0, 0xB9, 0xBE, 0xAB, 0xAC, 0xA5, 0xA2, 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, 36 | 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, 0x1F, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0D, 0x0A, 37 | 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, 38 | 0x89, 0x8E, 0x87, 0x80, 0x95, 0x92, 0x9B, 0x9C, 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, 39 | 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, 0xC1, 0xC6, 0xCF, 0xC8, 0xDD, 0xDA, 0xD3, 0xD4, 40 | 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, 41 | 0x19, 0x1E, 0x17, 0x10, 0x05, 0x02, 0x0B, 0x0C, 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, 42 | 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, 0x76, 0x71, 0x78, 0x7F, 0x6A, 0x6D, 0x64, 0x63, 43 | 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, 44 | 0xAE, 0xA9, 0xA0, 0xA7, 0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, 45 | 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF, 0xFA, 0xFD, 0xF4, 0xF3}; 46 | 47 | /************************************ 48 | * GLOBAL VARIABLES 49 | ************************************/ 50 | 51 | /************************************ 52 | * STATIC FUNCTION PROTOTYPES 53 | ************************************/ 54 | 55 | /************************************ 56 | * STATIC FUNCTIONS 57 | ************************************/ 58 | 59 | /************************************ 60 | * GLOBAL FUNCTIONS 61 | ************************************/ 62 | /**crc8 63 | * @brief Calculates the crc of the message 64 | * @param message: address of message 65 | * @param len: length of the message 66 | * @return CRC value 67 | */ 68 | uint8_t crc8(const char *message, uint16_t len) { 69 | uint8_t data; 70 | uint8_t remainder = 0; 71 | 72 | /* Divide the message by the polynomial, a byte at a time. */ 73 | for (int byte = 0; byte < len; ++byte) { 74 | data = message[byte] ^ (remainder >> 0); 75 | remainder = crcTable[data] ^ (remainder << 8); 76 | } 77 | 78 | /* The final remainder is the CRC. */ 79 | return (remainder); 80 | } 81 | 82 | -------------------------------------------------------------------------------- /firmware/Core/Tasks/Sensors.c: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file Sensors.c 4 | * @author Embedded Area 5 | * @date 2021 6 | * @brief Contains tasks related with sensor readings and usings 7 | ******************************************************************************** 8 | */ 9 | 10 | /************************************ 11 | * INCLUDES 12 | ************************************/ 13 | #include "main.h" 14 | #include "math.h" 15 | #include "../MPU9250/mpu9250.h" 16 | #include "../NEO_6M_GPS/gps.h" 17 | #include "string.h" 18 | #include "stdio.h" 19 | 20 | /************************************ 21 | * EXTERN VARIABLES 22 | ************************************/ 23 | extern DMA_HandleTypeDef hdma_i2c1_rx; 24 | extern osSemaphoreId mpu9265_smphrHandle; 25 | extern osThreadId gpsTaskHandle, mpu9265TaskHandle, batteryTaskHandle; 26 | 27 | /************************************ 28 | * PRIVATE MACROS AND DEFINES 29 | ************************************/ 30 | 31 | /************************************ 32 | * PRIVATE TYPEDEFS 33 | ************************************/ 34 | 35 | /************************************ 36 | * STATIC VARIABLES 37 | ************************************/ 38 | 39 | /************************************ 40 | * GLOBAL VARIABLES 41 | ************************************/ 42 | 43 | /************************************ 44 | * STATIC FUNCTION PROTOTYPES 45 | ************************************/ 46 | 47 | /************************************ 48 | * STATIC FUNCTIONS 49 | ************************************/ 50 | 51 | /************************************ 52 | * GLOBAL FUNCTIONS 53 | ************************************/ 54 | 55 | /** 56 | * @brief Function implementing the gpsTask thread. 57 | * @param argument: Not used 58 | * @retval None 59 | */ 60 | void GPSTask(void const * argument) 61 | { 62 | osThreadTerminate(gpsTaskHandle); 63 | for(;;) 64 | { 65 | osDelay(1); 66 | } 67 | } 68 | 69 | 70 | /** 71 | * @brief Function implementing the mpu9265Task thread. 72 | * @param argument: Not used 73 | * @retval None 74 | */ 75 | void MPU9265Task(void const * argument) 76 | { 77 | osSemaphoreWait(mpu9265_smphrHandle, osWaitForever); 78 | __HAL_DMA_ENABLE_IT(&hdma_i2c1_rx, DMA_IT_TC); 79 | 80 | float pitch = 0.0f, roll = 0.0f; 81 | 82 | #if SERIAL_DEBUG 83 | 84 | char text[65]; 85 | 86 | int ret = MPU9250_Init(); 87 | memset(text, 0, 65); 88 | sprintf((char *) text,"mpu_init: %d\n", ret); 89 | send_message_to_pc(text); 90 | 91 | int who = MPU9250_WhoAmI(); 92 | 93 | memset(text, 0, 65); 94 | sprintf((char *) text,"WhoAmI: %d\n", who); 95 | send_message_to_pc(text); 96 | 97 | who = MPU9250_WhoAmIAK8963(); 98 | 99 | memset(text, 0, 65); 100 | sprintf((char *) text,"whoAmIAK8963: %d\n", who); 101 | send_message_to_pc(text); 102 | 103 | #else 104 | MPU9250_Init(); 105 | #endif 106 | 107 | uint32_t time, deltaT; 108 | uint32_t lastTime = 0; 109 | 110 | for(;;) 111 | { 112 | MPU9250_ReadSensor(); 113 | time = HAL_GetTick(); 114 | deltaT = time - lastTime; 115 | lastTime = time; 116 | ComplementaryFilter(&pitch, &roll, deltaT); 117 | #if SERIAL_DEBUG 118 | memset(text, 0, 65); 119 | sprintf((char *) text,"Roll:%05d:Pitch:%05d:\r\n", (int)(100.0*roll), (int)(100.0*pitch)); 120 | send_message_to_pc(text); 121 | #endif 122 | 123 | osDelay(80); 124 | 125 | } 126 | } 127 | 128 | 129 | /** 130 | * @brief Function implementing the batteryTask thread. 131 | * @param argument: Not used 132 | * @retval None 133 | */ 134 | void BatteryTask(void const * argument) 135 | { 136 | osThreadTerminate(batteryTaskHandle); 137 | for(;;) 138 | { 139 | osDelay(1); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /firmware/Core/Src/circular_buffers.c: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file circular_buffers.c 4 | * @author Embedded Area 5 | * @date 2020 6 | * @brief Contains circular buffer implementation, related functions 7 | * and global variables. 8 | ******************************************************************************** 9 | */ 10 | 11 | /************************************ 12 | * INCLUDES 13 | ************************************/ 14 | #include "main.h" 15 | #include "string.h" 16 | #include "circular_buffers.h" 17 | 18 | /************************************ 19 | * EXTERN VARIABLES 20 | ************************************/ 21 | 22 | /************************************ 23 | * PRIVATE MACROS AND DEFINES 24 | ************************************/ 25 | 26 | /************************************ 27 | * PRIVATE TYPEDEFS 28 | ************************************/ 29 | 30 | /************************************ 31 | * STATIC VARIABLES 32 | ************************************/ 33 | 34 | /************************************ 35 | * GLOBAL VARIABLES 36 | ************************************/ 37 | 38 | /************************************ 39 | * STATIC FUNCTION PROTOTYPES 40 | ************************************/ 41 | 42 | /************************************ 43 | * STATIC FUNCTIONS 44 | ************************************/ 45 | 46 | /************************************ 47 | * GLOBAL FUNCTIONS 48 | ************************************/ 49 | 50 | /** 51 | * @brief This function writes the given buffer to the circular buffer at a number of size 52 | * Writing starts from head 53 | * @param circular: address of circular buffer 54 | * @param source_buffer: address of source buffer where the data is copied 55 | * @param size: length of data to be written in bytes 56 | * @retval 1 for successful writing 57 | */ 58 | circular_status_t circular_write(circular_buffers_t *circular, const uint8_t *source_buffer, uint32_t size){ 59 | /* Check if the circular buffer is empty enough */ 60 | if(circular->remaining_length >= size){ 61 | do { 62 | circular->data[circular->head] = *source_buffer++; 63 | circular->head = (circular->head + 1) % circular->size; 64 | circular->remaining_length--; 65 | } while(--size != 0); 66 | return CIRC_WRITE_SUCCESS; 67 | } 68 | else { 69 | return CIRC_WRITE_ERR_NO_SPACE; 70 | } 71 | } 72 | 73 | /** 74 | * @brief This function reads the circular buffer and copies to the dest buffer at a number of size 75 | * Reading starts from tail 76 | * @param circular: address of circular buffer 77 | * @param dest_buffer: address of destination buffer where the data is copied 78 | * @param size: length of data to be copied in bytes 79 | * @retval 1 for successful reading 80 | */ 81 | circular_status_t circular_read(circular_buffers_t *circular, uint8_t *dest_buffer, uint32_t size){ 82 | do { 83 | *dest_buffer++ = circular->data[circular->tail]; 84 | circular->tail = (circular->tail + 1) % circular->size; 85 | circular->remaining_length++; 86 | } while(--size != 0); 87 | return CIRC_READ_SUCCESS; 88 | } 89 | 90 | /** 91 | * @brief This function reads the circular buffer from the given index and copies to the dest buffer at a number of size 92 | * Reading starts from given index 93 | * @param circular: address of circular buffer 94 | * @param dest_buffer: address of destination buffer where the data is copied 95 | * @param starting_index: index of destination buffer where the data copying starts 96 | * @param size: length of data to be copied in bytes 97 | * @retval 1 for successful reading 98 | */ 99 | circular_status_t circular_read_from(circular_buffers_t *circular, uint8_t *dest_buffer, uint32_t starting_index, uint32_t size){ 100 | do { 101 | *dest_buffer++ = circular->data[starting_index]; 102 | starting_index = (starting_index + 1) % circular->size; 103 | circular->remaining_length++; 104 | } while(--size != 0); 105 | return CIRC_READ_SUCCESS; 106 | } 107 | -------------------------------------------------------------------------------- /firmware/Core/Inc/main.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : main.h 5 | * @brief : Header for main.c file. 6 | * This file contains the common defines of the application. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2020 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MAIN_H 24 | #define __MAIN_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f1xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | #include "circular_buffers.h" 36 | #define SERIAL_DEBUG 0 37 | /* USER CODE END Includes */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* USER CODE BEGIN ET */ 41 | 42 | /* USER CODE END ET */ 43 | 44 | /* Exported constants --------------------------------------------------------*/ 45 | /* USER CODE BEGIN EC */ 46 | 47 | /* USER CODE END EC */ 48 | 49 | /* Exported macro ------------------------------------------------------------*/ 50 | /* USER CODE BEGIN EM */ 51 | 52 | /* USER CODE END EM */ 53 | 54 | void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim); 55 | 56 | /* Exported functions prototypes ---------------------------------------------*/ 57 | void Error_Handler(void); 58 | 59 | /* USER CODE BEGIN EFP */ 60 | void send_message_to_pc(const char * buffer); 61 | void send_message_with_lora(const char * buffer); 62 | extern UART_HandleTypeDef huart1, huart2; 63 | extern DMA_HandleTypeDef hdma_usart1_rx, hdma_usart2_rx; 64 | /* USER CODE END EFP */ 65 | 66 | /* Private defines -----------------------------------------------------------*/ 67 | #define PC_TX_Pin GPIO_PIN_2 68 | #define PC_TX_GPIO_Port GPIOA 69 | #define PC_RX_Pin GPIO_PIN_3 70 | #define PC_RX_GPIO_Port GPIOA 71 | #define GPS_TX_Pin GPIO_PIN_10 72 | #define GPS_TX_GPIO_Port GPIOB 73 | #define GPS_RX_Pin GPIO_PIN_11 74 | #define GPS_RX_GPIO_Port GPIOB 75 | #define DEBUG_LED_Pin GPIO_PIN_13 76 | #define DEBUG_LED_GPIO_Port GPIOA 77 | #define LORA_AUX_Pin GPIO_PIN_3 78 | #define LORA_AUX_GPIO_Port GPIOB 79 | #define LORA_M1_Pin GPIO_PIN_4 80 | #define LORA_M1_GPIO_Port GPIOB 81 | #define LORA_M0_Pin GPIO_PIN_5 82 | #define LORA_M0_GPIO_Port GPIOB 83 | #define LORA_TX_Pin GPIO_PIN_6 84 | #define LORA_TX_GPIO_Port GPIOB 85 | #define LORA_RX_Pin GPIO_PIN_7 86 | #define LORA_RX_GPIO_Port GPIOB 87 | /* USER CODE BEGIN Private defines */ 88 | 89 | /** 90 | * Struct type that is sent to the queue 91 | */ 92 | typedef struct { 93 | uint32_t start_index; /** starting index of the circular buffer */ 94 | uint32_t length; /** message length */ 95 | } uart_data_t; 96 | 97 | /** 98 | * Size of circular buffer 99 | */ 100 | #define PC_CIRCULAR_UART_BUFFER_SIZE (100) 101 | #define LORA_CIRCULAR_BUFFER_SIZE (100) 102 | 103 | /** 104 | * PC UART_HandleTypeDef 105 | */ 106 | #define HUART_PC (huart2) 107 | 108 | /** 109 | * PC DMA_HandleTypeDef 110 | */ 111 | #define HDMA_UART_PC (hdma_usart2_rx) 112 | 113 | /** 114 | * PC DMA Buffer length for receiver 115 | */ 116 | #define PC_RX_DMA_BUFFER_LEN (100) 117 | 118 | /** 119 | * Lora DMA Buffer length for receiver 120 | */ 121 | #define LORA_RX_DMA_BUFFER_LEN (106) 122 | 123 | /** 124 | * LORA HandleTypeDefs 125 | */ 126 | #define HUART_LORA (huart1) 127 | #define HDMA_UART_LORA (hdma_usart1_rx) 128 | 129 | /* USER CODE END Private defines */ 130 | 131 | #ifdef __cplusplus 132 | } 133 | #endif 134 | 135 | #endif /* __MAIN_H */ 136 | 137 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 138 | -------------------------------------------------------------------------------- /firmware/Core/Src/stm32f1xx_hal_timebase_tim.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_hal_timebase_TIM.c 5 | * @brief HAL time base based on the hardware TIM. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under Ultimate Liberty license 13 | * SLA0044, the "License"; You may not use this file except in compliance with 14 | * the License. You may obtain a copy of the License at: 15 | * www.st.com/SLA0044 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32f1xx_hal.h" 23 | #include "stm32f1xx_hal_tim.h" 24 | 25 | /* Private typedef -----------------------------------------------------------*/ 26 | /* Private define ------------------------------------------------------------*/ 27 | /* Private macro -------------------------------------------------------------*/ 28 | /* Private variables ---------------------------------------------------------*/ 29 | TIM_HandleTypeDef htim4; 30 | /* Private function prototypes -----------------------------------------------*/ 31 | /* Private functions ---------------------------------------------------------*/ 32 | 33 | /** 34 | * @brief This function configures the TIM4 as a time base source. 35 | * The time source is configured to have 1ms time base with a dedicated 36 | * Tick interrupt priority. 37 | * @note This function is called automatically at the beginning of program after 38 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 39 | * @param TickPriority: Tick interrupt priority. 40 | * @retval HAL status 41 | */ 42 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 43 | { 44 | RCC_ClkInitTypeDef clkconfig; 45 | uint32_t uwTimclock = 0; 46 | uint32_t uwPrescalerValue = 0; 47 | uint32_t pFLatency; 48 | /*Configure the TIM4 IRQ priority */ 49 | HAL_NVIC_SetPriority(TIM4_IRQn, TickPriority ,0); 50 | 51 | /* Enable the TIM4 global Interrupt */ 52 | HAL_NVIC_EnableIRQ(TIM4_IRQn); 53 | /* Enable TIM4 clock */ 54 | __HAL_RCC_TIM4_CLK_ENABLE(); 55 | 56 | /* Get clock configuration */ 57 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 58 | 59 | /* Compute TIM4 clock */ 60 | uwTimclock = 2*HAL_RCC_GetPCLK1Freq(); 61 | 62 | /* Compute the prescaler value to have TIM4 counter clock equal to 1MHz */ 63 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000) - 1); 64 | 65 | /* Initialize TIM4 */ 66 | htim4.Instance = TIM4; 67 | 68 | /* Initialize TIMx peripheral as follow: 69 | + Period = [(TIM4CLK/1000) - 1]. to have a (1/1000) s time base. 70 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 71 | + ClockDivision = 0 72 | + Counter direction = Up 73 | */ 74 | htim4.Init.Period = (1000000 / 1000) - 1; 75 | htim4.Init.Prescaler = uwPrescalerValue; 76 | htim4.Init.ClockDivision = 0; 77 | htim4.Init.CounterMode = TIM_COUNTERMODE_UP; 78 | if(HAL_TIM_Base_Init(&htim4) == HAL_OK) 79 | { 80 | /* Start the TIM time Base generation in interrupt mode */ 81 | return HAL_TIM_Base_Start_IT(&htim4); 82 | } 83 | 84 | /* Return function status */ 85 | return HAL_ERROR; 86 | } 87 | 88 | /** 89 | * @brief Suspend Tick increment. 90 | * @note Disable the tick increment by disabling TIM4 update interrupt. 91 | * @param None 92 | * @retval None 93 | */ 94 | void HAL_SuspendTick(void) 95 | { 96 | /* Disable TIM4 update Interrupt */ 97 | __HAL_TIM_DISABLE_IT(&htim4, TIM_IT_UPDATE); 98 | } 99 | 100 | /** 101 | * @brief Resume Tick increment. 102 | * @note Enable the tick increment by Enabling TIM4 update interrupt. 103 | * @param None 104 | * @retval None 105 | */ 106 | void HAL_ResumeTick(void) 107 | { 108 | /* Enable TIM4 Update interrupt */ 109 | __HAL_TIM_ENABLE_IT(&htim4, TIM_IT_UPDATE); 110 | } 111 | 112 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 113 | -------------------------------------------------------------------------------- /firmware/Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_gpio_ex.c 4 | * @author MCD Application Team 5 | * @brief GPIO Extension HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of the General Purpose Input/Output (GPIO) extension peripheral. 8 | * + Extended features functions 9 | * 10 | @verbatim 11 | ============================================================================== 12 | ##### GPIO Peripheral extension features ##### 13 | ============================================================================== 14 | [..] GPIO module on STM32F1 family, manage also the AFIO register: 15 | (+) Possibility to use the EVENTOUT Cortex feature 16 | 17 | ##### How to use this driver ##### 18 | ============================================================================== 19 | [..] This driver provides functions to use EVENTOUT Cortex feature 20 | (#) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 21 | (#) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 22 | (#) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 23 | 24 | @endverbatim 25 | ****************************************************************************** 26 | * @attention 27 | * 28 | *

© Copyright (c) 2016 STMicroelectronics. 29 | * All rights reserved.

30 | * 31 | * This software component is licensed by ST under BSD 3-Clause license, 32 | * the "License"; You may not use this file except in compliance with the 33 | * License. You may obtain a copy of the License at: 34 | * opensource.org/licenses/BSD-3-Clause 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32f1xx_hal.h" 41 | 42 | /** @addtogroup STM32F1xx_HAL_Driver 43 | * @{ 44 | */ 45 | 46 | /** @defgroup GPIOEx GPIOEx 47 | * @brief GPIO HAL module driver 48 | * @{ 49 | */ 50 | 51 | #ifdef HAL_GPIO_MODULE_ENABLED 52 | 53 | /** @defgroup GPIOEx_Exported_Functions GPIOEx Exported Functions 54 | * @{ 55 | */ 56 | 57 | /** @defgroup GPIOEx_Exported_Functions_Group1 Extended features functions 58 | * @brief Extended features functions 59 | * 60 | @verbatim 61 | ============================================================================== 62 | ##### Extended features functions ##### 63 | ============================================================================== 64 | [..] This section provides functions allowing to: 65 | (+) Configure EVENTOUT Cortex feature using the function HAL_GPIOEx_ConfigEventout() 66 | (+) Activate EVENTOUT Cortex feature using the HAL_GPIOEx_EnableEventout() 67 | (+) Deactivate EVENTOUT Cortex feature using the HAL_GPIOEx_DisableEventout() 68 | 69 | @endverbatim 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Configures the port and pin on which the EVENTOUT Cortex signal will be connected. 75 | * @param GPIO_PortSource Select the port used to output the Cortex EVENTOUT signal. 76 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PORT. 77 | * @param GPIO_PinSource Select the pin used to output the Cortex EVENTOUT signal. 78 | * This parameter can be a value of @ref GPIOEx_EVENTOUT_PIN. 79 | * @retval None 80 | */ 81 | void HAL_GPIOEx_ConfigEventout(uint32_t GPIO_PortSource, uint32_t GPIO_PinSource) 82 | { 83 | /* Verify the parameters */ 84 | assert_param(IS_AFIO_EVENTOUT_PORT(GPIO_PortSource)); 85 | assert_param(IS_AFIO_EVENTOUT_PIN(GPIO_PinSource)); 86 | 87 | /* Apply the new configuration */ 88 | MODIFY_REG(AFIO->EVCR, (AFIO_EVCR_PORT) | (AFIO_EVCR_PIN), (GPIO_PortSource) | (GPIO_PinSource)); 89 | } 90 | 91 | /** 92 | * @brief Enables the Event Output. 93 | * @retval None 94 | */ 95 | void HAL_GPIOEx_EnableEventout(void) 96 | { 97 | SET_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 98 | } 99 | 100 | /** 101 | * @brief Disables the Event Output. 102 | * @retval None 103 | */ 104 | void HAL_GPIOEx_DisableEventout(void) 105 | { 106 | CLEAR_BIT(AFIO->EVCR, AFIO_EVCR_EVOE); 107 | } 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /* HAL_GPIO_MODULE_ENABLED */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /software/GroundStation/GroundStation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {88E2A23B-A975-4404-BB95-A9E04BA1CCBB} 8 | WinExe 9 | MyJoyGui 10 | MyJoyGui 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | ..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll 38 | 39 | 40 | ..\packages\SharpDX.DirectInput.4.2.0\lib\net45\SharpDX.DirectInput.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Form 66 | 67 | 68 | Form1.cs 69 | 70 | 71 | 72 | 73 | 74 | Component 75 | 76 | 77 | Form1.cs 78 | 79 | 80 | 81 | ResXFileCodeGenerator 82 | Resources.Designer.cs 83 | Designer 84 | 85 | 86 | True 87 | Resources.resx 88 | 89 | 90 | 91 | SettingsSingleFileGenerator 92 | Settings.Designer.cs 93 | 94 | 95 | True 96 | Settings.settings 97 | True 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /firmware/STM32F103C8TX_FLASH.ld: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file LinkerScript.ld 4 | * @author Auto-generated by STM32CubeIDE 5 | * @brief Linker script for STM32F103C8Tx Device from STM32F1 series 6 | * 64Kbytes FLASH 7 | * 20Kbytes RAM 8 | * 9 | * Set heap size, stack size and stack location according 10 | * to application requirements. 11 | * 12 | * Set memory bank area and size if external memory is used 13 | ****************************************************************************** 14 | * @attention 15 | * 16 | *

© Copyright (c) 2020 STMicroelectronics. 17 | * All rights reserved.

18 | * 19 | * This software component is licensed by ST under BSD 3-Clause license, 20 | * the "License"; You may not use this file except in compliance with the 21 | * License. You may obtain a copy of the License at: 22 | * opensource.org/licenses/BSD-3-Clause 23 | * 24 | ****************************************************************************** 25 | */ 26 | 27 | /* Entry Point */ 28 | ENTRY(Reset_Handler) 29 | 30 | /* Highest address of the user mode stack */ 31 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ 32 | 33 | _Min_Heap_Size = 0x200 ; /* required amount of heap */ 34 | _Min_Stack_Size = 0x400 ; /* required amount of stack */ 35 | 36 | /* Memories definition */ 37 | MEMORY 38 | { 39 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 40 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K 41 | } 42 | 43 | /* Sections */ 44 | SECTIONS 45 | { 46 | /* The startup code into "FLASH" Rom type memory */ 47 | .isr_vector : 48 | { 49 | . = ALIGN(4); 50 | KEEP(*(.isr_vector)) /* Startup code */ 51 | . = ALIGN(4); 52 | } >FLASH 53 | 54 | /* The program code and other data into "FLASH" Rom type memory */ 55 | .text : 56 | { 57 | . = ALIGN(4); 58 | *(.text) /* .text sections (code) */ 59 | *(.text*) /* .text* sections (code) */ 60 | *(.glue_7) /* glue arm to thumb code */ 61 | *(.glue_7t) /* glue thumb to arm code */ 62 | *(.eh_frame) 63 | 64 | KEEP (*(.init)) 65 | KEEP (*(.fini)) 66 | 67 | . = ALIGN(4); 68 | _etext = .; /* define a global symbols at end of code */ 69 | } >FLASH 70 | 71 | /* Constant data into "FLASH" Rom type memory */ 72 | .rodata : 73 | { 74 | . = ALIGN(4); 75 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 76 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 77 | . = ALIGN(4); 78 | } >FLASH 79 | 80 | .ARM.extab : { 81 | . = ALIGN(4); 82 | *(.ARM.extab* .gnu.linkonce.armextab.*) 83 | . = ALIGN(4); 84 | } >FLASH 85 | 86 | .ARM : { 87 | . = ALIGN(4); 88 | __exidx_start = .; 89 | *(.ARM.exidx*) 90 | __exidx_end = .; 91 | . = ALIGN(4); 92 | } >FLASH 93 | 94 | .preinit_array : 95 | { 96 | . = ALIGN(4); 97 | PROVIDE_HIDDEN (__preinit_array_start = .); 98 | KEEP (*(.preinit_array*)) 99 | PROVIDE_HIDDEN (__preinit_array_end = .); 100 | . = ALIGN(4); 101 | } >FLASH 102 | 103 | .init_array : 104 | { 105 | . = ALIGN(4); 106 | PROVIDE_HIDDEN (__init_array_start = .); 107 | KEEP (*(SORT(.init_array.*))) 108 | KEEP (*(.init_array*)) 109 | PROVIDE_HIDDEN (__init_array_end = .); 110 | . = ALIGN(4); 111 | } >FLASH 112 | 113 | .fini_array : 114 | { 115 | . = ALIGN(4); 116 | PROVIDE_HIDDEN (__fini_array_start = .); 117 | KEEP (*(SORT(.fini_array.*))) 118 | KEEP (*(.fini_array*)) 119 | PROVIDE_HIDDEN (__fini_array_end = .); 120 | . = ALIGN(4); 121 | } >FLASH 122 | 123 | /* Used by the startup to initialize data */ 124 | _sidata = LOADADDR(.data); 125 | 126 | /* Initialized data sections into "RAM" Ram type memory */ 127 | .data : 128 | { 129 | . = ALIGN(4); 130 | _sdata = .; /* create a global symbol at data start */ 131 | *(.data) /* .data sections */ 132 | *(.data*) /* .data* sections */ 133 | 134 | . = ALIGN(4); 135 | _edata = .; /* define a global symbol at data end */ 136 | 137 | } >RAM AT> FLASH 138 | 139 | /* Uninitialized data section into "RAM" Ram type memory */ 140 | . = ALIGN(4); 141 | .bss : 142 | { 143 | /* This is used by the startup in order to initialize the .bss section */ 144 | _sbss = .; /* define a global symbol at bss start */ 145 | __bss_start__ = _sbss; 146 | *(.bss) 147 | *(.bss*) 148 | *(COMMON) 149 | 150 | . = ALIGN(4); 151 | _ebss = .; /* define a global symbol at bss end */ 152 | __bss_end__ = _ebss; 153 | } >RAM 154 | 155 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ 156 | ._user_heap_stack : 157 | { 158 | . = ALIGN(8); 159 | PROVIDE ( end = . ); 160 | PROVIDE ( _end = . ); 161 | . = . + _Min_Heap_Size; 162 | . = . + _Min_Stack_Size; 163 | . = ALIGN(8); 164 | } >RAM 165 | 166 | /* Remove information from the compiler libraries */ 167 | /DISCARD/ : 168 | { 169 | libc.a ( * ) 170 | libm.a ( * ) 171 | libgcc.a ( * ) 172 | } 173 | 174 | .ARM.attributes 0 : { *(.ARM.attributes) } 175 | } 176 | -------------------------------------------------------------------------------- /firmware/Core/NEO_6M_GPS/gps.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file gps.h 4 | * @author Embedded Area 5 | * @date Jan 9, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef INC_GPS_H_ 11 | #define INC_GPS_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | #include 21 | #include 22 | #include "gps_conf.h" 23 | 24 | /************************************ 25 | * MACROS AND DEFINES 26 | ************************************/ 27 | #define VALUE_SEPERATOR_HEXADECIMAL 0x2C 28 | #define ADDRESS_INDICATOR 0x24 29 | #define CHECKSUM_INDICATOR 0x2A 30 | #define FLOAT_SEPERATION_INDICATOR 0x2E 31 | 32 | /************************************ 33 | * TYPEDEFS 34 | ************************************/ 35 | typedef enum{ 36 | GPS_FLOAT_TYPE = 0, 37 | GPS_INTEGER_TYPE, 38 | GPS_CHARACTER_TYPE, 39 | GPS_INFO_ERROR 40 | }gps_infoType_t; 41 | 42 | typedef struct{ 43 | gps_infoType_t typeOfData; 44 | union{ 45 | float fdata; 46 | uint32_t udata; 47 | uint8_t cdata; 48 | }typesOfData; 49 | }gps_infoData_t; 50 | 51 | #if GPRMC_FRAME_PARSE_ON 52 | typedef enum GPRMC_FRAME_{ 53 | GPRMC_UTC_TIME = 0, 54 | GPRMC_STATUS, 55 | GPRMC_LATITUDE, 56 | GPRMC_NORTH_OR_SOUTH, 57 | GPRMC_LONGITUDE, 58 | GPRMC_EAST_OR_WEST, 59 | GPRMC_SPEED, 60 | GPRMC_COURSE, 61 | GPRMC_DATE, 62 | GPRMC_MAGNETIC_VARIATION, 63 | GPRMC_MAGNETIC_EAST_OR_WEST, 64 | GPRMC_MODE, 65 | GPRMC_FRAME_BUFFER_SIZE 66 | }dataGPRMC_t; 67 | #endif 68 | 69 | #if GPVTG_FRAME_PARSE_ON 70 | typedef enum GPVTG_FRAME_{ 71 | GPVTG_COURSE_OVER_GROUND = 0, 72 | GPVTG_FIXED_FIELD, 73 | GPVTG_COURSE_OVER_GROUND_MAGNETIC, 74 | GPVTG_FIXED_FIELD_MAGNETIC, 75 | GPVTG_SPEED_OVER_GROUND_KNOTS, 76 | GPVTG_FIXED_FIELD_KNOTS, 77 | GPVTG_SPEED_OVER_GROUND_KM_PER_H, 78 | GPVTG_FIXED_FIELD_KM_PER_H, 79 | GPVTG_MODE, 80 | GPVTG_FRAME_BUFFER_SIZE, 81 | }dataGPVTG_t; 82 | #endif 83 | 84 | #if GPGGA_FRAME_PARSE_ON 85 | typedef enum GPGGA_FRAME_{ 86 | GPGGA_UTC_TIME = 0, 87 | GPGGA_LATITUDE, 88 | GPGGA_NORTH_OR_SOUTH, 89 | GPGGA_LONGITUDE, 90 | GPGGA_EAST_OR_WEST, 91 | GPGGA_POSITION_FIX_STATUS, 92 | GPGGA_SATELLITES_USED, 93 | GPGGA_HORIZONTAL_DILUTION_OF_PRECISION, 94 | GPGGA_MSL_ALTITUDE, 95 | GPGGA_UNITS_MSL, 96 | GPGGA_GEOID_SEPERATION, 97 | GPGGA_UNITS_SEPERATION, 98 | GPGGA_AGE_OF_DIFFERENTIAL_CORRECTIONS, 99 | GPGGA_DIFF_REFERENCE_STATION_ID, 100 | GPGGA_FRAME_BUFFER_SIZE, 101 | }dataGPGGA_t; 102 | #endif 103 | 104 | #if GPGSA_FRAME_PARSE_ON 105 | typedef enum GPGSA_FRAME_{ 106 | GPGSA_S_MODE = 0, 107 | GPGSA_FIX_STATUS, 108 | GPGSA_SATELLITE_NUMBER_1, 109 | GPGSA_SATELLITE_NUMBER_2, 110 | GPGSA_SATELLITE_NUMBER_3, 111 | GPGSA_SATELLITE_NUMBER_4, 112 | GPGSA_SATELLITE_NUMBER_5, 113 | GPGSA_SATELLITE_NUMBER_6, 114 | GPGSA_SATELLITE_NUMBER_7, 115 | GPGSA_SATELLITE_NUMBER_8, 116 | GPGSA_SATELLITE_NUMBER_9, 117 | GPGSA_SATELLITE_NUMBER_10, 118 | GPGSA_SATELLITE_NUMBER_11, 119 | GPGSA_SATELLITE_NUMBER_12, 120 | GPGSA_POSITION_DILUTION_OF_PRECISION, 121 | GPGSA_HORIZONTAL_DILUTION_OF_PRECISION, 122 | GPGSA_VERTICAL_DILUTION_OF_PRECISION, 123 | GPGSA_FRAME_BUFFER_SIZE, 124 | }dataGPGSA_t; 125 | #endif 126 | 127 | #if GPGSV_FRAME_PARSE_ON 128 | typedef enum GPGSV_FRAME_{ 129 | GPGSV_TOTAL_NUMBER_OF_MESSAGES = 0, 130 | GPGSV_NUMBER_OF_RELATED_MESSAGE, 131 | GPGSV_SATELLITES_IN_VIEW, 132 | GPGSV_SATELLITE_ID, 133 | GPGSV_ELEVATION, 134 | GPGSV_AZIMUTH, 135 | GPGSV_C_PER_N0, 136 | GPGSV_FRAME_BUFFER_SIZE, 137 | }dataGPGSV_t; 138 | #endif 139 | 140 | #if GPGLL_FRAME_PARSE_ON 141 | typedef enum GPGLL_FRAME_{ 142 | GPGLL_LATITUDE = 0, 143 | GPGLL_NORTH_OR_SOUTH, 144 | GPGLL_LONGITUDE, 145 | GPGLL_EAST_OR_WEST, 146 | GPGLL_UTC_TIME, 147 | GPGLL_STATUS, 148 | GPGLL_MODE, 149 | GPGLL_FRAME_BUFFER_SIZE, 150 | }dataGPGLL_t; 151 | #endif 152 | 153 | typedef enum{ 154 | GPS_ERROR = -3, 155 | GPS_NO_CHECKSUM_INDICATOR = -2, 156 | GPS_INVALID_CHECKSUM = -1, 157 | GPS_VALID_CHECKSUM = 0, 158 | GPS_SUCCESSFUL = 1, 159 | }gps_Status_t; 160 | 161 | /* Sum of three bytes sentence formatters to identify */ 162 | typedef enum{ 163 | GPS_GPRMC = 'R' + 'M' + 'C', 164 | GPS_GPVTG = 'V' + 'T' + 'G', 165 | GPS_GPGGA = 'G' + 'G' + 'A', 166 | GPS_GPGSA = 'G' + 'S' + 'A', 167 | GPS_GPGSV = 'G' + 'G' + 'V', 168 | GPS_GPGLL = 'G' + 'L' + 'L', 169 | }gps_addressIdentifier_t; 170 | 171 | /************************************ 172 | * EXPORTED VARIABLES 173 | ************************************/ 174 | 175 | /************************************ 176 | * GLOBAL FUNCTION PROTOTYPES 177 | ************************************/ 178 | size_t gps_findIndex(uint8_t * str, size_t size, size_t startIndex, uint8_t value); 179 | size_t gps_findXthIndex(uint8_t * str, size_t size, size_t startIndex, uint8_t value, uint8_t Xth); 180 | gps_Status_t gps_controlChecksum(uint8_t * str, size_t size, size_t startIndex); 181 | int32_t gps_findAdress(uint8_t * str, size_t size, size_t startIndex, gps_addressIdentifier_t address); 182 | uint32_t gps_ascii2num(uint8_t * str, size_t startIndex, size_t endIndex); 183 | float gps_floatAscii2num(uint8_t * str, size_t startIndex, size_t endIndex); 184 | uint8_t gps_getSingleChar(uint8_t * str, size_t index); 185 | gps_infoType_t * gps_getTable(gps_addressIdentifier_t address); 186 | gps_infoData_t gps_getData(uint8_t * str, size_t startIndex, size_t endIndex, gps_infoType_t * address, uint8_t index); 187 | gps_infoData_t gps_getInfo(uint8_t * str, size_t size, gps_addressIdentifier_t address, uint8_t index); 188 | 189 | 190 | #ifdef __cplusplus 191 | } 192 | #endif 193 | 194 | #endif 195 | -------------------------------------------------------------------------------- /software/GroundStation/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/include/projdefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef PROJDEFS_H 29 | #define PROJDEFS_H 30 | 31 | /* 32 | * Defines the prototype to which task functions must conform. Defined in this 33 | * file to ensure the type is known before portable.h is included. 34 | */ 35 | typedef void (*TaskFunction_t)( void * ); 36 | 37 | /* Converts a time in milliseconds to a time in ticks. This macro can be 38 | overridden by a macro of the same name defined in FreeRTOSConfig.h in case the 39 | definition here is not suitable for your application. */ 40 | #ifndef pdMS_TO_TICKS 41 | #define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) ) 42 | #endif 43 | 44 | #define pdFALSE ( ( BaseType_t ) 0 ) 45 | #define pdTRUE ( ( BaseType_t ) 1 ) 46 | 47 | #define pdPASS ( pdTRUE ) 48 | #define pdFAIL ( pdFALSE ) 49 | #define errQUEUE_EMPTY ( ( BaseType_t ) 0 ) 50 | #define errQUEUE_FULL ( ( BaseType_t ) 0 ) 51 | 52 | /* FreeRTOS error definitions. */ 53 | #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) 54 | #define errQUEUE_BLOCKED ( -4 ) 55 | #define errQUEUE_YIELD ( -5 ) 56 | 57 | /* Macros used for basic data corruption checks. */ 58 | #ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 59 | #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0 60 | #endif 61 | 62 | #if( configUSE_16_BIT_TICKS == 1 ) 63 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a 64 | #else 65 | #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL 66 | #endif 67 | 68 | /* The following errno values are used by FreeRTOS+ components, not FreeRTOS 69 | itself. */ 70 | #define pdFREERTOS_ERRNO_NONE 0 /* No errors */ 71 | #define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */ 72 | #define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */ 73 | #define pdFREERTOS_ERRNO_EIO 5 /* I/O error */ 74 | #define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */ 75 | #define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */ 76 | #define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */ 77 | #define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */ 78 | #define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */ 79 | #define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */ 80 | #define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */ 81 | #define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */ 82 | #define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */ 83 | #define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */ 84 | #define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */ 85 | #define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */ 86 | #define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */ 87 | #define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */ 88 | #define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */ 89 | #define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */ 90 | #define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */ 91 | #define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */ 92 | #define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */ 93 | #define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */ 94 | #define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */ 95 | #define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */ 96 | #define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */ 97 | #define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ 98 | #define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */ 99 | #define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */ 100 | #define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */ 101 | #define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */ 102 | #define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */ 103 | #define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */ 104 | #define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */ 105 | #define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */ 106 | #define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */ 107 | #define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */ 108 | #define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */ 109 | #define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */ 110 | 111 | /* The following endian values are used by FreeRTOS+ components, not FreeRTOS 112 | itself. */ 113 | #define pdFREERTOS_LITTLE_ENDIAN 0 114 | #define pdFREERTOS_BIG_ENDIAN 1 115 | 116 | /* Re-defining endian values for generic naming. */ 117 | #define pdLITTLE_ENDIAN pdFREERTOS_LITTLE_ENDIAN 118 | #define pdBIG_ENDIAN pdFREERTOS_BIG_ENDIAN 119 | 120 | 121 | #endif /* PROJDEFS_H */ 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /software/GroundStation/View/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /firmware/Core/Inc/FreeRTOSConfig.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /* 3 | * FreeRTOS Kernel V10.0.1 4 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | * this software and associated documentation files (the "Software"), to deal in 8 | * the Software without restriction, including without limitation the rights to 9 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | * the Software, and to permit persons to whom the Software is furnished to do so, 11 | * subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | * 23 | * http://www.FreeRTOS.org 24 | * http://aws.amazon.com/freertos 25 | * 26 | * 1 tab == 4 spaces! 27 | */ 28 | /* USER CODE END Header */ 29 | 30 | #ifndef FREERTOS_CONFIG_H 31 | #define FREERTOS_CONFIG_H 32 | 33 | /*----------------------------------------------------------- 34 | * Application specific definitions. 35 | * 36 | * These definitions should be adjusted for your particular hardware and 37 | * application requirements. 38 | * 39 | * These parameters and more are described within the 'configuration' section of the 40 | * FreeRTOS API documentation available on the FreeRTOS.org web site. 41 | * 42 | * See http://www.freertos.org/a00110.html 43 | *----------------------------------------------------------*/ 44 | 45 | /* USER CODE BEGIN Includes */ 46 | /* Section where include file can be added */ 47 | /* USER CODE END Includes */ 48 | 49 | /* Ensure definitions are only used by the compiler, and not by the assembler. */ 50 | #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 51 | #include 52 | extern uint32_t SystemCoreClock; 53 | #endif 54 | #define configUSE_PREEMPTION 1 55 | #define configSUPPORT_STATIC_ALLOCATION 1 56 | #define configSUPPORT_DYNAMIC_ALLOCATION 1 57 | #define configUSE_IDLE_HOOK 0 58 | #define configUSE_TICK_HOOK 0 59 | #define configCPU_CLOCK_HZ ( SystemCoreClock ) 60 | #define configTICK_RATE_HZ ((TickType_t)1000) 61 | #define configMAX_PRIORITIES ( 7 ) 62 | #define configMINIMAL_STACK_SIZE ((uint16_t)64) 63 | #define configTOTAL_HEAP_SIZE ((size_t)6144) 64 | #define configMAX_TASK_NAME_LEN ( 16 ) 65 | #define configUSE_16_BIT_TICKS 0 66 | #define configUSE_MUTEXES 1 67 | #define configQUEUE_REGISTRY_SIZE 8 68 | #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 69 | 70 | /* Co-routine definitions. */ 71 | #define configUSE_CO_ROUTINES 0 72 | #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 73 | 74 | /* Set the following definitions to 1 to include the API function, or zero 75 | to exclude the API function. */ 76 | #define INCLUDE_vTaskPrioritySet 1 77 | #define INCLUDE_uxTaskPriorityGet 1 78 | #define INCLUDE_vTaskDelete 1 79 | #define INCLUDE_vTaskCleanUpResources 0 80 | #define INCLUDE_vTaskSuspend 1 81 | #define INCLUDE_vTaskDelayUntil 0 82 | #define INCLUDE_vTaskDelay 1 83 | #define INCLUDE_xTaskGetSchedulerState 1 84 | 85 | /* Cortex-M specific definitions. */ 86 | #ifdef __NVIC_PRIO_BITS 87 | /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 88 | #define configPRIO_BITS __NVIC_PRIO_BITS 89 | #else 90 | #define configPRIO_BITS 4 91 | #endif 92 | 93 | /* The lowest interrupt priority that can be used in a call to a "set priority" 94 | function. */ 95 | #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 96 | 97 | /* The highest interrupt priority that can be used by any interrupt service 98 | routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 99 | INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 100 | PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 101 | #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 102 | 103 | /* Interrupt priorities used by the kernel port layer itself. These are generic 104 | to all Cortex-M ports, and do not rely on any particular library functions. */ 105 | #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 106 | /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 107 | See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 108 | #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 109 | 110 | /* Normal assert() semantics without relying on the provision of an assert.h 111 | header file. */ 112 | /* USER CODE BEGIN 1 */ 113 | #define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );} 114 | /* USER CODE END 1 */ 115 | 116 | /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 117 | standard names. */ 118 | #define vPortSVCHandler SVC_Handler 119 | #define xPortPendSVHandler PendSV_Handler 120 | 121 | /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, 122 | to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 123 | 124 | #define xPortSysTickHandler SysTick_Handler 125 | 126 | /* USER CODE BEGIN Defines */ 127 | /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ 128 | /* USER CODE END Defines */ 129 | 130 | #endif /* FREERTOS_CONFIG_H */ 131 | -------------------------------------------------------------------------------- /firmware/Core/MPU9250/mpu9250.h: -------------------------------------------------------------------------------- 1 | /** 2 | ******************************************************************************** 3 | * @file mpu9250.h 4 | * @author Embedded Area 5 | * @date Jan 10, 2021 6 | * @brief 7 | ******************************************************************************** 8 | */ 9 | 10 | #ifndef INC_MPU_H_ 11 | #define INC_MPU_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /************************************ 18 | * INCLUDES 19 | ************************************/ 20 | #include "main.h" 21 | #include "stdint.h" 22 | #include "cmsis_os.h" 23 | #include "math.h" 24 | 25 | extern I2C_HandleTypeDef hi2c1; 26 | 27 | /************************************ 28 | * MACROS AND DEFINES 29 | ************************************/ 30 | #define delay(x) (osDelay(x)) 31 | 32 | #define MPU9250_I2C hi2c1 33 | #define MPU_I2C_ADDRESS 0x68<<1 34 | 35 | #define GRAVITY (9.807f) 36 | #define DEGREE_TO_RADIAN (3.14159265359f/180.0f) 37 | #define RADIANS_TO_DEGREES (180.0f/3.14159265359f) 38 | 39 | /********************* 40 | * REGISTERS 41 | *********************/ 42 | // MPU9250 registers 43 | #define ACCEL_OUT 0x3B 44 | #define GYRO_OUT 0x43 45 | #define TEMP_OUT 0x41 46 | #define EXT_SENS_DATA_00 0x49 47 | #define ACCEL_CONFIG 0x1C 48 | #define ACCEL_FS_SEL_2G 0x00 49 | #define ACCEL_FS_SEL_4G 0x08 50 | #define ACCEL_FS_SEL_8G 0x10 51 | #define ACCEL_FS_SEL_16G 0x18 52 | #define GYRO_CONFIG 0x1B 53 | #define GYRO_FS_SEL_250DPS 0x00 54 | #define GYRO_FS_SEL_500DPS 0x08 55 | #define GYRO_FS_SEL_1000DPS 0x10 56 | #define GYRO_FS_SEL_2000DPS 0x18 57 | #define ACCEL_CONFIG2 0x1D 58 | #define ACCEL_DLPF_184 0x01 59 | #define ACCEL_DLPF_92 0x02 60 | #define ACCEL_DLPF_41 0x03 61 | #define ACCEL_DLPF_20 0x04 62 | #define ACCEL_DLPF_10 0x05 63 | #define ACCEL_DLPF_5 0x06 64 | #define CONFIG 0x1A 65 | #define GYRO_DLPF_184 0x01 66 | #define GYRO_DLPF_92 0x02 67 | #define GYRO_DLPF_41 0x03 68 | #define GYRO_DLPF_20 0x04 69 | #define GYRO_DLPF_10 0x05 70 | #define GYRO_DLPF_5 0x06 71 | #define SMPDIV 0x19 72 | #define INT_PIN_CFG 0x37 73 | #define INT_ENABLE 0x38 74 | #define INT_DISABLE 0x00 75 | #define INT_PULSE_50US 0x00 76 | #define INT_WOM_EN 0x40 77 | #define INT_RAW_RDY_EN 0x01 78 | #define PWR_MGMNT_1 0x6B 79 | #define PWR_CYCLE 0x20 80 | #define PWR_RESET 0x80 81 | #define CLOCK_SEL_PLL 0x01 82 | #define PWR_MGMNT_2 0x6C 83 | #define SEN_ENABLE 0x00 84 | #define DIS_GYRO 0x07 85 | #define USER_CTRL 0x6A 86 | #define I2C_MST_EN 0x20 87 | #define I2C_MST_CLK 0x0D 88 | #define I2C_MST_CTRL 0x24 89 | #define I2C_SLV0_ADDR 0x25 90 | #define I2C_SLV0_REG 0x26 91 | #define I2C_SLV0_DO 0x63 92 | #define I2C_SLV0_CTRL 0x27 93 | #define I2C_SLV0_EN 0x80 94 | #define I2C_READ_FLAG 0x80 95 | #define MOT_DETECT_CTRL 0x69 96 | #define ACCEL_INTEL_EN 0x80 97 | #define ACCEL_INTEL_MODE 0x40 98 | #define LP_ACCEL_ODR 0x1E 99 | #define WOM_THR 0x1F 100 | #define WHO_AM_I 0x75 101 | #define FIFO_EN 0x23 102 | #define FIFO_TEMP 0x80 103 | #define FIFO_GYRO 0x70 104 | #define FIFO_ACCEL 0x08 105 | #define FIFO_MAG 0x01 106 | #define FIFO_COUNT 0x72 107 | #define FIFO_READ 0x74 108 | 109 | // AK8963 registers 110 | #define AK8963_I2C_ADDR 0x0C 111 | #define AK8963_ST1 0x02 112 | #define AK8963_HXL 0x03 113 | #define AK8963_CNTL1 0x0A 114 | #define AK8963_PWR_DOWN 0x00 115 | #define AK8963_CNT_MEAS1 0x12 116 | #define AK8963_CNT_MEAS2 0x16 117 | #define AK8963_FUSE_ROM 0x0F 118 | #define AK8963_CNTL2 0x0B 119 | #define AK8963_RESET 0x01 120 | #define AK8963_ASA 0x10 121 | #define AK8963_WHO_AM_I 0x00 122 | 123 | /************************************ 124 | * TYPEDEFS 125 | ************************************/ 126 | 127 | /** 128 | * Gyroscope Features 129 | */ 130 | typedef enum 131 | { 132 | GYRO_RANGE_250DPS, 133 | GYRO_RANGE_500DPS, 134 | GYRO_RANGE_1000DPS, 135 | GYRO_RANGE_2000DPS 136 | } mpu_gyroscope_range_t; 137 | 138 | /** 139 | * Accelerometer Features 140 | */ 141 | typedef enum 142 | { 143 | ACCEL_RANGE_2G, 144 | ACCEL_RANGE_4G, 145 | ACCEL_RANGE_8G, 146 | ACCEL_RANGE_16G 147 | } mpu_accelerometer_range_t; 148 | 149 | /** 150 | * Bandwidth Values 151 | */ 152 | typedef enum 153 | { 154 | DLPF_BANDWIDTH_184HZ , 155 | DLPF_BANDWIDTH_92HZ, 156 | DLPF_BANDWIDTH_41HZ, 157 | DLPF_BANDWIDTH_20HZ, 158 | DLPF_BANDWIDTH_10HZ, 159 | DLPF_BANDWIDTH_5HZ 160 | } mpu_dlpf_bandwidth_t; 161 | 162 | /** 163 | * Sample Rate Divider Values 164 | */ 165 | typedef enum 166 | { 167 | LP_ACCEL_ODR_0_24HZ = 0, 168 | LP_ACCEL_ODR_0_49HZ = 1, 169 | LP_ACCEL_ODR_0_98HZ = 2, 170 | LP_ACCEL_ODR_1_95HZ = 3, 171 | LP_ACCEL_ODR_3_91HZ = 4, 172 | LP_ACCEL_ODR_7_81HZ = 5, 173 | LP_ACCEL_ODR_15_63HZ = 6, 174 | LP_ACCEL_ODR_31_25HZ = 7, 175 | LP_ACCEL_ODR_62_50HZ = 8, 176 | LP_ACCEL_ODR_125HZ = 9, 177 | LP_ACCEL_ODR_250HZ = 10, 178 | LP_ACCEL_ODR_500HZ = 11 179 | } mpu_sample_rate_divider_t; 180 | 181 | 182 | /************************************ 183 | * EXPORTED VARIABLES 184 | ************************************/ 185 | 186 | /************************************ 187 | * GLOBAL FUNCTION PROTOTYPES 188 | ************************************/ 189 | int MPU9250_WhoAmI(); 190 | int MPU9250_WhoAmIAK8963(); 191 | 192 | int MPU9250_Init(); 193 | int MPU9250_SetAccelRange(mpu_accelerometer_range_t range); 194 | int MPU9250_SetGyroRange(mpu_gyroscope_range_t range); 195 | int MPU9250_SetDlpfBandwidth(mpu_dlpf_bandwidth_t bandwidth); 196 | int MPU9250_SetSrd(uint8_t srd); 197 | 198 | int MPU9250_ReadSensor(); 199 | float getAccelX_mss(); 200 | float getAccelY_mss(); 201 | float getAccelZ_mss(); 202 | float getGyroX_rads(); 203 | float getGyroY_rads(); 204 | float getGyroZ_rads(); 205 | float getMagX_uT(); 206 | float getMagY_uT(); 207 | float getMagZ_uT(); 208 | float getTemperature_C(); 209 | 210 | int calibrateGyro(); 211 | int calibrateMagneto(void) ; 212 | void MPU9250_Calibrate(); 213 | 214 | float getGyroBiasX_rads(); 215 | float getGyroBiasY_rads(); 216 | float getGyroBiasZ_rads(); 217 | void setGyroBiasX_rads(float bias); 218 | void setGyroBiasY_rads(float bias); 219 | void setGyroBiasZ_rads(float bias); 220 | 221 | void ComplementaryFilter(float *pitch, float *roll, uint32_t deltaT); 222 | 223 | 224 | #ifdef __cplusplus 225 | } 226 | #endif 227 | 228 | #endif 229 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/include/stack_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | /* 32 | * Call the stack overflow hook function if the stack of the task being swapped 33 | * out is currently overflowed, or looks like it might have overflowed in the 34 | * past. 35 | * 36 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 37 | * the current stack state only - comparing the current top of stack value to 38 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 39 | * will also cause the last few stack bytes to be checked to ensure the value 40 | * to which the bytes were set when the task was created have not been 41 | * overwritten. Note this second test does not guarantee that an overflowed 42 | * stack will always be recognised. 43 | */ 44 | 45 | /*-----------------------------------------------------------*/ 46 | 47 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 48 | 49 | /* Only the current stack state is to be checked. */ 50 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 51 | { \ 52 | /* Is the currently saved stack pointer within the stack limit? */ \ 53 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 54 | { \ 55 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 56 | } \ 57 | } 58 | 59 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 60 | /*-----------------------------------------------------------*/ 61 | 62 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 63 | 64 | /* Only the current stack state is to be checked. */ 65 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 66 | { \ 67 | \ 68 | /* Is the currently saved stack pointer within the stack limit? */ \ 69 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 70 | { \ 71 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 72 | } \ 73 | } 74 | 75 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 76 | /*-----------------------------------------------------------*/ 77 | 78 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 79 | 80 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 81 | { \ 82 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 83 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 84 | \ 85 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 86 | ( pulStack[ 1 ] != ulCheckValue ) || \ 87 | ( pulStack[ 2 ] != ulCheckValue ) || \ 88 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 89 | { \ 90 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 91 | } \ 92 | } 93 | 94 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 95 | /*-----------------------------------------------------------*/ 96 | 97 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 98 | 99 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 100 | { \ 101 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 102 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 103 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 104 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 105 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 106 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 107 | \ 108 | \ 109 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 110 | \ 111 | /* Has the extremity of the task stack ever been written over? */ \ 112 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 113 | { \ 114 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 115 | } \ 116 | } 117 | 118 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 119 | /*-----------------------------------------------------------*/ 120 | 121 | /* Remove stack overflow macro if not being used. */ 122 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 123 | #define taskCHECK_FOR_STACK_OVERFLOW() 124 | #endif 125 | 126 | 127 | 128 | #endif /* STACK_MACROS_H */ 129 | 130 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/include/StackMacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef STACK_MACROS_H 29 | #define STACK_MACROS_H 30 | 31 | #ifndef _MSC_VER /* Visual Studio doesn't support #warning. */ 32 | #warning The name of this file has changed to stack_macros.h. Please update your code accordingly. This source file (which has the original name) will be removed in future released. 33 | #endif 34 | 35 | /* 36 | * Call the stack overflow hook function if the stack of the task being swapped 37 | * out is currently overflowed, or looks like it might have overflowed in the 38 | * past. 39 | * 40 | * Setting configCHECK_FOR_STACK_OVERFLOW to 1 will cause the macro to check 41 | * the current stack state only - comparing the current top of stack value to 42 | * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 43 | * will also cause the last few stack bytes to be checked to ensure the value 44 | * to which the bytes were set when the task was created have not been 45 | * overwritten. Note this second test does not guarantee that an overflowed 46 | * stack will always be recognised. 47 | */ 48 | 49 | /*-----------------------------------------------------------*/ 50 | 51 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) ) 52 | 53 | /* Only the current stack state is to be checked. */ 54 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 55 | { \ 56 | /* Is the currently saved stack pointer within the stack limit? */ \ 57 | if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 58 | { \ 59 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 60 | } \ 61 | } 62 | 63 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 64 | /*-----------------------------------------------------------*/ 65 | 66 | #if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) ) 67 | 68 | /* Only the current stack state is to be checked. */ 69 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 70 | { \ 71 | \ 72 | /* Is the currently saved stack pointer within the stack limit? */ \ 73 | if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ 74 | { \ 75 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 76 | } \ 77 | } 78 | 79 | #endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ 80 | /*-----------------------------------------------------------*/ 81 | 82 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) ) 83 | 84 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 85 | { \ 86 | const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \ 87 | const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \ 88 | \ 89 | if( ( pulStack[ 0 ] != ulCheckValue ) || \ 90 | ( pulStack[ 1 ] != ulCheckValue ) || \ 91 | ( pulStack[ 2 ] != ulCheckValue ) || \ 92 | ( pulStack[ 3 ] != ulCheckValue ) ) \ 93 | { \ 94 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 95 | } \ 96 | } 97 | 98 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 99 | /*-----------------------------------------------------------*/ 100 | 101 | #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) ) 102 | 103 | #define taskCHECK_FOR_STACK_OVERFLOW() \ 104 | { \ 105 | int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \ 106 | static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 107 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 108 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 109 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 110 | tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \ 111 | \ 112 | \ 113 | pcEndOfStack -= sizeof( ucExpectedStackBytes ); \ 114 | \ 115 | /* Has the extremity of the task stack ever been written over? */ \ 116 | if( memcmp( ( void * ) pcEndOfStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \ 117 | { \ 118 | vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \ 119 | } \ 120 | } 121 | 122 | #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */ 123 | /*-----------------------------------------------------------*/ 124 | 125 | /* Remove stack overflow macro if not being used. */ 126 | #ifndef taskCHECK_FOR_STACK_OVERFLOW 127 | #define taskCHECK_FOR_STACK_OVERFLOW() 128 | #endif 129 | 130 | 131 | 132 | #endif /* STACK_MACROS_H */ 133 | 134 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/include/portable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | /*----------------------------------------------------------- 29 | * Portable layer API. Each function must be defined for each port. 30 | *----------------------------------------------------------*/ 31 | 32 | #ifndef PORTABLE_H 33 | #define PORTABLE_H 34 | 35 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 36 | pre-processor definition was used to ensure the pre-processor found the correct 37 | portmacro.h file for the port being used. That scheme was deprecated in favour 38 | of setting the compiler's include path such that it found the correct 39 | portmacro.h file - removing the need for the constant and allowing the 40 | portmacro.h file to be located anywhere in relation to the port being used. 41 | Purely for reasons of backward compatibility the old method is still valid, but 42 | to make it clear that new projects should not use it, support for the port 43 | specific constants has been moved into the deprecated_definitions.h header 44 | file. */ 45 | #include "deprecated_definitions.h" 46 | 47 | /* If portENTER_CRITICAL is not defined then including deprecated_definitions.h 48 | did not result in a portmacro.h header file being included - and it should be 49 | included here. In this case the path to the correct portmacro.h header file 50 | must be set in the compiler's include path. */ 51 | #ifndef portENTER_CRITICAL 52 | #include "portmacro.h" 53 | #endif 54 | 55 | #if portBYTE_ALIGNMENT == 32 56 | #define portBYTE_ALIGNMENT_MASK ( 0x001f ) 57 | #endif 58 | 59 | #if portBYTE_ALIGNMENT == 16 60 | #define portBYTE_ALIGNMENT_MASK ( 0x000f ) 61 | #endif 62 | 63 | #if portBYTE_ALIGNMENT == 8 64 | #define portBYTE_ALIGNMENT_MASK ( 0x0007 ) 65 | #endif 66 | 67 | #if portBYTE_ALIGNMENT == 4 68 | #define portBYTE_ALIGNMENT_MASK ( 0x0003 ) 69 | #endif 70 | 71 | #if portBYTE_ALIGNMENT == 2 72 | #define portBYTE_ALIGNMENT_MASK ( 0x0001 ) 73 | #endif 74 | 75 | #if portBYTE_ALIGNMENT == 1 76 | #define portBYTE_ALIGNMENT_MASK ( 0x0000 ) 77 | #endif 78 | 79 | #ifndef portBYTE_ALIGNMENT_MASK 80 | #error "Invalid portBYTE_ALIGNMENT definition" 81 | #endif 82 | 83 | #ifndef portNUM_CONFIGURABLE_REGIONS 84 | #define portNUM_CONFIGURABLE_REGIONS 1 85 | #endif 86 | 87 | #ifdef __cplusplus 88 | extern "C" { 89 | #endif 90 | 91 | #include "mpu_wrappers.h" 92 | 93 | /* 94 | * Setup the stack of a new task so it is ready to be placed under the 95 | * scheduler control. The registers have to be placed on the stack in 96 | * the order that the port expects to find them. 97 | * 98 | */ 99 | #if( portUSING_MPU_WRAPPERS == 1 ) 100 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters, BaseType_t xRunPrivileged ) PRIVILEGED_FUNCTION; 101 | #else 102 | StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) PRIVILEGED_FUNCTION; 103 | #endif 104 | 105 | /* Used by heap_5.c. */ 106 | typedef struct HeapRegion 107 | { 108 | uint8_t *pucStartAddress; 109 | size_t xSizeInBytes; 110 | } HeapRegion_t; 111 | 112 | /* 113 | * Used to define multiple heap regions for use by heap_5.c. This function 114 | * must be called before any calls to pvPortMalloc() - not creating a task, 115 | * queue, semaphore, mutex, software timer, event group, etc. will result in 116 | * pvPortMalloc being called. 117 | * 118 | * pxHeapRegions passes in an array of HeapRegion_t structures - each of which 119 | * defines a region of memory that can be used as the heap. The array is 120 | * terminated by a HeapRegions_t structure that has a size of 0. The region 121 | * with the lowest start address must appear first in the array. 122 | */ 123 | void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION; 124 | 125 | 126 | /* 127 | * Map to the memory management routines required for the port. 128 | */ 129 | void *pvPortMalloc( size_t xSize ) PRIVILEGED_FUNCTION; 130 | void vPortFree( void *pv ) PRIVILEGED_FUNCTION; 131 | void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION; 132 | size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION; 133 | size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION; 134 | 135 | /* 136 | * Setup the hardware ready for the scheduler to take control. This generally 137 | * sets up a tick interrupt and sets timers for the correct tick frequency. 138 | */ 139 | BaseType_t xPortStartScheduler( void ) PRIVILEGED_FUNCTION; 140 | 141 | /* 142 | * Undo any hardware/ISR setup that was performed by xPortStartScheduler() so 143 | * the hardware is left in its original condition after the scheduler stops 144 | * executing. 145 | */ 146 | void vPortEndScheduler( void ) PRIVILEGED_FUNCTION; 147 | 148 | /* 149 | * The structures and methods of manipulating the MPU are contained within the 150 | * port layer. 151 | * 152 | * Fills the xMPUSettings structure with the memory region information 153 | * contained in xRegions. 154 | */ 155 | #if( portUSING_MPU_WRAPPERS == 1 ) 156 | struct xMEMORY_REGION; 157 | void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION; 158 | #endif 159 | 160 | #ifdef __cplusplus 161 | } 162 | #endif 163 | 164 | #endif /* PORTABLE_H */ 165 | 166 | -------------------------------------------------------------------------------- /firmware/drone_f1_ea.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /firmware/Core/Src/stm32f1xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f1xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2020 STMicroelectronics. 10 | * All rights reserved.

11 | * 12 | * This software component is licensed by ST under BSD 3-Clause license, 13 | * the "License"; You may not use this file except in compliance with the 14 | * License. You may obtain a copy of the License at: 15 | * opensource.org/licenses/BSD-3-Clause 16 | * 17 | ****************************************************************************** 18 | */ 19 | /* USER CODE END Header */ 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | #include "main.h" 23 | #include "stm32f1xx_it.h" 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | #include "cmsis_os.h" 27 | /* USER CODE END Includes */ 28 | 29 | /* Private typedef -----------------------------------------------------------*/ 30 | /* USER CODE BEGIN TD */ 31 | 32 | /* USER CODE END TD */ 33 | 34 | /* Private define ------------------------------------------------------------*/ 35 | /* USER CODE BEGIN PD */ 36 | 37 | /* USER CODE END PD */ 38 | 39 | /* Private macro -------------------------------------------------------------*/ 40 | /* USER CODE BEGIN PM */ 41 | 42 | /* USER CODE END PM */ 43 | 44 | /* Private variables ---------------------------------------------------------*/ 45 | /* USER CODE BEGIN PV */ 46 | 47 | /* USER CODE END PV */ 48 | 49 | /* Private function prototypes -----------------------------------------------*/ 50 | /* USER CODE BEGIN PFP */ 51 | 52 | /* USER CODE END PFP */ 53 | 54 | /* Private user code ---------------------------------------------------------*/ 55 | /* USER CODE BEGIN 0 */ 56 | 57 | /* USER CODE END 0 */ 58 | 59 | /* External variables --------------------------------------------------------*/ 60 | extern DMA_HandleTypeDef hdma_i2c1_rx; 61 | extern I2C_HandleTypeDef hi2c1; 62 | extern DMA_HandleTypeDef hdma_usart1_rx; 63 | extern DMA_HandleTypeDef hdma_usart2_rx; 64 | extern DMA_HandleTypeDef hdma_usart3_rx; 65 | extern UART_HandleTypeDef huart1; 66 | extern UART_HandleTypeDef huart2; 67 | extern TIM_HandleTypeDef htim4; 68 | 69 | /* USER CODE BEGIN EV */ 70 | extern osSemaphoreId pc_rx_smphrHandle, mpu9265_smphrHandle, lora_rx_smphrHandle; 71 | 72 | /* USER CODE END EV */ 73 | 74 | /******************************************************************************/ 75 | /* Cortex-M3 Processor Interruption and Exception Handlers */ 76 | /******************************************************************************/ 77 | /** 78 | * @brief This function handles Hard fault interrupt. 79 | */ 80 | void HardFault_Handler(void) 81 | { 82 | /* USER CODE BEGIN HardFault_IRQn 0 */ 83 | HAL_UART_Transmit(&HUART_PC, (uint8_t *) "\nHF\n", 4, 0xFF); 84 | /* USER CODE END HardFault_IRQn 0 */ 85 | while (1) 86 | { 87 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 88 | /* USER CODE END W1_HardFault_IRQn 0 */ 89 | } 90 | } 91 | 92 | /******************************************************************************/ 93 | /* STM32F1xx Peripheral Interrupt Handlers */ 94 | /* Add here the Interrupt Handlers for the used peripherals. */ 95 | /* For the available peripheral interrupt handler names, */ 96 | /* please refer to the startup file (startup_stm32f1xx.s). */ 97 | /******************************************************************************/ 98 | 99 | /** 100 | * @brief This function handles DMA1 channel3 global interrupt. 101 | */ 102 | void DMA1_Channel3_IRQHandler(void) 103 | { 104 | /* USER CODE BEGIN DMA1_Channel3_IRQn 0 */ 105 | 106 | /* USER CODE END DMA1_Channel3_IRQn 0 */ 107 | HAL_DMA_IRQHandler(&hdma_usart3_rx); 108 | /* USER CODE BEGIN DMA1_Channel3_IRQn 1 */ 109 | 110 | /* USER CODE END DMA1_Channel3_IRQn 1 */ 111 | } 112 | 113 | /** 114 | * @brief This function handles DMA1 channel5 global interrupt. 115 | */ 116 | void DMA1_Channel5_IRQHandler(void) 117 | { 118 | /* USER CODE BEGIN DMA1_Channel5_IRQn 0 */ 119 | 120 | /* USER CODE END DMA1_Channel5_IRQn 0 */ 121 | HAL_DMA_IRQHandler(&hdma_usart1_rx); 122 | /* USER CODE BEGIN DMA1_Channel5_IRQn 1 */ 123 | 124 | /* USER CODE END DMA1_Channel5_IRQn 1 */ 125 | } 126 | 127 | /** 128 | * @brief This function handles DMA1 channel6 global interrupt. 129 | */ 130 | void DMA1_Channel6_IRQHandler(void) 131 | { 132 | /* USER CODE BEGIN DMA1_Channel6_IRQn 0 */ 133 | 134 | /* USER CODE END DMA1_Channel6_IRQn 0 */ 135 | HAL_DMA_IRQHandler(&hdma_usart2_rx); 136 | /* USER CODE BEGIN DMA1_Channel6_IRQn 1 */ 137 | 138 | /* USER CODE END DMA1_Channel6_IRQn 1 */ 139 | } 140 | 141 | /** 142 | * @brief This function handles DMA1 channel7 global interrupt. 143 | */ 144 | void DMA1_Channel7_IRQHandler(void) 145 | { 146 | /* USER CODE BEGIN DMA1_Channel7_IRQn 0 */ 147 | osSemaphoreRelease(mpu9265_smphrHandle); 148 | /* USER CODE END DMA1_Channel7_IRQn 0 */ 149 | HAL_DMA_IRQHandler(&hdma_i2c1_rx); 150 | /* USER CODE BEGIN DMA1_Channel7_IRQn 1 */ 151 | 152 | /* USER CODE END DMA1_Channel7_IRQn 1 */ 153 | } 154 | 155 | /** 156 | * @brief This function handles TIM4 global interrupt. 157 | */ 158 | void TIM4_IRQHandler(void) 159 | { 160 | /* USER CODE BEGIN TIM4_IRQn 0 */ 161 | 162 | /* USER CODE END TIM4_IRQn 0 */ 163 | HAL_TIM_IRQHandler(&htim4); 164 | /* USER CODE BEGIN TIM4_IRQn 1 */ 165 | 166 | /* USER CODE END TIM4_IRQn 1 */ 167 | } 168 | 169 | /** 170 | * @brief This function handles I2C1 event interrupt. 171 | */ 172 | void I2C1_EV_IRQHandler(void) 173 | { 174 | /* USER CODE BEGIN I2C1_EV_IRQn 0 */ 175 | 176 | /* USER CODE END I2C1_EV_IRQn 0 */ 177 | HAL_I2C_EV_IRQHandler(&hi2c1); 178 | /* USER CODE BEGIN I2C1_EV_IRQn 1 */ 179 | 180 | /* USER CODE END I2C1_EV_IRQn 1 */ 181 | } 182 | 183 | /** 184 | * @brief This function handles USART1 global interrupt. 185 | */ 186 | void USART1_IRQHandler(void) 187 | { 188 | /* USER CODE BEGIN USART1_IRQn 0 */ 189 | if (__HAL_UART_GET_IT_SOURCE(&HUART_LORA, UART_IT_IDLE) && __HAL_UART_GET_FLAG(&HUART_LORA, UART_FLAG_IDLE)){ 190 | __HAL_UART_CLEAR_IDLEFLAG(&HUART_LORA); 191 | osSemaphoreRelease(lora_rx_smphrHandle); /** Goes into PCRxManager task*/ 192 | } 193 | /* USER CODE END USART1_IRQn 0 */ 194 | HAL_UART_IRQHandler(&huart1); 195 | /* USER CODE BEGIN USART1_IRQn 1 */ 196 | 197 | /* USER CODE END USART1_IRQn 1 */ 198 | } 199 | 200 | /** 201 | * @brief This function handles USART2 global interrupt. 202 | */ 203 | void USART2_IRQHandler(void) 204 | { 205 | /* USER CODE BEGIN USART2_IRQn 0 */ 206 | if (__HAL_UART_GET_IT_SOURCE(&HUART_PC, UART_IT_IDLE) && __HAL_UART_GET_FLAG(&HUART_PC, UART_FLAG_IDLE)){ 207 | __HAL_UART_CLEAR_IDLEFLAG(&HUART_PC); 208 | osSemaphoreRelease(pc_rx_smphrHandle); /** Goes into PCRxManager task*/ 209 | } 210 | /* USER CODE END USART2_IRQn 0 */ 211 | HAL_UART_IRQHandler(&huart2); 212 | /* USER CODE BEGIN USART2_IRQn 1 */ 213 | 214 | /* USER CODE END USART2_IRQn 1 */ 215 | } 216 | 217 | /* USER CODE BEGIN 1 */ 218 | 219 | /* USER CODE END 1 */ 220 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 221 | -------------------------------------------------------------------------------- /software/GroundStation/Model/InitilizeSerialComm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.IO.Ports; 7 | using System.Threading; 8 | using System.Windows.Forms; 9 | 10 | namespace GroundStation 11 | { 12 | class InitilizeSerialComm : SerialPort 13 | { 14 | private Boolean IsReceiving = false; 15 | private Boolean IsRuning = false; 16 | private Boolean IsPeriodSending = false; 17 | private int sleepTime = 200; 18 | Thread receivingThread = null; 19 | public string yazi; 20 | Form1 form; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The form. 26 | public InitilizeSerialComm(Form1 form) 27 | { 28 | this.form = form; 29 | base.WriteTimeout = 50; 30 | //base.= new SerialPort(); 31 | receivingThread = new Thread(DoReceive); 32 | IsRuning = true; 33 | receivingThread.Start(); 34 | yazi = "engin"; 35 | } 36 | 37 | /// 38 | /// Gets or sets the sleep time. 39 | /// 40 | /// 41 | /// The sleep time. 42 | /// 43 | public int SleepTime 44 | { 45 | get 46 | { 47 | return sleepTime; 48 | } 49 | set 50 | { 51 | sleepTime = value; 52 | } 53 | } 54 | /// 55 | /// This is the function which is called in "receivingThread" 56 | /// 57 | private void DoReceive() 58 | { 59 | Byte[] buffer = new Byte[1024]; 60 | while (IsRuning) 61 | { 62 | while (IsReceiving) 63 | { 64 | try 65 | { 66 | if (base.BytesToRead > 0) 67 | { 68 | 69 | Int32 length = base.Read(buffer, 0, buffer.Length); 70 | Array.Resize(ref buffer, length); 71 | UpdateForm u = new UpdateForm(form.UpdateText); 72 | form.Invoke(u, new Object[] { buffer }); 73 | 74 | } 75 | } 76 | catch (Exception ex) 77 | { 78 | MessageBox.Show("Receving thread error: " + ex.Message ,"Warning!"); 79 | IsReceiving = false; 80 | } 81 | 82 | Thread.Sleep(500); 83 | } 84 | while (!IsReceiving) Thread.Sleep(10); 85 | } 86 | } 87 | /// 88 | /// This is the function which is called in receiving thread(field name: "receivingThread") 89 | /// #This function is uncomplete. 90 | /// 91 | /// The data. 92 | private void DoPeriodWrite(Object data) 93 | { 94 | while (true) 95 | { 96 | 97 | Byte[] dataBytes = data as Byte[]; 98 | try 99 | { 100 | base.Write(dataBytes, 0, dataBytes.Length); 101 | } 102 | catch (Exception e) 103 | { 104 | //show something exception details in dialog 105 | MessageBox.Show("Writing thread error: " + e.Message, "Warning!"); 106 | } 107 | Thread.Sleep(sleepTime); 108 | } 109 | } 110 | /// 111 | /// This is the function which is called in writing thread(field name: "writingThread") 112 | /// 113 | /// this object was sent by Thread.start method 114 | private void DoWrite(Object data) 115 | { 116 | Byte[] dataBytes = data as Byte[]; 117 | try 118 | { 119 | base.Write(dataBytes, 0, dataBytes.Length); 120 | } 121 | catch (Exception e) 122 | { 123 | //show something exception details in dialog 124 | MessageBox.Show("Writing thread error: " + e.Message, "Warning!"); 125 | } 126 | 127 | } 128 | /// 129 | /// Writes the specified MSG. 130 | /// 131 | /// 132 | new public void Write(string msg) 133 | { 134 | Byte[] dataBytes = Encoding.ASCII.GetBytes(msg); 135 | Object o = dataBytes; 136 | Thread writingThread = new Thread(DoWrite); 137 | writingThread.Start(o); 138 | writingThread.IsBackground = true; 139 | 140 | } 141 | 142 | /// 143 | /// Sets the port. 144 | /// 145 | /// Name of the port. 146 | /// The baud rate. 147 | public void SetPort(string portName, int baudRate) 148 | { 149 | //com1.text 150 | try 151 | { 152 | base.PortName = portName; 153 | base.BaudRate = baudRate; 154 | } 155 | catch (Exception e) 156 | { 157 | //show something exception details in dialog 158 | MessageBox.Show("Set port error: " + e.Message, "Warning!"); ; 159 | } 160 | base.DataBits = 8; 161 | base.Parity = System.IO.Ports.Parity.None; 162 | base.StopBits = System.IO.Ports.StopBits.One; 163 | base.Encoding = Encoding.ASCII; 164 | 165 | } 166 | /// 167 | /// Open port. 168 | /// 169 | /// 170 | /// 171 | /// 172 | new public void Open() 173 | { 174 | try 175 | { 176 | base.Open(); 177 | Thread.Sleep(200); 178 | 179 | } 180 | catch (Exception e) 181 | { 182 | MessageBox.Show("Open port error: " + e.Message,"Warning!"); ; 183 | } 184 | 185 | IsReceiving = true; 186 | Thread.Sleep(200); 187 | } 188 | /// 189 | /// close port,let to false 190 | /// 191 | /// 192 | /// 193 | /// 194 | new public void Close() 195 | { 196 | try 197 | { 198 | if (base.IsOpen == true) 199 | { 200 | IsReceiving = false; 201 | 202 | base.Close(); 203 | 204 | } 205 | 206 | Thread.Sleep(200); 207 | 208 | } 209 | catch (Exception e) 210 | { 211 | MessageBox.Show("Closing comport error: " + e.Message, "warning!"); ; 212 | } 213 | 214 | 215 | } 216 | /// 217 | /// Terminates this instance. This action will terminate receving thread and close the specific port. 218 | /// 219 | public void Terminate() 220 | { 221 | IsRuning = false; 222 | Close(); 223 | receivingThread.Abort(); 224 | receivingThread.Join(); 225 | 226 | } 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /firmware/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

© Copyright (c) 2017 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under BSD 3-Clause license, 14 | * the "License"; You may not use this file except in compliance with the 15 | * License. You may obtain a copy of the License at: 16 | * opensource.org/licenses/BSD-3-Clause 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F1xx_HAL_DEF 23 | #define __STM32F1xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f1xx.h" 31 | #include "Legacy/stm32_hal_legacy.h" 32 | #include 33 | 34 | /* Exported types ------------------------------------------------------------*/ 35 | 36 | /** 37 | * @brief HAL Status structures definition 38 | */ 39 | typedef enum 40 | { 41 | HAL_OK = 0x00U, 42 | HAL_ERROR = 0x01U, 43 | HAL_BUSY = 0x02U, 44 | HAL_TIMEOUT = 0x03U 45 | } HAL_StatusTypeDef; 46 | 47 | /** 48 | * @brief HAL Lock structures definition 49 | */ 50 | typedef enum 51 | { 52 | HAL_UNLOCKED = 0x00U, 53 | HAL_LOCKED = 0x01U 54 | } HAL_LockTypeDef; 55 | 56 | /* Exported macro ------------------------------------------------------------*/ 57 | #define HAL_MAX_DELAY 0xFFFFFFFFU 58 | 59 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != 0U) 60 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 61 | 62 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 63 | do{ \ 64 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 65 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 66 | } while(0U) 67 | 68 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ 69 | 70 | /** @brief Reset the Handle's State field. 71 | * @param __HANDLE__ specifies the Peripheral Handle. 72 | * @note This macro can be used for the following purpose: 73 | * - When the Handle is declared as local variable; before passing it as parameter 74 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 75 | * to set to 0 the Handle's "State" field. 76 | * Otherwise, "State" field may have any random value and the first time the function 77 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 78 | * (i.e. HAL_PPP_MspInit() will not be executed). 79 | * - When there is a need to reconfigure the low level hardware: instead of calling 80 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 81 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 82 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 83 | * @retval None 84 | */ 85 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 86 | 87 | #if (USE_RTOS == 1U) 88 | /* Reserved for future use */ 89 | #error "USE_RTOS should be 0 in the current HAL release" 90 | #else 91 | #define __HAL_LOCK(__HANDLE__) \ 92 | do{ \ 93 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 94 | { \ 95 | return HAL_BUSY; \ 96 | } \ 97 | else \ 98 | { \ 99 | (__HANDLE__)->Lock = HAL_LOCKED; \ 100 | } \ 101 | }while (0U) 102 | 103 | #define __HAL_UNLOCK(__HANDLE__) \ 104 | do{ \ 105 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 106 | }while (0U) 107 | #endif /* USE_RTOS */ 108 | 109 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 110 | #ifndef __weak 111 | #define __weak __attribute__((weak)) 112 | #endif 113 | #ifndef __packed 114 | #define __packed __attribute__((packed)) 115 | #endif 116 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 117 | #ifndef __weak 118 | #define __weak __attribute__((weak)) 119 | #endif /* __weak */ 120 | #ifndef __packed 121 | #define __packed __attribute__((__packed__)) 122 | #endif /* __packed */ 123 | #endif /* __GNUC__ */ 124 | 125 | 126 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 127 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 128 | #ifndef __ALIGN_BEGIN 129 | #define __ALIGN_BEGIN 130 | #endif 131 | #ifndef __ALIGN_END 132 | #define __ALIGN_END __attribute__ ((aligned (4))) 133 | #endif 134 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 135 | #ifndef __ALIGN_END 136 | #define __ALIGN_END __attribute__ ((aligned (4))) 137 | #endif /* __ALIGN_END */ 138 | #ifndef __ALIGN_BEGIN 139 | #define __ALIGN_BEGIN 140 | #endif /* __ALIGN_BEGIN */ 141 | #else 142 | #ifndef __ALIGN_END 143 | #define __ALIGN_END 144 | #endif /* __ALIGN_END */ 145 | #ifndef __ALIGN_BEGIN 146 | #if defined (__CC_ARM) /* ARM Compiler V5*/ 147 | #define __ALIGN_BEGIN __align(4) 148 | #elif defined (__ICCARM__) /* IAR Compiler */ 149 | #define __ALIGN_BEGIN 150 | #endif /* __CC_ARM */ 151 | #endif /* __ALIGN_BEGIN */ 152 | #endif /* __GNUC__ */ 153 | 154 | 155 | /** 156 | * @brief __RAM_FUNC definition 157 | */ 158 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) 159 | /* ARM Compiler V4/V5 and V6 160 | -------------------------- 161 | RAM functions are defined using the toolchain options. 162 | Functions that are executed in RAM should reside in a separate source module. 163 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 164 | area of a module to a memory space in physical RAM. 165 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 166 | dialog. 167 | */ 168 | #define __RAM_FUNC 169 | 170 | #elif defined ( __ICCARM__ ) 171 | /* ICCARM Compiler 172 | --------------- 173 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 174 | */ 175 | #define __RAM_FUNC __ramfunc 176 | 177 | #elif defined ( __GNUC__ ) 178 | /* GNU Compiler 179 | ------------ 180 | RAM functions are defined using a specific toolchain attribute 181 | "__attribute__((section(".RamFunc")))". 182 | */ 183 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 184 | 185 | #endif 186 | 187 | /** 188 | * @brief __NOINLINE definition 189 | */ 190 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) 191 | /* ARM V4/V5 and V6 & GNU Compiler 192 | ------------------------------- 193 | */ 194 | #define __NOINLINE __attribute__ ( (noinline) ) 195 | 196 | #elif defined ( __ICCARM__ ) 197 | /* ICCARM Compiler 198 | --------------- 199 | */ 200 | #define __NOINLINE _Pragma("optimize = no_inline") 201 | 202 | #endif 203 | 204 | #ifdef __cplusplus 205 | } 206 | #endif 207 | 208 | #endif /* ___STM32F1xx_HAL_DEF */ 209 | 210 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 211 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/include/deprecated_definitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | #ifndef DEPRECATED_DEFINITIONS_H 29 | #define DEPRECATED_DEFINITIONS_H 30 | 31 | 32 | /* Each FreeRTOS port has a unique portmacro.h header file. Originally a 33 | pre-processor definition was used to ensure the pre-processor found the correct 34 | portmacro.h file for the port being used. That scheme was deprecated in favour 35 | of setting the compiler's include path such that it found the correct 36 | portmacro.h file - removing the need for the constant and allowing the 37 | portmacro.h file to be located anywhere in relation to the port being used. The 38 | definitions below remain in the code for backward compatibility only. New 39 | projects should not use them. */ 40 | 41 | #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT 42 | #include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h" 43 | typedef void ( __interrupt __far *pxISR )(); 44 | #endif 45 | 46 | #ifdef OPEN_WATCOM_FLASH_LITE_186_PORT 47 | #include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h" 48 | typedef void ( __interrupt __far *pxISR )(); 49 | #endif 50 | 51 | #ifdef GCC_MEGA_AVR 52 | #include "../portable/GCC/ATMega323/portmacro.h" 53 | #endif 54 | 55 | #ifdef IAR_MEGA_AVR 56 | #include "../portable/IAR/ATMega323/portmacro.h" 57 | #endif 58 | 59 | #ifdef MPLAB_PIC24_PORT 60 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 61 | #endif 62 | 63 | #ifdef MPLAB_DSPIC_PORT 64 | #include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h" 65 | #endif 66 | 67 | #ifdef MPLAB_PIC18F_PORT 68 | #include "../../Source/portable/MPLAB/PIC18F/portmacro.h" 69 | #endif 70 | 71 | #ifdef MPLAB_PIC32MX_PORT 72 | #include "../../Source/portable/MPLAB/PIC32MX/portmacro.h" 73 | #endif 74 | 75 | #ifdef _FEDPICC 76 | #include "libFreeRTOS/Include/portmacro.h" 77 | #endif 78 | 79 | #ifdef SDCC_CYGNAL 80 | #include "../../Source/portable/SDCC/Cygnal/portmacro.h" 81 | #endif 82 | 83 | #ifdef GCC_ARM7 84 | #include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h" 85 | #endif 86 | 87 | #ifdef GCC_ARM7_ECLIPSE 88 | #include "portmacro.h" 89 | #endif 90 | 91 | #ifdef ROWLEY_LPC23xx 92 | #include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h" 93 | #endif 94 | 95 | #ifdef IAR_MSP430 96 | #include "..\..\Source\portable\IAR\MSP430\portmacro.h" 97 | #endif 98 | 99 | #ifdef GCC_MSP430 100 | #include "../../Source/portable/GCC/MSP430F449/portmacro.h" 101 | #endif 102 | 103 | #ifdef ROWLEY_MSP430 104 | #include "../../Source/portable/Rowley/MSP430F449/portmacro.h" 105 | #endif 106 | 107 | #ifdef ARM7_LPC21xx_KEIL_RVDS 108 | #include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h" 109 | #endif 110 | 111 | #ifdef SAM7_GCC 112 | #include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h" 113 | #endif 114 | 115 | #ifdef SAM7_IAR 116 | #include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h" 117 | #endif 118 | 119 | #ifdef SAM9XE_IAR 120 | #include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h" 121 | #endif 122 | 123 | #ifdef LPC2000_IAR 124 | #include "..\..\Source\portable\IAR\LPC2000\portmacro.h" 125 | #endif 126 | 127 | #ifdef STR71X_IAR 128 | #include "..\..\Source\portable\IAR\STR71x\portmacro.h" 129 | #endif 130 | 131 | #ifdef STR75X_IAR 132 | #include "..\..\Source\portable\IAR\STR75x\portmacro.h" 133 | #endif 134 | 135 | #ifdef STR75X_GCC 136 | #include "..\..\Source\portable\GCC\STR75x\portmacro.h" 137 | #endif 138 | 139 | #ifdef STR91X_IAR 140 | #include "..\..\Source\portable\IAR\STR91x\portmacro.h" 141 | #endif 142 | 143 | #ifdef GCC_H8S 144 | #include "../../Source/portable/GCC/H8S2329/portmacro.h" 145 | #endif 146 | 147 | #ifdef GCC_AT91FR40008 148 | #include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h" 149 | #endif 150 | 151 | #ifdef RVDS_ARMCM3_LM3S102 152 | #include "../../Source/portable/RVDS/ARM_CM3/portmacro.h" 153 | #endif 154 | 155 | #ifdef GCC_ARMCM3_LM3S102 156 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 157 | #endif 158 | 159 | #ifdef GCC_ARMCM3 160 | #include "../../Source/portable/GCC/ARM_CM3/portmacro.h" 161 | #endif 162 | 163 | #ifdef IAR_ARM_CM3 164 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 165 | #endif 166 | 167 | #ifdef IAR_ARMCM3_LM 168 | #include "../../Source/portable/IAR/ARM_CM3/portmacro.h" 169 | #endif 170 | 171 | #ifdef HCS12_CODE_WARRIOR 172 | #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h" 173 | #endif 174 | 175 | #ifdef MICROBLAZE_GCC 176 | #include "../../Source/portable/GCC/MicroBlaze/portmacro.h" 177 | #endif 178 | 179 | #ifdef TERN_EE 180 | #include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h" 181 | #endif 182 | 183 | #ifdef GCC_HCS12 184 | #include "../../Source/portable/GCC/HCS12/portmacro.h" 185 | #endif 186 | 187 | #ifdef GCC_MCF5235 188 | #include "../../Source/portable/GCC/MCF5235/portmacro.h" 189 | #endif 190 | 191 | #ifdef COLDFIRE_V2_GCC 192 | #include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h" 193 | #endif 194 | 195 | #ifdef COLDFIRE_V2_CODEWARRIOR 196 | #include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h" 197 | #endif 198 | 199 | #ifdef GCC_PPC405 200 | #include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h" 201 | #endif 202 | 203 | #ifdef GCC_PPC440 204 | #include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h" 205 | #endif 206 | 207 | #ifdef _16FX_SOFTUNE 208 | #include "..\..\Source\portable\Softune\MB96340\portmacro.h" 209 | #endif 210 | 211 | #ifdef BCC_INDUSTRIAL_PC_PORT 212 | /* A short file name has to be used in place of the normal 213 | FreeRTOSConfig.h when using the Borland compiler. */ 214 | #include "frconfig.h" 215 | #include "..\portable\BCC\16BitDOS\PC\prtmacro.h" 216 | typedef void ( __interrupt __far *pxISR )(); 217 | #endif 218 | 219 | #ifdef BCC_FLASH_LITE_186_PORT 220 | /* A short file name has to be used in place of the normal 221 | FreeRTOSConfig.h when using the Borland compiler. */ 222 | #include "frconfig.h" 223 | #include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h" 224 | typedef void ( __interrupt __far *pxISR )(); 225 | #endif 226 | 227 | #ifdef __GNUC__ 228 | #ifdef __AVR32_AVR32A__ 229 | #include "portmacro.h" 230 | #endif 231 | #endif 232 | 233 | #ifdef __ICCAVR32__ 234 | #ifdef __CORE__ 235 | #if __CORE__ == __AVR32A__ 236 | #include "portmacro.h" 237 | #endif 238 | #endif 239 | #endif 240 | 241 | #ifdef __91467D 242 | #include "portmacro.h" 243 | #endif 244 | 245 | #ifdef __96340 246 | #include "portmacro.h" 247 | #endif 248 | 249 | 250 | #ifdef __IAR_V850ES_Fx3__ 251 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 252 | #endif 253 | 254 | #ifdef __IAR_V850ES_Jx3__ 255 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 256 | #endif 257 | 258 | #ifdef __IAR_V850ES_Jx3_L__ 259 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 260 | #endif 261 | 262 | #ifdef __IAR_V850ES_Jx2__ 263 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 264 | #endif 265 | 266 | #ifdef __IAR_V850ES_Hx2__ 267 | #include "../../Source/portable/IAR/V850ES/portmacro.h" 268 | #endif 269 | 270 | #ifdef __IAR_78K0R_Kx3__ 271 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 272 | #endif 273 | 274 | #ifdef __IAR_78K0R_Kx3L__ 275 | #include "../../Source/portable/IAR/78K0R/portmacro.h" 276 | #endif 277 | 278 | #endif /* DEPRECATED_DEFINITIONS_H */ 279 | 280 | -------------------------------------------------------------------------------- /firmware/Middlewares/Third_Party/FreeRTOS/Source/list.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeRTOS Kernel V10.0.1 3 | * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | * this software and associated documentation files (the "Software"), to deal in 7 | * the Software without restriction, including without limitation the rights to 8 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | * the Software, and to permit persons to whom the Software is furnished to do so, 10 | * subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | * 22 | * http://www.FreeRTOS.org 23 | * http://aws.amazon.com/freertos 24 | * 25 | * 1 tab == 4 spaces! 26 | */ 27 | 28 | 29 | #include 30 | #include "FreeRTOS.h" 31 | #include "list.h" 32 | 33 | /*----------------------------------------------------------- 34 | * PUBLIC LIST API documented in list.h 35 | *----------------------------------------------------------*/ 36 | 37 | void vListInitialise( List_t * const pxList ) 38 | { 39 | /* The list structure contains a list item which is used to mark the 40 | end of the list. To initialise the list the list end is inserted 41 | as the only list entry. */ 42 | pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 43 | 44 | /* The list end value is the highest possible value in the list to 45 | ensure it remains at the end of the list. */ 46 | pxList->xListEnd.xItemValue = portMAX_DELAY; 47 | 48 | /* The list end next and previous pointers point to itself so we know 49 | when the list is empty. */ 50 | pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 51 | pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 52 | 53 | pxList->uxNumberOfItems = ( UBaseType_t ) 0U; 54 | 55 | /* Write known values into the list if 56 | configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ 57 | listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ); 58 | listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ); 59 | } 60 | /*-----------------------------------------------------------*/ 61 | 62 | void vListInitialiseItem( ListItem_t * const pxItem ) 63 | { 64 | /* Make sure the list item is not recorded as being on a list. */ 65 | pxItem->pvContainer = NULL; 66 | 67 | /* Write known values into the list item if 68 | configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */ 69 | listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); 70 | listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ); 71 | } 72 | /*-----------------------------------------------------------*/ 73 | 74 | void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ) 75 | { 76 | ListItem_t * const pxIndex = pxList->pxIndex; 77 | 78 | /* Only effective when configASSERT() is also defined, these tests may catch 79 | the list data structures being overwritten in memory. They will not catch 80 | data errors caused by incorrect configuration or use of FreeRTOS. */ 81 | listTEST_LIST_INTEGRITY( pxList ); 82 | listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); 83 | 84 | /* Insert a new list item into pxList, but rather than sort the list, 85 | makes the new list item the last item to be removed by a call to 86 | listGET_OWNER_OF_NEXT_ENTRY(). */ 87 | pxNewListItem->pxNext = pxIndex; 88 | pxNewListItem->pxPrevious = pxIndex->pxPrevious; 89 | 90 | /* Only used during decision coverage testing. */ 91 | mtCOVERAGE_TEST_DELAY(); 92 | 93 | pxIndex->pxPrevious->pxNext = pxNewListItem; 94 | pxIndex->pxPrevious = pxNewListItem; 95 | 96 | /* Remember which list the item is in. */ 97 | pxNewListItem->pvContainer = ( void * ) pxList; 98 | 99 | ( pxList->uxNumberOfItems )++; 100 | } 101 | /*-----------------------------------------------------------*/ 102 | 103 | void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) 104 | { 105 | ListItem_t *pxIterator; 106 | const TickType_t xValueOfInsertion = pxNewListItem->xItemValue; 107 | 108 | /* Only effective when configASSERT() is also defined, these tests may catch 109 | the list data structures being overwritten in memory. They will not catch 110 | data errors caused by incorrect configuration or use of FreeRTOS. */ 111 | listTEST_LIST_INTEGRITY( pxList ); 112 | listTEST_LIST_ITEM_INTEGRITY( pxNewListItem ); 113 | 114 | /* Insert the new list item into the list, sorted in xItemValue order. 115 | 116 | If the list already contains a list item with the same item value then the 117 | new list item should be placed after it. This ensures that TCB's which are 118 | stored in ready lists (all of which have the same xItemValue value) get a 119 | share of the CPU. However, if the xItemValue is the same as the back marker 120 | the iteration loop below will not end. Therefore the value is checked 121 | first, and the algorithm slightly modified if necessary. */ 122 | if( xValueOfInsertion == portMAX_DELAY ) 123 | { 124 | pxIterator = pxList->xListEnd.pxPrevious; 125 | } 126 | else 127 | { 128 | /* *** NOTE *********************************************************** 129 | If you find your application is crashing here then likely causes are 130 | listed below. In addition see http://www.freertos.org/FAQHelp.html for 131 | more tips, and ensure configASSERT() is defined! 132 | http://www.freertos.org/a00110.html#configASSERT 133 | 134 | 1) Stack overflow - 135 | see http://www.freertos.org/Stacks-and-stack-overflow-checking.html 136 | 2) Incorrect interrupt priority assignment, especially on Cortex-M 137 | parts where numerically high priority values denote low actual 138 | interrupt priorities, which can seem counter intuitive. See 139 | http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition 140 | of configMAX_SYSCALL_INTERRUPT_PRIORITY on 141 | http://www.freertos.org/a00110.html 142 | 3) Calling an API function from within a critical section or when 143 | the scheduler is suspended, or calling an API function that does 144 | not end in "FromISR" from an interrupt. 145 | 4) Using a queue or semaphore before it has been initialised or 146 | before the scheduler has been started (are interrupts firing 147 | before vTaskStartScheduler() has been called?). 148 | **********************************************************************/ 149 | 150 | for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */ 151 | { 152 | /* There is nothing to do here, just iterating to the wanted 153 | insertion position. */ 154 | } 155 | } 156 | 157 | pxNewListItem->pxNext = pxIterator->pxNext; 158 | pxNewListItem->pxNext->pxPrevious = pxNewListItem; 159 | pxNewListItem->pxPrevious = pxIterator; 160 | pxIterator->pxNext = pxNewListItem; 161 | 162 | /* Remember which list the item is in. This allows fast removal of the 163 | item later. */ 164 | pxNewListItem->pvContainer = ( void * ) pxList; 165 | 166 | ( pxList->uxNumberOfItems )++; 167 | } 168 | /*-----------------------------------------------------------*/ 169 | 170 | UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) 171 | { 172 | /* The list item knows which list it is in. Obtain the list from the list 173 | item. */ 174 | List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer; 175 | 176 | pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; 177 | pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; 178 | 179 | /* Only used during decision coverage testing. */ 180 | mtCOVERAGE_TEST_DELAY(); 181 | 182 | /* Make sure the index is left pointing to a valid item. */ 183 | if( pxList->pxIndex == pxItemToRemove ) 184 | { 185 | pxList->pxIndex = pxItemToRemove->pxPrevious; 186 | } 187 | else 188 | { 189 | mtCOVERAGE_TEST_MARKER(); 190 | } 191 | 192 | pxItemToRemove->pvContainer = NULL; 193 | ( pxList->uxNumberOfItems )--; 194 | 195 | return pxList->uxNumberOfItems; 196 | } 197 | /*-----------------------------------------------------------*/ 198 | 199 | --------------------------------------------------------------------------------