├── Firmware ├── .cproject ├── .mxproject ├── .project ├── .settings │ ├── language.settings.xml │ └── stm32cubeide.project.prefs ├── Core │ ├── Inc │ │ ├── FIRFilter.h │ │ ├── main.h │ │ ├── stm32f0xx_hal_conf.h │ │ └── stm32f0xx_it.h │ ├── Src │ │ ├── FIRFilter.c │ │ ├── main.c │ │ ├── stm32f0xx_hal_msp.c │ │ ├── stm32f0xx_it.c │ │ ├── syscalls.c │ │ ├── sysmem.c │ │ └── system_stm32f0xx.c │ └── Startup │ │ └── startup_stm32f072c8ux.s ├── Drivers │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F0xx │ │ │ │ └── Include │ │ │ │ ├── stm32f072xb.h │ │ │ │ ├── stm32f0xx.h │ │ │ │ └── system_stm32f0xx.h │ │ └── Include │ │ │ ├── cmsis_armcc.h │ │ │ ├── cmsis_armclang.h │ │ │ ├── cmsis_compiler.h │ │ │ ├── cmsis_gcc.h │ │ │ ├── cmsis_iccarm.h │ │ │ ├── cmsis_version.h │ │ │ ├── core_armv8mbl.h │ │ │ ├── core_armv8mml.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm1.h │ │ │ ├── core_cm23.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm33.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm7.h │ │ │ ├── core_sc000.h │ │ │ ├── core_sc300.h │ │ │ ├── mpu_armv7.h │ │ │ ├── mpu_armv8.h │ │ │ └── tz_context.h │ └── STM32F0xx_HAL_Driver │ │ ├── Inc │ │ ├── Legacy │ │ │ └── stm32_hal_legacy.h │ │ ├── stm32f0xx_hal.h │ │ ├── stm32f0xx_hal_cortex.h │ │ ├── stm32f0xx_hal_def.h │ │ ├── stm32f0xx_hal_dma.h │ │ ├── stm32f0xx_hal_dma_ex.h │ │ ├── stm32f0xx_hal_exti.h │ │ ├── stm32f0xx_hal_flash.h │ │ ├── stm32f0xx_hal_flash_ex.h │ │ ├── stm32f0xx_hal_gpio.h │ │ ├── stm32f0xx_hal_gpio_ex.h │ │ ├── stm32f0xx_hal_i2c.h │ │ ├── stm32f0xx_hal_i2c_ex.h │ │ ├── stm32f0xx_hal_pcd.h │ │ ├── stm32f0xx_hal_pcd_ex.h │ │ ├── stm32f0xx_hal_pwr.h │ │ ├── stm32f0xx_hal_pwr_ex.h │ │ ├── stm32f0xx_hal_rcc.h │ │ ├── stm32f0xx_hal_rcc_ex.h │ │ ├── stm32f0xx_hal_tim.h │ │ ├── stm32f0xx_hal_tim_ex.h │ │ └── stm32f0xx_ll_usb.h │ │ └── Src │ │ ├── stm32f0xx_hal.c │ │ ├── stm32f0xx_hal_cortex.c │ │ ├── stm32f0xx_hal_dma.c │ │ ├── stm32f0xx_hal_exti.c │ │ ├── stm32f0xx_hal_flash.c │ │ ├── stm32f0xx_hal_flash_ex.c │ │ ├── stm32f0xx_hal_gpio.c │ │ ├── stm32f0xx_hal_i2c.c │ │ ├── stm32f0xx_hal_i2c_ex.c │ │ ├── stm32f0xx_hal_pcd.c │ │ ├── stm32f0xx_hal_pcd_ex.c │ │ ├── stm32f0xx_hal_pwr.c │ │ ├── stm32f0xx_hal_pwr_ex.c │ │ ├── stm32f0xx_hal_rcc.c │ │ ├── stm32f0xx_hal_rcc_ex.c │ │ ├── stm32f0xx_hal_tim.c │ │ ├── stm32f0xx_hal_tim_ex.c │ │ └── stm32f0xx_ll_usb.c ├── Middlewares │ └── ST │ │ └── STM32_USB_Device_Library │ │ ├── Class │ │ └── CDC │ │ │ ├── Inc │ │ │ └── usbd_cdc.h │ │ │ └── Src │ │ │ └── usbd_cdc.c │ │ └── Core │ │ ├── Inc │ │ ├── usbd_core.h │ │ ├── usbd_ctlreq.h │ │ ├── usbd_def.h │ │ └── usbd_ioreq.h │ │ └── Src │ │ ├── usbd_core.c │ │ ├── usbd_ctlreq.c │ │ └── usbd_ioreq.c ├── STM32F072C8UX_FLASH.ld ├── USB_DEVICE │ ├── App │ │ ├── usb_device.c │ │ ├── usb_device.h │ │ ├── usbd_cdc_if.c │ │ ├── usbd_cdc_if.h │ │ ├── usbd_desc.c │ │ └── usbd_desc.h │ └── Target │ │ ├── usbd_conf.c │ │ └── usbd_conf.h ├── nAmmeter_v2.cfg ├── nAmmeter_v2.ioc └── nAmmeter_v2.launch ├── Hardware ├── Gerbers │ ├── nanoAmmeter_v2-B_Cu.gbr │ ├── nanoAmmeter_v2-B_Mask.gbr │ ├── nanoAmmeter_v2-B_Paste.gbr │ ├── nanoAmmeter_v2-B_Silkscreen.gbr │ ├── nanoAmmeter_v2-Edge_Cuts.gbr │ ├── nanoAmmeter_v2-F_Cu.gbr │ ├── nanoAmmeter_v2-F_Mask.gbr │ ├── nanoAmmeter_v2-F_Paste.gbr │ ├── nanoAmmeter_v2-F_Silkscreen.gbr │ ├── nanoAmmeter_v2-Ground.gbr │ ├── nanoAmmeter_v2-NPTH-drl_map.ps │ ├── nanoAmmeter_v2-NPTH.drl │ ├── nanoAmmeter_v2-PTH-drl_map.ps │ ├── nanoAmmeter_v2-PTH.drl │ ├── nanoAmmeter_v2-Power.gbr │ └── nanoAmmeter_v2-job.gbrjob ├── Interactive BOM │ └── nanoAmmeter_v2_iBOM.html ├── fp-info-cache ├── nanoAmmeter_v2.kicad_pcb ├── nanoAmmeter_v2.kicad_prl ├── nanoAmmeter_v2.kicad_pro ├── nanoAmmeter_v2.kicad_sch ├── nanoAmmeter_v2.kicad_sym ├── nanoAmmeter_v2.pretty │ ├── E6C0606RGBC3UDA.kicad_mod │ ├── Molex_105450-0101.kicad_mod │ ├── PTS636 SL43.kicad_mod │ └── ksclogo.kicad_mod ├── nanoAmmeter_v2.xml └── nanoAmmeter_v2_schematic.pdf ├── PC Application ├── Biosensor_nAmmeter.sln └── Biosensor_nAmmeter │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Biosensor_nAmmeter.csproj │ ├── Biosensor_nAmmeter.csproj.user │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ └── PublishProfiles │ │ ├── FolderProfile.pubxml │ │ └── FolderProfile.pubxml.user │ ├── bin │ ├── Debug │ │ └── netcoreapp3.1 │ │ │ ├── 2020-11-30 10-40-59.csv │ │ │ └── 2020-11-30 10-51-52.csv │ └── Release │ │ └── netcoreapp3.1 │ │ ├── Biosensor_nAmmeter.deps.json │ │ ├── Biosensor_nAmmeter.dll │ │ ├── Biosensor_nAmmeter.exe │ │ ├── Biosensor_nAmmeter.pdb │ │ ├── Biosensor_nAmmeter.runtimeconfig.dev.json │ │ ├── Biosensor_nAmmeter.runtimeconfig.json │ │ ├── Microsoft.Win32.Registry.dll │ │ ├── ScottPlot.WPF.dll │ │ ├── ScottPlot.dll │ │ ├── System.IO.Ports.dll │ │ ├── System.Security.AccessControl.dll │ │ ├── System.Security.Principal.Windows.dll │ │ ├── publish │ │ ├── Biosensor_nAmmeter.deps.json │ │ ├── Biosensor_nAmmeter.dll │ │ ├── Biosensor_nAmmeter.exe │ │ ├── Biosensor_nAmmeter.pdb │ │ ├── Biosensor_nAmmeter.runtimeconfig.json │ │ ├── Microsoft.Win32.Registry.dll │ │ ├── ScottPlot.WPF.dll │ │ ├── ScottPlot.dll │ │ ├── System.IO.Ports.dll │ │ ├── System.Security.AccessControl.dll │ │ ├── System.Security.Principal.Windows.dll │ │ └── runtimes │ │ │ ├── linux-arm │ │ │ └── native │ │ │ │ └── libSystem.IO.Ports.Native.so │ │ │ ├── linux-arm64 │ │ │ └── native │ │ │ │ └── libSystem.IO.Ports.Native.so │ │ │ ├── linux-x64 │ │ │ └── native │ │ │ │ └── libSystem.IO.Ports.Native.so │ │ │ ├── linux │ │ │ └── lib │ │ │ │ └── netstandard2.0 │ │ │ │ └── System.IO.Ports.dll │ │ │ ├── osx-x64 │ │ │ └── native │ │ │ │ └── libSystem.IO.Ports.Native.dylib │ │ │ ├── osx │ │ │ └── lib │ │ │ │ └── netstandard2.0 │ │ │ │ └── System.IO.Ports.dll │ │ │ ├── unix │ │ │ └── lib │ │ │ │ └── netcoreapp2.1 │ │ │ │ └── System.Security.Principal.Windows.dll │ │ │ └── win │ │ │ └── lib │ │ │ ├── netcoreapp2.0 │ │ │ └── System.Security.AccessControl.dll │ │ │ ├── netcoreapp2.1 │ │ │ └── System.Security.Principal.Windows.dll │ │ │ └── netstandard2.0 │ │ │ ├── Microsoft.Win32.Registry.dll │ │ │ └── System.IO.Ports.dll │ │ └── runtimes │ │ ├── linux-arm │ │ └── native │ │ │ └── libSystem.IO.Ports.Native.so │ │ ├── linux-arm64 │ │ └── native │ │ │ └── libSystem.IO.Ports.Native.so │ │ ├── linux-x64 │ │ └── native │ │ │ └── libSystem.IO.Ports.Native.so │ │ ├── linux │ │ └── lib │ │ │ └── netstandard2.0 │ │ │ └── System.IO.Ports.dll │ │ ├── osx-x64 │ │ └── native │ │ │ └── libSystem.IO.Ports.Native.dylib │ │ ├── osx │ │ └── lib │ │ │ └── netstandard2.0 │ │ │ └── System.IO.Ports.dll │ │ ├── unix │ │ └── lib │ │ │ └── netcoreapp2.1 │ │ │ └── System.Security.Principal.Windows.dll │ │ └── win │ │ └── lib │ │ ├── netcoreapp2.0 │ │ └── System.Security.AccessControl.dll │ │ ├── netcoreapp2.1 │ │ └── System.Security.Principal.Windows.dll │ │ └── netstandard2.0 │ │ ├── Microsoft.Win32.Registry.dll │ │ └── System.IO.Ports.dll │ ├── icon_bfc_icon.ico │ └── obj │ ├── Biosensor_nAmmeter.csproj.nuget.dgspec.json │ ├── Biosensor_nAmmeter.csproj.nuget.g.props │ ├── Biosensor_nAmmeter.csproj.nuget.g.targets │ ├── Debug │ └── netcoreapp3.1 │ │ ├── App.g.i.cs │ │ ├── Biosensor_nAmmeter.assets.cache │ │ ├── Biosensor_nAmmeter.csproj.FileListAbsolute.txt │ │ ├── Biosensor_nAmmeter.designer.deps.json │ │ ├── Biosensor_nAmmeter.designer.runtimeconfig.json │ │ ├── Biosensor_nAmmeter.exe │ │ └── MainWindow.g.i.cs │ ├── Release │ └── netcoreapp3.1 │ │ ├── App.g.cs │ │ ├── App.g.i.cs │ │ ├── Biosensor_nAmmeter.AssemblyInfo.cs │ │ ├── Biosensor_nAmmeter.AssemblyInfoInputs.cache │ │ ├── Biosensor_nAmmeter.assets.cache │ │ ├── Biosensor_nAmmeter.csproj.CopyComplete │ │ ├── Biosensor_nAmmeter.csproj.CoreCompileInputs.cache │ │ ├── Biosensor_nAmmeter.csproj.FileListAbsolute.txt │ │ ├── Biosensor_nAmmeter.csprojAssemblyReference.cache │ │ ├── Biosensor_nAmmeter.designer.deps.json │ │ ├── Biosensor_nAmmeter.designer.runtimeconfig.json │ │ ├── Biosensor_nAmmeter.dll │ │ ├── Biosensor_nAmmeter.exe │ │ ├── Biosensor_nAmmeter.g.resources │ │ ├── Biosensor_nAmmeter.genruntimeconfig.cache │ │ ├── Biosensor_nAmmeter.pdb │ │ ├── Biosensor_nAmmeter_MarkupCompile.cache │ │ ├── Biosensor_nAmmeter_MarkupCompile.i.cache │ │ ├── Biosensor_nAmmeter_MarkupCompile.lref │ │ ├── MainWindow.baml │ │ ├── MainWindow.g.cs │ │ └── MainWindow.g.i.cs │ └── project.assets.json ├── README.md └── pcb_image.png /Firmware/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | nAmmeter_v2 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Firmware/.settings/stm32cubeide.project.prefs: -------------------------------------------------------------------------------- 1 | 2F62501ED4689FB349E356AB974DBE57=E89B72CA1C3E82AE56771BEE1379307F 2 | 8DF89ED150041C4CBC7CB9A9CAA90856=E89B72CA1C3E82AE56771BEE1379307F 3 | DC22A860405A8BF2F2C095E5B6529F12=57B445F7ADCFDB7BF7050E759D96C152 4 | eclipse.preferences.version=1 5 | -------------------------------------------------------------------------------- /Firmware/Core/Inc/FIRFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef FIR_FILTER_H 2 | #define FIR_FILTER_H 3 | 4 | #include 5 | 6 | #define FIR_FILTER_LENGTH 16 7 | 8 | typedef struct 9 | { 10 | float buf[FIR_FILTER_LENGTH]; 11 | uint8_t bufIndex; 12 | 13 | float out; 14 | } FIRFilter; 15 | 16 | void FIRFilter_Init(FIRFilter *fir); 17 | float FIRFilter_Update(FIRFilter *fir, float inp); 18 | uint8_t FIRFilter_FilterLength(FIRFilter *fir); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /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) 2021 STMicroelectronics. 11 | * All rights reserved.

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 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 "stm32f0xx_hal.h" 32 | 33 | /* Private includes ----------------------------------------------------------*/ 34 | /* USER CODE BEGIN Includes */ 35 | 36 | /* USER CODE END Includes */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* USER CODE BEGIN ET */ 40 | 41 | /* USER CODE END ET */ 42 | 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* USER CODE BEGIN EC */ 45 | 46 | /* USER CODE END EC */ 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* USER CODE BEGIN EM */ 50 | 51 | /* USER CODE END EM */ 52 | 53 | /* Exported functions prototypes ---------------------------------------------*/ 54 | void Error_Handler(void); 55 | 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | /* Private defines -----------------------------------------------------------*/ 61 | #define LED_R_Pin GPIO_PIN_0 62 | #define LED_R_GPIO_Port GPIOA 63 | #define LED_G_Pin GPIO_PIN_1 64 | #define LED_G_GPIO_Port GPIOA 65 | #define LED_B_Pin GPIO_PIN_2 66 | #define LED_B_GPIO_Port GPIOA 67 | #define ADC_Alert_Pin GPIO_PIN_9 68 | #define ADC_Alert_GPIO_Port GPIOB 69 | /* USER CODE BEGIN Private defines */ 70 | 71 | /* USER CODE END Private defines */ 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* __MAIN_H */ 78 | 79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 80 | -------------------------------------------------------------------------------- /Firmware/Core/Inc/stm32f0xx_it.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f0xx_it.h 5 | * @brief This file contains the headers of the interrupt handlers. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2021 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F0xx_IT_H 23 | #define __STM32F0xx_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 NMI_Handler(void); 51 | void HardFault_Handler(void); 52 | void SVC_Handler(void); 53 | void PendSV_Handler(void); 54 | void SysTick_Handler(void); 55 | void USB_IRQHandler(void); 56 | /* USER CODE BEGIN EFP */ 57 | 58 | /* USER CODE END EFP */ 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* __STM32F0xx_IT_H */ 65 | 66 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 67 | -------------------------------------------------------------------------------- /Firmware/Core/Src/FIRFilter.c: -------------------------------------------------------------------------------- 1 | #include "FIRFilter.h" 2 | 3 | static float FIR_IMPULSE_RESPONSE[FIR_FILTER_LENGTH] = 4 | { -0.0032906f, -0.0052635f, -0.0068811f, 0.0000000f, 0.0254209f, 0.0724719f, 5 | 0.1311260f, 0.1805961f, 0.2000000f, 0.1805961f, 0.1311260f, 0.0724719f, 6 | 0.0254209f, 0.0000000f, -0.0068811f, -0.0052635f }; 7 | 8 | 9 | void FIRFilter_Init(FIRFilter *fir) 10 | { 11 | // Clear filter buffer 12 | for (uint8_t n = 0; n < FIR_FILTER_LENGTH; n++) 13 | { 14 | fir->buf[n] = 0.0f; 15 | } 16 | 17 | // Reset buffer index 18 | fir->bufIndex = 0; 19 | 20 | // Clear filter output 21 | fir->out = 0.0f; 22 | } 23 | 24 | uint8_t FIRFilter_FilterLength(FIRFilter *fir) 25 | { 26 | return FIR_FILTER_LENGTH; 27 | } 28 | 29 | float FIRFilter_Update(FIRFilter *fir, float inp) 30 | { 31 | // Store latest sample in buffer 32 | fir->buf[fir->bufIndex] = inp; 33 | 34 | // Increment the buffer index. Wrap around if necessary 35 | fir->bufIndex++; 36 | 37 | if (fir->bufIndex == FIR_FILTER_LENGTH) 38 | { 39 | fir->bufIndex = 0; 40 | } 41 | 42 | // Compute the new output sample 43 | fir->out = 0.0f; 44 | 45 | uint8_t sumIndex = fir->bufIndex; 46 | 47 | for (uint8_t n = 0; n < FIR_FILTER_LENGTH; n++) 48 | { 49 | // Decrement index and wrap if necessary 50 | if (sumIndex > 0) 51 | { 52 | sumIndex--; 53 | } 54 | else 55 | { 56 | sumIndex = FIR_FILTER_LENGTH - 1; 57 | } 58 | 59 | // Multiple impulse response with shifted input sample and add to output 60 | fir->out += FIR_IMPULSE_RESPONSE[n] * fir->buf[sumIndex]; 61 | } 62 | 63 | return fir->out; 64 | } 65 | -------------------------------------------------------------------------------- /Firmware/Core/Src/stm32f0xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * File Name : stm32f0xx_hal_msp.c 5 | * Description : This file provides code for the MSP Initialization 6 | * and de-Initialization codes. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "main.h" 24 | /* USER CODE BEGIN Includes */ 25 | 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN Define */ 35 | 36 | /* USER CODE END Define */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN Macro */ 40 | 41 | /* USER CODE END Macro */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* External functions --------------------------------------------------------*/ 54 | /* USER CODE BEGIN ExternalFunctions */ 55 | 56 | /* USER CODE END ExternalFunctions */ 57 | 58 | /* USER CODE BEGIN 0 */ 59 | 60 | /* USER CODE END 0 */ 61 | /** 62 | * Initializes the Global MSP. 63 | */ 64 | void HAL_MspInit(void) 65 | { 66 | /* USER CODE BEGIN MspInit 0 */ 67 | 68 | /* USER CODE END MspInit 0 */ 69 | 70 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 71 | __HAL_RCC_PWR_CLK_ENABLE(); 72 | 73 | /* System interrupt init*/ 74 | 75 | /* USER CODE BEGIN MspInit 1 */ 76 | 77 | /* USER CODE END MspInit 1 */ 78 | } 79 | 80 | /** 81 | * @brief I2C MSP Initialization 82 | * This function configures the hardware resources used in this example 83 | * @param hi2c: I2C handle pointer 84 | * @retval None 85 | */ 86 | void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c) 87 | { 88 | GPIO_InitTypeDef GPIO_InitStruct = {0}; 89 | if(hi2c->Instance==I2C1) 90 | { 91 | /* USER CODE BEGIN I2C1_MspInit 0 */ 92 | 93 | /* USER CODE END I2C1_MspInit 0 */ 94 | 95 | __HAL_RCC_GPIOB_CLK_ENABLE(); 96 | /**I2C1 GPIO Configuration 97 | PB6 ------> I2C1_SCL 98 | PB7 ------> I2C1_SDA 99 | */ 100 | GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; 101 | GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; 102 | GPIO_InitStruct.Pull = GPIO_PULLUP; 103 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; 104 | GPIO_InitStruct.Alternate = GPIO_AF1_I2C1; 105 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); 106 | 107 | /* Peripheral clock enable */ 108 | __HAL_RCC_I2C1_CLK_ENABLE(); 109 | /* USER CODE BEGIN I2C1_MspInit 1 */ 110 | 111 | /* USER CODE END I2C1_MspInit 1 */ 112 | } 113 | 114 | } 115 | 116 | /** 117 | * @brief I2C MSP De-Initialization 118 | * This function freeze the hardware resources used in this example 119 | * @param hi2c: I2C handle pointer 120 | * @retval None 121 | */ 122 | void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c) 123 | { 124 | if(hi2c->Instance==I2C1) 125 | { 126 | /* USER CODE BEGIN I2C1_MspDeInit 0 */ 127 | 128 | /* USER CODE END I2C1_MspDeInit 0 */ 129 | /* Peripheral clock disable */ 130 | __HAL_RCC_I2C1_CLK_DISABLE(); 131 | 132 | /**I2C1 GPIO Configuration 133 | PB6 ------> I2C1_SCL 134 | PB7 ------> I2C1_SDA 135 | */ 136 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6); 137 | 138 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7); 139 | 140 | /* USER CODE BEGIN I2C1_MspDeInit 1 */ 141 | 142 | /* USER CODE END I2C1_MspDeInit 1 */ 143 | } 144 | 145 | } 146 | 147 | /* USER CODE BEGIN 1 */ 148 | 149 | /* USER CODE END 1 */ 150 | 151 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 152 | -------------------------------------------------------------------------------- /Firmware/Core/Src/stm32f0xx_it.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file stm32f0xx_it.c 5 | * @brief Interrupt Service Routines. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2021 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 "main.h" 23 | #include "stm32f0xx_it.h" 24 | /* Private includes ----------------------------------------------------------*/ 25 | /* USER CODE BEGIN Includes */ 26 | /* USER CODE END Includes */ 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* USER CODE BEGIN TD */ 30 | 31 | /* USER CODE END TD */ 32 | 33 | /* Private define ------------------------------------------------------------*/ 34 | /* USER CODE BEGIN PD */ 35 | 36 | /* USER CODE END PD */ 37 | 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* USER CODE BEGIN PM */ 40 | 41 | /* USER CODE END PM */ 42 | 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* USER CODE BEGIN PV */ 45 | 46 | /* USER CODE END PV */ 47 | 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* USER CODE BEGIN PFP */ 50 | 51 | /* USER CODE END PFP */ 52 | 53 | /* Private user code ---------------------------------------------------------*/ 54 | /* USER CODE BEGIN 0 */ 55 | 56 | /* USER CODE END 0 */ 57 | 58 | /* External variables --------------------------------------------------------*/ 59 | extern PCD_HandleTypeDef hpcd_USB_FS; 60 | /* USER CODE BEGIN EV */ 61 | 62 | /* USER CODE END EV */ 63 | 64 | /******************************************************************************/ 65 | /* Cortex-M0 Processor Interruption and Exception Handlers */ 66 | /******************************************************************************/ 67 | /** 68 | * @brief This function handles Non maskable interrupt. 69 | */ 70 | void NMI_Handler(void) 71 | { 72 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 73 | 74 | /* USER CODE END NonMaskableInt_IRQn 0 */ 75 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 76 | 77 | /* USER CODE END NonMaskableInt_IRQn 1 */ 78 | } 79 | 80 | /** 81 | * @brief This function handles Hard fault interrupt. 82 | */ 83 | void HardFault_Handler(void) 84 | { 85 | /* USER CODE BEGIN HardFault_IRQn 0 */ 86 | 87 | /* USER CODE END HardFault_IRQn 0 */ 88 | while (1) 89 | { 90 | /* USER CODE BEGIN W1_HardFault_IRQn 0 */ 91 | /* USER CODE END W1_HardFault_IRQn 0 */ 92 | } 93 | } 94 | 95 | /** 96 | * @brief This function handles System service call via SWI instruction. 97 | */ 98 | void SVC_Handler(void) 99 | { 100 | /* USER CODE BEGIN SVC_IRQn 0 */ 101 | 102 | /* USER CODE END SVC_IRQn 0 */ 103 | /* USER CODE BEGIN SVC_IRQn 1 */ 104 | 105 | /* USER CODE END SVC_IRQn 1 */ 106 | } 107 | 108 | /** 109 | * @brief This function handles Pendable request for system service. 110 | */ 111 | void PendSV_Handler(void) 112 | { 113 | /* USER CODE BEGIN PendSV_IRQn 0 */ 114 | 115 | /* USER CODE END PendSV_IRQn 0 */ 116 | /* USER CODE BEGIN PendSV_IRQn 1 */ 117 | 118 | /* USER CODE END PendSV_IRQn 1 */ 119 | } 120 | 121 | /** 122 | * @brief This function handles System tick timer. 123 | */ 124 | void SysTick_Handler(void) 125 | { 126 | /* USER CODE BEGIN SysTick_IRQn 0 */ 127 | 128 | /* USER CODE END SysTick_IRQn 0 */ 129 | HAL_IncTick(); 130 | /* USER CODE BEGIN SysTick_IRQn 1 */ 131 | 132 | /* USER CODE END SysTick_IRQn 1 */ 133 | } 134 | 135 | /******************************************************************************/ 136 | /* STM32F0xx Peripheral Interrupt Handlers */ 137 | /* Add here the Interrupt Handlers for the used peripherals. */ 138 | /* For the available peripheral interrupt handler names, */ 139 | /* please refer to the startup file (startup_stm32f0xx.s). */ 140 | /******************************************************************************/ 141 | 142 | /** 143 | * @brief This function handles USB global interrupt / USB wake-up interrupt through EXTI line 18. 144 | */ 145 | void USB_IRQHandler(void) 146 | { 147 | /* USER CODE BEGIN USB_IRQn 0 */ 148 | 149 | /* USER CODE END USB_IRQn 0 */ 150 | HAL_PCD_IRQHandler(&hpcd_USB_FS); 151 | /* USER CODE BEGIN USB_IRQn 1 */ 152 | 153 | /* USER CODE END USB_IRQn 1 */ 154 | } 155 | 156 | /* USER CODE BEGIN 1 */ 157 | 158 | /* USER CODE END 1 */ 159 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 160 | -------------------------------------------------------------------------------- /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/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/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f072xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joeltroughton/nanoAmmeter/7971d07e66f701068158726d8ddab41a94d04c3f/Firmware/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f072xb.h -------------------------------------------------------------------------------- /Firmware/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joeltroughton/nanoAmmeter/7971d07e66f701068158726d8ddab41a94d04c3f/Firmware/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h -------------------------------------------------------------------------------- /Firmware/Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f0xx.h 4 | * @author MCD Application Team 5 | * @brief CMSIS Cortex-M0 Device System Source File for STM32F0xx devices. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 stm32f0xx_system 25 | * @{ 26 | */ 27 | 28 | /** 29 | * @brief Define to prevent recursive inclusion 30 | */ 31 | #ifndef __SYSTEM_STM32F0XX_H 32 | #define __SYSTEM_STM32F0XX_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** @addtogroup STM32F0xx_System_Includes 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @addtogroup STM32F0xx_System_Exported_types 48 | * @{ 49 | */ 50 | /* This variable is updated in three ways: 51 | 1) by calling CMSIS function SystemCoreClockUpdate() 52 | 3) by calling HAL API function HAL_RCC_GetHCLKFreq() 53 | 3) by calling HAL API function HAL_RCC_ClockConfig() 54 | Note: If you use this function to configure the system clock; then there 55 | is no need to call the 2 first functions listed above, since SystemCoreClock 56 | variable is updated automatically. 57 | */ 58 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 59 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ 60 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F0xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F0xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F0xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F0XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /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/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/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_cortex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_hal_cortex.h 4 | * @author MCD Application Team 5 | * @brief Header file of CORTEX HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F0xx_HAL_CORTEX_H 22 | #define __STM32F0xx_HAL_CORTEX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f0xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup CORTEX CORTEX 36 | * @{ 37 | */ 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | 41 | /** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants 42 | * @{ 43 | */ 44 | 45 | /** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source 46 | * @{ 47 | */ 48 | #define SYSTICK_CLKSOURCE_HCLK_DIV8 (0x00000000U) 49 | #define SYSTICK_CLKSOURCE_HCLK (0x00000004U) 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported Macros -----------------------------------------------------------*/ 60 | 61 | /* Exported functions --------------------------------------------------------*/ 62 | /** @addtogroup CORTEX_Exported_Functions CORTEX Exported Functions 63 | * @{ 64 | */ 65 | /** @addtogroup CORTEX_Exported_Functions_Group1 Initialization and de-initialization functions 66 | * @brief Initialization and Configuration functions 67 | * @{ 68 | */ 69 | /* Initialization and de-initialization functions *******************************/ 70 | void HAL_NVIC_SetPriority(IRQn_Type IRQn,uint32_t PreemptPriority, uint32_t SubPriority); 71 | void HAL_NVIC_EnableIRQ(IRQn_Type IRQn); 72 | void HAL_NVIC_DisableIRQ(IRQn_Type IRQn); 73 | void HAL_NVIC_SystemReset(void); 74 | uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @addtogroup CORTEX_Exported_Functions_Group2 Peripheral Control functions 80 | * @brief Cortex control functions 81 | * @{ 82 | */ 83 | 84 | /* Peripheral Control functions *************************************************/ 85 | uint32_t HAL_NVIC_GetPriority(IRQn_Type IRQn); 86 | uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); 87 | void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn); 88 | void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn); 89 | void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource); 90 | void HAL_SYSTICK_IRQHandler(void); 91 | void HAL_SYSTICK_Callback(void); 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /* Private types -------------------------------------------------------------*/ 101 | /* Private variables ---------------------------------------------------------*/ 102 | /* Private constants ---------------------------------------------------------*/ 103 | /* Private macros ------------------------------------------------------------*/ 104 | /** @defgroup CORTEX_Private_Macros CORTEX Private Macros 105 | * @{ 106 | */ 107 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x4) 108 | 109 | #define IS_NVIC_DEVICE_IRQ(IRQ) ((IRQ) >= 0x00) 110 | 111 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \ 112 | ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | #ifdef __cplusplus 126 | } 127 | #endif 128 | 129 | #endif /* __STM32F0xx_HAL_CORTEX_H */ 130 | 131 | 132 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 133 | 134 | -------------------------------------------------------------------------------- /Firmware/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_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) 2016 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 __STM32F0xx_HAL_DEF 23 | #define __STM32F0xx_HAL_DEF 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32f0xx.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 | 58 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ 59 | 60 | #define HAL_MAX_DELAY 0xFFFFFFFFU 61 | 62 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) 63 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 64 | 65 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 66 | do{ \ 67 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 68 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 69 | } while(0U) 70 | 71 | /** @brief Reset the Handle's State field. 72 | * @param __HANDLE__ specifies the Peripheral Handle. 73 | * @note This macro can be used for the following purpose: 74 | * - When the Handle is declared as local variable; before passing it as parameter 75 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 76 | * to set to 0 the Handle's "State" field. 77 | * Otherwise, "State" field may have any random value and the first time the function 78 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 79 | * (i.e. HAL_PPP_MspInit() will not be executed). 80 | * - When there is a need to reconfigure the low level hardware: instead of calling 81 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 82 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 83 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 84 | * @retval None 85 | */ 86 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 87 | 88 | #if (USE_RTOS == 1U) 89 | /* Reserved for future use */ 90 | #error " USE_RTOS should be 0 in the current HAL release " 91 | #else 92 | #define __HAL_LOCK(__HANDLE__) \ 93 | do{ \ 94 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 95 | { \ 96 | return HAL_BUSY; \ 97 | } \ 98 | else \ 99 | { \ 100 | (__HANDLE__)->Lock = HAL_LOCKED; \ 101 | } \ 102 | }while (0U) 103 | 104 | #define __HAL_UNLOCK(__HANDLE__) \ 105 | do{ \ 106 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 107 | }while (0U) 108 | #endif /* USE_RTOS */ 109 | 110 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 111 | #ifndef __weak 112 | #define __weak __attribute__((weak)) 113 | #endif 114 | #ifndef __packed 115 | #define __packed __attribute__((packed)) 116 | #endif 117 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 118 | #ifndef __weak 119 | #define __weak __attribute__((weak)) 120 | #endif /* __weak */ 121 | #ifndef __packed 122 | #define __packed __attribute__((__packed__)) 123 | #endif /* __packed */ 124 | #endif /* __GNUC__ */ 125 | 126 | 127 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 128 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 129 | #ifndef __ALIGN_BEGIN 130 | #define __ALIGN_BEGIN 131 | #endif 132 | #ifndef __ALIGN_END 133 | #define __ALIGN_END __attribute__ ((aligned (4))) 134 | #endif 135 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 136 | #ifndef __ALIGN_END 137 | #define __ALIGN_END __attribute__ ((aligned (4))) 138 | #endif /* __ALIGN_END */ 139 | #ifndef __ALIGN_BEGIN 140 | #define __ALIGN_BEGIN 141 | #endif /* __ALIGN_BEGIN */ 142 | #else 143 | #ifndef __ALIGN_END 144 | #define __ALIGN_END 145 | #endif /* __ALIGN_END */ 146 | #ifndef __ALIGN_BEGIN 147 | #if defined (__CC_ARM) /* ARM Compiler V5*/ 148 | #define __ALIGN_BEGIN __align(4) 149 | #elif defined (__ICCARM__) /* IAR Compiler */ 150 | #define __ALIGN_BEGIN 151 | #endif /* __CC_ARM */ 152 | #endif /* __ALIGN_BEGIN */ 153 | #endif /* __GNUC__ */ 154 | 155 | /** 156 | * @brief __NOINLINE definition 157 | */ 158 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) 159 | /* ARM V4/V5 and V6 & GNU Compiler 160 | ------------------------------- 161 | */ 162 | #define __NOINLINE __attribute__ ( (noinline) ) 163 | 164 | #elif defined ( __ICCARM__ ) 165 | /* ICCARM Compiler 166 | --------------- 167 | */ 168 | #define __NOINLINE _Pragma("optimize = no_inline") 169 | 170 | #endif 171 | 172 | #ifdef __cplusplus 173 | } 174 | #endif 175 | 176 | #endif /* ___STM32F0xx_HAL_DEF */ 177 | 178 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 179 | -------------------------------------------------------------------------------- /Firmware/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of I2C HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32F0xx_HAL_I2C_EX_H 22 | #define STM32F0xx_HAL_I2C_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f0xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup I2CEx 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | 42 | /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants 43 | * @{ 44 | */ 45 | 46 | /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter 47 | * @{ 48 | */ 49 | #define I2C_ANALOGFILTER_ENABLE 0x00000000U 50 | #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus 56 | * @{ 57 | */ 58 | #define I2C_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */ 59 | #if defined(SYSCFG_CFGR1_I2C_FMP_PA9) 60 | #define I2C_FASTMODEPLUS_PA9 SYSCFG_CFGR1_I2C_FMP_PA9 /*!< Enable Fast Mode Plus on PA9 */ 61 | #define I2C_FASTMODEPLUS_PA10 SYSCFG_CFGR1_I2C_FMP_PA10 /*!< Enable Fast Mode Plus on PA10 */ 62 | #else 63 | #define I2C_FASTMODEPLUS_PA9 (uint32_t)(0x00000001U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PA9 not supported */ 64 | #define I2C_FASTMODEPLUS_PA10 (uint32_t)(0x00000002U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PA10 not supported */ 65 | #endif 66 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_FMP_PB6 /*!< Enable Fast Mode Plus on PB6 */ 67 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_FMP_PB7 /*!< Enable Fast Mode Plus on PB7 */ 68 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_FMP_PB8 /*!< Enable Fast Mode Plus on PB8 */ 69 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_FMP_PB9 /*!< Enable Fast Mode Plus on PB9 */ 70 | #if defined(SYSCFG_CFGR1_I2C_FMP_I2C1) 71 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C_FMP_I2C1 /*!< Enable Fast Mode Plus on I2C1 pins */ 72 | #else 73 | #define I2C_FASTMODEPLUS_I2C1 (uint32_t)(0x00000100U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C1 not supported */ 74 | #endif 75 | #if defined(SYSCFG_CFGR1_I2C_FMP_I2C2) 76 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C_FMP_I2C2 /*!< Enable Fast Mode Plus on I2C2 pins */ 77 | #else 78 | #define I2C_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 79 | #endif 80 | /** 81 | * @} 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /* Exported macro ------------------------------------------------------------*/ 89 | /* Exported functions --------------------------------------------------------*/ 90 | 91 | /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions 92 | * @{ 93 | */ 94 | 95 | /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions 96 | * @brief Extended features functions 97 | * @{ 98 | */ 99 | 100 | /* Peripheral Control functions ************************************************/ 101 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, 102 | uint32_t AnalogFilter); 103 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, 104 | uint32_t DigitalFilter); 105 | #if defined(I2C_CR1_WUPEN) 106 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); 107 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); 108 | #endif 109 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 110 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 111 | 112 | /* Private constants ---------------------------------------------------------*/ 113 | /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants 114 | * @{ 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /* Private macros ------------------------------------------------------------*/ 122 | /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros 123 | * @{ 124 | */ 125 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ 126 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) 127 | 128 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) 129 | 130 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \ 131 | ((((__CONFIG__) & (I2C_FASTMODEPLUS_PA9)) == I2C_FASTMODEPLUS_PA9) || \ 132 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PA10)) == I2C_FASTMODEPLUS_PA10) || \ 133 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ 134 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ 135 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ 136 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ 137 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ 138 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2))) 139 | /** 140 | * @} 141 | */ 142 | 143 | /* Private Functions ---------------------------------------------------------*/ 144 | /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions 145 | * @{ 146 | */ 147 | /* Private functions are defined in stm32f0xx_hal_i2c_ex.c file */ 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | #ifdef __cplusplus 169 | } 170 | #endif 171 | 172 | #endif /* STM32F0xx_HAL_I2C_EX_H */ 173 | 174 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 175 | -------------------------------------------------------------------------------- /Firmware/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of PCD HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32F0xx_HAL_PCD_EX_H 22 | #define STM32F0xx_HAL_PCD_EX_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f0xx_hal_def.h" 30 | 31 | #if defined (USB) 32 | /** @addtogroup STM32F0xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup PCDEx 37 | * @{ 38 | */ 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macros -----------------------------------------------------------*/ 42 | /* Exported functions --------------------------------------------------------*/ 43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 44 | * @{ 45 | */ 46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 47 | * @{ 48 | */ 49 | 50 | 51 | 52 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, 53 | uint16_t ep_kind, uint32_t pmaadress); 54 | 55 | 56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 58 | 59 | 60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 63 | 64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | #endif /* defined (USB) */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | 89 | #endif /* STM32F0xx_HAL_PCD_EX_H */ 90 | 91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 92 | -------------------------------------------------------------------------------- /Firmware/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_hal_pwr.h 4 | * @author MCD Application Team 5 | * @brief Header file of PWR HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32F0xx_HAL_PWR_H 22 | #define __STM32F0xx_HAL_PWR_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f0xx_hal_def.h" 30 | 31 | /** @addtogroup STM32F0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup PWR PWR 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | 42 | /** @defgroup PWR_Exported_Constants PWR Exported Constants 43 | * @{ 44 | */ 45 | 46 | /** @defgroup PWR_Regulator_state_in_STOP_mode PWR Regulator state in STOP mode 47 | * @{ 48 | */ 49 | #define PWR_MAINREGULATOR_ON (0x00000000U) 50 | #define PWR_LOWPOWERREGULATOR_ON PWR_CR_LPDS 51 | 52 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_MAINREGULATOR_ON) || \ 53 | ((REGULATOR) == PWR_LOWPOWERREGULATOR_ON)) 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup PWR_SLEEP_mode_entry PWR SLEEP mode entry 59 | * @{ 60 | */ 61 | #define PWR_SLEEPENTRY_WFI ((uint8_t)0x01U) 62 | #define PWR_SLEEPENTRY_WFE ((uint8_t)0x02U) 63 | #define IS_PWR_SLEEP_ENTRY(ENTRY) (((ENTRY) == PWR_SLEEPENTRY_WFI) || ((ENTRY) == PWR_SLEEPENTRY_WFE)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup PWR_STOP_mode_entry PWR STOP mode entry 69 | * @{ 70 | */ 71 | #define PWR_STOPENTRY_WFI ((uint8_t)0x01U) 72 | #define PWR_STOPENTRY_WFE ((uint8_t)0x02U) 73 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPENTRY_WFI) || ((ENTRY) == PWR_STOPENTRY_WFE)) 74 | /** 75 | * @} 76 | */ 77 | 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /* Exported macro ------------------------------------------------------------*/ 84 | /** @defgroup PWR_Exported_Macro PWR Exported Macro 85 | * @{ 86 | */ 87 | 88 | /** @brief Check PWR flag is set or not. 89 | * @param __FLAG__ specifies the flag to check. 90 | * This parameter can be one of the following values: 91 | * @arg PWR_FLAG_WU: Wake Up flag. This flag indicates that a wakeup event 92 | * was received from the WKUP pin or from the RTC alarm (Alarm A), 93 | * RTC Tamper event, RTC TimeStamp event or RTC Wakeup. 94 | * An additional wakeup event is detected if the WKUP pin is enabled 95 | * (by setting the EWUP bit) when the WKUP pin level is already high. 96 | * @arg PWR_FLAG_SB: StandBy flag. This flag indicates that the system was 97 | * resumed from StandBy mode. 98 | * @arg PWR_FLAG_PVDO: PVD Output. This flag is valid only if PVD is enabled 99 | * by the HAL_PWR_EnablePVD() function. The PVD is stopped by Standby mode 100 | * For this reason, this bit is equal to 0 after Standby or reset 101 | * until the PVDE bit is set. 102 | * Warning: this Flag is not available on STM32F030x8 products 103 | * @arg PWR_FLAG_VREFINTRDY: This flag indicates that the internal reference 104 | * voltage VREFINT is ready. 105 | * Warning: this Flag is not available on STM32F030x8 products 106 | * @retval The new state of __FLAG__ (TRUE or FALSE). 107 | */ 108 | #define __HAL_PWR_GET_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) 109 | 110 | /** @brief Clear the PWR's pending flags. 111 | * @param __FLAG__ specifies the flag to clear. 112 | * This parameter can be one of the following values: 113 | * @arg PWR_FLAG_WU: Wake Up flag 114 | * @arg PWR_FLAG_SB: StandBy flag 115 | */ 116 | #define __HAL_PWR_CLEAR_FLAG(__FLAG__) (PWR->CR |= (__FLAG__) << 2U) 117 | 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /* Include PWR HAL Extension module */ 124 | #include "stm32f0xx_hal_pwr_ex.h" 125 | 126 | /* Exported functions --------------------------------------------------------*/ 127 | 128 | /** @addtogroup PWR_Exported_Functions PWR Exported Functions 129 | * @{ 130 | */ 131 | 132 | /** @addtogroup PWR_Exported_Functions_Group1 Initialization and de-initialization functions 133 | * @{ 134 | */ 135 | 136 | /* Initialization and de-initialization functions *****************************/ 137 | void HAL_PWR_DeInit(void); 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /** @addtogroup PWR_Exported_Functions_Group2 Peripheral Control functions 144 | * @{ 145 | */ 146 | 147 | /* Peripheral Control functions **********************************************/ 148 | void HAL_PWR_EnableBkUpAccess(void); 149 | void HAL_PWR_DisableBkUpAccess(void); 150 | 151 | /* WakeUp pins configuration functions ****************************************/ 152 | void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinx); 153 | void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx); 154 | 155 | /* Low Power modes configuration functions ************************************/ 156 | void HAL_PWR_EnterSTOPMode(uint32_t Regulator, uint8_t STOPEntry); 157 | void HAL_PWR_EnterSLEEPMode(uint32_t Regulator, uint8_t SLEEPEntry); 158 | void HAL_PWR_EnterSTANDBYMode(void); 159 | 160 | void HAL_PWR_EnableSleepOnExit(void); 161 | void HAL_PWR_DisableSleepOnExit(void); 162 | void HAL_PWR_EnableSEVOnPend(void); 163 | void HAL_PWR_DisableSEVOnPend(void); 164 | 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /** 174 | * @} 175 | */ 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | #ifdef __cplusplus 182 | } 183 | #endif 184 | 185 | 186 | #endif /* __STM32F0xx_HAL_PWR_H */ 187 | 188 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 189 | 190 | -------------------------------------------------------------------------------- /Firmware/Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_ll_usb.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f0xx_ll_usb.h 4 | * @author MCD Application Team 5 | * @brief Header file of USB Low Layer HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2016 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef STM32F0xx_LL_USB_H 22 | #define STM32F0xx_LL_USB_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f0xx_hal_def.h" 30 | 31 | #if defined (USB) 32 | /** @addtogroup STM32F0xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup USB_LL 37 | * @{ 38 | */ 39 | 40 | /* Exported types ------------------------------------------------------------*/ 41 | 42 | /** 43 | * @brief USB Mode definition 44 | */ 45 | 46 | 47 | 48 | typedef enum 49 | { 50 | USB_DEVICE_MODE = 0 51 | } USB_ModeTypeDef; 52 | 53 | /** 54 | * @brief USB Initialization Structure definition 55 | */ 56 | typedef struct 57 | { 58 | uint32_t dev_endpoints; /*!< Device Endpoints number. 59 | This parameter depends on the used USB core. 60 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ 61 | 62 | uint32_t speed; /*!< USB Core speed. 63 | This parameter can be any value of @ref USB_Core_Speed */ 64 | 65 | uint32_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */ 66 | 67 | uint32_t phy_itface; /*!< Select the used PHY interface. 68 | This parameter can be any value of @ref USB_Core_PHY */ 69 | 70 | uint32_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ 71 | 72 | uint32_t low_power_enable; /*!< Enable or disable Low Power mode */ 73 | 74 | uint32_t lpm_enable; /*!< Enable or disable Battery charging. */ 75 | 76 | uint32_t battery_charging_enable; /*!< Enable or disable Battery charging. */ 77 | } USB_CfgTypeDef; 78 | 79 | typedef struct 80 | { 81 | uint8_t num; /*!< Endpoint number 82 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ 83 | 84 | uint8_t is_in; /*!< Endpoint direction 85 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 86 | 87 | uint8_t is_stall; /*!< Endpoint stall condition 88 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 89 | 90 | uint8_t type; /*!< Endpoint type 91 | This parameter can be any value of @ref USB_EP_Type */ 92 | 93 | uint8_t data_pid_start; /*!< Initial data PID 94 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 95 | 96 | uint16_t pmaadress; /*!< PMA Address 97 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 98 | 99 | uint16_t pmaaddr0; /*!< PMA Address0 100 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 101 | 102 | uint16_t pmaaddr1; /*!< PMA Address1 103 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 104 | 105 | uint8_t doublebuffer; /*!< Double buffer enable 106 | This parameter can be 0 or 1 */ 107 | 108 | uint16_t tx_fifo_num; /*!< This parameter is not required by USB Device FS peripheral, it is used 109 | only by USB OTG FS peripheral 110 | This parameter is added to ensure compatibility across USB peripherals */ 111 | 112 | uint32_t maxpacket; /*!< Endpoint Max packet size 113 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ 114 | 115 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ 116 | 117 | uint32_t xfer_len; /*!< Current transfer length */ 118 | 119 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ 120 | 121 | uint32_t xfer_len_db; /*!< double buffer transfer length used with bulk double buffer in */ 122 | 123 | uint8_t xfer_fill_db; /*!< double buffer Need to Fill new buffer used with bulk_in */ 124 | 125 | } USB_EPTypeDef; 126 | 127 | 128 | /* Exported constants --------------------------------------------------------*/ 129 | 130 | /** @defgroup PCD_Exported_Constants PCD Exported Constants 131 | * @{ 132 | */ 133 | 134 | 135 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS 136 | * @{ 137 | */ 138 | #define EP_MPS_64 0U 139 | #define EP_MPS_32 1U 140 | #define EP_MPS_16 2U 141 | #define EP_MPS_8 3U 142 | /** 143 | * @} 144 | */ 145 | 146 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type 147 | * @{ 148 | */ 149 | #define EP_TYPE_CTRL 0U 150 | #define EP_TYPE_ISOC 1U 151 | #define EP_TYPE_BULK 2U 152 | #define EP_TYPE_INTR 3U 153 | #define EP_TYPE_MSK 3U 154 | /** 155 | * @} 156 | */ 157 | 158 | /** @defgroup USB_LL Device Speed 159 | * @{ 160 | */ 161 | #define USBD_FS_SPEED 2U 162 | /** 163 | * @} 164 | */ 165 | 166 | #define BTABLE_ADDRESS 0x000U 167 | #define PMA_ACCESS 1U 168 | 169 | #define EP_ADDR_MSK 0x7U 170 | /** 171 | * @} 172 | */ 173 | 174 | /* Exported macro ------------------------------------------------------------*/ 175 | /** 176 | * @} 177 | */ 178 | 179 | /* Exported functions --------------------------------------------------------*/ 180 | /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions 181 | * @{ 182 | */ 183 | 184 | 185 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); 186 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); 187 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx); 188 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx); 189 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode); 190 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); 191 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); 192 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); 193 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); 194 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); 195 | HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address); 196 | HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx); 197 | HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx); 198 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx); 199 | uint32_t USB_ReadInterrupts(USB_TypeDef *USBx); 200 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx); 201 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx); 202 | 203 | void USB_WritePMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, 204 | uint16_t wPMABufAddr, uint16_t wNBytes); 205 | 206 | void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, 207 | uint16_t wPMABufAddr, uint16_t wNBytes); 208 | 209 | /** 210 | * @} 211 | */ 212 | 213 | /** 214 | * @} 215 | */ 216 | 217 | /** 218 | * @} 219 | */ 220 | 221 | /** 222 | * @} 223 | */ 224 | #endif /* defined (USB) */ 225 | 226 | #ifdef __cplusplus 227 | } 228 | #endif 229 | 230 | 231 | #endif /* STM32F0xx_LL_USB_H */ 232 | 233 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 234 | -------------------------------------------------------------------------------- /Firmware/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc/usbd_cdc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc.h 4 | * @author MCD Application Team 5 | * @brief header file for the usbd_cdc.c file. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2015 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 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __USB_CDC_H 22 | #define __USB_CDC_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_ioreq.h" 30 | 31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | /** @defgroup usbd_cdc 36 | * @brief This file is the Header file for usbd_cdc.c 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup usbd_cdc_Exported_Defines 42 | * @{ 43 | */ 44 | #define CDC_IN_EP 0x81U /* EP1 for data IN */ 45 | #define CDC_OUT_EP 0x01U /* EP1 for data OUT */ 46 | #define CDC_CMD_EP 0x82U /* EP2 for CDC commands */ 47 | 48 | #ifndef CDC_HS_BINTERVAL 49 | #define CDC_HS_BINTERVAL 0x10U 50 | #endif /* CDC_HS_BINTERVAL */ 51 | 52 | #ifndef CDC_FS_BINTERVAL 53 | #define CDC_FS_BINTERVAL 0x10U 54 | #endif /* CDC_FS_BINTERVAL */ 55 | 56 | /* CDC Endpoints parameters: you can fine tune these values depending on the needed baudrates and performance. */ 57 | #define CDC_DATA_HS_MAX_PACKET_SIZE 512U /* Endpoint IN & OUT Packet size */ 58 | #define CDC_DATA_FS_MAX_PACKET_SIZE 64U /* Endpoint IN & OUT Packet size */ 59 | #define CDC_CMD_PACKET_SIZE 8U /* Control Endpoint Packet size */ 60 | 61 | #define USB_CDC_CONFIG_DESC_SIZ 67U 62 | #define CDC_DATA_HS_IN_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE 63 | #define CDC_DATA_HS_OUT_PACKET_SIZE CDC_DATA_HS_MAX_PACKET_SIZE 64 | 65 | #define CDC_DATA_FS_IN_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE 66 | #define CDC_DATA_FS_OUT_PACKET_SIZE CDC_DATA_FS_MAX_PACKET_SIZE 67 | 68 | /*---------------------------------------------------------------------*/ 69 | /* CDC definitions */ 70 | /*---------------------------------------------------------------------*/ 71 | #define CDC_SEND_ENCAPSULATED_COMMAND 0x00U 72 | #define CDC_GET_ENCAPSULATED_RESPONSE 0x01U 73 | #define CDC_SET_COMM_FEATURE 0x02U 74 | #define CDC_GET_COMM_FEATURE 0x03U 75 | #define CDC_CLEAR_COMM_FEATURE 0x04U 76 | #define CDC_SET_LINE_CODING 0x20U 77 | #define CDC_GET_LINE_CODING 0x21U 78 | #define CDC_SET_CONTROL_LINE_STATE 0x22U 79 | #define CDC_SEND_BREAK 0x23U 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | 86 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | typedef struct 94 | { 95 | uint32_t bitrate; 96 | uint8_t format; 97 | uint8_t paritytype; 98 | uint8_t datatype; 99 | } USBD_CDC_LineCodingTypeDef; 100 | 101 | typedef struct _USBD_CDC_Itf 102 | { 103 | int8_t (* Init)(void); 104 | int8_t (* DeInit)(void); 105 | int8_t (* Control)(uint8_t cmd, uint8_t *pbuf, uint16_t length); 106 | int8_t (* Receive)(uint8_t *Buf, uint32_t *Len); 107 | 108 | } USBD_CDC_ItfTypeDef; 109 | 110 | 111 | typedef struct 112 | { 113 | uint32_t data[CDC_DATA_HS_MAX_PACKET_SIZE / 4U]; /* Force 32bits alignment */ 114 | uint8_t CmdOpCode; 115 | uint8_t CmdLength; 116 | uint8_t *RxBuffer; 117 | uint8_t *TxBuffer; 118 | uint32_t RxLength; 119 | uint32_t TxLength; 120 | 121 | __IO uint32_t TxState; 122 | __IO uint32_t RxState; 123 | } 124 | USBD_CDC_HandleTypeDef; 125 | 126 | 127 | 128 | /** @defgroup USBD_CORE_Exported_Macros 129 | * @{ 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** @defgroup USBD_CORE_Exported_Variables 137 | * @{ 138 | */ 139 | 140 | extern USBD_ClassTypeDef USBD_CDC; 141 | #define USBD_CDC_CLASS &USBD_CDC 142 | /** 143 | * @} 144 | */ 145 | 146 | /** @defgroup USB_CORE_Exported_Functions 147 | * @{ 148 | */ 149 | uint8_t USBD_CDC_RegisterInterface(USBD_HandleTypeDef *pdev, 150 | USBD_CDC_ItfTypeDef *fops); 151 | 152 | uint8_t USBD_CDC_SetTxBuffer(USBD_HandleTypeDef *pdev, 153 | uint8_t *pbuff, 154 | uint16_t length); 155 | 156 | uint8_t USBD_CDC_SetRxBuffer(USBD_HandleTypeDef *pdev, 157 | uint8_t *pbuff); 158 | 159 | uint8_t USBD_CDC_ReceivePacket(USBD_HandleTypeDef *pdev); 160 | 161 | uint8_t USBD_CDC_TransmitPacket(USBD_HandleTypeDef *pdev); 162 | /** 163 | * @} 164 | */ 165 | 166 | #ifdef __cplusplus 167 | } 168 | #endif 169 | 170 | #endif /* __USB_CDC_H */ 171 | /** 172 | * @} 173 | */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 180 | -------------------------------------------------------------------------------- /Firmware/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @brief Header file for usbd_core.c file 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2015 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 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __USBD_CORE_H 22 | #define __USBD_CORE_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_conf.h" 30 | #include "usbd_def.h" 31 | #include "usbd_ioreq.h" 32 | #include "usbd_ctlreq.h" 33 | 34 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 35 | * @{ 36 | */ 37 | 38 | /** @defgroup USBD_CORE 39 | * @brief This file is the Header file for usbd_core.c file 40 | * @{ 41 | */ 42 | 43 | 44 | /** @defgroup USBD_CORE_Exported_Defines 45 | * @{ 46 | */ 47 | #ifndef USBD_DEBUG_LEVEL 48 | #define USBD_DEBUG_LEVEL 0U 49 | #endif /* USBD_DEBUG_LEVEL */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 56 | * @{ 57 | */ 58 | 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | 66 | /** @defgroup USBD_CORE_Exported_Macros 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USBD_CORE_Exported_Variables 75 | * @{ 76 | */ 77 | #define USBD_SOF USBD_LL_SOF 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 83 | * @{ 84 | */ 85 | USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id); 86 | USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev); 87 | USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev); 88 | USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev); 89 | USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass); 90 | 91 | USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev); 92 | USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); 93 | USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); 94 | 95 | USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup); 96 | USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); 97 | USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata); 98 | 99 | USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev); 100 | USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed); 101 | USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev); 102 | USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev); 103 | 104 | USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev); 105 | USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); 106 | USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); 107 | 108 | USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev); 109 | USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev); 110 | 111 | /* USBD Low Level Driver */ 112 | USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev); 113 | USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev); 114 | USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev); 115 | USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev); 116 | USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, 117 | uint8_t ep_addr, 118 | uint8_t ep_type, 119 | uint16_t ep_mps); 120 | 121 | USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 122 | USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 123 | USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 124 | USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 125 | uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 126 | USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr); 127 | USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, 128 | uint8_t ep_addr, 129 | uint8_t *pbuf, 130 | uint16_t size); 131 | 132 | USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, 133 | uint8_t ep_addr, 134 | uint8_t *pbuf, 135 | uint16_t size); 136 | 137 | uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 138 | void USBD_LL_Delay(uint32_t Delay); 139 | 140 | /** 141 | * @} 142 | */ 143 | 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | 148 | #endif /* __USBD_CORE_H */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /Firmware/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @brief Header file for the usbd_req.c file 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2015 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 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __USB_REQUEST_H 22 | #define __USB_REQUEST_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_def.h" 30 | 31 | 32 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 33 | * @{ 34 | */ 35 | 36 | /** @defgroup USBD_REQ 37 | * @brief header file for the usbd_req.c file 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_REQ_Exported_Defines 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USBD_REQ_Exported_Types 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | 58 | /** @defgroup USBD_REQ_Exported_Macros 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup USBD_REQ_Exported_Variables 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 73 | * @{ 74 | */ 75 | 76 | USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 77 | USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 78 | USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 79 | 80 | 81 | void USBD_CtlError(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 82 | 83 | void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata); 84 | 85 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 86 | /** 87 | * @} 88 | */ 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* __USB_REQUEST_H */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /Firmware/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @brief Header file for the usbd_ioreq.c file 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2015 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 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __USBD_IOREQ_H 22 | #define __USBD_IOREQ_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_def.h" 30 | #include "usbd_core.h" 31 | 32 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 33 | * @{ 34 | */ 35 | 36 | /** @defgroup USBD_IOREQ 37 | * @brief header file for the usbd_ioreq.c file 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_IOREQ_Exported_Defines 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USBD_IOREQ_Exported_Types 50 | * @{ 51 | */ 52 | 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | 60 | /** @defgroup USBD_IOREQ_Exported_Macros 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBD_IOREQ_Exported_Variables 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 77 | * @{ 78 | */ 79 | 80 | USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, 81 | uint8_t *pbuf, 82 | uint16_t len); 83 | 84 | USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, 85 | uint8_t *pbuf, 86 | uint16_t len); 87 | 88 | USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev, 89 | uint8_t *pbuf, 90 | uint16_t len); 91 | 92 | USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, 93 | uint8_t *pbuf, 94 | uint16_t len); 95 | 96 | USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev); 97 | 98 | USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev); 99 | 100 | uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr); 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | #ifdef __cplusplus 107 | } 108 | #endif 109 | 110 | #endif /* __USBD_IOREQ_H */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /Firmware/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.c 4 | * @author MCD Application Team 5 | * @brief This file provides the IO requests APIs for control endpoints. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | *

© Copyright (c) 2015 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 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "usbd_ioreq.h" 22 | 23 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 24 | * @{ 25 | */ 26 | 27 | 28 | /** @defgroup USBD_IOREQ 29 | * @brief control I/O requests module 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions 34 | * @{ 35 | */ 36 | /** 37 | * @} 38 | */ 39 | 40 | 41 | /** @defgroup USBD_IOREQ_Private_Defines 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @} 47 | */ 48 | 49 | 50 | /** @defgroup USBD_IOREQ_Private_Macros 51 | * @{ 52 | */ 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | /** @defgroup USBD_IOREQ_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | 67 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | /** @defgroup USBD_IOREQ_Private_Functions 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @brief USBD_CtlSendData 81 | * send data on the ctl pipe 82 | * @param pdev: device instance 83 | * @param buff: pointer to data buffer 84 | * @param len: length of data to be sent 85 | * @retval status 86 | */ 87 | USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev, 88 | uint8_t *pbuf, uint16_t len) 89 | { 90 | /* Set EP0 State */ 91 | pdev->ep0_state = USBD_EP0_DATA_IN; 92 | pdev->ep_in[0].total_length = len; 93 | pdev->ep_in[0].rem_length = len; 94 | 95 | /* Start the transfer */ 96 | USBD_LL_Transmit(pdev, 0x00U, pbuf, len); 97 | 98 | return USBD_OK; 99 | } 100 | 101 | /** 102 | * @brief USBD_CtlContinueSendData 103 | * continue sending data on the ctl pipe 104 | * @param pdev: device instance 105 | * @param buff: pointer to data buffer 106 | * @param len: length of data to be sent 107 | * @retval status 108 | */ 109 | USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, 110 | uint8_t *pbuf, uint16_t len) 111 | { 112 | /* Start the next transfer */ 113 | USBD_LL_Transmit(pdev, 0x00U, pbuf, len); 114 | 115 | return USBD_OK; 116 | } 117 | 118 | /** 119 | * @brief USBD_CtlPrepareRx 120 | * receive data on the ctl pipe 121 | * @param pdev: device instance 122 | * @param buff: pointer to data buffer 123 | * @param len: length of data to be received 124 | * @retval status 125 | */ 126 | USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev, 127 | uint8_t *pbuf, uint16_t len) 128 | { 129 | /* Set EP0 State */ 130 | pdev->ep0_state = USBD_EP0_DATA_OUT; 131 | pdev->ep_out[0].total_length = len; 132 | pdev->ep_out[0].rem_length = len; 133 | 134 | /* Start the transfer */ 135 | USBD_LL_PrepareReceive(pdev, 0U, pbuf, len); 136 | 137 | return USBD_OK; 138 | } 139 | 140 | /** 141 | * @brief USBD_CtlContinueRx 142 | * continue receive data on the ctl pipe 143 | * @param pdev: device instance 144 | * @param buff: pointer to data buffer 145 | * @param len: length of data to be received 146 | * @retval status 147 | */ 148 | USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev, 149 | uint8_t *pbuf, uint16_t len) 150 | { 151 | USBD_LL_PrepareReceive(pdev, 0U, pbuf, len); 152 | 153 | return USBD_OK; 154 | } 155 | 156 | /** 157 | * @brief USBD_CtlSendStatus 158 | * send zero lzngth packet on the ctl pipe 159 | * @param pdev: device instance 160 | * @retval status 161 | */ 162 | USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev) 163 | { 164 | /* Set EP0 State */ 165 | pdev->ep0_state = USBD_EP0_STATUS_IN; 166 | 167 | /* Start the transfer */ 168 | USBD_LL_Transmit(pdev, 0x00U, NULL, 0U); 169 | 170 | return USBD_OK; 171 | } 172 | 173 | /** 174 | * @brief USBD_CtlReceiveStatus 175 | * receive zero lzngth packet on the ctl pipe 176 | * @param pdev: device instance 177 | * @retval status 178 | */ 179 | USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev) 180 | { 181 | /* Set EP0 State */ 182 | pdev->ep0_state = USBD_EP0_STATUS_OUT; 183 | 184 | /* Start the transfer */ 185 | USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U); 186 | 187 | return USBD_OK; 188 | } 189 | 190 | /** 191 | * @brief USBD_GetRxCount 192 | * returns the received data length 193 | * @param pdev: device instance 194 | * @param ep_addr: endpoint address 195 | * @retval Rx Data blength 196 | */ 197 | uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr) 198 | { 199 | return USBD_LL_GetRxDataSize(pdev, ep_addr); 200 | } 201 | 202 | /** 203 | * @} 204 | */ 205 | 206 | 207 | /** 208 | * @} 209 | */ 210 | 211 | 212 | /** 213 | * @} 214 | */ 215 | 216 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 217 | -------------------------------------------------------------------------------- /Firmware/STM32F072C8UX_FLASH.ld: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file LinkerScript.ld 4 | * @author Auto-generated by STM32CubeIDE 5 | * @brief Linker script for STM32F072C8Ux Device from STM32F0 series 6 | * 64Kbytes FLASH 7 | * 16Kbytes 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 = 16K 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/USB_DEVICE/App/usb_device.c: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : usb_device.c 5 | * @version : v2.0_Cube 6 | * @brief : This file implements the USB Device 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #include "usb_device.h" 25 | #include "usbd_core.h" 26 | #include "usbd_desc.h" 27 | #include "usbd_cdc.h" 28 | #include "usbd_cdc_if.h" 29 | 30 | /* USER CODE BEGIN Includes */ 31 | 32 | /* USER CODE END Includes */ 33 | 34 | /* USER CODE BEGIN PV */ 35 | /* Private variables ---------------------------------------------------------*/ 36 | 37 | /* USER CODE END PV */ 38 | 39 | /* USER CODE BEGIN PFP */ 40 | /* Private function prototypes -----------------------------------------------*/ 41 | 42 | /* USER CODE END PFP */ 43 | 44 | /* USB Device Core handle declaration. */ 45 | USBD_HandleTypeDef hUsbDeviceFS; 46 | 47 | /* 48 | * -- Insert your variables declaration here -- 49 | */ 50 | /* USER CODE BEGIN 0 */ 51 | 52 | /* USER CODE END 0 */ 53 | 54 | /* 55 | * -- Insert your external function declaration here -- 56 | */ 57 | /* USER CODE BEGIN 1 */ 58 | 59 | /* USER CODE END 1 */ 60 | 61 | /** 62 | * Init USB device Library, add supported class and start the library 63 | * @retval None 64 | */ 65 | void MX_USB_DEVICE_Init(void) 66 | { 67 | /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */ 68 | 69 | /* USER CODE END USB_DEVICE_Init_PreTreatment */ 70 | 71 | /* Init Device Library, add supported class and start the library. */ 72 | if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK) 73 | { 74 | Error_Handler(); 75 | } 76 | if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_CDC) != USBD_OK) 77 | { 78 | Error_Handler(); 79 | } 80 | if (USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS) != USBD_OK) 81 | { 82 | Error_Handler(); 83 | } 84 | if (USBD_Start(&hUsbDeviceFS) != USBD_OK) 85 | { 86 | Error_Handler(); 87 | } 88 | 89 | /* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */ 90 | 91 | /* USER CODE END USB_DEVICE_Init_PostTreatment */ 92 | } 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | -------------------------------------------------------------------------------- /Firmware/USB_DEVICE/App/usb_device.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : usb_device.h 5 | * @version : v2.0_Cube 6 | * @brief : Header for usb_device.c file. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_DEVICE__H__ 24 | #define __USB_DEVICE__H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f0xx.h" 32 | #include "stm32f0xx_hal.h" 33 | #include "usbd_def.h" 34 | 35 | /* USER CODE BEGIN INCLUDE */ 36 | 37 | /* USER CODE END INCLUDE */ 38 | 39 | /** @addtogroup USBD_OTG_DRIVER 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBD_DEVICE USBD_DEVICE 44 | * @brief Device file for Usb otg low level driver. 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBD_DEVICE_Exported_Variables USBD_DEVICE_Exported_Variables 49 | * @brief Public variables. 50 | * @{ 51 | */ 52 | 53 | /* Private variables ---------------------------------------------------------*/ 54 | /* USER CODE BEGIN PV */ 55 | 56 | /* USER CODE END PV */ 57 | 58 | /* Private function prototypes -----------------------------------------------*/ 59 | /* USER CODE BEGIN PFP */ 60 | 61 | /* USER CODE END PFP */ 62 | 63 | /* 64 | * -- Insert your variables declaration here -- 65 | */ 66 | /* USER CODE BEGIN VARIABLES */ 67 | 68 | /* USER CODE END VARIABLES */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_DEVICE_Exported_FunctionsPrototype USBD_DEVICE_Exported_FunctionsPrototype 74 | * @brief Declaration of public functions for Usb device. 75 | * @{ 76 | */ 77 | 78 | /** USB Device initialization function. */ 79 | void MX_USB_DEVICE_Init(void); 80 | 81 | /* 82 | * -- Insert functions declaration here -- 83 | */ 84 | /* USER CODE BEGIN FD */ 85 | 86 | /* USER CODE END FD */ 87 | /** 88 | * @} 89 | */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif /* __USB_DEVICE__H__ */ 104 | 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /Firmware/USB_DEVICE/App/usbd_cdc_if.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : usbd_cdc_if.h 5 | * @version : v2.0_Cube 6 | * @brief : Header for usbd_cdc_if.c file. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CDC_IF_H__ 24 | #define __USBD_CDC_IF_H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "usbd_cdc.h" 32 | 33 | /* USER CODE BEGIN INCLUDE */ 34 | 35 | /* USER CODE END INCLUDE */ 36 | 37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 38 | * @brief For Usb device. 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBD_CDC_IF USBD_CDC_IF 43 | * @brief Usb VCP device module 44 | * @{ 45 | */ 46 | 47 | /** @defgroup USBD_CDC_IF_Exported_Defines USBD_CDC_IF_Exported_Defines 48 | * @brief Defines. 49 | * @{ 50 | */ 51 | /* USER CODE BEGIN EXPORTED_DEFINES */ 52 | /* Define size for the receive and transmit buffer over CDC */ 53 | /* It's up to user to redefine and/or remove those define */ 54 | #define APP_RX_DATA_SIZE 1000 55 | #define APP_TX_DATA_SIZE 1000 56 | 57 | /* USER CODE END EXPORTED_DEFINES */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup USBD_CDC_IF_Exported_Types USBD_CDC_IF_Exported_Types 64 | * @brief Types. 65 | * @{ 66 | */ 67 | 68 | /* USER CODE BEGIN EXPORTED_TYPES */ 69 | 70 | /* USER CODE END EXPORTED_TYPES */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBD_CDC_IF_Exported_Macros USBD_CDC_IF_Exported_Macros 77 | * @brief Aliases. 78 | * @{ 79 | */ 80 | 81 | /* USER CODE BEGIN EXPORTED_MACRO */ 82 | 83 | /* USER CODE END EXPORTED_MACRO */ 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USBD_CDC_IF_Exported_Variables USBD_CDC_IF_Exported_Variables 90 | * @brief Public variables. 91 | * @{ 92 | */ 93 | 94 | /** CDC Interface callback. */ 95 | extern USBD_CDC_ItfTypeDef USBD_Interface_fops_FS; 96 | 97 | /* USER CODE BEGIN EXPORTED_VARIABLES */ 98 | 99 | /* USER CODE END EXPORTED_VARIABLES */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** @defgroup USBD_CDC_IF_Exported_FunctionsPrototype USBD_CDC_IF_Exported_FunctionsPrototype 106 | * @brief Public functions declaration. 107 | * @{ 108 | */ 109 | 110 | uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len); 111 | 112 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */ 113 | 114 | /* USER CODE END EXPORTED_FUNCTIONS */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | #ifdef __cplusplus 129 | } 130 | #endif 131 | 132 | #endif /* __USBD_CDC_IF_H__ */ 133 | 134 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 135 | -------------------------------------------------------------------------------- /Firmware/USB_DEVICE/App/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : usbd_desc.c 5 | * @version : v2.0_Cube 6 | * @brief : Header for usbd_conf.c file. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __USBD_DESC__C__ 23 | #define __USBD_DESC__C__ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usbd_def.h" 31 | 32 | /* USER CODE BEGIN INCLUDE */ 33 | 34 | /* USER CODE END INCLUDE */ 35 | 36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USBD_DESC USBD_DESC 41 | * @brief Usb device descriptors module. 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants 46 | * @brief Constants. 47 | * @{ 48 | */ 49 | #define DEVICE_ID1 (UID_BASE) 50 | #define DEVICE_ID2 (UID_BASE + 0x4) 51 | #define DEVICE_ID3 (UID_BASE + 0x8) 52 | 53 | #define USB_SIZ_STRING_SERIAL 0x1A 54 | 55 | /* USER CODE BEGIN EXPORTED_CONSTANTS */ 56 | 57 | /* USER CODE END EXPORTED_CONSTANTS */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup USBD_DESC_Exported_Defines USBD_DESC_Exported_Defines 64 | * @brief Defines. 65 | * @{ 66 | */ 67 | 68 | /* USER CODE BEGIN EXPORTED_DEFINES */ 69 | 70 | /* USER CODE END EXPORTED_DEFINES */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBD_DESC_Exported_TypesDefinitions USBD_DESC_Exported_TypesDefinitions 77 | * @brief Types. 78 | * @{ 79 | */ 80 | 81 | /* USER CODE BEGIN EXPORTED_TYPES */ 82 | 83 | /* USER CODE END EXPORTED_TYPES */ 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USBD_DESC_Exported_Macros USBD_DESC_Exported_Macros 90 | * @brief Aliases. 91 | * @{ 92 | */ 93 | 94 | /* USER CODE BEGIN EXPORTED_MACRO */ 95 | 96 | /* USER CODE END EXPORTED_MACRO */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @defgroup USBD_DESC_Exported_Variables USBD_DESC_Exported_Variables 103 | * @brief Public variables. 104 | * @{ 105 | */ 106 | 107 | /** Descriptor for the Usb device. */ 108 | extern USBD_DescriptorsTypeDef FS_Desc; 109 | 110 | /* USER CODE BEGIN EXPORTED_VARIABLES */ 111 | 112 | /* USER CODE END EXPORTED_VARIABLES */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype USBD_DESC_Exported_FunctionsPrototype 119 | * @brief Public functions declaration. 120 | * @{ 121 | */ 122 | 123 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */ 124 | 125 | /* USER CODE END EXPORTED_FUNCTIONS */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | 143 | #endif /* __USBD_DESC__C__ */ 144 | 145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 146 | -------------------------------------------------------------------------------- /Firmware/USB_DEVICE/Target/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /* USER CODE BEGIN Header */ 2 | /** 3 | ****************************************************************************** 4 | * @file : usbd_conf.h 5 | * @version : v2.0_Cube 6 | * @brief : Header for usbd_conf.c file. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | *

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

12 | * 13 | * This software component is licensed by ST under Ultimate Liberty license 14 | * SLA0044, the "License"; You may not use this file except in compliance with 15 | * the License. You may obtain a copy of the License at: 16 | * www.st.com/SLA0044 17 | * 18 | ****************************************************************************** 19 | */ 20 | /* USER CODE END Header */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CONF__H__ 24 | #define __USBD_CONF__H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include 32 | #include 33 | #include 34 | #include "main.h" 35 | #include "stm32f0xx.h" 36 | #include "stm32f0xx_hal.h" 37 | 38 | /* USER CODE BEGIN INCLUDE */ 39 | 40 | /* USER CODE END INCLUDE */ 41 | 42 | /** @addtogroup USBD_OTG_DRIVER 43 | * @{ 44 | */ 45 | 46 | /** @defgroup USBD_CONF USBD_CONF 47 | * @brief Configuration file for Usb otg low level driver. 48 | * @{ 49 | */ 50 | 51 | /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables 52 | * @brief Public variables. 53 | * @{ 54 | */ 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines 61 | * @brief Defines for configuration of the Usb device. 62 | * @{ 63 | */ 64 | 65 | /*---------- -----------*/ 66 | #define USBD_MAX_NUM_INTERFACES 1 67 | /*---------- -----------*/ 68 | #define USBD_MAX_NUM_CONFIGURATION 1 69 | /*---------- -----------*/ 70 | #define USBD_MAX_STR_DESC_SIZ 512 71 | /*---------- -----------*/ 72 | #define USBD_DEBUG_LEVEL 0 73 | /*---------- -----------*/ 74 | #define USBD_SELF_POWERED 1 75 | /*---------- -----------*/ 76 | #define MAX_STATIC_ALLOC_SIZE 512 77 | 78 | /****************************************/ 79 | /* #define for FS and HS identification */ 80 | #define DEVICE_FS 0 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros 87 | * @brief Aliases. 88 | * @{ 89 | */ 90 | 91 | /* Memory management macros */ 92 | 93 | /** Alias for memory allocation. */ 94 | #define USBD_malloc (uint32_t *)USBD_static_malloc 95 | 96 | /** Alias for memory release. */ 97 | #define USBD_free USBD_static_free 98 | 99 | /** Alias for memory set. */ 100 | #define USBD_memset /* Not used */ 101 | 102 | /** Alias for memory copy. */ 103 | #define USBD_memcpy /* Not used */ 104 | 105 | /** Alias for delay. */ 106 | #define USBD_Delay HAL_Delay 107 | 108 | /* DEBUG macros */ 109 | 110 | #if (USBD_DEBUG_LEVEL > 0) 111 | #define USBD_UsrLog(...) printf(__VA_ARGS__);\ 112 | printf("\n"); 113 | #else 114 | #define USBD_UsrLog(...) 115 | #endif 116 | 117 | #if (USBD_DEBUG_LEVEL > 1) 118 | 119 | #define USBD_ErrLog(...) printf("ERROR: ") ;\ 120 | printf(__VA_ARGS__);\ 121 | printf("\n"); 122 | #else 123 | #define USBD_ErrLog(...) 124 | #endif 125 | 126 | #if (USBD_DEBUG_LEVEL > 2) 127 | #define USBD_DbgLog(...) printf("DEBUG : ") ;\ 128 | printf(__VA_ARGS__);\ 129 | printf("\n"); 130 | #else 131 | #define USBD_DbgLog(...) 132 | #endif 133 | 134 | /** 135 | * @} 136 | */ 137 | 138 | /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types 139 | * @brief Types. 140 | * @{ 141 | */ 142 | 143 | /** 144 | * @} 145 | */ 146 | 147 | /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype 148 | * @brief Declaration of public functions for Usb device. 149 | * @{ 150 | */ 151 | 152 | /* Exported functions -------------------------------------------------------*/ 153 | void *USBD_static_malloc(uint32_t size); 154 | void USBD_static_free(void *p); 155 | /** 156 | * @} 157 | */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #endif /* __USBD_CONF__H__ */ 172 | 173 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 174 | -------------------------------------------------------------------------------- /Firmware/nAmmeter_v2.cfg: -------------------------------------------------------------------------------- 1 | # This is an genericBoard board with a single STM32F072C8Ux chip 2 | # 3 | # Generated by STM32CubeIDE 4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s) 5 | 6 | source [find interface/stlink-dap.cfg] 7 | 8 | 9 | set WORKAREASIZE 0x4000 10 | 11 | transport select "dapdirect_swd" 12 | 13 | set CHIPNAME STM32F072C8Ux 14 | set BOARDNAME genericBoard 15 | 16 | # Enable debug when in low power modes 17 | set ENABLE_LOW_POWER 1 18 | 19 | # Stop Watchdog counters when halt 20 | set STOP_WATCHDOG 1 21 | 22 | # STlink Debug clock frequency 23 | set CLOCK_FREQ 8000 24 | 25 | # Reset configuration 26 | # use hardware reset, connect under reset 27 | # connect_assert_srst needed if low power mode application running (WFI...) 28 | reset_config srst_only srst_nogate connect_assert_srst 29 | set CONNECT_UNDER_RESET 1 30 | set CORE_RESET 0 31 | 32 | # ACCESS PORT NUMBER 33 | set AP_NUM 0 34 | # GDB PORT 35 | set GDB_PORT 3333 36 | 37 | 38 | 39 | # BCTM CPU variables 40 | 41 | source [find target/stm32f0x.cfg] 42 | 43 | #SWV trace 44 | tpiu config disable 45 | -------------------------------------------------------------------------------- /Firmware/nAmmeter_v2.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | File.Version=6 3 | GPIO.groupedBy=Group By Peripherals 4 | KeepUserPlacement=false 5 | Mcu.Family=STM32F0 6 | Mcu.IP0=I2C1 7 | Mcu.IP1=NVIC 8 | Mcu.IP2=RCC 9 | Mcu.IP3=SYS 10 | Mcu.IP4=USB 11 | Mcu.IP5=USB_DEVICE 12 | Mcu.IPNb=6 13 | Mcu.Name=STM32F072C(8-B)Ux 14 | Mcu.Package=UFQFPN48 15 | Mcu.Pin0=PA0 16 | Mcu.Pin1=PA1 17 | Mcu.Pin2=PA2 18 | Mcu.Pin3=PA11 19 | Mcu.Pin4=PA12 20 | Mcu.Pin5=PB6 21 | Mcu.Pin6=PB7 22 | Mcu.Pin7=PB9 23 | Mcu.Pin8=VP_SYS_VS_Systick 24 | Mcu.Pin9=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS 25 | Mcu.PinsNb=10 26 | Mcu.ThirdPartyNb=0 27 | Mcu.UserConstants= 28 | Mcu.UserName=STM32F072C8Ux 29 | MxCube.Version=6.1.1 30 | MxDb.Version=DB.6.0.10 31 | NVIC.ForceEnableDMAVector=true 32 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false 33 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false 34 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false 35 | NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:false\:false 36 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true 37 | NVIC.USB_IRQn=true\:0\:0\:false\:false\:true\:false\:true 38 | PA0.GPIOParameters=GPIO_Label 39 | PA0.GPIO_Label=LED_R 40 | PA0.Locked=true 41 | PA0.Signal=GPIO_Output 42 | PA1.GPIOParameters=GPIO_Label 43 | PA1.GPIO_Label=LED_G 44 | PA1.Locked=true 45 | PA1.Signal=GPIO_Output 46 | PA11.Mode=Device 47 | PA11.Signal=USB_DM 48 | PA12.Mode=Device 49 | PA12.Signal=USB_DP 50 | PA2.GPIOParameters=GPIO_Label 51 | PA2.GPIO_Label=LED_B 52 | PA2.Locked=true 53 | PA2.Signal=GPIO_Output 54 | PB6.Mode=I2C 55 | PB6.Signal=I2C1_SCL 56 | PB7.Mode=I2C 57 | PB7.Signal=I2C1_SDA 58 | PB9.GPIOParameters=GPIO_Label 59 | PB9.GPIO_Label=ADC_Alert 60 | PB9.Locked=true 61 | PB9.Signal=GPIO_Input 62 | PinOutPanel.RotationAngle=0 63 | ProjectManager.AskForMigrate=true 64 | ProjectManager.BackupPrevious=false 65 | ProjectManager.CompilerOptimize=6 66 | ProjectManager.ComputerToolchain=false 67 | ProjectManager.CoupleFile=false 68 | ProjectManager.CustomerFirmwarePackage= 69 | ProjectManager.DefaultFWLocation=true 70 | ProjectManager.DeletePrevious=true 71 | ProjectManager.DeviceId=STM32F072C8Ux 72 | ProjectManager.FirmwarePackage=STM32Cube FW_F0 V1.11.2 73 | ProjectManager.FreePins=false 74 | ProjectManager.HalAssertFull=false 75 | ProjectManager.HeapSize=0x200 76 | ProjectManager.KeepUserCode=true 77 | ProjectManager.LastFirmware=true 78 | ProjectManager.LibraryCopy=1 79 | ProjectManager.MainLocation=Core/Src 80 | ProjectManager.NoMain=false 81 | ProjectManager.PreviousToolchain=STM32CubeIDE 82 | ProjectManager.ProjectBuild=false 83 | ProjectManager.ProjectFileName=nAmmeter_v2.ioc 84 | ProjectManager.ProjectName=nAmmeter_v2 85 | ProjectManager.RegisterCallBack= 86 | ProjectManager.StackSize=0x400 87 | ProjectManager.TargetToolchain=STM32CubeIDE 88 | ProjectManager.ToolChainLocation= 89 | ProjectManager.UnderRoot=true 90 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_I2C1_Init-I2C1-false-HAL-true,4-MX_TIM2_Init-TIM2-false-HAL-true,5-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false 91 | RCC.AHBFreq_Value=48000000 92 | RCC.APB1Freq_Value=48000000 93 | RCC.APB1TimFreq_Value=48000000 94 | RCC.CECFreq_Value=32786.88524590164 95 | RCC.FCLKCortexFreq_Value=48000000 96 | RCC.FamilyName=M 97 | RCC.HCLKFreq_Value=48000000 98 | RCC.HSICECFreq_Value=32786.88524590164 99 | RCC.I2SFreq_Value=48000000 100 | RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,CECFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSICECFreq_Value,I2SFreq_Value,MCOFreq_Value,PLLCLKFreq_Value,PLLMCOFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,TimSysFreq_Value,USART1Freq_Value,USART2Freq_Value,VCOOutput2Freq_Value 101 | RCC.MCOFreq_Value=48000000 102 | RCC.PLLCLKFreq_Value=16000000 103 | RCC.PLLMCOFreq_Value=16000000 104 | RCC.SYSCLKFreq_VALUE=48000000 105 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_HSI48 106 | RCC.TimSysFreq_Value=48000000 107 | RCC.USART1Freq_Value=48000000 108 | RCC.USART2Freq_Value=48000000 109 | RCC.VCOOutput2Freq_Value=8000000 110 | USB_DEVICE.CLASS_NAME_FS=CDC 111 | USB_DEVICE.IPParameters=VirtualMode,VirtualModeFS,CLASS_NAME_FS 112 | USB_DEVICE.VirtualMode=Cdc 113 | USB_DEVICE.VirtualModeFS=Cdc_FS 114 | VP_SYS_VS_Systick.Mode=SysTick 115 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 116 | VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Mode=CDC_FS 117 | VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_FS 118 | board=custom 119 | isbadioc=false 120 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-B_Mask.gbr: -------------------------------------------------------------------------------- 1 | %TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-8564-gb2cd1fddf9)*% 2 | %TF.CreationDate,2021-01-25T15:54:05+03:00*% 3 | %TF.ProjectId,Eloise_nA_meter_v2,456c6f69-7365-45f6-9e41-5f6d65746572,rev?*% 4 | %TF.SameCoordinates,Original*% 5 | %TF.FileFunction,Soldermask,Bot*% 6 | %TF.FilePolarity,Negative*% 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (5.99.0-8564-gb2cd1fddf9)) date 2021-01-25 15:54:05* 10 | %MOMM*% 11 | %LPD*% 12 | G01* 13 | G04 APERTURE LIST* 14 | %ADD10R,1.700000X1.700000*% 15 | %ADD11O,1.700000X1.700000*% 16 | %ADD12O,1.100000X2.600000*% 17 | %ADD13O,1.100000X2.100000*% 18 | G04 APERTURE END LIST* 19 | D10* 20 | %TO.C,J2*% 21 | X139600000Y-86800000D03* 22 | D11* 23 | X142140000Y-86800000D03* 24 | X144680000Y-86800000D03* 25 | %TD*% 26 | D12* 27 | %TO.C,J3*% 28 | X151920000Y-112870000D03* 29 | D13* 30 | X143280000Y-107510000D03* 31 | D12* 32 | X143280000Y-112870000D03* 33 | D13* 34 | X151920000Y-107510000D03* 35 | %TD*% 36 | M02* 37 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-B_Paste.gbr: -------------------------------------------------------------------------------- 1 | %TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-8564-gb2cd1fddf9)*% 2 | %TF.CreationDate,2021-01-25T15:54:05+03:00*% 3 | %TF.ProjectId,Eloise_nA_meter_v2,456c6f69-7365-45f6-9e41-5f6d65746572,rev?*% 4 | %TF.SameCoordinates,Original*% 5 | %TF.FileFunction,Paste,Bot*% 6 | %TF.FilePolarity,Positive*% 7 | %FSLAX46Y46*% 8 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 9 | G04 Created by KiCad (PCBNEW (5.99.0-8564-gb2cd1fddf9)) date 2021-01-25 15:54:05* 10 | %MOMM*% 11 | %LPD*% 12 | G01* 13 | G04 APERTURE LIST* 14 | G04 APERTURE END LIST* 15 | M02* 16 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-Edge_Cuts.gbr: -------------------------------------------------------------------------------- 1 | %TF.GenerationSoftware,KiCad,Pcbnew,(5.99.0-8564-gb2cd1fddf9)*% 2 | %TF.CreationDate,2021-01-25T15:54:05+03:00*% 3 | %TF.ProjectId,Eloise_nA_meter_v2,456c6f69-7365-45f6-9e41-5f6d65746572,rev?*% 4 | %TF.SameCoordinates,Original*% 5 | %TF.FileFunction,Profile,NP*% 6 | %FSLAX46Y46*% 7 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 8 | G04 Created by KiCad (PCBNEW (5.99.0-8564-gb2cd1fddf9)) date 2021-01-25 15:54:05* 9 | %MOMM*% 10 | %LPD*% 11 | G01* 12 | G04 APERTURE LIST* 13 | %TA.AperFunction,Profile*% 14 | %ADD10C,0.100000*% 15 | %TD*% 16 | G04 APERTURE END LIST* 17 | D10* 18 | X157600000Y-113800000D02* 19 | X157600000Y-85800000D01* 20 | X156600000Y-84800000D02* 21 | G75* 22 | G02* 23 | X157600000Y-85800000I0J-1000000D01* 24 | G01* 25 | X138600000Y-114800000D02* 26 | X156600000Y-114800000D01* 27 | X138600000Y-114800000D02* 28 | G75* 29 | G02* 30 | X137600000Y-113800000I0J1000000D01* 31 | G01* 32 | X156600000Y-84800000D02* 33 | X138600000Y-84800000D01* 34 | X157600000Y-113800000D02* 35 | G75* 36 | G02* 37 | X156600000Y-114800000I-1000000J0D01* 38 | G01* 39 | X137600000Y-85800000D02* 40 | G75* 41 | G02* 42 | X138600000Y-84800000I1000000J0D01* 43 | G01* 44 | X137600000Y-85800000D02* 45 | X137600000Y-113800000D01* 46 | M02* 47 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-NPTH-drl_map.ps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 2 | %%Creator: PCBNEW 3 | %%CreationDate: Mon Jan 25 15:54:02 2021 4 | %%Title: () 5 | %%Pages: 1 6 | %%PageOrder: Ascend 7 | %%BoundingBox: 0 0 596 842 8 | %%DocumentMedia: A4 595 842 0 () () 9 | %%Orientation: Landscape 10 | %%EndComments 11 | %%BeginProlog 12 | /line { newpath moveto lineto stroke } bind def 13 | /cir0 { newpath 0 360 arc stroke } bind def 14 | /cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def 15 | /cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def 16 | /arc0 { newpath arc stroke } bind def 17 | /arc1 { newpath 4 index 4 index moveto arc closepath gsave fill 18 | grestore stroke } bind def 19 | /arc2 { newpath 4 index 4 index moveto arc closepath gsave fill 20 | grestore stroke } bind def 21 | /poly0 { stroke } bind def 22 | /poly1 { closepath gsave fill grestore stroke } bind def 23 | /poly2 { closepath gsave fill grestore stroke } bind def 24 | /rect0 { rectstroke } bind def 25 | /rect1 { rectfill } bind def 26 | /rect2 { rectfill } bind def 27 | /linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def 28 | /linemode1 { 1 setlinecap 1 setlinejoin } bind def 29 | /dashedline { [200] 100 setdash } bind def 30 | /solidline { [] 0 setdash } bind def 31 | /phantomshow { moveto 32 | /KicadFont findfont 0.000001 scalefont setfont 33 | show } bind def 34 | /textshow { gsave 35 | findfont exch scalefont setfont concat 1 scale 0 0 moveto show 36 | } bind def 37 | /reencodefont { 38 | findfont dup length dict begin 39 | { 1 index /FID ne 40 | { def } 41 | { pop pop } ifelse 42 | } forall 43 | /Encoding ISOLatin1Encoding def 44 | currentdict 45 | end } bind def 46 | /KicadFont /Helvetica reencodefont definefont pop 47 | /KicadFont-Bold /Helvetica-Bold reencodefont definefont pop 48 | /KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop 49 | /KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop 50 | %%EndProlog 51 | %%Page: 1 1 52 | %%BeginPageSetup 53 | gsave 54 | 0.0072 0.0072 scale 55 | linemode1 56 | 82680 0 translate 90 rotate 57 | 236.22 setlinewidth 58 | %%EndPageSetup 59 | 0 0 0 setrgbcolor 60 | 118.11 setlinewidth 61 | newpath 62 | 70276 41340.6 moveto 63 | 70276 74411.4 lineto 64 | stroke 65 | 0 0 0 setrgbcolor 66 | 69094.9 74411.4 1181.1 -0 90 arc0 67 | 0 0 0 setrgbcolor 68 | newpath 69 | 47835.1 40159.5 moveto 70 | 69094.9 40159.5 lineto 71 | stroke 72 | 0 0 0 setrgbcolor 73 | 47835.1 41340.6 1181.1 180 270 arc0 74 | 0 0 0 setrgbcolor 75 | newpath 76 | 69094.9 75592.5 moveto 77 | 47835.1 75592.5 lineto 78 | stroke 79 | 0 0 0 setrgbcolor 80 | 69094.9 41340.6 1181.1 -90 -0 arc0 81 | 0 0 0 setrgbcolor 82 | 47835.1 74411.4 1181.1 90 180 arc0 83 | 0 0 0 setrgbcolor 84 | newpath 85 | 46654 74411.4 moveto 86 | 46654 41340.6 lineto 87 | stroke 88 | 236.22 setlinewidth 89 | 78.7406 setlinewidth 90 | 0 0 0 setrgbcolor 91 | 0 0 0 setrgbcolor 92 | newpath 93 | 47609.2 38878.1 moveto 94 | 47609.2 39665.5 lineto 95 | 47796.6 39665.5 lineto 96 | 47909.1 39628 lineto 97 | 47984.1 39553 lineto 98 | 48021.6 39478 lineto 99 | 48059.1 39328 lineto 100 | 48059.1 39215.5 lineto 101 | 48021.6 39065.5 lineto 102 | 47984.1 38990.5 lineto 103 | 47909.1 38915.6 lineto 104 | 47796.6 38878.1 lineto 105 | 47609.2 38878.1 lineto 106 | stroke 107 | newpath 108 | 48396.6 38878.1 moveto 109 | 48396.6 39403 lineto 110 | stroke 111 | newpath 112 | 48396.6 39253 moveto 113 | 48434.1 39328 lineto 114 | 48471.6 39365.5 lineto 115 | 48546.6 39403 lineto 116 | 48621.5 39403 lineto 117 | stroke 118 | newpath 119 | 48884 38878.1 moveto 120 | 48884 39403 lineto 121 | stroke 122 | newpath 123 | 48884 39665.5 moveto 124 | 48846.5 39628 lineto 125 | 48884 39590.5 lineto 126 | 48921.5 39628 lineto 127 | 48884 39665.5 lineto 128 | 48884 39590.5 lineto 129 | stroke 130 | newpath 131 | 49371.4 38878.1 moveto 132 | 49296.5 38915.6 lineto 133 | 49259 38990.5 lineto 134 | 49259 39665.5 lineto 135 | stroke 136 | newpath 137 | 49783.9 38878.1 moveto 138 | 49708.9 38915.6 lineto 139 | 49671.4 38990.5 lineto 140 | 49671.4 39665.5 lineto 141 | stroke 142 | newpath 143 | 50683.8 38878.1 moveto 144 | 50683.8 39665.5 lineto 145 | 50946.3 39103 lineto 146 | 51208.7 39665.5 lineto 147 | 51208.7 38878.1 lineto 148 | stroke 149 | newpath 150 | 51921.1 38878.1 moveto 151 | 51921.1 39290.5 lineto 152 | 51883.6 39365.5 lineto 153 | 51808.6 39403 lineto 154 | 51658.7 39403 lineto 155 | 51583.7 39365.5 lineto 156 | stroke 157 | newpath 158 | 51921.1 38915.6 moveto 159 | 51846.1 38878.1 lineto 160 | 51658.7 38878.1 lineto 161 | 51583.7 38915.6 lineto 162 | 51546.2 38990.5 lineto 163 | 51546.2 39065.5 lineto 164 | 51583.7 39140.5 lineto 165 | 51658.7 39178 lineto 166 | 51846.1 39178 lineto 167 | 51921.1 39215.5 lineto 168 | stroke 169 | newpath 170 | 52296.1 39403 moveto 171 | 52296.1 38615.6 lineto 172 | stroke 173 | newpath 174 | 52296.1 39365.5 moveto 175 | 52371.1 39403 lineto 176 | 52521.1 39403 lineto 177 | 52596 39365.5 lineto 178 | 52633.5 39328 lineto 179 | 52671 39253 lineto 180 | 52671 39028 lineto 181 | 52633.5 38953.1 lineto 182 | 52596 38915.6 lineto 183 | 52521.1 38878.1 lineto 184 | 52371.1 38878.1 lineto 185 | 52296.1 38915.6 lineto 186 | stroke 187 | newpath 188 | 53008.5 38953.1 moveto 189 | 53046 38915.6 lineto 190 | 53008.5 38878.1 lineto 191 | 52971 38915.6 lineto 192 | 53008.5 38953.1 lineto 193 | 53008.5 38878.1 lineto 194 | stroke 195 | newpath 196 | 53008.5 39365.5 moveto 197 | 53046 39328 lineto 198 | 53008.5 39290.5 lineto 199 | 52971 39328 lineto 200 | 53008.5 39365.5 lineto 201 | 53008.5 39290.5 lineto 202 | stroke 203 | showpage 204 | grestore 205 | %%EOF 206 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-NPTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ; DRILL file {KiCad (5.99.0-8564-gb2cd1fddf9)} date 01/25/21 15:54:02 3 | ; FORMAT={-:-/ absolute / inch / decimal} 4 | ; #@! TF.CreationDate,2021-01-25T15:54:02+03:00 5 | ; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.99.0-8564-gb2cd1fddf9) 6 | ; #@! TF.FileFunction,NonPlated,1,4,NPTH 7 | FMAT,2 8 | INCH 9 | % 10 | G90 11 | G05 12 | T0 13 | M30 14 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-PTH.drl: -------------------------------------------------------------------------------- 1 | M48 2 | ; DRILL file {KiCad (5.99.0-8564-gb2cd1fddf9)} date 01/25/21 15:54:02 3 | ; FORMAT={-:-/ absolute / inch / decimal} 4 | ; #@! TF.CreationDate,2021-01-25T15:54:02+03:00 5 | ; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.99.0-8564-gb2cd1fddf9) 6 | ; #@! TF.FileFunction,Plated,1,4,PTH 7 | FMAT,2 8 | INCH 9 | T1C0.0157 10 | T2C0.0236 11 | T3C0.0394 12 | % 13 | G90 14 | G05 15 | T1 16 | X5.4488Y-4.2205 17 | X5.4488Y-4.3071 18 | X5.4567Y-4.4016 19 | X5.4882Y-3.7087 20 | X5.4921Y-4.2559 21 | X5.5039Y-3.8819 22 | X5.5059Y-3.998 23 | X5.5236Y-4.1614 24 | X5.5433Y-3.8425 25 | X5.5827Y-4.1181 26 | X5.5906Y-4.4724 27 | X5.5984Y-4.3858 28 | X5.6063Y-3.8425 29 | X5.6142Y-3.6772 30 | X5.6299Y-3.5197 31 | X5.6378Y-3.5827 32 | X5.6535Y-4.3031 33 | X5.6614Y-3.7638 34 | X5.7008Y-4.1811 35 | X5.7008Y-4.3051 36 | X5.7244Y-3.622 37 | X5.7397Y-4.0871 38 | X5.7402Y-4.1516 39 | X5.748Y-4.315 40 | X5.7874Y-4.0945 41 | X5.8031Y-4.1732 42 | X5.8031Y-4.315 43 | X5.811Y-3.5197 44 | X5.811Y-3.5906 45 | X5.8561Y-4.1815 46 | X5.874Y-4.315 47 | X5.8898Y-4.378 48 | X5.8898Y-4.4409 49 | X5.9055Y-4.1811 50 | X5.9291Y-4.315 51 | X5.9409Y-3.9252 52 | X5.9409Y-4.0433 53 | X5.9606Y-3.4803 54 | X5.9606Y-3.6142 55 | X5.9754Y-3.686 56 | X5.9764Y-3.5669 57 | X5.9774Y-3.747 58 | X5.9843Y-3.8031 59 | X6.0Y-3.9843 60 | X6.0236Y-3.8031 61 | X6.0264Y-4.2126 62 | X6.063Y-3.9252 63 | X6.063Y-4.0433 64 | X6.0719Y-3.6683 65 | X6.1093Y-4.1663 66 | X6.1116Y-3.3691 67 | X6.1163Y-3.4953 68 | X6.126Y-3.5669 69 | X6.1329Y-3.749 70 | X6.1496Y-3.8346 71 | X6.1575Y-3.4803 72 | X6.1654Y-4.126 73 | X6.1654Y-4.3307 74 | X6.1654Y-4.4724 75 | X6.1791Y-4.0236 76 | T3 77 | X5.4961Y-3.4173 78 | X5.5961Y-3.4173 79 | X5.6961Y-3.4173 80 | T2 81 | G00X5.6409Y-4.213 82 | M15 83 | G01X5.6409Y-4.2524 84 | M16 85 | G05 86 | G00X5.6409Y-4.4142 87 | M15 88 | G01X5.6409Y-4.4732 89 | M16 90 | G05 91 | G00X5.9811Y-4.213 92 | M15 93 | G01X5.9811Y-4.2524 94 | M16 95 | G05 96 | G00X5.9811Y-4.4142 97 | M15 98 | G01X5.9811Y-4.4732 99 | M16 100 | G05 101 | T0 102 | M30 103 | -------------------------------------------------------------------------------- /Hardware/Gerbers/nanoAmmeter_v2-job.gbrjob: -------------------------------------------------------------------------------- 1 | { 2 | "Header": { 3 | "GenerationSoftware": { 4 | "Vendor": "KiCad", 5 | "Application": "Pcbnew", 6 | "Version": "(5.99.0-8564-gb2cd1fddf9)" 7 | }, 8 | "CreationDate": "2021-01-25T15:54:05+03:00" 9 | }, 10 | "GeneralSpecs": { 11 | "ProjectId": { 12 | "Name": "Eloise_nA_meter_v2", 13 | "GUID": "456c6f69-7365-45f6-9e41-5f6d65746572", 14 | "Revision": "rev?" 15 | }, 16 | "Size": { 17 | "X": 20.1, 18 | "Y": 30.1 19 | }, 20 | "LayerNumber": 4, 21 | "BoardThickness": 1.6, 22 | "Finish": "None" 23 | }, 24 | "DesignRules": [ 25 | { 26 | "Layers": "Outer", 27 | "PadToPad": 0.0, 28 | "PadToTrack": 0.0, 29 | "TrackToTrack": 0.2, 30 | "MinLineWidth": 0.2, 31 | "TrackToRegion": 0.508, 32 | "RegionToRegion": 0.508 33 | }, 34 | { 35 | "Layers": "Inner", 36 | "PadToPad": 0.0, 37 | "PadToTrack": 0.0, 38 | "TrackToTrack": 0.2, 39 | "TrackToRegion": 0.508, 40 | "RegionToRegion": 0.508 41 | } 42 | ], 43 | "FilesAttributes": [ 44 | { 45 | "Path": "Eloise_nA_meter_v2-F_Cu.gbr", 46 | "FileFunction": "Copper,L1,Top", 47 | "FilePolarity": "Positive" 48 | }, 49 | { 50 | "Path": "Eloise_nA_meter_v2-Ground.gbr", 51 | "FileFunction": "Copper,L2,Inr", 52 | "FilePolarity": "Positive" 53 | }, 54 | { 55 | "Path": "Eloise_nA_meter_v2-Power.gbr", 56 | "FileFunction": "Copper,L3,Inr", 57 | "FilePolarity": "Positive" 58 | }, 59 | { 60 | "Path": "Eloise_nA_meter_v2-B_Cu.gbr", 61 | "FileFunction": "Copper,L4,Bot", 62 | "FilePolarity": "Positive" 63 | }, 64 | { 65 | "Path": "Eloise_nA_meter_v2-F_Paste.gbr", 66 | "FileFunction": "SolderPaste,Top", 67 | "FilePolarity": "Positive" 68 | }, 69 | { 70 | "Path": "Eloise_nA_meter_v2-B_Paste.gbr", 71 | "FileFunction": "SolderPaste,Bot", 72 | "FilePolarity": "Positive" 73 | }, 74 | { 75 | "Path": "Eloise_nA_meter_v2-F_Silkscreen.gbr", 76 | "FileFunction": "Legend,Top", 77 | "FilePolarity": "Positive" 78 | }, 79 | { 80 | "Path": "Eloise_nA_meter_v2-B_Silkscreen.gbr", 81 | "FileFunction": "Legend,Bot", 82 | "FilePolarity": "Positive" 83 | }, 84 | { 85 | "Path": "Eloise_nA_meter_v2-F_Mask.gbr", 86 | "FileFunction": "SolderMask,Top", 87 | "FilePolarity": "Negative" 88 | }, 89 | { 90 | "Path": "Eloise_nA_meter_v2-B_Mask.gbr", 91 | "FileFunction": "SolderMask,Bot", 92 | "FilePolarity": "Negative" 93 | }, 94 | { 95 | "Path": "Eloise_nA_meter_v2-Edge_Cuts.gbr", 96 | "FileFunction": "Profile", 97 | "FilePolarity": "Positive" 98 | } 99 | ], 100 | "MaterialStackup": [ 101 | { 102 | "Type": "Legend", 103 | "Name": "Top Silk Screen" 104 | }, 105 | { 106 | "Type": "SolderPaste", 107 | "Name": "Top Solder Paste" 108 | }, 109 | { 110 | "Type": "SolderMask", 111 | "Color": "Green", 112 | "Thickness": 0.01, 113 | "Name": "Top Solder Mask" 114 | }, 115 | { 116 | "Type": "Copper", 117 | "Thickness": 0.035, 118 | "Name": "F.Cu" 119 | }, 120 | { 121 | "Type": "Dielectric", 122 | "Thickness": 0.48, 123 | "Material": "FR4", 124 | "Name": "F.Cu/Ground", 125 | "Notes": "Type: dielectric layer 1 (from F.Cu to Ground)" 126 | }, 127 | { 128 | "Type": "Copper", 129 | "Thickness": 0.035, 130 | "Name": "Ground" 131 | }, 132 | { 133 | "Type": "Dielectric", 134 | "Thickness": 0.48, 135 | "Material": "FR4", 136 | "Name": "Ground/Power", 137 | "Notes": "Type: dielectric layer 2 (from Ground to Power)" 138 | }, 139 | { 140 | "Type": "Copper", 141 | "Thickness": 0.035, 142 | "Name": "Power" 143 | }, 144 | { 145 | "Type": "Dielectric", 146 | "Thickness": 0.48, 147 | "Material": "FR4", 148 | "Name": "Power/B.Cu", 149 | "Notes": "Type: dielectric layer 3 (from Power to B.Cu)" 150 | }, 151 | { 152 | "Type": "Copper", 153 | "Thickness": 0.035, 154 | "Name": "B.Cu" 155 | }, 156 | { 157 | "Type": "SolderMask", 158 | "Color": "Green", 159 | "Thickness": 0.01, 160 | "Name": "Bottom Solder Mask" 161 | }, 162 | { 163 | "Type": "SolderPaste", 164 | "Name": "Bottom Solder Paste" 165 | }, 166 | { 167 | "Type": "Legend", 168 | "Name": "Bottom Silk Screen" 169 | } 170 | ] 171 | } 172 | -------------------------------------------------------------------------------- /Hardware/fp-info-cache: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2.kicad_prl: -------------------------------------------------------------------------------- 1 | { 2 | "board": { 3 | "active_layer": 0, 4 | "active_layer_preset": "", 5 | "auto_track_width": true, 6 | "hidden_nets": [], 7 | "high_contrast_mode": 0, 8 | "net_color_mode": 1, 9 | "opacity": { 10 | "pads": 1.0, 11 | "tracks": 1.0, 12 | "vias": 1.0, 13 | "zones": 0.6 14 | }, 15 | "ratsnest_display_mode": 0, 16 | "selection_filter": { 17 | "dimensions": true, 18 | "footprints": true, 19 | "graphics": true, 20 | "keepouts": true, 21 | "lockedItems": true, 22 | "otherItems": true, 23 | "pads": true, 24 | "text": true, 25 | "tracks": true, 26 | "vias": true, 27 | "zones": true 28 | }, 29 | "visible_items": [ 30 | 0, 31 | 1, 32 | 2, 33 | 3, 34 | 4, 35 | 5, 36 | 6, 37 | 8, 38 | 9, 39 | 10, 40 | 11, 41 | 12, 42 | 13, 43 | 14, 44 | 15, 45 | 16, 46 | 17, 47 | 18, 48 | 19, 49 | 20, 50 | 21, 51 | 22, 52 | 23, 53 | 24, 54 | 27, 55 | 28, 56 | 29, 57 | 30, 58 | 31, 59 | 32, 60 | 33, 61 | 37, 62 | 38 63 | ], 64 | "visible_layers": "ffdffef_ffffffff", 65 | "zone_display_mode": 1 66 | }, 67 | "meta": { 68 | "filename": "nanoAmmeter_v2.kicad_prl", 69 | "version": 2 70 | }, 71 | "project": { 72 | "files": [] 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2.kicad_sym: -------------------------------------------------------------------------------- 1 | (kicad_symbol_lib (version 20200126) (host kicad_symbol_editor "(5.99.0-2555-g9cc6a77cc-dirty)") 2 | (symbol "Elosie_nA:LTC2055CMS8" (pin_names (offset 0.127)) 3 | (property "Reference" "U" (id 0) (at 0 5.08 0) 4 | (effects (font (size 1.27 1.27)) (justify left)) 5 | ) 6 | (property "Value" "LTC2055CMS8" (id 1) (at 0 -5.08 0) 7 | (effects (font (size 1.27 1.27)) (justify left)) 8 | ) 9 | (property "Footprint" "" (id 2) (at 0 0 0) 10 | (effects (font (size 1.27 1.27)) hide) 11 | ) 12 | (property "Datasheet" "" (id 3) (at 0 0 0) 13 | (effects (font (size 1.27 1.27)) hide) 14 | ) 15 | (property "ki_locked" "" (id 4) (at 0 0 0) 16 | (effects (font (size 1.27 1.27))) 17 | ) 18 | (property "ki_fp_filters" "SOIC*3.9x4.9mm*P1.27mm*\nDIP*W7.62mm*\nTO*99*\nOnSemi*Micro8*\nTSSOP*3x3mm*P0.65mm*\nTSSOP*4.4x3mm*P0.65mm*\nMSOP*3x3mm*P0.65mm*\nSSOP*3.9x4.9mm*P0.635mm*\nLFCSP*2x2mm*P0.5mm*\n*SIP*\nSOIC*5.3x6.2mm*P1.27mm*" (id 5) (at 0 0 0) 19 | (effects (font (size 1.27 1.27)) hide) 20 | ) 21 | (symbol "LTC2055CMS8_1_1" 22 | (polyline 23 | (pts 24 | (xy -5.08 5.08) 25 | (xy 5.08 0) 26 | (xy -5.08 -5.08) 27 | (xy -5.08 5.08) 28 | ) 29 | (stroke (width 0.254)) (fill (type background)) 30 | ) 31 | (pin output line (at 7.62 0 180) (length 2.54) 32 | (name "~" (effects (font (size 1.27 1.27)))) 33 | (number "1" (effects (font (size 1.27 1.27)))) 34 | ) 35 | (pin input line (at -7.62 -2.54 0) (length 2.54) 36 | (name "-" (effects (font (size 1.27 1.27)))) 37 | (number "2" (effects (font (size 1.27 1.27)))) 38 | ) 39 | (pin input line (at -7.62 2.54 0) (length 2.54) 40 | (name "+" (effects (font (size 1.27 1.27)))) 41 | (number "3" (effects (font (size 1.27 1.27)))) 42 | ) 43 | ) 44 | (symbol "LTC2055CMS8_2_1" 45 | (polyline 46 | (pts 47 | (xy -5.08 5.08) 48 | (xy 5.08 0) 49 | (xy -5.08 -5.08) 50 | (xy -5.08 5.08) 51 | ) 52 | (stroke (width 0.254)) (fill (type background)) 53 | ) 54 | (pin input line (at -7.62 2.54 0) (length 2.54) 55 | (name "+" (effects (font (size 1.27 1.27)))) 56 | (number "5" (effects (font (size 1.27 1.27)))) 57 | ) 58 | (pin input line (at -7.62 -2.54 0) (length 2.54) 59 | (name "-" (effects (font (size 1.27 1.27)))) 60 | (number "6" (effects (font (size 1.27 1.27)))) 61 | ) 62 | (pin output line (at 7.62 0 180) (length 2.54) 63 | (name "~" (effects (font (size 1.27 1.27)))) 64 | (number "7" (effects (font (size 1.27 1.27)))) 65 | ) 66 | ) 67 | (symbol "LTC2055CMS8_3_1" 68 | (pin power_in line (at -2.54 -7.62 90) (length 3.81) 69 | (name "V-" (effects (font (size 1.27 1.27)))) 70 | (number "4" (effects (font (size 1.27 1.27)))) 71 | ) 72 | (pin power_in line (at -2.54 7.62 270) (length 3.81) 73 | (name "V+" (effects (font (size 1.27 1.27)))) 74 | (number "8" (effects (font (size 1.27 1.27)))) 75 | ) 76 | ) 77 | ) 78 | ) 79 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2.pretty/E6C0606RGBC3UDA.kicad_mod: -------------------------------------------------------------------------------- 1 | (module "E6C0606RGBC3UDA" (layer F.Cu) (tedit 5FB0D1FB) 2 | (fp_text reference "REF**" (at 0 -9.5 unlocked) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | (tstamp ad8b0931-8e91-4f14-ae4e-041bf4ccff28) 5 | ) 6 | (fp_text value "E6C0606RGBC3UDA" (at 0 -8 unlocked) (layer F.Fab) 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 32fe31a5-3427-4934-a0a8-bf5d97c80eb6) 9 | ) 10 | (fp_text user "${REF}" (at 0 -6.5 unlocked) (layer F.Fab) 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 7387e9d7-79d9-4b52-a12d-5ec3d4d372d7) 13 | ) 14 | (fp_line (start 1.340974 -0.1) (end 1.140974 -0.2) (layer F.SilkS) (width 0.12) (tstamp 1e6d0167-fe23-45e0-b2dd-1ea11cc001c2)) 15 | (fp_line (start 1.140974 -0.2) (end 1.140974 0.2) (layer F.SilkS) (width 0.12) (tstamp 49ea66ae-6aa9-4800-a35d-5db1cf3648f3)) 16 | (fp_line (start 1.140974 0.2) (end 1.340974 0.1) (layer F.SilkS) (width 0.12) (tstamp 759b16fd-8898-46d4-9f2e-0f465fe71b6d)) 17 | (fp_line (start 1.340974 0.1) (end 1.340974 -0.1) (layer F.SilkS) (width 0.12) (tstamp f981c09a-bb58-46af-b553-f06efc43962c)) 18 | (fp_rect (start -1.2 -1) (end 1.2 1) (layer F.CrtYd) (width 0.05) (tstamp 086faad4-3383-49ed-90ce-2d511a5ab31e)) 19 | (pad "1" smd rect (at -0.7 -0.5) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 99402ada-4ed1-4899-8ee5-4747813efe25)) 20 | (pad "2" smd rect (at 0.7 -0.5) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e1ce60bb-96a5-478e-b16a-bfc39705a29b)) 21 | (pad "3" smd rect (at -0.7 0.5) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp ae2b2c35-e49d-4329-8dcf-02bc5b825ee8)) 22 | (pad "4" smd rect (at 0.7 0.5) (size 0.6 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp ebafc8f5-9dd7-44e6-a013-693a2ec8f548)) 23 | ) 24 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2.pretty/Molex_105450-0101.kicad_mod: -------------------------------------------------------------------------------- 1 | (module "Molex_105450-0101" (layer F.Cu) (tedit 5F9E4A05) 2 | (fp_text reference "REF**" (at 2.525 -6.35 unlocked) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | (tstamp f9833159-8541-4e3f-ad67-ddad5b8e5caf) 5 | ) 6 | (fp_text value "Molex_105450-0101" (at 2.525 -4.85 unlocked) (layer F.Fab) 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 56287274-1c6d-4cb2-86c3-694499a316ac) 9 | ) 10 | (fp_text user "${REF}" (at 2.525 -3.35 unlocked) (layer F.Fab) 11 | (effects (font (size 1 1) (thickness 0.15))) 12 | (tstamp 746813e2-321e-4d6e-bf6c-83c89629c0d4) 13 | ) 14 | (fp_line (start 7.575 2.85) (end 7.57358 0.425) (layer F.SilkS) (width 0.05) (tstamp 8ce1c4f4-aab0-4d4e-9310-825bb99bb6c1)) 15 | (fp_line (start -1.37642 6.425333) (end 7.57358 6.425333) (layer Eco1.User) (width 0.05) (tstamp 3d9cd9b2-25b3-4a82-8077-7cb9ec554a74)) 16 | (fp_rect (start -1.975 -2.15) (end 8.175 6.425) (layer F.CrtYd) (width 0.05) (tstamp cb5a4c2a-dda1-4c27-88bf-f128a8a10184)) 17 | (pad "A1" smd rect (at 0.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 87fb0e8a-0aaa-40d0-b766-54e193456e95)) 18 | (pad "A2" smd rect (at 0.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 6f5e5ed4-2dab-4d12-ae35-8dc79f4ba2bb)) 19 | (pad "A3" smd rect (at 1.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 0c01d3b4-3328-4fdc-9f84-28c0876ad435)) 20 | (pad "A4" smd rect (at 1.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 013c7ce8-d6f4-49b1-96d3-b2c0433ac54f)) 21 | (pad "A5" smd rect (at 2.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 36a699bc-4bb9-4857-8a0e-a1f05a0445e9)) 22 | (pad "A6" smd rect (at 2.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 5ebc7079-b703-428c-abbb-6f4a107409cc)) 23 | (pad "A7" smd rect (at 3.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 086003b0-b1e8-4a71-93d4-42e42f9bd759)) 24 | (pad "A8" smd rect (at 4.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 29675bbc-4add-48bb-87b5-e43446868892)) 25 | (pad "A9" smd rect (at 4.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 1574eb69-43d9-4a08-bdc2-d991053ac198)) 26 | (pad "A10" smd rect (at 5.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 83605621-4244-4846-95ee-b0eadbdf948c)) 27 | (pad "A11" smd rect (at 5.6 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 93c92a22-3215-4700-b5f0-c9ab1d3b96dd)) 28 | (pad "A12" smd rect (at 6.1 -1.24) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 82706b36-bd23-4d12-8a46-1f85a6f30313)) 29 | (pad "B1" smd rect (at 6.2 0) (size 1 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp b72a3635-5298-4c70-947f-de9920bfc26e)) 30 | (pad "B2" smd rect (at 5.35 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 419cc280-9cc1-479d-9742-275eddcda0be)) 31 | (pad "B3" smd rect (at 4.85 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 918a0e83-f832-490a-a397-a79f14eb83c2)) 32 | (pad "B4" smd rect (at 4.35 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp b8b89898-07a7-4c54-ad8c-a2188006ffdb)) 33 | (pad "B5" smd rect (at 3.85 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp d02d3612-16ae-4ec5-915f-e2a009055774)) 34 | (pad "B6" smd rect (at 3.35 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 4767f2ff-f536-4162-908f-5cf1cb8790f9)) 35 | (pad "B7" smd rect (at 2.85 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp b957e2d0-e960-4add-ba17-c7659ef26d8d)) 36 | (pad "B8" smd rect (at 2.35 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 8fca13a6-cdf3-41a6-ae22-550d77c572e5)) 37 | (pad "B9" smd rect (at 1.85 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2296c9d8-bd75-43c8-bd79-8c60cc3ccef9)) 38 | (pad "B10" smd rect (at 1.35 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 54ef61cf-1551-4101-850a-76ac3cdf59d9)) 39 | (pad "B11" smd rect (at 0.85 0) (size 0.3 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 2c194ff2-40b8-458e-a662-1ec043b765b9)) 40 | (pad "B12" smd rect (at 0 0) (size 1 0.7) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp e18e5e9c-468e-484b-9b68-d4f4d5d86443)) 41 | (pad "S1" thru_hole oval (at -1.22 4.47) (size 1.1 2.6) (drill oval 0.6 2.1) (layers *.Cu *.Mask) (tstamp 827919e1-ae24-464f-8d6e-5fcf0af40c65)) 42 | (pad "S1" thru_hole oval (at -1.22 -0.89) (size 1.1 2.1) (drill oval 0.6 1.6) (layers *.Cu *.Mask) (tstamp 8d4d9dab-5379-4e37-b012-aaa8bdf6a99c)) 43 | (pad "S1" thru_hole oval (at 7.42 4.47) (size 1.1 2.6) (drill oval 0.6 2.1) (layers *.Cu *.Mask) (tstamp 99390292-e6c0-4f90-b88f-8225feaeb959)) 44 | (pad "S1" thru_hole oval (at 7.42 -0.89) (size 1.1 2.1) (drill oval 0.6 1.6) (layers *.Cu *.Mask) (tstamp b46f969f-cadb-402f-aaae-c532dab159f5)) 45 | (zone (net 0) (net_name "") (layers "F.Cu" "In1.Cu" "In2.Cu" "In3.Cu" "In4.Cu" "In5.Cu" "In6.Cu" "In7.Cu" "In8.Cu" "In9.Cu" "In10.Cu" "In11.Cu" "In12.Cu" "In13.Cu" "In14.Cu" "In15.Cu" "In16.Cu" "In17.Cu" "In18.Cu" "In19.Cu" "In20.Cu" "In21.Cu" "In22.Cu" "In23.Cu" "In24.Cu" "In25.Cu" "In26.Cu" "In27.Cu" "In28.Cu" "In29.Cu" "In30.Cu") (tstamp beb6f58a-0c7f-4262-bba0-e62d35e3f882) (hatch edge 0.508) 46 | (connect_pads (clearance 0.508)) 47 | (min_thickness 0.254) 48 | (keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed ) (copperpour not_allowed) (footprints allowed)) 49 | (fill (thermal_gap 0.508) (thermal_bridge_width 0.508)) 50 | (polygon 51 | (pts 52 | (xy 6.574046 6.252645) 53 | (xy -0.425954 6.252645) 54 | (xy -0.425954 0.602645) 55 | (xy 6.574046 0.602645) 56 | ) 57 | ) 58 | ) 59 | ) 60 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2.pretty/PTS636 SL43.kicad_mod: -------------------------------------------------------------------------------- 1 | (module "PTS636 SL43" (layer F.Cu) (tedit 5DE7EE3C) 2 | (fp_text reference "REF**" (at 0 -4) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | (tstamp 1f1e6d47-1f45-444d-95d6-7eb5c1fab4b8) 5 | ) 6 | (fp_text value "PTS636 SL43" (at 0 -6) (layer F.Fab) 7 | (effects (font (size 1 1) (thickness 0.15))) 8 | (tstamp 6c2d8050-f895-4fdd-9652-dc639a187dfa) 9 | ) 10 | (fp_line (start 3 -1.7) (end 3 1.8) (layer F.SilkS) (width 0.12) (tstamp 10e8bd5f-5a02-424a-a05b-d18974f6479d)) 11 | (fp_line (start 3 1.8) (end -3 1.8) (layer F.SilkS) (width 0.12) (tstamp 2db41c56-7cc8-43e1-9a45-eaf5ac3acb7f)) 12 | (fp_line (start -3 1.8) (end -3 -1.7) (layer F.SilkS) (width 0.12) (tstamp 433c43fa-8240-4c47-b00c-ce7618d96bca)) 13 | (fp_line (start -3 -1.7) (end 3 -1.7) (layer F.SilkS) (width 0.12) (tstamp f038d085-cd20-4c1e-ac8e-fd6e48f7e7da)) 14 | (fp_line (start -5.4 -2.4) (end 5.4 -2.4) (layer F.CrtYd) (width 0.12) (tstamp 2f9d0296-14d1-47ce-90d1-3fdfbfc8d178)) 15 | (fp_line (start -5.4 2.5) (end -5.4 -2.4) (layer F.CrtYd) (width 0.12) (tstamp 9b2b7517-16fe-4640-a043-1390253a0bb3)) 16 | (fp_line (start 5.4 2.5) (end -5.4 2.5) (layer F.CrtYd) (width 0.12) (tstamp ab646376-c274-4cec-8690-4b75d0d63d03)) 17 | (fp_line (start 5.4 -2.4) (end 5.4 2.5) (layer F.CrtYd) (width 0.12) (tstamp b9564817-e1eb-4913-8cae-9693a0f209f0)) 18 | (pad "1" smd roundrect (at -4.1 0) (size 2 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 454dcccb-2b17-405c-88ce-efa647da938c)) 19 | (pad "2" smd roundrect (at 4.1 0) (size 2 1.5) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 3c599b4c-8487-478a-ac04-40fa2b810aa1)) 20 | ) 21 | -------------------------------------------------------------------------------- /Hardware/nanoAmmeter_v2_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joeltroughton/nanoAmmeter/7971d07e66f701068158726d8ddab41a94d04c3f/Hardware/nanoAmmeter_v2_schematic.pdf -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30002.166 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Biosensor_nAmmeter", "Biosensor_nAmmeter\Biosensor_nAmmeter.csproj", "{33EABD0A-82E2-4A17-8CC8-72F1474A158A}" 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 | {33EABD0A-82E2-4A17-8CC8-72F1474A158A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {33EABD0A-82E2-4A17-8CC8-72F1474A158A}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {33EABD0A-82E2-4A17-8CC8-72F1474A158A}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {33EABD0A-82E2-4A17-8CC8-72F1474A158A}.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 = {13C58BDE-B788-407C-BFEC-C3E149325EA4} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace Biosensor_nAmmeter 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/Biosensor_nAmmeter.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | icon_bfc_icon.ico 8 | 9 | 10 | 11 | 12 | 215d64d2-031c-33c7-96e3-61794cd1ee61 13 | 2 14 | 4 15 | tlbimp 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/Biosensor_nAmmeter.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_LastSelectedProfileId>C:\Users\Joel\source\repos\Biosensor_nAmmeter\Biosensor_nAmmeter\Properties\PublishProfiles\FolderProfile.pubxml 5 | 6 | 7 | 8 | Designer 9 | 10 | 11 | 12 | 13 | Designer 14 | 15 | 16 | -------------------------------------------------------------------------------- /PC Application/Biosensor_nAmmeter/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  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 |