From 812d9675f84dee92cf64a5d5b9a700d4f694cf87 Mon Sep 17 00:00:00 2001 From: Goran Mahovlic Date: Thu, 18 Aug 2022 17:12:55 +0200 Subject: [PATCH] Adding BPS Components --- Drivers/BSP/Components/Common/Release_Notes.html | 212 +++++++++++++++++++ Drivers/BSP/Components/Common/accelero.h | 125 ++++++++++++ Drivers/BSP/Components/Common/audio.h | 104 ++++++++++ Drivers/BSP/Components/Common/camera.h | 123 ++++++++++++ Drivers/BSP/Components/Common/dpredriver.h | 104 ++++++++++ Drivers/BSP/Components/Common/epd.h | 97 +++++++++ Drivers/BSP/Components/Common/gyro.h | 127 ++++++++++++ Drivers/BSP/Components/Common/hsensor.h | 83 ++++++++ Drivers/BSP/Components/Common/idd.h | 150 ++++++++++++++ Drivers/BSP/Components/Common/io.h | 132 ++++++++++++ Drivers/BSP/Components/Common/lcd.h | 96 +++++++++ Drivers/BSP/Components/Common/magneto.h | 107 ++++++++++ Drivers/BSP/Components/Common/psensor.h | 83 ++++++++ Drivers/BSP/Components/Common/pwrmon.h | 246 +++++++++++++++++++++++ Drivers/BSP/Components/Common/ts.h | 89 ++++++++ Drivers/BSP/Components/Common/tsensor.h | 100 +++++++++ Drivers/BSP/Components/Common/usbtypecswitch.h | 114 +++++++++++ 17 files changed, 2092 insertions(+) create mode 100644 Drivers/BSP/Components/Common/Release_Notes.html create mode 100644 Drivers/BSP/Components/Common/accelero.h create mode 100644 Drivers/BSP/Components/Common/audio.h create mode 100644 Drivers/BSP/Components/Common/camera.h create mode 100644 Drivers/BSP/Components/Common/dpredriver.h create mode 100644 Drivers/BSP/Components/Common/epd.h create mode 100644 Drivers/BSP/Components/Common/gyro.h create mode 100644 Drivers/BSP/Components/Common/hsensor.h create mode 100644 Drivers/BSP/Components/Common/idd.h create mode 100644 Drivers/BSP/Components/Common/io.h create mode 100644 Drivers/BSP/Components/Common/lcd.h create mode 100644 Drivers/BSP/Components/Common/magneto.h create mode 100644 Drivers/BSP/Components/Common/psensor.h create mode 100644 Drivers/BSP/Components/Common/pwrmon.h create mode 100644 Drivers/BSP/Components/Common/ts.h create mode 100644 Drivers/BSP/Components/Common/tsensor.h create mode 100644 Drivers/BSP/Components/Common/usbtypecswitch.h diff --git a/Drivers/BSP/Components/Common/Release_Notes.html b/Drivers/BSP/Components/Common/Release_Notes.html new file mode 100644 index 0000000..d80459e --- /dev/null +++ b/Drivers/BSP/Components/Common/Release_Notes.html @@ -0,0 +1,212 @@ + + + + + + + Release Notes for BSP Components Common Drivers + + + + + +
+
+
+
+
+

Release Notes for BSP Components Common Drivers

+

Copyright © 2017 STMicroelectronics
+

+ +
+
+
+

License

+

Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:

+

https://opensource.org/licenses/BSD-3-Clause

+

Purpose

+

This directory contains the BSP components common drivers.

+
+
+

Update History

+
+ +
+

Main Changes

+
    +
  • Update release notes format
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • Reformat the BSD 3-Clause license declaration in the files header (replace license terms by a web reference to OSI website where those terms lie)
  • +
  • Correct sensor names in headers files hsensor.h and psensor.h
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • Add dpredriver.h: support of DP redriver class
  • +
  • Add pwrmon.h: support of power monitor class
  • +
  • Add usbtypecswitch.h: support of USB type C switch class
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • Add hsensor.h: support of humidity class
  • +
  • Add psensor.h: support of pressure class
  • +
  • Update tsensor.h: Temperature can be negative
  • +
  • Update accelero.h: LowPower API can enable or disable the low power mode
  • +
  • Update magneto.h: LowPower API can enable or disable the low power mode
  • +
+

Notes:

+

This version breaks the compatibility with previous versions.

+
+
+
+ +
+

Main Changes

+
    +
  • tsensor.h: Fix compilation issue on TSENSOR_InitTypeDef
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • accelero.h: add *DeInit field in ACCELERO_DrvTypeDef structure
  • +
  • audio.h: add *DeInit field in AUDIO_DrvTypeDef structure
  • +
  • idd.h: +
      +
    • add Shunt0StabDelay, Shunt1StabDelay, Shunt2StabDelay, Shunt3StabDelay, Shunt4StabDelay and ShuntNbOnBoard fields in IDD_ConfigTypeDef structure
    • +
    • rename ShuntNumber field to ShuntNbUsed in IDD_ConfigTypeDef structure
    • +
  • +
  • magneto.h: add *DeInit field in MAGNETO_DrvTypeDef structure
  • +
+

Important Note:

+

This release V4.0.0 is not backward compatible with V3.0.0.

+
+
+
+ +
+

Main Changes

+
    +
  • accelero.h: add LowPower field in ACCELERO_DrvTypeDef structure
  • +
  • magneto.h: add LowPower field in MAGNETO_DrvTypeDef structure
  • +
  • gyro.h: add DeInit and LowPower fields in GYRO_DrvTypeDef structure
  • +
  • camera.h: add CAMERA_COLOR_EFFECT_NONE define
  • +
  • idd.h: +
      +
    • add MeasureNb, DeltaDelayUnit and DeltaDelayValue fields in IDD_ConfigTypeDef structure
    • +
    • rename PreDelay field to PreDelayUnit in IDD_ConfigTypeDef structure
    • +
  • +
+

Important Note:

+

This release V3.0.0 is not backward compatible with V2.2.0.

+
+
+
+ +
+

Main Changes

+
    +
  • Magnetometer driver function prototypes added (magneto.h file)
  • +
  • Update “idd.h” file to provide DeInit() and WakeUp() services in IDD current measurement driver
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • IDD current measurement driver function prototypes added (idd.h file)
  • +
  • io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • Update “io.h” file to support MFX (Multi Function eXpander) device available on some STM32 boards +
      +
    • add new entries for IO_ModeTypedef enumeration structure
    • +
    • update the IO_DrvTypeDef structure +
        +
      • Update all return values and function parameters to uint32_t
      • +
      • Add a return value for Config field
      • +
    • +
  • +
+

Important Note:

+

This version V2.0.0 is not backward compatible with V1.2.1.

+
+
+
+ +
+

Main Changes

+
    +
  • gyro.h: change “__GIRO_H” by “__GYRO_H” to fix compilation issue under Mac OS
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • EPD (E Paper Display) driver function prototype added (epd.h file)
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • Temperature Sensor driver function prototype added
  • +
+
+
+
+ +
+

Main Changes

+
    +
  • First official release with Accelerometer, Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes
  • +
+
+
+
+
+ + + diff --git a/Drivers/BSP/Components/Common/accelero.h b/Drivers/BSP/Components/Common/accelero.h new file mode 100644 index 0000000..7c680cf --- /dev/null +++ b/Drivers/BSP/Components/Common/accelero.h @@ -0,0 +1,125 @@ +/** + ****************************************************************************** + * @file accelero.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the Accelerometer driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __ACCELERO_H +#define __ACCELERO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup ACCELERO + * @{ + */ + +/** @defgroup ACCELERO_Exported_Types + * @{ + */ + +/** @defgroup ACCELERO_Driver_structure Accelerometer Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + void (*DeInit)(void); + uint8_t (*ReadID)(void); + void (*Reset)(void); + void (*LowPower)(uint16_t); + void (*ConfigIT)(void); + void (*EnableIT)(uint8_t); + void (*DisableIT)(uint8_t); + uint8_t (*ITStatus)(uint16_t); + void (*ClearIT)(void); + void (*FilterConfig)(uint8_t); + void (*FilterCmd)(uint8_t); + void (*GetXYZ)(int16_t *); +}ACCELERO_DrvTypeDef; +/** + * @} + */ + +/** @defgroup ACCELERO_Configuration_structure Accelerometer Configuration structure + * @{ + */ + +/* ACCELERO struct */ +typedef struct +{ + uint8_t Power_Mode; /* Power-down/Normal Mode */ + uint8_t AccOutput_DataRate; /* OUT data rate */ + uint8_t Axes_Enable; /* Axes enable */ + uint8_t High_Resolution; /* High Resolution enabling/disabling */ + uint8_t BlockData_Update; /* Block Data Update */ + uint8_t Endianness; /* Endian Data selection */ + uint8_t AccFull_Scale; /* Full Scale selection */ + uint8_t Communication_Mode; +}ACCELERO_InitTypeDef; + +/* ACCELERO High Pass Filter struct */ +typedef struct +{ + uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */ + uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */ + uint8_t HighPassFilter_AOI1; /* HPF_enabling/disabling for AOI function on interrupt 1 */ + uint8_t HighPassFilter_AOI2; /* HPF_enabling/disabling for AOI function on interrupt 2 */ + uint8_t HighPassFilter_Data_Sel; + uint8_t HighPassFilter_Stat; +}ACCELERO_FilterConfigTypeDef; + +/** + * @} + */ + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ACCELERO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/audio.h b/Drivers/BSP/Components/Common/audio.h new file mode 100644 index 0000000..75dc3d2 --- /dev/null +++ b/Drivers/BSP/Components/Common/audio.h @@ -0,0 +1,104 @@ +/** + ****************************************************************************** + * @file audio.h + * @author MCD Application Team + * @brief This header file contains the common defines and functions prototypes + * for the Audio driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __AUDIO_H +#define __AUDIO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup AUDIO + * @{ + */ + +/** @defgroup AUDIO_Exported_Constants + * @{ + */ + +/* Codec audio Standards */ +#define CODEC_STANDARD 0x04 +#define I2S_STANDARD I2S_STANDARD_PHILIPS + +/** + * @} + */ + +/** @defgroup AUDIO_Exported_Types + * @{ + */ + +/** @defgroup AUDIO_Driver_structure Audio Driver structure + * @{ + */ +typedef struct +{ + uint32_t (*Init)(uint16_t, uint16_t, uint8_t, uint32_t); + void (*DeInit)(void); + uint32_t (*ReadID)(uint16_t); + uint32_t (*Play)(uint16_t, uint16_t*, uint16_t); + uint32_t (*Pause)(uint16_t); + uint32_t (*Resume)(uint16_t); + uint32_t (*Stop)(uint16_t, uint32_t); + uint32_t (*SetFrequency)(uint16_t, uint32_t); + uint32_t (*SetVolume)(uint16_t, uint8_t); + uint32_t (*SetMute)(uint16_t, uint32_t); + uint32_t (*SetOutputMode)(uint16_t, uint8_t); + uint32_t (*Reset)(uint16_t); +}AUDIO_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __AUDIO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/camera.h b/Drivers/BSP/Components/Common/camera.h new file mode 100644 index 0000000..1a49204 --- /dev/null +++ b/Drivers/BSP/Components/Common/camera.h @@ -0,0 +1,123 @@ +/** + ****************************************************************************** + * @file camera.h + * @author MCD Application Team + * @brief This header file contains the common defines and functions prototypes + * for the camera driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CAMERA_H +#define __CAMERA_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup CAMERA + * @{ + */ + + +/** @defgroup CAMERA_Exported_Types + * @{ + */ + +/** @defgroup CAMERA_Driver_structure Camera Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t, uint32_t); + uint16_t (*ReadID)(uint16_t); + void (*Config)(uint16_t, uint32_t, uint32_t, uint32_t); +}CAMERA_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** @defgroup CAMERA_Exported_Constants + * @{ + */ +#define CAMERA_R160x120 0x00 /* QQVGA Resolution */ +#define CAMERA_R320x240 0x01 /* QVGA Resolution */ +#define CAMERA_R480x272 0x02 /* 480x272 Resolution */ +#define CAMERA_R640x480 0x03 /* VGA Resolution */ + +#define CAMERA_CONTRAST_BRIGHTNESS 0x00 /* Camera contrast brightness features */ +#define CAMERA_BLACK_WHITE 0x01 /* Camera black white feature */ +#define CAMERA_COLOR_EFFECT 0x03 /* Camera color effect feature */ + +#define CAMERA_BRIGHTNESS_LEVEL0 0x00 /* Brightness level -2 */ +#define CAMERA_BRIGHTNESS_LEVEL1 0x01 /* Brightness level -1 */ +#define CAMERA_BRIGHTNESS_LEVEL2 0x02 /* Brightness level 0 */ +#define CAMERA_BRIGHTNESS_LEVEL3 0x03 /* Brightness level +1 */ +#define CAMERA_BRIGHTNESS_LEVEL4 0x04 /* Brightness level +2 */ + +#define CAMERA_CONTRAST_LEVEL0 0x05 /* Contrast level -2 */ +#define CAMERA_CONTRAST_LEVEL1 0x06 /* Contrast level -1 */ +#define CAMERA_CONTRAST_LEVEL2 0x07 /* Contrast level 0 */ +#define CAMERA_CONTRAST_LEVEL3 0x08 /* Contrast level +1 */ +#define CAMERA_CONTRAST_LEVEL4 0x09 /* Contrast level +2 */ + +#define CAMERA_BLACK_WHITE_BW 0x00 /* Black and white effect */ +#define CAMERA_BLACK_WHITE_NEGATIVE 0x01 /* Negative effect */ +#define CAMERA_BLACK_WHITE_BW_NEGATIVE 0x02 /* BW and Negative effect */ +#define CAMERA_BLACK_WHITE_NORMAL 0x03 /* Normal effect */ + +#define CAMERA_COLOR_EFFECT_NONE 0x00 /* No effects */ +#define CAMERA_COLOR_EFFECT_BLUE 0x01 /* Blue effect */ +#define CAMERA_COLOR_EFFECT_GREEN 0x02 /* Green effect */ +#define CAMERA_COLOR_EFFECT_RED 0x03 /* Red effect */ +#define CAMERA_COLOR_EFFECT_ANTIQUE 0x04 /* Antique effect */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CAMERA_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/dpredriver.h b/Drivers/BSP/Components/Common/dpredriver.h new file mode 100644 index 0000000..fbfa21e --- /dev/null +++ b/Drivers/BSP/Components/Common/dpredriver.h @@ -0,0 +1,104 @@ +/** + ****************************************************************************** + * @file dpredriver.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * DisplayPort Linear Redriver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __DPREDRIVER_H +#define __DPREDRIVER_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup DPREDRIVER + * @{ + */ + +/** @defgroup DPREDRIVER_Exported_Types + * @{ + */ + +/** @defgroup DPREDRIVER_Channel_Identifier Channel Identifier + * @{ + */ + typedef enum { + CHANNEL_DP0 = 0, + CHANNEL_DP1, + CHANNEL_DP2, + CHANNEL_DP3, + CHANNEL_RX1, + CHANNEL_RX2, + CHANNEL_SSTX + } DPREDRIVER_ChannelId_t; +/** + * @} + */ + + /** @defgroup DPREDRIVER_Driver_structure DisplayPort Linear Redriver Driver structure + * @{ + */ +typedef struct +{ + uint32_t (*Init)(uint16_t); + void (*DeInit)(uint16_t); + uint32_t (*PowerOn)(uint16_t); + uint32_t (*PowerOff)(uint16_t); + uint32_t (*SetEQGain)(uint16_t, DPREDRIVER_ChannelId_t, uint8_t); + uint32_t (*EnableChannel)(uint16_t, DPREDRIVER_ChannelId_t); + uint32_t (*DisableChannel)(uint16_t, DPREDRIVER_ChannelId_t); +}DPREDRIVER_Drv_t; +/** + * @} + */ + +/** + * @} + */ + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __DPREDRIVER_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/epd.h b/Drivers/BSP/Components/Common/epd.h new file mode 100644 index 0000000..a4798d7 --- /dev/null +++ b/Drivers/BSP/Components/Common/epd.h @@ -0,0 +1,97 @@ +/** + ****************************************************************************** + * @file epd.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the + * EPD (E Paper Display) driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __EPD_H +#define __EPD_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup Common + * @{ + */ + +/** @addtogroup EPD + * @{ + */ + +/** @defgroup EPD_Exported_Types + * @{ + */ + +/** @defgroup EPD_Driver_structure E Paper Display Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(void); + void (*WritePixel)(uint8_t); + + /* Optimized operation */ + void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t); + void (*RefreshDisplay)(void); + void (*CloseChargePump)(void); + + uint16_t (*GetEpdPixelWidth)(void); + uint16_t (*GetEpdPixelHeight)(void); + void (*DrawImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*); +} +EPD_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif + +#endif /* EPD_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/gyro.h b/Drivers/BSP/Components/Common/gyro.h new file mode 100644 index 0000000..867f1a5 --- /dev/null +++ b/Drivers/BSP/Components/Common/gyro.h @@ -0,0 +1,127 @@ +/** + ****************************************************************************** + * @file gyro.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the gyroscope driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GYRO_H +#define __GYRO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup GYRO + * @{ + */ + +/** @defgroup GYRO_Exported_Types + * @{ + */ + +/** @defgroup GYRO_Driver_structure Gyroscope Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + void (*DeInit)(void); + uint8_t (*ReadID)(void); + void (*Reset)(void); + void (*LowPower)(uint16_t); + void (*ConfigIT)(uint16_t); + void (*EnableIT)(uint8_t); + void (*DisableIT)(uint8_t); + uint8_t (*ITStatus)(uint16_t, uint16_t); + void (*ClearIT)(uint16_t, uint16_t); + void (*FilterConfig)(uint8_t); + void (*FilterCmd)(uint8_t); + void (*GetXYZ)(float *); +}GYRO_DrvTypeDef; +/** + * @} + */ + +/** @defgroup GYRO_Config_structure Gyroscope Configuration structure + * @{ + */ + +typedef struct +{ + uint8_t Power_Mode; /* Power-down/Sleep/Normal Mode */ + uint8_t Output_DataRate; /* OUT data rate */ + uint8_t Axes_Enable; /* Axes enable */ + uint8_t Band_Width; /* Bandwidth selection */ + uint8_t BlockData_Update; /* Block Data Update */ + uint8_t Endianness; /* Endian Data selection */ + uint8_t Full_Scale; /* Full Scale selection */ +}GYRO_InitTypeDef; + +/* GYRO High Pass Filter struct */ +typedef struct +{ + uint8_t HighPassFilter_Mode_Selection; /* Internal filter mode */ + uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */ +}GYRO_FilterConfigTypeDef; + +/*GYRO Interrupt struct */ +typedef struct +{ + uint8_t Latch_Request; /* Latch interrupt request into CLICK_SRC register */ + uint8_t Interrupt_Axes; /* X, Y, Z Axes Interrupts */ + uint8_t Interrupt_ActiveEdge; /* Interrupt Active edge */ +}GYRO_InterruptConfigTypeDef; + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GYRO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/hsensor.h b/Drivers/BSP/Components/Common/hsensor.h new file mode 100644 index 0000000..25499e0 --- /dev/null +++ b/Drivers/BSP/Components/Common/hsensor.h @@ -0,0 +1,83 @@ +/** + ****************************************************************************** + * @file hsensor.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * Humidity Sensor driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __HSENSOR_H +#define __HSENSOR_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup HSENSOR + * @{ + */ + +/** @defgroup HSENSOR_Exported_Types + * @{ + */ + +/** @defgroup HSENSOR_Driver_structure Humidity Sensor Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + uint8_t (*ReadID)(uint16_t); + float (*ReadHumidity)(uint16_t); +}HSENSOR_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __HSENSOR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/idd.h b/Drivers/BSP/Components/Common/idd.h new file mode 100644 index 0000000..3a138f4 --- /dev/null +++ b/Drivers/BSP/Components/Common/idd.h @@ -0,0 +1,150 @@ +/** + ****************************************************************************** + * @file idd.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the IDD driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __IDD_H +#define __IDD_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup IDD + * @{ + */ + +/** @defgroup IDD_Exported_Types IDD Exported Types + * @{ + */ + +/** @defgroup IDD_Config_structure IDD Configuration structure + * @{ + */ +typedef struct +{ + uint16_t AmpliGain; /*!< Specifies ampli gain value + */ + uint16_t VddMin; /*!< Specifies minimum MCU VDD can reach to protect MCU from reset + */ + uint16_t Shunt0Value; /*!< Specifies value of Shunt 0 if existing + */ + uint16_t Shunt1Value; /*!< Specifies value of Shunt 1 if existing + */ + uint16_t Shunt2Value; /*!< Specifies value of Shunt 2 if existing + */ + uint16_t Shunt3Value; /*!< Specifies value of Shunt 3 if existing + */ + uint16_t Shunt4Value; /*!< Specifies value of Shunt 4 if existing + */ + uint16_t Shunt0StabDelay; /*!< Specifies delay of Shunt 0 stabilization if existing + */ + uint16_t Shunt1StabDelay; /*!< Specifies delay of Shunt 1 stabilization if existing + */ + uint16_t Shunt2StabDelay; /*!< Specifies delay of Shunt 2 stabilization if existing + */ + uint16_t Shunt3StabDelay; /*!< Specifies delay of Shunt 3 stabilization if existing + */ + uint16_t Shunt4StabDelay; /*!< Specifies delay of Shunt 4 stabilization if existing + */ + uint8_t ShuntNbOnBoard; /*!< Specifies number of shunts that are present on board + This parameter can be a value of @ref IDD_shunt_number */ + uint8_t ShuntNbUsed; /*!< Specifies number of shunts used for measurement + This parameter can be a value of @ref IDD_shunt_number */ + uint8_t VrefMeasurement; /*!< Specifies if Vref is automatically measured before each Idd measurement + This parameter can be a value of @ref IDD_Vref_Measurement */ + uint8_t Calibration; /*!< Specifies if calibration is done before each Idd measurement + */ + uint8_t PreDelayUnit; /*!< Specifies Pre delay unit + This parameter can be a value of @ref IDD_PreDelay */ + uint8_t PreDelayValue; /*!< Specifies Pre delay value in selected unit + */ + uint8_t MeasureNb; /*!< Specifies number of Measure to be performed + This parameter can be a value between 1 and 256 */ + uint8_t DeltaDelayUnit; /*!< Specifies Delta delay unit + This parameter can be a value of @ref IDD_DeltaDelay */ + uint8_t DeltaDelayValue; /*!< Specifies Delta delay between 2 measures + value can be between 1 and 128 */ +}IDD_ConfigTypeDef; +/** + * @} + */ + +/** @defgroup IDD_Driver_structure IDD Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + void (*DeInit)(uint16_t); + uint16_t (*ReadID)(uint16_t); + void (*Reset)(uint16_t); + void (*LowPower)(uint16_t); + void (*WakeUp)(uint16_t); + void (*Start)(uint16_t); + void (*Config)(uint16_t,IDD_ConfigTypeDef); + void (*GetValue)(uint16_t, uint32_t *); + void (*EnableIT)(uint16_t); + void (*ClearIT)(uint16_t); + uint8_t (*GetITStatus)(uint16_t); + void (*DisableIT)(uint16_t); + void (*ErrorEnableIT)(uint16_t); + void (*ErrorClearIT)(uint16_t); + uint8_t (*ErrorGetITStatus)(uint16_t); + void (*ErrorDisableIT)(uint16_t); + uint8_t (*ErrorGetSrc)(uint16_t); + uint8_t (*ErrorGetCode)(uint16_t); +}IDD_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __IDD_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/io.h b/Drivers/BSP/Components/Common/io.h new file mode 100644 index 0000000..84c5e9c --- /dev/null +++ b/Drivers/BSP/Components/Common/io.h @@ -0,0 +1,132 @@ +/** + ****************************************************************************** + * @file io.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the IO driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __IO_H +#define __IO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup IO + * @{ + */ + +/** @defgroup IO_Exported_Types + * @{ + */ + +/** + * @brief IO Bit SET and Bit RESET enumeration + */ +typedef enum +{ + IO_PIN_RESET = 0, + IO_PIN_SET +}IO_PinState; + +typedef enum +{ + IO_MODE_INPUT = 0, /* input floating */ + IO_MODE_OUTPUT, /* output Push Pull */ + IO_MODE_IT_RISING_EDGE, /* float input - irq detect on rising edge */ + IO_MODE_IT_FALLING_EDGE, /* float input - irq detect on falling edge */ + IO_MODE_IT_LOW_LEVEL, /* float input - irq detect on low level */ + IO_MODE_IT_HIGH_LEVEL, /* float input - irq detect on high level */ + /* following modes only available on MFX*/ + IO_MODE_ANALOG, /* analog mode */ + IO_MODE_OFF, /* when pin isn't used*/ + IO_MODE_INPUT_PU, /* input with internal pull up resistor */ + IO_MODE_INPUT_PD, /* input with internal pull down resistor */ + IO_MODE_OUTPUT_OD, /* Open Drain output without internal resistor */ + IO_MODE_OUTPUT_OD_PU, /* Open Drain output with internal pullup resistor */ + IO_MODE_OUTPUT_OD_PD, /* Open Drain output with internal pulldown resistor */ + IO_MODE_OUTPUT_PP, /* PushPull output without internal resistor */ + IO_MODE_OUTPUT_PP_PU, /* PushPull output with internal pullup resistor */ + IO_MODE_OUTPUT_PP_PD, /* PushPull output with internal pulldown resistor */ + IO_MODE_IT_RISING_EDGE_PU, /* push up resistor input - irq on rising edge */ + IO_MODE_IT_RISING_EDGE_PD, /* push dw resistor input - irq on rising edge */ + IO_MODE_IT_FALLING_EDGE_PU, /* push up resistor input - irq on falling edge */ + IO_MODE_IT_FALLING_EDGE_PD, /* push dw resistor input - irq on falling edge */ + IO_MODE_IT_LOW_LEVEL_PU, /* push up resistor input - irq detect on low level */ + IO_MODE_IT_LOW_LEVEL_PD, /* push dw resistor input - irq detect on low level */ + IO_MODE_IT_HIGH_LEVEL_PU, /* push up resistor input - irq detect on high level */ + IO_MODE_IT_HIGH_LEVEL_PD, /* push dw resistor input - irq detect on high level */ + +}IO_ModeTypedef; + +/** @defgroup IO_Driver_structure IO Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + uint16_t (*ReadID)(uint16_t); + void (*Reset)(uint16_t); + + void (*Start)(uint16_t, uint32_t); + uint8_t (*Config)(uint16_t, uint32_t, IO_ModeTypedef); + void (*WritePin)(uint16_t, uint32_t, uint8_t); + uint32_t (*ReadPin)(uint16_t, uint32_t); + + void (*EnableIT)(uint16_t); + void (*DisableIT)(uint16_t); + uint32_t (*ITStatus)(uint16_t, uint32_t); + void (*ClearIT)(uint16_t, uint32_t); + +}IO_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __IO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/lcd.h b/Drivers/BSP/Components/Common/lcd.h new file mode 100644 index 0000000..e24dd2b --- /dev/null +++ b/Drivers/BSP/Components/Common/lcd.h @@ -0,0 +1,96 @@ +/** + ****************************************************************************** + * @file lcd.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the LCD driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LCD_H +#define __LCD_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup LCD + * @{ + */ + +/** @defgroup LCD_Exported_Types + * @{ + */ + +/** @defgroup LCD_Driver_structure LCD Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(void); + uint16_t (*ReadID)(void); + void (*DisplayOn)(void); + void (*DisplayOff)(void); + void (*SetCursor)(uint16_t, uint16_t); + void (*WritePixel)(uint16_t, uint16_t, uint16_t); + uint16_t (*ReadPixel)(uint16_t, uint16_t); + + /* Optimized operation */ + void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t); + void (*DrawHLine)(uint16_t, uint16_t, uint16_t, uint16_t); + void (*DrawVLine)(uint16_t, uint16_t, uint16_t, uint16_t); + + uint16_t (*GetLcdPixelWidth)(void); + uint16_t (*GetLcdPixelHeight)(void); + void (*DrawBitmap)(uint16_t, uint16_t, uint8_t*); + void (*DrawRGBImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*); +}LCD_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LCD_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/magneto.h b/Drivers/BSP/Components/Common/magneto.h new file mode 100644 index 0000000..b70f82c --- /dev/null +++ b/Drivers/BSP/Components/Common/magneto.h @@ -0,0 +1,107 @@ +/** + ****************************************************************************** + * @file magneto.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the MAGNETO driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MAGNETO_H +#define __MAGNETO_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup MAGNETO + * @{ + */ + +/** @defgroup MAGNETO_Exported_Types + * @{ + */ + +/** @defgroup MAGNETO_Config_structure Magnetometer Configuration structure + * @{ + */ +typedef struct +{ + uint8_t Register1; + uint8_t Register2; + uint8_t Register3; + uint8_t Register4; + uint8_t Register5; +}MAGNETO_InitTypeDef; +/** + * @} + */ + +/** @defgroup MAGNETO_Driver_structure Magnetometer Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(MAGNETO_InitTypeDef); + void (*DeInit)(void); + uint8_t (*ReadID)(void); + void (*Reset)(void); + void (*LowPower)(uint16_t); + void (*ConfigIT)(void); + void (*EnableIT)(uint8_t); + void (*DisableIT)(uint8_t); + uint8_t (*ITStatus)(uint16_t); + void (*ClearIT)(void); + void (*FilterConfig)(uint8_t); + void (*FilterCmd)(uint8_t); + void (*GetXYZ)(int16_t *); +}MAGNETO_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __MAGNETO_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/psensor.h b/Drivers/BSP/Components/Common/psensor.h new file mode 100644 index 0000000..3943269 --- /dev/null +++ b/Drivers/BSP/Components/Common/psensor.h @@ -0,0 +1,83 @@ +/** + ****************************************************************************** + * @file psensor.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * Pressure Sensor driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __PSENSOR_H +#define __PSENSOR_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup PSENSOR + * @{ + */ + +/** @defgroup PSENSOR_Exported_Types + * @{ + */ + +/** @defgroup PSENSOR_Driver_structure Pressure Sensor Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + uint8_t (*ReadID)(uint16_t); + float (*ReadPressure)(uint16_t); +}PSENSOR_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __PSENSOR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/pwrmon.h b/Drivers/BSP/Components/Common/pwrmon.h new file mode 100644 index 0000000..50dd8af --- /dev/null +++ b/Drivers/BSP/Components/Common/pwrmon.h @@ -0,0 +1,246 @@ +/** + ****************************************************************************** + * @file pwrmon.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * Current/Power Monitor device driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __PWRMON_H +#define __PWRMON_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup PWRMON + * @{ + */ + +/** @defgroup PWRMON_Exported_Types + * @{ + */ + +/** @defgroup PWRMON_Operating_Mode_enum Power Monitor Operating Mode enums + * @{ + */ +typedef enum { + OPERATING_MODE_TRIGGERED = 0, + OPERATING_MODE_CONTINUOUS, + OPERATING_MODE_NB +} PWRMON_OperatingMode_t; +/** + * @} + */ + +/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums + * @{ + */ +typedef enum { + CONVERT_TIME_140 = 0, + CONVERT_TIME_204, + CONVERT_TIME_332, + CONVERT_TIME_588, + CONVERT_TIME_1100, + CONVERT_TIME_2116, + CONVERT_TIME_4156, + CONVERT_TIME_8244, + CONVERT_TIME_NB +} PWRMON_ConvertTime_t; +/** + * @} + */ + +/** @defgroup PWRMON_Conversion_Time_enum Power Monitor Conversion_Time enums + * @{ + */ +typedef enum { + AVERAGING_MODE_1 = 0, + AVERAGING_MODE_4, + AVERAGING_MODE_16, + AVERAGING_MODE_64, + AVERAGING_MODE_128, + AVERAGING_MODE_256, + AVERAGING_MODE_512, + AVERAGING_MODE_1024, + AVERAGING_MODE_NB +} PWRMON_AveragingMode_t; +/** + * @} + */ + +/** @defgroup PWRMON_Device_Configuration_structure Power Monitor Device Configuration structure + * @{ + */ +typedef struct +{ + PWRMON_ConvertTime_t ShuntConvertTime; + PWRMON_ConvertTime_t BusConvertTime; + PWRMON_AveragingMode_t AveragingMode; +} PWRMON_Config_t; +/** + * @} + */ + +/** @defgroup PWRMON_Alert_Polarity_enum Power Monitor Alert Polarity enums + * @{ + */ +typedef enum { + ALERT_POLARITY_NORMAL = 0, + ALERT_POLARITY_INVERTED, + ALERT_POLARITY_NB +} PWRMON_AlertPolarity_t; +/** + * @} + */ + +/** @defgroup PWRMON_Alert_Latch_Enable_enum Power Monitor Alert Latch Enable enums + * @{ + */ +typedef enum { + ALERT_LATCH_DISABLE = 0, + ALERT_LATCH_ENABLE, + ALERT_LATCH_NB +} PWRMON_AlertLatchEnable_t; +/** + * @} + */ + +/** @defgroup PWRMON_Alert_Function_enum Power Monitor Alert Function enums + * @{ + */ +typedef enum { + ALERT_FUNCTION_NONE = 0, + ALERT_FUNCTION_SOL, + ALERT_FUNCTION_SUL, + ALERT_FUNCTION_BOL, + ALERT_FUNCTION_BUL, + ALERT_FUNCTION_POL, + ALERT_FUNCTION_NB, +} PWRMON_AlertFunction_t; +/** + * @} + */ + +/** @defgroup PWRMON_Alert_Configuration_structure Power Monitor Alert Configuration structure + * @{ + */ +typedef struct +{ + PWRMON_AlertPolarity_t Polarity; + PWRMON_AlertLatchEnable_t LatchEnable; +} PWRMON_AlertPinConfig_t; +/** + * @} + */ + +/** @defgroup PWRMON_Voltage_Input_enum Power Monitor Voltage Input enums + * @{ + */ +typedef enum { + VOLTAGE_INPUT_SHUNT = 0, + VOLTAGE_INPUT_BUS, + VOLTAGE_INPUT_ALL, + VOLTAGE_INPUT_NB +} PWRMON_InputSignal_t; +/** + * @} + */ + +/** @defgroup PWRMON_Flag_enum Power Monitor Flag enums + * @{ + */ +typedef enum { + FLAG_ALERT_FUNCTION = 0, + FLAG_CONVERSION_READY, + FLAG_MATH_OVERFLOW, + FLAG_NB +} PWRMON_Flag_t; +/** + * @} + */ + +/** @defgroup PWRMON_Driver_structure Power Monitor Driver structure + * @{ + */ +typedef struct +{ +void (*Init)(uint16_t, PWRMON_Config_t *); +void (*DeInit)(uint16_t); +uint16_t (*ReadId)(uint16_t); +void (*Reset)(uint16_t); +void (*SetCalibration)(uint16_t, uint16_t); +uint16_t (*GetCalibration)(uint16_t); +void (*SetAlertFunction)(uint16_t, PWRMON_AlertFunction_t); +PWRMON_AlertFunction_t (*GetAlertFunction)(uint16_t); +void (*AlertPinConfig)(uint16_t, PWRMON_AlertPinConfig_t *); +void (*SetVBusThreshold)(uint16_t, uint16_t); +uint16_t (*GetVBusThreshold)(uint16_t); +void (*SetVShuntThreshold)(uint16_t, int16_t); +int16_t (*GetVShuntThreshold)(uint16_t); +void (*SetPowerThreshold)(uint16_t, uint32_t); +uint32_t (*GetPowerThreshold)(uint16_t); +void (*AlertThresholdEnableIT)(uint16_t); +void (*AlertThresholdDisableIT)(uint16_t); +void (*ConversionReadyEnableIT)(uint16_t); +void (*ConversionReadyDisableIT)(uint16_t); +void (*StartConversion)(uint16_t, PWRMON_InputSignal_t, PWRMON_OperatingMode_t); +void (*StopConversion)(uint16_t); +uint16_t (*GetVBus)(uint16_t); +int16_t (*GetVShunt)(uint16_t); +uint16_t (*GetPower)(uint16_t); +int16_t (*GetCurrent)(uint16_t); +uint8_t (*GetFlag)(uint16_t, PWRMON_Flag_t); +} PWRMON_Drv_t; +/** + * @} + */ + +/** + * @} + */ + + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __PWRMON_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/ts.h b/Drivers/BSP/Components/Common/ts.h new file mode 100644 index 0000000..4dd82df --- /dev/null +++ b/Drivers/BSP/Components/Common/ts.h @@ -0,0 +1,89 @@ +/** + ****************************************************************************** + * @file ts.h + * @author MCD Application Team + * @brief This file contains all the functions prototypes for the Touch Screen driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __TS_H +#define __TS_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup TS + * @{ + */ + +/** @defgroup TS_Exported_Types + * @{ + */ + +/** @defgroup TS_Driver_structure Touch Sensor Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t); + uint16_t (*ReadID)(uint16_t); + void (*Reset)(uint16_t); + void (*Start)(uint16_t); + uint8_t (*DetectTouch)(uint16_t); + void (*GetXY)(uint16_t, uint16_t*, uint16_t*); + void (*EnableIT)(uint16_t); + void (*ClearIT)(uint16_t); + uint8_t (*GetITStatus)(uint16_t); + void (*DisableIT)(uint16_t); +}TS_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TS_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/tsensor.h b/Drivers/BSP/Components/Common/tsensor.h new file mode 100644 index 0000000..7d4807c --- /dev/null +++ b/Drivers/BSP/Components/Common/tsensor.h @@ -0,0 +1,100 @@ +/** + ****************************************************************************** + * @file tsensor.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * Temperature Sensor driver. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __TSENSOR_H +#define __TSENSOR_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup TSENSOR + * @{ + */ + +/** @defgroup TSENSOR_Exported_Types + * @{ + */ + +/** @defgroup TSENSOR_Config_structure Temperature Sensor Configuration structure + * @{ + */ +typedef struct +{ + uint8_t AlertMode; /* Alert Mode Temperature out of range*/ + uint8_t ConversionMode; /* Continuous/One Shot Mode */ + uint8_t ConversionResolution; /* Temperature Resolution */ + uint8_t ConversionRate; /* Number of measure per second */ + int8_t TemperatureLimitHigh; /* High Temperature Limit Range */ + int8_t TemperatureLimitLow; /* Low Temperature Limit Range */ +}TSENSOR_InitTypeDef; +/** + * @} + */ + +/** @defgroup TSENSOR_Driver_structure Temperature Sensor Driver structure + * @{ + */ +typedef struct +{ + void (*Init)(uint16_t, TSENSOR_InitTypeDef *); + uint8_t (*IsReady)(uint16_t, uint32_t); + uint8_t (*ReadStatus)(uint16_t); + float (*ReadTemp)(uint16_t); +}TSENSOR_DrvTypeDef; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TSENSOR_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/Common/usbtypecswitch.h b/Drivers/BSP/Components/Common/usbtypecswitch.h new file mode 100644 index 0000000..126cc4e --- /dev/null +++ b/Drivers/BSP/Components/Common/usbtypecswitch.h @@ -0,0 +1,114 @@ +/** + ****************************************************************************** + * @file usbtypecswitch.h + * @author MCD Application Team + * @brief This header file contains the functions prototypes for the + * crossbar switch device for USB Type-C systems. + ****************************************************************************** + * @attention + * + *

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

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __USBTYPECSWITCH_H +#define __USBTYPECSWITCH_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include + +/** @addtogroup BSP + * @{ + */ + +/** @addtogroup Components + * @{ + */ + +/** @addtogroup TYPECSWITCH + * @{ + */ + +/** @defgroup TYPECSWITCH_Exported_Types + * @{ + */ + typedef enum { + USB_NORMAL = 0, + USB_FLIPPED, + DFP_D_PIN_ASSIGNMENT_A_NORMAL, + DFP_D_PIN_ASSIGNMENT_A_FLIPPED, + DFP_D_PIN_ASSIGNMENT_B_NORMAL, + DFP_D_PIN_ASSIGNMENT_B_FLIPPED, + DFP_D_PIN_ASSIGNMENT_C_NORMAL, + DFP_D_PIN_ASSIGNMENT_C_FLIPPED, + DFP_D_PIN_ASSIGNMENT_D_NORMAL, + DFP_D_PIN_ASSIGNMENT_D_FLIPPED, + DFP_D_PIN_ASSIGNMENT_E_NORMAL, + DFP_D_PIN_ASSIGNMENT_E_FLIPPED, + DFP_D_PIN_ASSIGNMENT_F_NORMAL, + DFP_D_PIN_ASSIGNMENT_F_FLIPPED, + UFP_D_PIN_ASSIGNMENT_A_NORMAL, + UFP_D_PIN_ASSIGNMENT_A_FLIPPED, + UFP_D_PIN_ASSIGNMENT_B_NORMAL, + UFP_D_PIN_ASSIGNMENT_B_FLIPPED, + UFP_D_PIN_ASSIGNMENT_C_NORMAL, + UFP_D_PIN_ASSIGNMENT_C_FLIPPED, + UFP_D_PIN_ASSIGNMENT_D_NORMAL, + UFP_D_PIN_ASSIGNMENT_D_FLIPPED, + UFP_D_PIN_ASSIGNMENT_E_NORMAL, + UFP_D_PIN_ASSIGNMENT_E_FLIPPED, + UFP_D_PIN_ASSIGNMENT_F_NORMAL, + UFP_D_PIN_ASSIGNMENT_F_FLIPPED + } TYPECSWITCH_Mode_t; + +/** @defgroup TYPECSWITCH_Driver_structure USB Type-C Crossbar Switch Driver structure + * @{ + */ +typedef struct +{ + uint32_t (*Init)(uint16_t); + void (*DeInit)(uint16_t); + uint32_t (*PowerOn)(uint16_t); + uint32_t (*PowerOff)(uint16_t); + uint32_t (*SetMode)(uint16_t, TYPECSWITCH_Mode_t); + uint32_t (*IsSupportedMode)(TYPECSWITCH_Mode_t); +} TYPECSWITCH_Drv_t; +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __USBTYPECSWITCH_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/