diff --git a/.gitmodules b/.gitmodules index 93d7197..d1f79f6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,47 @@ path = Drivers/BSP/STM3210E_EVAL url = https://github.com/STMicroelectronics/stm3210e-eval-bsp.git branch = main +[submodule "Drivers/BSP/Components/Common"] + path = Drivers/BSP/Components/Common + url = https://github.com/STMicroelectronics/stm32-bsp-common.git + branch = main +[submodule "Drivers/BSP/Components/ak4343"] + path = Drivers/BSP/Components/ak4343 + url = https://github.com/STMicroelectronics/stm32-ak4343.git + branch = main +[submodule "Drivers/BSP/Components/cs43l22"] + path = Drivers/BSP/Components/cs43l22 + url = https://github.com/STMicroelectronics/stm32-cs43l22.git + branch = main +[submodule "Drivers/BSP/Components/hx8347d"] + path = Drivers/BSP/Components/hx8347d + url = https://github.com/STMicroelectronics/stm32-hx8347d.git + branch = main +[submodule "Drivers/BSP/Components/ili9320"] + path = Drivers/BSP/Components/ili9320 + url = https://github.com/STMicroelectronics/stm32-ili9320.git + branch = main +[submodule "Drivers/BSP/Components/ili9325"] + path = Drivers/BSP/Components/ili9325 + url = https://github.com/STMicroelectronics/stm32-ili9325.git + branch = main +[submodule "Drivers/BSP/Components/lis302dl"] + path = Drivers/BSP/Components/lis302dl + url = https://github.com/STMicroelectronics/stm32-lis302dl.git + branch = main +[submodule "Drivers/BSP/Components/spfd5408"] + path = Drivers/BSP/Components/spfd5408 + url = https://github.com/STMicroelectronics/stm32-spfd5408.git + branch = main +[submodule "Drivers/BSP/Components/st7735"] + path = Drivers/BSP/Components/st7735 + url = https://github.com/STMicroelectronics/stm32-st7735.git + branch = main +[submodule "Drivers/BSP/Components/stlm75"] + path = Drivers/BSP/Components/stlm75 + url = https://github.com/STMicroelectronics/stm32-stlm75.git + branch = main +[submodule "Drivers/BSP/Components/stmpe811"] + path = Drivers/BSP/Components/stmpe811 + url = https://github.com/STMicroelectronics/stm32-stmpe811.git + branch = main diff --git a/Drivers/BSP/Components/Common b/Drivers/BSP/Components/Common new file mode 160000 index 0000000..1e18c5a --- /dev/null +++ b/Drivers/BSP/Components/Common @@ -0,0 +1 @@ +Subproject commit 1e18c5afdf1f5971a35c8e2f88b6a21e5568ed92 diff --git a/Drivers/BSP/Components/Common/Release_Notes.html b/Drivers/BSP/Components/Common/Release_Notes.html deleted file mode 100644 index e173ae5..0000000 --- a/Drivers/BSP/Components/Common/Release_Notes.html +++ /dev/null @@ -1,759 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Release Notes for BSP Components Common Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
- -

Release -Notes for BSP Components Common  Drivers

- -

Copyright -2015 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

-

V4.0.1 / 21-July-2015

Main -Changes

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

V4.0.0 / 22-June-2015

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

V3.0.0 / 28-April-2015

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
    -
  • -

V2.2.0 / 09-February-2015

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

V2.1.0 / 06-February-2015

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

V2.0.0 / 15-December-2014

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

V1.2.1 / 02-December-2014

-

Main -Changes

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

V1.2.0 / 18-June-2014

Main -Changes

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

V1.1.0 / 21-March-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • Temperature Sensor driver function prototype added

V1.0.0 / 18-February-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • First official release with  Accelerometer, Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/Common/accelero.h b/Drivers/BSP/Components/Common/accelero.h deleted file mode 100644 index 0de8232..0000000 --- a/Drivers/BSP/Components/Common/accelero.h +++ /dev/null @@ -1,143 +0,0 @@ -/** - ****************************************************************************** - * @file accelero.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the functions prototypes for the Accelerometer driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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)(void); - 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 deleted file mode 100644 index 8b93673..0000000 --- a/Drivers/BSP/Components/Common/audio.h +++ /dev/null @@ -1,122 +0,0 @@ -/** - ****************************************************************************** - * @file audio.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the common defines and functions prototypes - * for the Audio driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index c64f32f..0000000 --- a/Drivers/BSP/Components/Common/camera.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - ****************************************************************************** - * @file camera.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the common defines and functions prototypes - * for the camera driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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/epd.h b/Drivers/BSP/Components/Common/epd.h deleted file mode 100644 index a06be10..0000000 --- a/Drivers/BSP/Components/Common/epd.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - ****************************************************************************** - * @file epd.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This file contains all the functions prototypes for the - * EPD (E Paper Display) driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index 462928c..0000000 --- a/Drivers/BSP/Components/Common/gyro.h +++ /dev/null @@ -1,145 +0,0 @@ -/** - ****************************************************************************** - * @file gyro.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the functions prototypes for the gyroscope driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - - -/* 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/idd.h b/Drivers/BSP/Components/Common/idd.h deleted file mode 100644 index 1b8a762..0000000 --- a/Drivers/BSP/Components/Common/idd.h +++ /dev/null @@ -1,168 +0,0 @@ -/** - ****************************************************************************** - * @file idd.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This file contains all the functions prototypes for the IDD driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index b33c00e..0000000 --- a/Drivers/BSP/Components/Common/io.h +++ /dev/null @@ -1,150 +0,0 @@ -/** - ****************************************************************************** - * @file io.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This file contains all the functions prototypes for the IO driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index 9ff398b..0000000 --- a/Drivers/BSP/Components/Common/lcd.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - ****************************************************************************** - * @file lcd.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This file contains all the functions prototypes for the LCD driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index dc27dd0..0000000 --- a/Drivers/BSP/Components/Common/magneto.h +++ /dev/null @@ -1,125 +0,0 @@ -/** - ****************************************************************************** - * @file magneto.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the functions prototypes for the MAGNETO driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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)(void); - 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/ts.h b/Drivers/BSP/Components/Common/ts.h deleted file mode 100644 index 7370596..0000000 --- a/Drivers/BSP/Components/Common/ts.h +++ /dev/null @@ -1,107 +0,0 @@ -/** - ****************************************************************************** - * @file ts.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This file contains all the functions prototypes for the Touch Screen driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 deleted file mode 100644 index 4ea0ffc..0000000 --- a/Drivers/BSP/Components/Common/tsensor.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - ****************************************************************************** - * @file tsensor.h - * @author MCD Application Team - * @version V4.0.1 - * @date 21-July-2015 - * @brief This header file contains the functions prototypes for the - * Temperature Sensor driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* 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 */ - uint8_t TemperatureLimitHigh; /* High Temperature Limit Range */ - uint8_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); - uint16_t (*ReadTemp)(uint16_t); -}TSENSOR_DrvTypeDef; -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __TSENSOR_H */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ak4343 b/Drivers/BSP/Components/ak4343 new file mode 160000 index 0000000..ca1d875 --- /dev/null +++ b/Drivers/BSP/Components/ak4343 @@ -0,0 +1 @@ +Subproject commit ca1d875d09049a161002efa8b07e4d8965aa7fd8 diff --git a/Drivers/BSP/Components/ak4343/Release_Notes.html b/Drivers/BSP/Components/ak4343/Release_Notes.html deleted file mode 100644 index c2a1942..0000000 --- a/Drivers/BSP/Components/ak4343/Release_Notes.html +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - - - - - - - - - - - - - - Release Notes for AK4343 Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for AK4343 Component Driver

-

Copyright -2016 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

-

V2.0.0 / 11-April-2016

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • ak4343.c: -
    • Align ak4343_drv with BSP Common driver V4.0.1 (Stub DeInit function)
  • NOTE: This release must be used with BSP Common -driver V4.0.1 or later

V1.0.0 / 18-February-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • First official release
  • -

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/ak4343/ak4343.c b/Drivers/BSP/Components/ak4343/ak4343.c deleted file mode 100644 index 02a007b..0000000 --- a/Drivers/BSP/Components/ak4343/ak4343.c +++ /dev/null @@ -1,504 +0,0 @@ -/** - ****************************************************************************** - * @file ak4343.c - * @author MCD Application Team - * @version V2.0.0 - * @date 11-April-2016 - * @brief This file provides the AK4343 Audio Codec driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2016 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "ak4343.h" - -/* Private variables ---------------------------------------------------------*/ - -/* Local variable to determine whether the audio Codec is driven by: */ -/* - I2S master clock: value different of "0", */ -/* equivalent to I2S_MCLKOUTPUT_ENABLE */ -/* - its own internal PLL from I2S_CK: value equal to "0", */ -/* equivalent to I2S_MCLKOUTPUT_DISABLE */ -uint8_t ak4343_i2s_mclk_output = 1; /* Default setting: master clock required */ - - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ak4343 - * @brief This file provides a set of functions needed to drive the - * CS43l22 audio codec. - * @{ - */ - -/** @defgroup AK4343_Private_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup AK4343_Private_Defines - * @{ - */ -/* Uncomment this line to enable verifying data sent to codec after each write - operation (for debug purpose) */ -#if !defined (VERIFY_WRITTENDATA) -/* #define VERIFY_WRITTENDATA */ -#endif /* VERIFY_WRITTENDATA */ -/** - * @} - */ - -/** @defgroup AK4343_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup AK4343_Private_Variables - * @{ - */ - -/* Audio codec driver structure initialization */ -AUDIO_DrvTypeDef ak4343_drv = -{ - ak4343_Init, - 0, /* On some other codec audio devices: DeInit */ - 0, /* On some other codec audio devices: ReadID */ - ak4343_Play, - ak4343_Pause, - ak4343_Resume, - ak4343_Stop, - 0, /* On some other codec audio devices: SetFrequency */ - ak4343_SetVolume, - ak4343_SetMute, - ak4343_SetOutputMode, - 0, /* On some other codec audio devices: Reset */ -}; - -static uint8_t Is_ak4343_Stop = 1; - -/** - * @} - */ - -/** @defgroup AK4343_Function_Prototypes - * @{ - */ -static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value); -/** - * @} - */ - -/** @defgroup AK4343_Private_Functions - * @{ - */ - -/** - * @brief Initializes the audio codec and the control interface. - * Note: I2S standard is fixed to standard Philips. - * @param DeviceAddr: Device address on communication Bus. - * @param OutputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, - * OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO . - * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max)) - * @param AudioFreq: Audio frequency used to play the audio stream. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) -{ - uint32_t counter = 0; - uint32_t Standard = 0; - uint32_t PLLMode =0; - - /* Initialize the Control interface of the Audio Codec */ - AUDIO_IO_Init(); - - /* I2S standard fixed to standard Philips */ - /* (Corresponding to I2S init parameter standard = I2S_STANDARD_PHILIPS) */ - Standard = AK4343_I2S_STANDARD_PHILIPS; - - /* PLL Slave SD/WS reference mode ----------------------*/ - if (ak4343_i2s_mclk_output == 0) /* I2S_MCLKOUTPUT_DISABLE */ - { - /* set the PLLMode variable */ - PLLMode = 0x1; - - /* Set I2S standard */ - counter += CODEC_IO_Write(DeviceAddr, 0x04, (Standard | 0x20)); - /* MCKI input frequency = 256.Fs */ - counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x03); - /* VCOM Power up (PMVCM bit)*/ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x40); - /* Enable PLL*/ - counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x01); - } - /* Ext Slave mode with no PLL --------------------------*/ - else - { - /* Reset the PLL mode variable */ - PLLMode = 0; - /* Set I2S standard */ - counter += CODEC_IO_Write(DeviceAddr, 0x04, Standard); - /* MCKI input frequency = 256.Fs */ - counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x00); - /* VCOM Power up (PMVCM bit)*/ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x40); - } - - - /* Left Channel Digital Volume control */ - counter += CODEC_IO_Write(DeviceAddr, 0x0A, VOLUME_CONVERT(Volume)); - /* Right Channel Digital Volume control */ - counter += CODEC_IO_Write(DeviceAddr, 0x0D, VOLUME_CONVERT(Volume)); - - /* Extra Configuration (of the ALC) */ - counter += CODEC_IO_Write(DeviceAddr, 0x06, 0x3C ); - counter += CODEC_IO_Write(DeviceAddr, 0x08, 0xE1 ); - counter += CODEC_IO_Write(DeviceAddr, 0x0B, 0x00 ); - counter += CODEC_IO_Write(DeviceAddr, 0x07, 0x20 ); - counter += CODEC_IO_Write(DeviceAddr, 0x09, 0xC1 ); - counter += CODEC_IO_Write(DeviceAddr, 0x0C, 0xC1 ); - - /* Uncomment these lines and set the correct filters values to use the */ - /* codec digital filters (for more details refer to the codec datasheet) */ - /* Filter 1 programming as High Pass filter (Fc=500Hz, Fs=8KHz, K=20, A=1, B=1) */ - /* - counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x80); - counter += CODEC_IO_Write(DeviceAddr, 0x1E, 0xA0); - counter += CODEC_IO_Write(DeviceAddr, 0x1F, 0x0B); - */ - /* Filter 3 programming as Low Pass filter (Fc=20KHz, Fs=8KHz, K=40, A=1, B=1) */ - /* - counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x00); - counter += CODEC_IO_Write(DeviceAddr, 0x1E, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x1F, 0x01); - */ - - /* Equilizer programming BP filter (Fc1=20Hz, Fc2=2.5KHz, Fs=44.1KHz, K=40, A=?, B=?, C=?) */ - /* - counter += CODEC_IO_Write(DeviceAddr, 0x16, 0x00); - counter += CODEC_IO_Write(DeviceAddr, 0x17, 0x75); - counter += CODEC_IO_Write(DeviceAddr, 0x18, 0x00); - counter += CODEC_IO_Write(DeviceAddr, 0x19, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x1A, 0x00); - counter += CODEC_IO_Write(DeviceAddr, 0x1B, 0x51); - */ - - - - /* HEADPHONE codec configuration */ - if ((OutputDevice & OUTPUT_DEVICE_HEADPHONE) != 0) - { - /* MCKI is 256.Fs with no PLL */ - counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x00 ); - /* Switch control from DAC to Headphone */ - counter += CODEC_IO_Write(DeviceAddr, 0x0F, 0x09 ); - /* Bass Boost and Demphasis enable */ - counter += CODEC_IO_Write(DeviceAddr, 0x0E, 0x18 ); - /* Power up MIN and DAC (PMMIN and PMDAC bits) */ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x74); - /* Enable Slave mode and Left/Right HP lines*/ - counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x30 | PLLMode)); - /* Exit HP mute mode */ - counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x70 | PLLMode)); - } - - /* SPEAKER codec configuration */ - if ((OutputDevice & OUTPUT_DEVICE_SPEAKER) != 0) - { - /* ReSelect the MCKI frequency (FS0-1 bits): 256.Fs */ - counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x02 ); - /* Set up the path "DAC->Speaker-Amp" with no power save (DACS and SPPSN bits) */ - counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x20 ); - /* Speaker Gain (SPKG0-1 bits): Gain=+10.65dB(ALC off)/+12.65(ALC on) */ - counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x10); - /* Power up Speaker and DAC (PMSPK and PMDAC bits) */ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x54); - /* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */ - counter += CODEC_IO_Write(DeviceAddr, 0x02, 0xA0 /*0xA1*/); - } - - /* Return communication control value */ - return counter; -} - -/** - * @brief Start the audio Codec play feature. - * @note For this codec no Play options are required. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size) -{ - uint32_t counter = 0; - - if(Is_ak4343_Stop == 1) - { - /* Enable Output device */ - counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_OFF); - - Is_ak4343_Stop = 0; - } - - /* Return communication control value */ - return counter; -} - -/** - * @brief Pauses playing on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_Pause(uint16_t DeviceAddr) -{ - uint32_t counter = 0; - - /* Pause the audio file playing */ - /* Mute the output first */ - counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_ON); - - return counter; -} - -/** - * @brief Resumes playing on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_Resume(uint16_t DeviceAddr) -{ - uint32_t counter = 0; - - /* Unmute the output */ - counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_OFF); - - return counter; -} - -/** - * @brief Stops audio Codec playing. It powers down the codec. - * @param DeviceAddr: Device address on communication Bus. - * @param CodecPdwnMode: selects the power down mode. - * - CODEC_PDWN_HW: Physically power down the codec. When resuming from this - * mode, the codec is set to default configuration - * (user should re-Initialize the codec in order to - * play again the audio stream). - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode) -{ - uint32_t counter = 0; - - /* Mute the output first */ - counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_ON); - - /* Power down the DAC and the speaker (PMDAC and PMSPK bits)*/ - counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x9F); - - Is_ak4343_Stop = 1; - return counter; -} - -/** - * @brief Sets higher or lower the codec volume level. - * @param DeviceAddr: Device address on communication Bus. - * @param Volume: a byte value from 0 to 255 (refer to codec registers - * description for more details). - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_SetVolume(uint16_t DeviceAddr, uint8_t Volume) -{ - uint32_t counter = 0; - uint8_t convertedvol = VOLUME_CONVERT(Volume); - - /* Left Channel Digital Volume control */ - counter += CODEC_IO_Write(DeviceAddr, 0x0A, convertedvol); - - /* Right Channel Digital Volume control */ - counter += CODEC_IO_Write(DeviceAddr, 0x0D, convertedvol); - - return counter; -} - -/** - * @brief Enables or disables the mute feature on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the - * mute mode. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_SetMute(uint16_t DeviceAddr, uint32_t Cmd) -{ - uint32_t counter = 0; - uint32_t tmp = 0; - - /* Read the current value of the config register number 0x0E */ - tmp = AUDIO_IO_Read(DeviceAddr, 0x0E); - - /* Set the Mute mode */ - if(Cmd == AUDIO_MUTE_ON) - { - counter += CODEC_IO_Write(DeviceAddr, 0x0E, (tmp | 0x20)); - } - else /* AUDIO_MUTE_OFF Disable the Mute */ - { - counter += CODEC_IO_Write(DeviceAddr, 0x0E, (tmp & 0xD1)); - } - return counter; -} - -/** - * @brief Switch dynamically (while audio file is played) the output target - * (speaker or headphone). - * @param DeviceAddr: Device address on communication Bus. - * @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER, - * OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH - * @retval 0 if correct communication, else wrong communication - */ -uint32_t ak4343_SetOutputMode(uint16_t DeviceAddr, uint8_t Output) -{ - uint32_t counter = 0; - uint32_t tmp_reg = 0; - - switch (Output) - { - case OUTPUT_DEVICE_SPEAKER: /* SPK always OFF & HP always ON */ - /* Turn-off headset */ - /* Disable Left/Right HP lines*/ - tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x01, tmp_reg &~ 0x70); - - /* Turn-on speaker */ - /* Power up Speaker and DAC (PMSPK and PMDAC bits) */ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x54); - /* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */ - counter += CODEC_IO_Write(DeviceAddr, 0x02, 0xA0 /*0xA1*/); - - break; - - case OUTPUT_DEVICE_HEADPHONE: /* SPK always ON & HP always OFF */ - /* Turn-on headset */ - /* Power up MIN and DAC (PMMIN and PMDAC bits) */ - counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x74); - /* Enable Slave mode and Left/Right HP lines*/ - counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x30 | 0x00)); - /* Exit HP mute mode */ - counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x70 | 0x00)); - - /* Turn-off speaker */ - /* Set up the path "DAC -> Speaker-Amp" with power save (SPPSN bit) */ - tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x02); - counter += CODEC_IO_Write(DeviceAddr, 0x02, tmp_reg &~ 0x80); - - break; - - default: - case OUTPUT_DEVICE_BOTH: /* SPK always ON & HP always ON */ - /* Turn-on headset */ - /* Enable Slave mode and Left/Right HP lines*/ - tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x01); - counter += CODEC_IO_Write(DeviceAddr, 0x01, tmp_reg | 0x70); - - /* Turn-on speaker */ - /* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */ - tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x02); - counter += CODEC_IO_Write(DeviceAddr, 0x02, tmp_reg | 0x80); - break; - - } - return counter; -} - -/** - * @brief Enables or disables the requirement of I2S master clock - * (supplied by I2S master device) - * @param I2S_MCLKOutput: I2S initialisation parameter "MCLKOutput" determines - * whether the audio Codec is driven by: - * - I2S master clock: value different of "0", - * equivalent to I2S_MCLKOUTPUT_ENABLE - * - its own internal PLL from I2S_CK: value equal to "0", - * equivalent to I2S_MCLKOUTPUT_DISABLE - * @retval None - */ -void ak4343_MCLKOutput(uint32_t I2S_MCLKOutput) -{ - /* Update private variable */ - ak4343_i2s_mclk_output = I2S_MCLKOutput; - -} - -/** - * @brief Writes/Read a single data. - * @param Addr: I2C address - * @param Reg: Reg address - * @param Value: Data to be written - * @retval None - */ -static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value) -{ - uint32_t result = 0; - - AUDIO_IO_Write(Addr, Reg, Value); - -#ifdef VERIFY_WRITTENDATA - /* Verify that the data has been correctly written */ - result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1; -#endif /* VERIFY_WRITTENDATA */ - - return result; -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ak4343/ak4343.h b/Drivers/BSP/Components/ak4343/ak4343.h deleted file mode 100644 index 1e12f03..0000000 --- a/Drivers/BSP/Components/ak4343/ak4343.h +++ /dev/null @@ -1,164 +0,0 @@ -/** - ****************************************************************************** - * @file ak4343.h - * @author MCD Application Team - * @version V2.0.0 - * @date 11-April-2016 - * @brief This file contains all the functions prototypes for the ak4343.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2016 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __AK4343_H -#define __AK4343_H - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/audio.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Component - * @{ - */ - -/** @addtogroup AK4343 - * @{ - */ - -/** @defgroup AK4343_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup AK4343_Exported_Constants - * @{ - */ - -/******************************************************************************/ -/*************************** Codec User defines ******************************/ -/******************************************************************************/ -/* Codec output DEVICE */ -#define OUTPUT_DEVICE_SPEAKER 0x01 -#define OUTPUT_DEVICE_HEADPHONE 0x02 -#define OUTPUT_DEVICE_BOTH (OUTPUT_DEVICE_SPEAKER | OUTPUT_DEVICE_HEADPHONE) - -/* Volume Levels values */ -#define DEFAULT_VOLMIN 0x00 -#define DEFAULT_VOLMAX 0xFF -#define DEFAULT_VOLSTEP 0x04 - -#define AUDIO_PAUSE 0 -#define AUDIO_RESUME 1 - -/* Codec POWER DOWN modes */ -#define CODEC_PDWN_HW 1 -#define CODEC_PDWN_SW 2 - -/* MUTE commands */ -#define AUDIO_MUTE_ON 1 -#define AUDIO_MUTE_OFF 0 - -/******************************************************************************/ -/****************************** REGISTER MAPPING ******************************/ -/******************************************************************************/ -/** - * @brief AK4343 registers definitions - */ -#define AK4343_MODE_CONTROL_1 0x04 - -#define AK4343_I2S_STANDARD_PHILIPS 0x03 -#define AK4343_I2S_STANDARD_MSB 0x02 -#define AK4343_I2S_STANDARD_LSB 0x01 - -/** - * @} - */ - -/** @defgroup AK4343_Exported_Macros - * @{ - */ -/* Conversion of volume from user scale [0:100] to audio codec AK4343 scale [255:0] */ -#define VOLUME_CONVERT(Volume) (((Volume) > 100) ? 255 : ((uint8_t)(255 - ((255*(Volume))/100)))) -/** - * @} - */ - -/** @defgroup AK4343_Exported_Functions - * @{ - */ - -/*------------------------------------------------------------------------------ - Audio Codec functions -------------------------------------------------------------------------------*/ -/* High Layer codec functions */ -uint32_t ak4343_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t I2S_MCLKOutput); - -uint32_t ak4343_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size); -uint32_t ak4343_Pause(uint16_t DeviceAddr); -uint32_t ak4343_Resume(uint16_t DeviceAddr); -uint32_t ak4343_Stop(uint16_t DeviceAddr, uint32_t Cmd); -uint32_t ak4343_SetVolume(uint16_t DeviceAddr, uint8_t Volume); -uint32_t ak4343_SetMute(uint16_t DeviceAddr, uint32_t Cmd); -uint32_t ak4343_SetOutputMode(uint16_t DeviceAddr, uint8_t Output); - -/* AUDIO IO functions */ -void AUDIO_IO_Init(void); -void ak4343_MCLKOutput(uint32_t I2S_MCLKOutput); -void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value); -uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg); - - -/* Audio driver structure */ -extern AUDIO_DrvTypeDef ak4343_drv; - -#endif /* __AK4343_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/cs43l22 b/Drivers/BSP/Components/cs43l22 new file mode 160000 index 0000000..7dfa7f8 --- /dev/null +++ b/Drivers/BSP/Components/cs43l22 @@ -0,0 +1 @@ +Subproject commit 7dfa7f82b9286fbcd7cec7f8129ac2439304cb01 diff --git a/Drivers/BSP/Components/cs43l22/Release_Notes.html b/Drivers/BSP/Components/cs43l22/Release_Notes.html deleted file mode 100644 index e70b212..0000000 --- a/Drivers/BSP/Components/cs43l22/Release_Notes.html +++ /dev/null @@ -1,659 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Release Notes for CS43L22 Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for CS43L22 Component Driver

-

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

-

V2.0.2 / 02-October-2015

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • cs43l22.c/.h: 
    • Move VOLUME_CONVERT macro from cs43l22.h to cs43l22.c as internally used to convert volume.
    • Add literals instead of magic number for cs34l22 registers.

V2.0.1 / 16-September-2015

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • cs43l22.c: 
    • Enable the digital soft ramp to avoid clac noise.
    • Improve mute/unmute by muting/unmuting also the DAC inputs. 

V2.0.0 / 24-June-2015

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • cs43l22.h/.c: 
    • Add codec de-initialization function: cs43l22_DeInit()
    • Add Audio IO de-initialization function prototype: AUDIO_IO_DeInit()
    • NOTE: This release must be used with BSP Common -driver V4.0.0 or later

V1.1.0 / 10-February-2015

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • cs43l22.h/.c: 
    • Add AUDIO_FREQUENCY_xxx defines for frequencies capabilities (8K to 192K)
    • Add codec reset function: cs43l22_Reset()

V1.0.1 / 02-December-2014

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • cs43l22.h: change "\" by "/" in the include path to fix compilation issue under Linux
  • -
- -

V1.0.0 / 18-February-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • First official release of CS43L22 audio codec  
  • -

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/cs43l22/cs43l22.c b/Drivers/BSP/Components/cs43l22/cs43l22.c deleted file mode 100644 index c54ad84..0000000 --- a/Drivers/BSP/Components/cs43l22/cs43l22.c +++ /dev/null @@ -1,494 +0,0 @@ -/** - ****************************************************************************** - * @file cs43l22.c - * @author MCD Application Team - * @version V2.0.2 - * @date 06-October-2015 - * @brief This file provides the CS43L22 Audio Codec driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "cs43l22.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup CS43L22 - * @brief This file provides a set of functions needed to drive the - * CS43L22 audio codec. - * @{ - */ - -/** @defgroup CS43L22_Private_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup CS43L22_Private_Defines - * @{ - */ -#define VOLUME_CONVERT(Volume) (((Volume) > 100)? 100:((uint8_t)(((Volume) * 255) / 100))) -/* Uncomment this line to enable verifying data sent to codec after each write - operation (for debug purpose) */ -#if !defined (VERIFY_WRITTENDATA) -/* #define VERIFY_WRITTENDATA */ -#endif /* VERIFY_WRITTENDATA */ -/** - * @} - */ - -/** @defgroup CS43L22_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup CS43L22_Private_Variables - * @{ - */ - -/* Audio codec driver structure initialization */ -AUDIO_DrvTypeDef cs43l22_drv = -{ - cs43l22_Init, - cs43l22_DeInit, - cs43l22_ReadID, - - cs43l22_Play, - cs43l22_Pause, - cs43l22_Resume, - cs43l22_Stop, - - cs43l22_SetFrequency, - cs43l22_SetVolume, - cs43l22_SetMute, - cs43l22_SetOutputMode, - cs43l22_Reset, -}; - -static uint8_t Is_cs43l22_Stop = 1; - -volatile uint8_t OutputDev = 0; - -/** - * @} - */ - -/** @defgroup CS43L22_Function_Prototypes - * @{ - */ -static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value); -/** - * @} - */ - -/** @defgroup CS43L22_Private_Functions - * @{ - */ - -/** - * @brief Initializes the audio codec and the control interface. - * @param DeviceAddr: Device address on communication Bus. - * @param OutputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE, - * OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO . - * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max)) - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq) -{ - uint32_t counter = 0; - - /* Initialize the Control interface of the Audio Codec */ - AUDIO_IO_Init(); - - /* Keep Codec powered OFF */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x01); - - /*Save Output device for mute ON/OFF procedure*/ - switch (OutputDevice) - { - case OUTPUT_DEVICE_SPEAKER: - OutputDev = 0xFA; - break; - - case OUTPUT_DEVICE_HEADPHONE: - OutputDev = 0xAF; - break; - - case OUTPUT_DEVICE_BOTH: - OutputDev = 0xAA; - break; - - case OUTPUT_DEVICE_AUTO: - OutputDev = 0x05; - break; - - default: - OutputDev = 0x05; - break; - } - - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev); - - /* Clock configuration: Auto detection */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_CLOCKING_CTL, 0x81); - - /* Set the Slave Mode and the audio Standard */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_INTERFACE_CTL1, CODEC_STANDARD); - - /* Set the Master volume */ - counter += cs43l22_SetVolume(DeviceAddr, Volume); - - /* If the Speaker is enabled, set the Mono mode and volume attenuation level */ - if(OutputDevice != OUTPUT_DEVICE_HEADPHONE) - { - /* Set the Speaker Mono mode */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PLAYBACK_CTL2, 0x06); - - /* Set the Speaker attenuation level */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_SPEAKER_A_VOL, 0x00); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_SPEAKER_B_VOL, 0x00); - } - - /* Additional configuration for the CODEC. These configurations are done to reduce - the time needed for the Codec to power off. If these configurations are removed, - then a long delay should be added between powering off the Codec and switching - off the I2S peripheral MCLK clock (which is the operating clock for Codec). - If this delay is not inserted, then the codec will not shut down properly and - it results in high noise after shut down. */ - - /* Disable the analog soft ramp */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_ANALOG_ZC_SR_SETT, 0x00); - /* Disable the digital soft ramp */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x04); - /* Disable the limiter attack level */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_LIMIT_CTL1, 0x00); - /* Adjust Bass and Treble levels */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_TONE_CTL, 0x0F); - /* Adjust PCM volume level */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PCMA_VOL, 0x0A); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_PCMB_VOL, 0x0A); - - /* Return communication control value */ - return counter; -} - -/** - * @brief Deinitializes the audio codec. - * @param None - * @retval None - */ -void cs43l22_DeInit(void) -{ - /* Deinitialize Audio Codec interface */ - AUDIO_IO_DeInit(); -} - -/** - * @brief Get the CS43L22 ID. - * @param DeviceAddr: Device address on communication Bus. - * @retval The CS43L22 ID - */ -uint32_t cs43l22_ReadID(uint16_t DeviceAddr) -{ - uint8_t Value; - /* Initialize the Control interface of the Audio Codec */ - AUDIO_IO_Init(); - - Value = AUDIO_IO_Read(DeviceAddr, CS43L22_CHIPID_ADDR); - Value = (Value & CS43L22_ID_MASK); - - return((uint32_t) Value); -} - -/** - * @brief Start the audio Codec play feature. - * @note For this codec no Play options are required. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size) -{ - uint32_t counter = 0; - - if(Is_cs43l22_Stop == 1) - { - /* Enable the digital soft ramp */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x06); - - /* Enable Output device */ - counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_OFF); - - /* Power on the Codec */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9E); - Is_cs43l22_Stop = 0; - } - - /* Return communication control value */ - return counter; -} - -/** - * @brief Pauses playing on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Pause(uint16_t DeviceAddr) -{ - uint32_t counter = 0; - - /* Pause the audio file playing */ - /* Mute the output first */ - counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_ON); - - /* Put the Codec in Power save mode */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x01); - - return counter; -} - -/** - * @brief Resumes playing on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Resume(uint16_t DeviceAddr) -{ - uint32_t counter = 0; - volatile uint32_t index = 0x00; - /* Resumes the audio file playing */ - /* Unmute the output first */ - counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_OFF); - - for(index = 0x00; index < 0xFF; index++); - - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev); - - /* Exit the Power save mode */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9E); - - return counter; -} - -/** - * @brief Stops audio Codec playing. It powers down the codec. - * @param DeviceAddr: Device address on communication Bus. - * @param CodecPdwnMode: selects the power down mode. - * - CODEC_PDWN_HW: Physically power down the codec. When resuming from this - * mode, the codec is set to default configuration - * (user should re-Initialize the codec in order to - * play again the audio stream). - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode) -{ - uint32_t counter = 0; - - /* Mute the output first */ - counter += cs43l22_SetMute(DeviceAddr, AUDIO_MUTE_ON); - - /* Disable the digital soft ramp */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MISC_CTL, 0x04); - - /* Power down the DAC and the speaker (PMDAC and PMSPK bits)*/ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL1, 0x9F); - - Is_cs43l22_Stop = 1; - return counter; -} - -/** - * @brief Sets higher or lower the codec volume level. - * @param DeviceAddr: Device address on communication Bus. - * @param Volume: a byte value from 0 to 255 (refer to codec registers - * description for more details). - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume) -{ - uint32_t counter = 0; - uint8_t convertedvol = VOLUME_CONVERT(Volume); - - if(Volume > 0xE6) - { - /* Set the Master volume */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_A_VOL, convertedvol - 0xE7); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_B_VOL, convertedvol - 0xE7); - } - else - { - /* Set the Master volume */ - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_A_VOL, convertedvol + 0x19); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_MASTER_B_VOL, convertedvol + 0x19); - } - - return counter; -} - -/** - * @brief Sets new frequency. - * @param DeviceAddr: Device address on communication Bus. - * @param AudioFreq: Audio frequency used to play the audio stream. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq) -{ - return 0; -} - -/** - * @brief Enables or disables the mute feature on the audio codec. - * @param DeviceAddr: Device address on communication Bus. - * @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the - * mute mode. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd) -{ - uint32_t counter = 0; - - /* Set the Mute mode */ - if(Cmd == AUDIO_MUTE_ON) - { - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xFF); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_A_VOL, 0x01); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_B_VOL, 0x01); - } - else /* AUDIO_MUTE_OFF Disable the Mute */ - { - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_A_VOL, 0x00); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_HEADPHONE_B_VOL, 0x00); - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, OutputDev); - } - return counter; -} - -/** - * @brief Switch dynamically (while audio file is played) the output target - * (speaker or headphone). - * @note This function modifies a global variable of the audio codec driver: OutputDev. - * @param DeviceAddr: Device address on communication Bus. - * @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER, - * OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output) -{ - uint32_t counter = 0; - - switch (Output) - { - case OUTPUT_DEVICE_SPEAKER: - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xFA); /* SPK always ON & HP always OFF */ - OutputDev = 0xFA; - break; - - case OUTPUT_DEVICE_HEADPHONE: - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xAF); /* SPK always OFF & HP always ON */ - OutputDev = 0xAF; - break; - - case OUTPUT_DEVICE_BOTH: - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0xAA); /* SPK always ON & HP always ON */ - OutputDev = 0xAA; - break; - - case OUTPUT_DEVICE_AUTO: - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - - default: - counter += CODEC_IO_Write(DeviceAddr, CS43L22_REG_POWER_CTL2, 0x05); /* Detect the HP or the SPK automatically */ - OutputDev = 0x05; - break; - } - return counter; -} - -/** - * @brief Resets cs43l22 registers. - * @param DeviceAddr: Device address on communication Bus. - * @retval 0 if correct communication, else wrong communication - */ -uint32_t cs43l22_Reset(uint16_t DeviceAddr) -{ - return 0; -} - -/** - * @brief Writes/Read a single data. - * @param Addr: I2C address - * @param Reg: Reg address - * @param Value: Data to be written - * @retval None - */ -static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value) -{ - uint32_t result = 0; - - AUDIO_IO_Write(Addr, Reg, Value); - -#ifdef VERIFY_WRITTENDATA - /* Verify that the data has been correctly written */ - result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1; -#endif /* VERIFY_WRITTENDATA */ - - return result; -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/cs43l22/cs43l22.h b/Drivers/BSP/Components/cs43l22/cs43l22.h deleted file mode 100644 index d178531..0000000 --- a/Drivers/BSP/Components/cs43l22/cs43l22.h +++ /dev/null @@ -1,228 +0,0 @@ -/** - ****************************************************************************** - * @file cs43l22.h - * @author MCD Application Team - * @version V2.0.2 - * @date 06-October-2015 - * @brief This file contains all the functions prototypes for the cs43l22.c driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __CS43L22_H -#define __CS43L22_H - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/audio.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Component - * @{ - */ - -/** @addtogroup CS43L22 - * @{ - */ - -/** @defgroup CS43L22_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup CS43L22_Exported_Constants - * @{ - */ - -/******************************************************************************/ -/*************************** Codec User defines ******************************/ -/******************************************************************************/ -/* Codec output DEVICE */ -#define OUTPUT_DEVICE_SPEAKER 1 -#define OUTPUT_DEVICE_HEADPHONE 2 -#define OUTPUT_DEVICE_BOTH 3 -#define OUTPUT_DEVICE_AUTO 4 - -/* Volume Levels values */ -#define DEFAULT_VOLMIN 0x00 -#define DEFAULT_VOLMAX 0xFF -#define DEFAULT_VOLSTEP 0x04 - -#define AUDIO_PAUSE 0 -#define AUDIO_RESUME 1 - -/* Codec POWER DOWN modes */ -#define CODEC_PDWN_HW 1 -#define CODEC_PDWN_SW 2 - -/* MUTE commands */ -#define AUDIO_MUTE_ON 1 -#define AUDIO_MUTE_OFF 0 - -/* AUDIO FREQUENCY */ -#define AUDIO_FREQUENCY_192K ((uint32_t)192000) -#define AUDIO_FREQUENCY_96K ((uint32_t)96000) -#define AUDIO_FREQUENCY_48K ((uint32_t)48000) -#define AUDIO_FREQUENCY_44K ((uint32_t)44100) -#define AUDIO_FREQUENCY_32K ((uint32_t)32000) -#define AUDIO_FREQUENCY_22K ((uint32_t)22050) -#define AUDIO_FREQUENCY_16K ((uint32_t)16000) -#define AUDIO_FREQUENCY_11K ((uint32_t)11025) -#define AUDIO_FREQUENCY_8K ((uint32_t)8000) - -/** CS43l22 Registers ***/ -#define CS43L22_REG_ID 0x01 -#define CS43L22_REG_POWER_CTL1 0x02 -#define CS43L22_REG_POWER_CTL2 0x04 -#define CS43L22_REG_CLOCKING_CTL 0x05 -#define CS43L22_REG_INTERFACE_CTL1 0x06 -#define CS43L22_REG_INTERFACE_CTL2 0x07 -#define CS43L22_REG_PASSTHR_A_SELECT 0x08 -#define CS43L22_REG_PASSTHR_B_SELECT 0x09 -#define CS43L22_REG_ANALOG_ZC_SR_SETT 0x0A -#define CS43L22_REG_PASSTHR_GANG_CTL 0x0C -#define CS43L22_REG_PLAYBACK_CTL1 0x0D -#define CS43L22_REG_MISC_CTL 0x0E -#define CS43L22_REG_PLAYBACK_CTL2 0x0F -#define CS43L22_REG_PASSTHR_A_VOL 0x14 -#define CS43L22_REG_PASSTHR_B_VOL 0x15 -#define CS43L22_REG_PCMA_VOL 0x1A -#define CS43L22_REG_PCMB_VOL 0x1B -#define CS43L22_REG_BEEP_FREQ_ON_TIME 0x1C -#define CS43L22_REG_BEEP_VOL_OFF_TIME 0x1D -#define CS43L22_REG_BEEP_TONE_CFG 0x1E -#define CS43L22_REG_TONE_CTL 0x1F -#define CS43L22_REG_MASTER_A_VOL 0x20 -#define CS43L22_REG_MASTER_B_VOL 0x21 -#define CS43L22_REG_HEADPHONE_A_VOL 0x22 -#define CS43L22_REG_HEADPHONE_B_VOL 0x23 -#define CS43L22_REG_SPEAKER_A_VOL 0x24 -#define CS43L22_REG_SPEAKER_B_VOL 0x25 -#define CS43L22_REG_CH_MIXER_SWAP 0x26 -#define CS43L22_REG_LIMIT_CTL1 0x27 -#define CS43L22_REG_LIMIT_CTL2 0x28 -#define CS43L22_REG_LIMIT_ATTACK_RATE 0x29 -#define CS43L22_REG_OVF_CLK_STATUS 0x2E -#define CS43L22_REG_BATT_COMPENSATION 0x2F -#define CS43L22_REG_VP_BATTERY_LEVEL 0x30 -#define CS43L22_REG_SPEAKER_STATUS 0x31 -#define CS43L22_REG_TEMPMONITOR_CTL 0x32 -#define CS43L22_REG_THERMAL_FOLDBACK 0x33 -#define CS43L22_REG_CHARGE_PUMP_FREQ 0x34 - -/******************************************************************************/ -/****************************** REGISTER MAPPING ******************************/ -/******************************************************************************/ -/** - * @brief CS43L22 ID - */ -#define CS43L22_ID 0xE0 -#define CS43L22_ID_MASK 0xF8 -/** - * @brief Chip ID Register: Chip I.D. and Revision Register - * Read only register - * Default value: 0x01 - * [7:3] CHIPID[4:0]: I.D. code for the CS43L22. - * Default value: 11100b - * [2:0] REVID[2:0]: CS43L22 revision level. - * Default value: - * 000 - Rev A0 - * 001 - Rev A1 - * 010 - Rev B0 - * 011 - Rev B1 - */ -#define CS43L22_CHIPID_ADDR 0x01 - -/** - * @} - */ - -/** @defgroup CS43L22_Exported_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup CS43L22_Exported_Functions - * @{ - */ - -/*------------------------------------------------------------------------------ - Audio Codec functions -------------------------------------------------------------------------------*/ -/* High Layer codec functions */ -uint32_t cs43l22_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq); -void cs43l22_DeInit(void); -uint32_t cs43l22_ReadID(uint16_t DeviceAddr); -uint32_t cs43l22_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size); -uint32_t cs43l22_Pause(uint16_t DeviceAddr); -uint32_t cs43l22_Resume(uint16_t DeviceAddr); -uint32_t cs43l22_Stop(uint16_t DeviceAddr, uint32_t Cmd); -uint32_t cs43l22_SetVolume(uint16_t DeviceAddr, uint8_t Volume); -uint32_t cs43l22_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq); -uint32_t cs43l22_SetMute(uint16_t DeviceAddr, uint32_t Cmd); -uint32_t cs43l22_SetOutputMode(uint16_t DeviceAddr, uint8_t Output); -uint32_t cs43l22_Reset(uint16_t DeviceAddr); - -/* AUDIO IO functions */ -void AUDIO_IO_Init(void); -void AUDIO_IO_DeInit(void); -void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value); -uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg); - -/* Audio driver structure */ -extern AUDIO_DrvTypeDef cs43l22_drv; - -#endif /* __CS43L22_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/hx8347d b/Drivers/BSP/Components/hx8347d new file mode 160000 index 0000000..c4af83e --- /dev/null +++ b/Drivers/BSP/Components/hx8347d @@ -0,0 +1 @@ +Subproject commit c4af83ef9605a14b0fbd2401bec36561c23128a1 diff --git a/Drivers/BSP/Components/hx8347d/Release_Notes.html b/Drivers/BSP/Components/hx8347d/Release_Notes.html deleted file mode 100644 index 93344b3..0000000 --- a/Drivers/BSP/Components/hx8347d/Release_Notes.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - Release Notes for STM32 BSP Components Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for HX8347D Component Driver

-

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -

Update History

V1.1.1 -/ 24-November-2014

-

Main -Changes

- - - - - - - - - -
  • hx8347d.h: change "\" by "/" in the include path to fix compilation issue with Linux

V1.1.0 / 11-July-2014 -

-

Main -Changes

-
  • Beta release of HX8347D LCD Component driver in order to harmonize all -LCD controllers Link usage (Change LCD_IO_WriteData to -LCD_IO_WriteMultipleData)

V1.0.0 -/ 06-May-2014

-

Main -Changes

- - - - - - - - - -
  • First official release of HX8347D LCD Component driver

License

-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-
For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32
-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/hx8347d/hx8347d.c b/Drivers/BSP/Components/hx8347d/hx8347d.c deleted file mode 100644 index a0b000e..0000000 --- a/Drivers/BSP/Components/hx8347d/hx8347d.c +++ /dev/null @@ -1,506 +0,0 @@ -/** - ****************************************************************************** - * @file hx8347d.c - * @author MCD Application Team - * @version V1.1.1 - * @date 24-November-2014 - * @brief This file includes the LCD driver for HX8347D LCD. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "hx8347d.h" - -/** @addtogroup BSP -* @{ -*/ - -/** @addtogroup Components -* @{ -*/ - -/** @addtogroup HX8347D -* @brief This file provides a set of functions needed to drive the -* HX8347D LCD. -* @{ -*/ - -/** @defgroup HX8347D_Private_TypesDefinitions -* @{ -*/ - -/** -* @} -*/ - -/** @defgroup HX8347D_Private_Defines -* @{ -*/ - -/** -* @} -*/ - -/** @defgroup HX8347D_Private_Macros -* @{ -*/ - -/** -* @} -*/ - -/** @defgroup HX8347D_Private_Variables -* @{ -*/ -LCD_DrvTypeDef hx8347d_drv = -{ - hx8347d_Init, - hx8347d_ReadID, - hx8347d_DisplayOn, - hx8347d_DisplayOff, - hx8347d_SetCursor, - hx8347d_WritePixel, - hx8347d_ReadPixel, - hx8347d_SetDisplayWindow, - hx8347d_DrawHLine, - hx8347d_DrawVLine, - hx8347d_GetLcdPixelWidth, - hx8347d_GetLcdPixelHeight, - hx8347d_DrawBitmap, -}; - -static uint8_t Is_hx8347d_Initialized = 0; -static uint16_t ArrayRGB[320] = {0}; - - -/** -* @} -*/ - -/** @defgroup HX8347D_Private_FunctionPrototypes -* @{ -*/ - -/** -* @} -*/ - -/** @defgroup HX8347D_Private_Functions -* @{ -*/ - -/** -* @brief Initialise the HX8347D LCD Component. -* @param None -* @retval None -*/ -void hx8347d_Init(void) -{ - if(Is_hx8347d_Initialized == 0) - { - Is_hx8347d_Initialized = 1; - /* Initialise HX8347D low level bus layer --------------------------------*/ - LCD_IO_Init(); - - /* Driving ability setting */ - hx8347d_WriteReg(LCD_REG_234, 0x00); - hx8347d_WriteReg(LCD_REG_235, 0x20); - hx8347d_WriteReg(LCD_REG_236, 0x0C); - hx8347d_WriteReg(LCD_REG_237, 0xC4); - hx8347d_WriteReg(LCD_REG_232, 0x40); - hx8347d_WriteReg(LCD_REG_233, 0x38); - hx8347d_WriteReg(LCD_REG_241, 0x01); - hx8347d_WriteReg(LCD_REG_242, 0x10); - hx8347d_WriteReg(LCD_REG_39, 0xA3); - - /* Adjust the Gamma Curve */ - hx8347d_WriteReg(LCD_REG_64, 0x01); - hx8347d_WriteReg(LCD_REG_65, 0x00); - hx8347d_WriteReg(LCD_REG_66, 0x00); - hx8347d_WriteReg(LCD_REG_67, 0x10); - hx8347d_WriteReg(LCD_REG_68, 0x0E); - hx8347d_WriteReg(LCD_REG_69, 0x24); - hx8347d_WriteReg(LCD_REG_70, 0x04); - hx8347d_WriteReg(LCD_REG_71, 0x50); - hx8347d_WriteReg(LCD_REG_72, 0x02); - hx8347d_WriteReg(LCD_REG_73, 0x13); - hx8347d_WriteReg(LCD_REG_74, 0x19); - hx8347d_WriteReg(LCD_REG_75, 0x19); - hx8347d_WriteReg(LCD_REG_76, 0x16); - hx8347d_WriteReg(LCD_REG_80, 0x1B); - hx8347d_WriteReg(LCD_REG_81, 0x31); - hx8347d_WriteReg(LCD_REG_82, 0x2F); - hx8347d_WriteReg(LCD_REG_83, 0x3F); - hx8347d_WriteReg(LCD_REG_84, 0x3F); - hx8347d_WriteReg(LCD_REG_85, 0x3E); - hx8347d_WriteReg(LCD_REG_86, 0x2F); - hx8347d_WriteReg(LCD_REG_87, 0x7B); - hx8347d_WriteReg(LCD_REG_88, 0x09); - hx8347d_WriteReg(LCD_REG_89, 0x06); - hx8347d_WriteReg(LCD_REG_90, 0x06); - hx8347d_WriteReg(LCD_REG_91, 0x0C); - hx8347d_WriteReg(LCD_REG_92, 0x1D); - hx8347d_WriteReg(LCD_REG_93, 0xCC); - - /* Power voltage setting */ - hx8347d_WriteReg(LCD_REG_27, 0x1B); - hx8347d_WriteReg(LCD_REG_26, 0x01); - hx8347d_WriteReg(LCD_REG_36, 0x2F); - hx8347d_WriteReg(LCD_REG_37, 0x57); - /*****VCOM offset ****/ - hx8347d_WriteReg(LCD_REG_35, 0x86); - - /* Power on setting up flow */ - hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */ - hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */ - hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */ - hx8347d_WriteReg(LCD_REG_29, 0x06); /* AP[2:0] = 111 */ - hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/ - hx8347d_WriteReg(LCD_REG_39, 1); /* REF = 1 */ - - LCD_Delay(10); - /* 262k/65k color selection */ - hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */ - /* SET PANEL */ - hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */ - - /* Display ON flow */ - hx8347d_WriteReg(LCD_REG_40, 0x38); /* GON=1, DTE=1, D=10 */ - LCD_Delay(60); - hx8347d_WriteReg(LCD_REG_40, 0x3C); /* GON=1, DTE=1, D=11 */ - - /* Set GRAM Area - Partial Display Control */ - hx8347d_WriteReg(LCD_REG_1, 0x00); /* DP_STB = 0, DP_STB_S = 0, SCROLL = 0, */ - hx8347d_WriteReg(LCD_REG_2, 0x00); /* Column address start 2 */ - hx8347d_WriteReg(LCD_REG_3, 0x00); /* Column address start 1 */ - hx8347d_WriteReg(LCD_REG_4, 0x01); /* Column address end 2 */ - hx8347d_WriteReg(LCD_REG_5, 0x3F); /* Column address end 1 */ - hx8347d_WriteReg(LCD_REG_6, 0x00); /* Row address start 2 */ - hx8347d_WriteReg(LCD_REG_7, 0x00); /* Row address start 2 */ - hx8347d_WriteReg(LCD_REG_8, 0x00); /* Row address end 2 */ - hx8347d_WriteReg(LCD_REG_9, 0xEF); /* Row address end 1 */ - hx8347d_WriteReg(LCD_REG_22, 0xE0); /* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */ - } - /* Set the Cursor */ - hx8347d_SetCursor(0, 0); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); -} - -/** -* @brief Enables the Display. -* @param None -* @retval None -*/ -void hx8347d_DisplayOn(void) -{ - /* Power On sequence ---------------------------------------------------------*/ - hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */ - hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */ - hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */ - hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/ - LCD_Delay(10); - /* 262k/65k color selection */ - hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */ - /* SET PANEL */ - hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */ - - /* Display On */ - hx8347d_WriteReg(LCD_REG_40, 0x38); - LCD_Delay(60); - hx8347d_WriteReg(LCD_REG_40, 0x3C); -} - -/** -* @brief Disables the Display. -* @param None -* @retval None -*/ -void hx8347d_DisplayOff(void) -{ - /* Power Off sequence ---------------------------------------------------------*/ - hx8347d_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */ - hx8347d_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */ - hx8347d_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */ - hx8347d_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */ - hx8347d_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/ - hx8347d_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */ - - /* Display Off */ - hx8347d_WriteReg(LCD_REG_40, 0x38); - LCD_Delay(60); - hx8347d_WriteReg(LCD_REG_40, 0x04); -} - -/** -* @brief Get the LCD pixel Width. -* @param None -* @retval The Lcd Pixel Width -*/ -uint16_t hx8347d_GetLcdPixelWidth(void) -{ - return (uint16_t)HX8347D_LCD_PIXEL_WIDTH; -} - -/** -* @brief Get the LCD pixel Height. -* @param None -* @retval The Lcd Pixel Height -*/ -uint16_t hx8347d_GetLcdPixelHeight(void) -{ - return (uint16_t)HX8347D_LCD_PIXEL_HEIGHT; -} - -/** -* @brief Get the HX8347D ID. -* @param None -* @retval The HX8347D ID -*/ -uint16_t hx8347d_ReadID(void) -{ - if(Is_hx8347d_Initialized == 0) - { - hx8347d_Init(); - Is_hx8347d_Initialized = 1; - } - return (hx8347d_ReadReg(0x00)); -} - -/** -* @brief Set Cursor position. -* @param Xpos: specifies the X position. -* @param Ypos: specifies the Y position. -* @retval None -*/ -void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - hx8347d_WriteReg(LCD_REG_6, 0x00); - hx8347d_WriteReg(LCD_REG_7, Xpos); - hx8347d_WriteReg(LCD_REG_2, Ypos >> 8); - hx8347d_WriteReg(LCD_REG_3, Ypos & 0xFF); -} - -/** -* @brief Write pixel. -* @param Xpos: specifies the X position. -* @param Ypos: specifies the Y position. -* @param RGBCode: the RGB pixel color -* @retval None -*/ -void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode) -{ - /* Set Cursor */ - hx8347d_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2); -} - -/** -* @brief Read pixel. -* @param None -* @retval the RGB pixel color -*/ -uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos) -{ - /* Set Cursor */ - hx8347d_SetCursor(Xpos, Ypos); - - /* Dummy read */ - LCD_IO_ReadData(LCD_REG_34); - - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCD_REG_34)); -} - -/** -* @brief Writes to the selected LCD register. -* @param LCDReg: address of the selected register. -* @param LCDRegValue: value to write to the selected register. -* @retval None -*/ -void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue) -{ - LCD_IO_WriteReg(LCDReg); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2); -} - -/** -* @brief Reads the selected LCD Register. -* @param LCDReg: address of the selected register. -* @retval LCD Register Value. -*/ -uint16_t hx8347d_ReadReg(uint8_t LCDReg) -{ - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCDReg)); -} - -/** -* @brief Sets a display window -* @param Xpos: specifies the X bottom left position. -* @param Ypos: specifies the Y bottom left position. -* @param Height: display window height. -* @param Width: display window width. -* @retval None -*/ -void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - /* Horizontal GRAM Start Address */ - hx8347d_WriteReg(LCD_REG_6, (Xpos) >> 8); /* SP */ - hx8347d_WriteReg(LCD_REG_7, (Xpos) & 0xFF); /* SP */ - - /* Horizontal GRAM End Address */ - hx8347d_WriteReg(LCD_REG_8, (Xpos + Height - 1) >> 8); /* EP */ - hx8347d_WriteReg(LCD_REG_9, (Xpos + Height - 1) & 0xFF); /* EP */ - - /* Vertical GRAM Start Address */ - hx8347d_WriteReg(LCD_REG_2, (Ypos) >> 8); /* SC */ - hx8347d_WriteReg(LCD_REG_3, (Ypos) & 0xFF); /* SC */ - - /* Vertical GRAM End Address */ - hx8347d_WriteReg(LCD_REG_4, (Ypos + Width - 1) >> 8); /* EC */ - hx8347d_WriteReg(LCD_REG_5, (Ypos + Width - 1) & 0xFF); /* EC */ -} - -/** -* @brief Draw vertical line. -* @param RGBCode: Specifies the RGB color -* @param Xpos: specifies the X position. -* @param Ypos: specifies the Y position. -* @param Length: specifies the Line length. -* @retval None -*/ -void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint32_t i = 0; - - /* Set Cursor */ - hx8347d_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - - /* Sent a complete line */ - for(i = 0; i < Length; i++) - { - ArrayRGB[i] = RGBCode; - } - - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** -* @brief Draw vertical line. -* @param RGBCode: Specifies the RGB color -* @param Xpos: specifies the X position. -* @param Ypos: specifies the Y position. -* @param Length: specifies the Line length. -* @retval None -*/ -void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* Set Cursor */ - hx8347d_SetCursor(Xpos, Ypos); - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Fill a complete vertical line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** -* @brief Displays a bitmap picture loaded in the internal Flash. -* @param BmpAddress: Bmp picture address in the internal Flash. -* @retval None -*/ -void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp) -{ - uint32_t index = 0, size = 0; - - /* Read bitmap size */ - size = *(volatile uint16_t *) (pbmp + 2); - size |= (*(volatile uint16_t *) (pbmp + 4)) << 16; - /* Get bitmap data address offset */ - index = *(volatile uint16_t *) (pbmp + 10); - index |= (*(volatile uint16_t *) (pbmp + 12)) << 16; - size = (size - index)/2; - pbmp += index; - - /* Set GRAM write direction and BGR = 0 */ - /* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */ - hx8347d_WriteReg(LCD_REG_22, 0xA0); - - /* Set Cursor */ - hx8347d_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2); - - /* Set GRAM write direction and BGR = 0 */ - /* Memory access control: MY = 1, MX = 1, MV = 1, ML = 0 */ - hx8347d_WriteReg(LCD_REG_22, 0xE0); -} - -/** -* @} -*/ - -/** -* @} -*/ - -/** -* @} -*/ - -/** -* @} -*/ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/hx8347d/hx8347d.h b/Drivers/BSP/Components/hx8347d/hx8347d.h deleted file mode 100644 index ee85284..0000000 --- a/Drivers/BSP/Components/hx8347d/hx8347d.h +++ /dev/null @@ -1,278 +0,0 @@ -/** - ****************************************************************************** - * @file hx8347d.h - * @author MCD Application Team - * @version V1.1.1 - * @date 24-November-2014 - * @brief This file contains all the functions prototypes for the hx8347d.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __HX8347D_H -#define __HX8347D_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/lcd.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup HX8347D - * @{ - */ - -/** @defgroup HX8347D_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup HX8347D_Exported_Constants - * @{ - */ -/** - * @brief HX8347D ID - */ -#define HX8347D_ID 0x0047 - -/** - * @brief HX8347D Size - */ -#define HX8347D_LCD_PIXEL_WIDTH ((uint16_t)320) -#define HX8347D_LCD_PIXEL_HEIGHT ((uint16_t)240) - -/** - * @brief HX8347D Registers - */ -#define LCD_REG_0 0x00 -#define LCD_REG_1 0x01 -#define LCD_REG_2 0x02 -#define LCD_REG_3 0x03 -#define LCD_REG_4 0x04 -#define LCD_REG_5 0x05 -#define LCD_REG_6 0x06 -#define LCD_REG_7 0x07 -#define LCD_REG_8 0x08 -#define LCD_REG_9 0x09 -#define LCD_REG_10 0x0A -#define LCD_REG_12 0x0C -#define LCD_REG_13 0x0D -#define LCD_REG_14 0x0E -#define LCD_REG_15 0x0F -#define LCD_REG_16 0x10 -#define LCD_REG_17 0x11 -#define LCD_REG_18 0x12 -#define LCD_REG_19 0x13 -#define LCD_REG_20 0x14 -#define LCD_REG_21 0x15 -#define LCD_REG_22 0x16 -#define LCD_REG_23 0x17 -#define LCD_REG_24 0x18 -#define LCD_REG_25 0x19 -#define LCD_REG_26 0x1A -#define LCD_REG_27 0x1B -#define LCD_REG_28 0x1C -#define LCD_REG_29 0x1D -#define LCD_REG_30 0x1E -#define LCD_REG_31 0x1F -#define LCD_REG_32 0x20 -#define LCD_REG_33 0x21 -#define LCD_REG_34 0x22 -#define LCD_REG_35 0x23 -#define LCD_REG_36 0x24 -#define LCD_REG_37 0x25 -#define LCD_REG_39 0x27 -#define LCD_REG_40 0x28 -#define LCD_REG_41 0x29 -#define LCD_REG_43 0x2B -#define LCD_REG_45 0x2D -#define LCD_REG_48 0x30 -#define LCD_REG_49 0x31 -#define LCD_REG_50 0x32 -#define LCD_REG_51 0x33 -#define LCD_REG_52 0x34 -#define LCD_REG_53 0x35 -#define LCD_REG_54 0x36 -#define LCD_REG_55 0x37 -#define LCD_REG_56 0x38 -#define LCD_REG_57 0x39 -#define LCD_REG_59 0x3B -#define LCD_REG_60 0x3C -#define LCD_REG_61 0x3D -#define LCD_REG_62 0x3E -#define LCD_REG_63 0x3F -#define LCD_REG_64 0x40 -#define LCD_REG_65 0x41 -#define LCD_REG_66 0x42 -#define LCD_REG_67 0x43 -#define LCD_REG_68 0x44 -#define LCD_REG_69 0x45 -#define LCD_REG_70 0x46 -#define LCD_REG_71 0x47 -#define LCD_REG_72 0x48 -#define LCD_REG_73 0x49 -#define LCD_REG_74 0x4A -#define LCD_REG_75 0x4B -#define LCD_REG_76 0x4C -#define LCD_REG_77 0x4D -#define LCD_REG_78 0x4E -#define LCD_REG_79 0x4F -#define LCD_REG_80 0x50 -#define LCD_REG_81 0x51 -#define LCD_REG_82 0x52 -#define LCD_REG_83 0x53 -#define LCD_REG_84 0x54 -#define LCD_REG_85 0x55 -#define LCD_REG_86 0x56 -#define LCD_REG_87 0x57 -#define LCD_REG_88 0x58 -#define LCD_REG_89 0x59 -#define LCD_REG_90 0x5A -#define LCD_REG_91 0x5B -#define LCD_REG_92 0x5C -#define LCD_REG_93 0x5D -#define LCD_REG_96 0x60 -#define LCD_REG_97 0x61 -#define LCD_REG_106 0x6A -#define LCD_REG_118 0x76 -#define LCD_REG_128 0x80 -#define LCD_REG_129 0x81 -#define LCD_REG_130 0x82 -#define LCD_REG_131 0x83 -#define LCD_REG_132 0x84 -#define LCD_REG_133 0x85 -#define LCD_REG_134 0x86 -#define LCD_REG_135 0x87 -#define LCD_REG_136 0x88 -#define LCD_REG_137 0x89 -#define LCD_REG_139 0x8B -#define LCD_REG_140 0x8C -#define LCD_REG_141 0x8D -#define LCD_REG_143 0x8F -#define LCD_REG_144 0x90 -#define LCD_REG_145 0x91 -#define LCD_REG_146 0x92 -#define LCD_REG_147 0x93 -#define LCD_REG_148 0x94 -#define LCD_REG_149 0x95 -#define LCD_REG_150 0x96 -#define LCD_REG_151 0x97 -#define LCD_REG_152 0x98 -#define LCD_REG_153 0x99 -#define LCD_REG_154 0x9A -#define LCD_REG_157 0x9D -#define LCD_REG_192 0xC0 -#define LCD_REG_193 0xC1 -#define LCD_REG_227 0xE3 -#define LCD_REG_229 0xE5 -#define LCD_REG_231 0xE7 -#define LCD_REG_239 0xEF -#define LCD_REG_232 0xE8 -#define LCD_REG_233 0xE9 -#define LCD_REG_234 0xEA -#define LCD_REG_235 0xEB -#define LCD_REG_236 0xEC -#define LCD_REG_237 0xED -#define LCD_REG_241 0xF1 -#define LCD_REG_242 0xF2 - -/** - * @} - */ - -/** @defgroup HX8347D_Exported_Functions - * @{ - */ -void hx8347d_Init(void); -uint16_t hx8347d_ReadID(void); -void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue); -uint16_t hx8347d_ReadReg(uint8_t LCDReg); - -void hx8347d_DisplayOn(void); -void hx8347d_DisplayOff(void); -void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos); -void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode); -uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos); - -void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp); - -void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); - - -uint16_t hx8347d_GetLcdPixelWidth(void); -uint16_t hx8347d_GetLcdPixelHeight(void); - -/* LCD driver structure */ -extern LCD_DrvTypeDef hx8347d_drv; - -/* LCD IO functions */ -void LCD_IO_Init(void); -void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size); -void LCD_IO_WriteReg(uint8_t Reg); -uint16_t LCD_IO_ReadData(uint16_t Reg); -void LCD_Delay (uint32_t delay); -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __HX8347D_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ili9320 b/Drivers/BSP/Components/ili9320 new file mode 160000 index 0000000..7a844fe --- /dev/null +++ b/Drivers/BSP/Components/ili9320 @@ -0,0 +1 @@ +Subproject commit 7a844fe9fca8eb3ace5c773a59afd556610fd86c diff --git a/Drivers/BSP/Components/ili9320/Release_Notes.html b/Drivers/BSP/Components/ili9320/Release_Notes.html deleted file mode 100644 index 083ba60..0000000 --- a/Drivers/BSP/Components/ili9320/Release_Notes.html +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - - - - - - - - - - - - - - Release Notes for ILI9320 Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for ILI9320 Component Driver

-

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

V1.2.2 / 02-December-2014

- - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Official Final Release for Linux compilation compliancy
     ili9320.h : change "\" by "/" in the include path to fix compilation issue under Linux

V1.2.1 / 10-November-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Official Final Release for LCD Controllers harmonization
     Replace LCD_IO_WriteData by LCD_IO_WriteMultipleData to be compliant with SPI interface
     Warning : break compatibility with old BSP common files - done for STM3210C-EVAL board 

V1.1.1 / 5-September-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Official Final Release for LCD Controllers harmonization

V1.1.0 / 11-July-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Beta Release to change the usage of LCD_IO_ReadData

V1.0.0 / 13-March-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      First official release

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/ili9320/ili9320.c b/Drivers/BSP/Components/ili9320/ili9320.c deleted file mode 100644 index 4ba6ffa..0000000 --- a/Drivers/BSP/Components/ili9320/ili9320.c +++ /dev/null @@ -1,534 +0,0 @@ -/** - ****************************************************************************** - * @file ili9320.c - * @author MCD Application Team - * @version V1.2.2 - * @date 02-December-2014 - * @brief This file includes the LCD driver for ILI9320 LCD. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "ili9320.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ili9320 - * @brief This file provides a set of functions needed to drive the - * ILI9320 LCD. - * @{ - */ - -/** @defgroup ILI9320_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9320_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9320_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9320_Private_Variables - * @{ - */ -LCD_DrvTypeDef ili9320_drv = -{ - ili9320_Init, - ili9320_ReadID, - ili9320_DisplayOn, - ili9320_DisplayOff, - ili9320_SetCursor, - ili9320_WritePixel, - ili9320_ReadPixel, - ili9320_SetDisplayWindow, - ili9320_DrawHLine, - ili9320_DrawVLine, - ili9320_GetLcdPixelWidth, - ili9320_GetLcdPixelHeight, - ili9320_DrawBitmap, - ili9320_DrawRGBImage, -}; - -static uint8_t Is_ili9320_Initialized = 0; -static uint16_t ArrayRGB[320] = {0}; - -/** - * @} - */ - -/** @defgroup ILI9320_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9320_Private_Functions - * @{ - */ - -/** - * @brief Initialise the ILI9320 LCD Component. - * @param None - * @retval None - */ -void ili9320_Init(void) -{ - if(Is_ili9320_Initialized == 0) - { - Is_ili9320_Initialized = 1; - /* Initialise ILI9320 low level bus layer --------------------------------*/ - LCD_IO_Init(); - - /* Start Initial Sequence ------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_229,0x8000); /* Set the internal vcore voltage */ - ili9320_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */ - ili9320_WriteReg(LCD_REG_1, 0x0100); /* set SS and SM bit */ - ili9320_WriteReg(LCD_REG_2, 0x0700); /* set 1 line inversion */ - ili9320_WriteReg(LCD_REG_3, 0x1030); /* set GRAM write direction and BGR=1. */ - ili9320_WriteReg(LCD_REG_4, 0x0000); /* Resize register */ - ili9320_WriteReg(LCD_REG_8, 0x0202); /* set the back porch and front porch */ - ili9320_WriteReg(LCD_REG_9, 0x0000); /* set non-display area refresh cycle ISC[3:0] */ - ili9320_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */ - ili9320_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */ - ili9320_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */ - ili9320_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */ - - /* Power On sequence -----------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */ - - ili9320_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9320_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - - ili9320_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - - ili9320_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - ili9320_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - - ili9320_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */ - ili9320_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */ - - /* Adjust the Gamma Curve ------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_48, 0x0007); - ili9320_WriteReg(LCD_REG_49, 0x0007); - ili9320_WriteReg(LCD_REG_50, 0x0007); - ili9320_WriteReg(LCD_REG_53, 0x0007); - ili9320_WriteReg(LCD_REG_54, 0x0007); - ili9320_WriteReg(LCD_REG_55, 0x0700); - ili9320_WriteReg(LCD_REG_56, 0x0700); - ili9320_WriteReg(LCD_REG_57, 0x0700); - ili9320_WriteReg(LCD_REG_60, 0x0700); - ili9320_WriteReg(LCD_REG_61, 0x1F00); - - /* Set GRAM area ---------------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */ - ili9320_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */ - ili9320_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */ - ili9320_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */ - ili9320_WriteReg(LCD_REG_96, 0x2700); /* Gate Scan Line */ - ili9320_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */ - ili9320_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */ - - /* Partial Display Control -----------------------------------------------*/ - ili9320_WriteReg(LCD_REG_128, 0x0000); - ili9320_WriteReg(LCD_REG_129, 0x0000); - ili9320_WriteReg(LCD_REG_130, 0x0000); - ili9320_WriteReg(LCD_REG_131, 0x0000); - ili9320_WriteReg(LCD_REG_132, 0x0000); - ili9320_WriteReg(LCD_REG_133, 0x0000); - - /* Panel Control ---------------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_144, 0x0010); - ili9320_WriteReg(LCD_REG_146, 0x0000); - ili9320_WriteReg(LCD_REG_147, 0x0003); - ili9320_WriteReg(LCD_REG_149, 0x0110); - ili9320_WriteReg(LCD_REG_151, 0x0000); - ili9320_WriteReg(LCD_REG_152, 0x0000); - - /* Set GRAM write direction and BGR = 1 */ - /* I/D=01 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9320_WriteReg(LCD_REG_3, 0x1018); - - ili9320_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ - } - - /* Set the Cursor */ - ili9320_SetCursor(0, 0); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); -} - -/** - * @brief Enables the Display. - * @param None - * @retval None - */ -void ili9320_DisplayOn(void) -{ - /* Power On sequence ---------------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/ - - ili9320_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9320_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - - ili9320_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - - ili9320_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - ili9320_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - - /* Display On */ - ili9320_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ -} - -/** - * @brief Disables the Display. - * @param None - * @retval None - */ -void ili9320_DisplayOff(void) -{ - /* Power Off sequence ---------------------------------------------------------*/ - ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/ - - ili9320_WriteReg(LCD_REG_41, 0x0000); /* VCM[4:0] for VCOMH */ - - /* Display Off */ - ili9320_WriteReg(LCD_REG_7, 0x0); -} - -/** - * @brief Get the LCD pixel Width. - * @param None - * @retval The Lcd Pixel Width - */ -uint16_t ili9320_GetLcdPixelWidth(void) -{ - return (uint16_t)320; -} - -/** - * @brief Get the LCD pixel Height. - * @param None - * @retval The Lcd Pixel Height - */ -uint16_t ili9320_GetLcdPixelHeight(void) -{ - return (uint16_t)240; -} - -/** - * @brief Get the ILI9320 ID. - * @param None - * @retval The ILI9320 ID - */ -uint16_t ili9320_ReadID(void) -{ - if(Is_ili9320_Initialized == 0) - { - ili9320_Init(); - } - return (ili9320_ReadReg(0x00)); -} - -/** - * @brief Set Cursor position. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @retval None - */ -void ili9320_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - ili9320_WriteReg(LCD_REG_32, Ypos); - ili9320_WriteReg(LCD_REG_33, (ILI9320_LCD_PIXEL_WIDTH - 1 - Xpos)); -} - -/** - * @brief Write pixel. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param RGBCode: the RGB pixel color - * @retval None - */ -void ili9320_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode) -{ - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2); -} - -/** - * @brief Read pixel. - * @param None - * @retval the RGB pixel color - */ -uint16_t ili9320_ReadPixel(uint16_t Xpos, uint16_t Ypos) -{ - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Dummy read */ - LCD_IO_ReadData(0x00); - - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(0x00)); -} - -/** - * @brief Writes to the selected LCD register. - * @param LCDReg: address of the selected register. - * @param LCDRegValue: value to write to the selected register. - * @retval None - */ -void ili9320_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue) -{ - LCD_IO_WriteReg(LCDReg); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2); -} - -/** - * @brief Reads the selected LCD Register. - * @param LCDReg: address of the selected register. - * @retval LCD Register Value. - */ -uint16_t ili9320_ReadReg(uint8_t LCDReg) -{ - /* Write 16-bit Index (then Read Reg) */ - LCD_IO_WriteReg(LCDReg); - - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(0x00)); -} - -/** - * @brief Sets a display window - * @param Xpos: specifies the X bottom left position. - * @param Ypos: specifies the Y bottom left position. - * @param Height: display window height. - * @param Width: display window width. - * @retval None - */ -void ili9320_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - /* Horizontal GRAM Start Address */ - ili9320_WriteReg(LCD_REG_80, (Ypos)); - /* Horizontal GRAM End Address */ - ili9320_WriteReg(LCD_REG_81, (Ypos + Height - 1)); - - /* Vertical GRAM Start Address */ - ili9320_WriteReg(LCD_REG_82, ILI9320_LCD_PIXEL_WIDTH - Xpos - Width); - /* Vertical GRAM End Address */ - ili9320_WriteReg(LCD_REG_83, ILI9320_LCD_PIXEL_WIDTH - Xpos - 1); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void ili9320_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Sent a complete line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void ili9320_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9320_WriteReg(LCD_REG_3, 0x1010); - - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Fill a complete vertical line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9320_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays a bitmap picture.. - * @param BmpAddress: Bmp picture address. - * @param Xpos: Bmp X position in the LCD - * @param Ypos: Bmp Y position in the LCD - * @retval None - */ -void ili9320_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp) -{ - uint32_t index = 0, size = 0; - /* Read bitmap size */ - size = *(volatile uint16_t *) (pbmp + 2); - size |= (*(volatile uint16_t *) (pbmp + 4)) << 16; - /* Get bitmap data address offset */ - index = *(volatile uint16_t *) (pbmp + 10); - index |= (*(volatile uint16_t *) (pbmp + 12)) << 16; - size = (size - index)/2; - pbmp += index; - /* Set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : decrement, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9320_WriteReg(LCD_REG_3, 0x1008); - - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2); - - /* Set GRAM write direction and BGR = 1 */ - /* I/D = 01 (Horizontal : increment, Vertical : decrement) */ - /* AM = 1 (address is updated in vertical writing direction) */ - ili9320_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays picture.. - * @param pdata: picture address. - * @param Xpos: Image X position in the LCD - * @param Ypos: Image Y position in the LCD - * @param Xsize: Image X size in the LCD - * @param Ysize: Image Y size in the LCD - * @retval None - */ -void ili9320_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata) -{ - uint32_t size = 0; - - size = (Xsize * Ysize); - - /* Set Cursor */ - ili9320_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pdata, size*2); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ili9320/ili9320.h b/Drivers/BSP/Components/ili9320/ili9320.h deleted file mode 100644 index 0f1652c..0000000 --- a/Drivers/BSP/Components/ili9320/ili9320.h +++ /dev/null @@ -1,256 +0,0 @@ -/** - ****************************************************************************** - * @file ili9320.h - * @author MCD Application Team - * @version V1.2.2 - * @date 02-December-2014 - * @brief This file contains all the functions prototypes for the ili9320.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __ILI9320_H -#define __ILI9320_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/lcd.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ili9320 - * @{ - */ - -/** @defgroup ILI9320_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9320_Exported_Constants - * @{ - */ -/** - * @brief ILI9320 ID - */ -#define ILI9320_ID 0x9320 - -/** - * @brief ILI9320 Size - */ -#define ILI9320_LCD_PIXEL_WIDTH ((uint16_t)320) -#define ILI9320_LCD_PIXEL_HEIGHT ((uint16_t)240) - -/** - * @brief ILI9320 Registers - */ -#define LCD_REG_0 0x00 -#define LCD_REG_1 0x01 -#define LCD_REG_2 0x02 -#define LCD_REG_3 0x03 -#define LCD_REG_4 0x04 -#define LCD_REG_5 0x05 -#define LCD_REG_6 0x06 -#define LCD_REG_7 0x07 -#define LCD_REG_8 0x08 -#define LCD_REG_9 0x09 -#define LCD_REG_10 0x0A -#define LCD_REG_12 0x0C -#define LCD_REG_13 0x0D -#define LCD_REG_14 0x0E -#define LCD_REG_15 0x0F -#define LCD_REG_16 0x10 -#define LCD_REG_17 0x11 -#define LCD_REG_18 0x12 -#define LCD_REG_19 0x13 -#define LCD_REG_20 0x14 -#define LCD_REG_21 0x15 -#define LCD_REG_22 0x16 -#define LCD_REG_23 0x17 -#define LCD_REG_24 0x18 -#define LCD_REG_25 0x19 -#define LCD_REG_26 0x1A -#define LCD_REG_27 0x1B -#define LCD_REG_28 0x1C -#define LCD_REG_29 0x1D -#define LCD_REG_30 0x1E -#define LCD_REG_31 0x1F -#define LCD_REG_32 0x20 -#define LCD_REG_33 0x21 -#define LCD_REG_34 0x22 -#define LCD_REG_36 0x24 -#define LCD_REG_37 0x25 -#define LCD_REG_40 0x28 -#define LCD_REG_41 0x29 -#define LCD_REG_43 0x2B -#define LCD_REG_45 0x2D -#define LCD_REG_48 0x30 -#define LCD_REG_49 0x31 -#define LCD_REG_50 0x32 -#define LCD_REG_51 0x33 -#define LCD_REG_52 0x34 -#define LCD_REG_53 0x35 -#define LCD_REG_54 0x36 -#define LCD_REG_55 0x37 -#define LCD_REG_56 0x38 -#define LCD_REG_57 0x39 -#define LCD_REG_58 0x3A -#define LCD_REG_59 0x3B -#define LCD_REG_60 0x3C -#define LCD_REG_61 0x3D -#define LCD_REG_62 0x3E -#define LCD_REG_63 0x3F -#define LCD_REG_64 0x40 -#define LCD_REG_65 0x41 -#define LCD_REG_66 0x42 -#define LCD_REG_67 0x43 -#define LCD_REG_68 0x44 -#define LCD_REG_69 0x45 -#define LCD_REG_70 0x46 -#define LCD_REG_71 0x47 -#define LCD_REG_72 0x48 -#define LCD_REG_73 0x49 -#define LCD_REG_74 0x4A -#define LCD_REG_75 0x4B -#define LCD_REG_76 0x4C -#define LCD_REG_77 0x4D -#define LCD_REG_78 0x4E -#define LCD_REG_79 0x4F -#define LCD_REG_80 0x50 -#define LCD_REG_81 0x51 -#define LCD_REG_82 0x52 -#define LCD_REG_83 0x53 -#define LCD_REG_96 0x60 -#define LCD_REG_97 0x61 -#define LCD_REG_106 0x6A -#define LCD_REG_118 0x76 -#define LCD_REG_128 0x80 -#define LCD_REG_129 0x81 -#define LCD_REG_130 0x82 -#define LCD_REG_131 0x83 -#define LCD_REG_132 0x84 -#define LCD_REG_133 0x85 -#define LCD_REG_134 0x86 -#define LCD_REG_135 0x87 -#define LCD_REG_136 0x88 -#define LCD_REG_137 0x89 -#define LCD_REG_139 0x8B -#define LCD_REG_140 0x8C -#define LCD_REG_141 0x8D -#define LCD_REG_143 0x8F -#define LCD_REG_144 0x90 -#define LCD_REG_145 0x91 -#define LCD_REG_146 0x92 -#define LCD_REG_147 0x93 -#define LCD_REG_148 0x94 -#define LCD_REG_149 0x95 -#define LCD_REG_150 0x96 -#define LCD_REG_151 0x97 -#define LCD_REG_152 0x98 -#define LCD_REG_153 0x99 -#define LCD_REG_154 0x9A -#define LCD_REG_157 0x9D -#define LCD_REG_192 0xC0 -#define LCD_REG_193 0xC1 -#define LCD_REG_229 0xE5 -/** - * @} - */ - -/** @defgroup ILI9320_Exported_Functions - * @{ - */ -void ili9320_Init(void); -uint16_t ili9320_ReadID(void); -void ili9320_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue); -uint16_t ili9320_ReadReg(uint8_t LCDReg); - -void ili9320_DisplayOn(void); -void ili9320_DisplayOff(void); -void ili9320_SetCursor(uint16_t Xpos, uint16_t Ypos); -void ili9320_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code); -uint16_t ili9320_ReadPixel(uint16_t Xpos, uint16_t Ypos); - -void ili9320_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void ili9320_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void ili9320_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp); -void ili9320_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata); - -void ili9320_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); - - -uint16_t ili9320_GetLcdPixelWidth(void); -uint16_t ili9320_GetLcdPixelHeight(void); - -/* LCD driver structure */ -extern LCD_DrvTypeDef ili9320_drv; - -/* LCD IO functions */ -void LCD_IO_Init(void); -void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size); -void LCD_IO_WriteReg(uint8_t Reg); -uint16_t LCD_IO_ReadData(uint16_t Reg); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ILI9320_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ili9325 b/Drivers/BSP/Components/ili9325 new file mode 160000 index 0000000..29e24e2 --- /dev/null +++ b/Drivers/BSP/Components/ili9325 @@ -0,0 +1 @@ +Subproject commit 29e24e2114f926b04f29b576311a575a5a4e34b2 diff --git a/Drivers/BSP/Components/ili9325/Release_Notes.html b/Drivers/BSP/Components/ili9325/Release_Notes.html deleted file mode 100644 index d3dc2b3..0000000 --- a/Drivers/BSP/Components/ili9325/Release_Notes.html +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Release Notes for ILI9325 BSP Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for ILI9325 Component Driver

-

Copyright -2016 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

-

V1.2.3 / 03-May-2016

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • ili9325.c: alignment with BSP STM32446E_EVAL  V1.1.2 and BSP STM324xG_EVAL V2.2.2
    • Update ili9325_ReadPixel() and ili9325_ReadReg() to support the new LCD_IO_ReadData() API

V1.2.2 / 02-December-2014

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • ili9325.h: change "\" by "/" in the include path to fix compilation issue under Linux
  • -
-

V1.2.1 / 10-November-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Official Final Release for LCD Controllers harmonization
     Replace LCD_IO_WriteData() by LCD_IO_WriteMultipleData() to be compliant with SPI interface
     Warning : break compatibility with old BSP common files - done for STM3210C-EVAL board 

V1.1.1 / 5-September-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Final Official Release for LCD Controller harmonization

V1.1.0 / 11-July-2014

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      Beta Release to change the usage of LCD_IO_ReadData -

V1.0.1 / 19-June-2014

- - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • Align driver with the STM32Cube BSP architecture by removing check for initialization in ili9325_Init() 
    -
  • Initializes -only the LCD IO in read ID APIs instead of all initialization sequence -and remove the check for initialization in ili9325_ReadID() function
  • Comments clean up and typo corrections
- -

V1.0.0 / 18-February-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • First official release

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- \ No newline at end of file diff --git a/Drivers/BSP/Components/ili9325/ili9325.c b/Drivers/BSP/Components/ili9325/ili9325.c deleted file mode 100644 index 449510f..0000000 --- a/Drivers/BSP/Components/ili9325/ili9325.c +++ /dev/null @@ -1,518 +0,0 @@ -/** - ****************************************************************************** - * @file ili9325.c - * @author MCD Application Team - * @version V1.2.3 - * @date 03-May-2016 - * @brief This file includes the LCD driver for ILI9325 LCD. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2016 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "ili9325.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ili9325 - * @brief This file provides a set of functions needed to drive the - * ILI9325 LCD. - * @{ - */ - -/** @defgroup ILI9325_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9325_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9325_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9325_Private_Variables - * @{ - */ -LCD_DrvTypeDef ili9325_drv = -{ - ili9325_Init, - ili9325_ReadID, - ili9325_DisplayOn, - ili9325_DisplayOff, - ili9325_SetCursor, - ili9325_WritePixel, - ili9325_ReadPixel, - ili9325_SetDisplayWindow, - ili9325_DrawHLine, - ili9325_DrawVLine, - ili9325_GetLcdPixelWidth, - ili9325_GetLcdPixelHeight, - ili9325_DrawBitmap, - ili9325_DrawRGBImage, -}; - -static uint16_t ArrayRGB[320] = {0}; -/** - * @} - */ - -/** @defgroup ILI9325_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9325_Private_Functions - * @{ - */ - -/** - * @brief Initialize the ILI9325 LCD Component. - * @param None - * @retval None - */ -void ili9325_Init(void) -{ - /* Initialize ILI9325 low level bus layer ----------------------------------*/ - LCD_IO_Init(); - - /* Start Initial Sequence --------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */ - ili9325_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */ - ili9325_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */ - ili9325_WriteReg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */ - ili9325_WriteReg(LCD_REG_4, 0x0000); /* Resize register */ - ili9325_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */ - ili9325_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */ - ili9325_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */ - ili9325_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */ - ili9325_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */ - ili9325_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */ - - /* Power On sequence -------------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */ - - ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - - ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - - ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - - ili9325_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */ - ili9325_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */ - - /* Adjust the Gamma Curve (ILI9325) ----------------------------------------*/ - ili9325_WriteReg(LCD_REG_48, 0x0007); - ili9325_WriteReg(LCD_REG_49, 0x0302); - ili9325_WriteReg(LCD_REG_50, 0x0105); - ili9325_WriteReg(LCD_REG_53, 0x0206); - ili9325_WriteReg(LCD_REG_54, 0x0808); - ili9325_WriteReg(LCD_REG_55, 0x0206); - ili9325_WriteReg(LCD_REG_56, 0x0504); - ili9325_WriteReg(LCD_REG_57, 0x0007); - ili9325_WriteReg(LCD_REG_60, 0x0105); - ili9325_WriteReg(LCD_REG_61, 0x0808); - - /* Set GRAM area -----------------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */ - ili9325_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */ - ili9325_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */ - ili9325_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */ - - ili9325_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */ - ili9325_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */ - ili9325_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */ - - /* Partial Display Control -------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_128, 0x0000); - ili9325_WriteReg(LCD_REG_129, 0x0000); - ili9325_WriteReg(LCD_REG_130, 0x0000); - ili9325_WriteReg(LCD_REG_131, 0x0000); - ili9325_WriteReg(LCD_REG_132, 0x0000); - ili9325_WriteReg(LCD_REG_133, 0x0000); - - /* Panel Control -----------------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_144, 0x0010); - ili9325_WriteReg(LCD_REG_146, 0x0000); - ili9325_WriteReg(LCD_REG_147, 0x0003); - ili9325_WriteReg(LCD_REG_149, 0x0110); - ili9325_WriteReg(LCD_REG_151, 0x0000); - ili9325_WriteReg(LCD_REG_152, 0x0000); - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9325_WriteReg(LCD_REG_3, 0x1018); - - /* 262K color and display ON */ - ili9325_WriteReg(LCD_REG_7, 0x0173); - - /* Set the Cursor */ - ili9325_SetCursor(0, 0); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); -} - -/** - * @brief Enables the Display. - * @param None - * @retval None - */ -void ili9325_DisplayOn(void) -{ - /* Power On sequence -------------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/ - - ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */ - - ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */ - - ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */ - ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */ - - /* Display On */ - ili9325_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */ -} - -/** - * @brief Disables the Display. - * @param None - * @retval None - */ -void ili9325_DisplayOff(void) -{ - /* Power Off sequence ------------------------------------------------------*/ - ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/ - - ili9325_WriteReg(LCD_REG_41, 0x0000); /* VCM[4:0] for VCOMH */ - - /* Display Off */ - ili9325_WriteReg(LCD_REG_7, 0x0); -} - -/** - * @brief Get the LCD pixel Width. - * @param None - * @retval The Lcd Pixel Width - */ -uint16_t ili9325_GetLcdPixelWidth(void) -{ - return (uint16_t)320; -} - -/** - * @brief Get the LCD pixel Height. - * @param None - * @retval The Lcd Pixel Height - */ -uint16_t ili9325_GetLcdPixelHeight(void) -{ - return (uint16_t)240; -} - -/** - * @brief Get the ILI9325 ID. - * @param None - * @retval The ILI9325 ID - */ -uint16_t ili9325_ReadID(void) -{ - LCD_IO_Init(); - return (ili9325_ReadReg(0x00)); -} - -/** - * @brief Set Cursor position. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @retval None - */ -void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - ili9325_WriteReg(LCD_REG_32, Ypos); - ili9325_WriteReg(LCD_REG_33, (ILI9325_LCD_PIXEL_WIDTH - 1 - Xpos)); -} - -/** - * @brief Write pixel. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param RGBCode: the RGB pixel color - * @retval None - */ -void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode) -{ - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2); -} - -/** - * @brief Read pixel. - * @param None - * @retval The RGB pixel color - */ -uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos) -{ - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCD_REG_34)); -} - -/** - * @brief Writes to the selected LCD register. - * @param LCDReg: Address of the selected register. - * @param LCDRegValue: Value to write to the selected register. - * @retval None - */ -void ili9325_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue) -{ - LCD_IO_WriteReg(LCDReg); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2); -} - -/** - * @brief Reads the selected LCD Register. - * @param LCDReg: address of the selected register. - * @retval LCD Register Value. - */ -uint16_t ili9325_ReadReg(uint8_t LCDReg) -{ - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCDReg)); -} - -/** - * @brief Sets a display window - * @param Xpos: specifies the X bottom left position. - * @param Ypos: specifies the Y bottom left position. - * @param Height: display window height. - * @param Width: display window width. - * @retval None - */ -void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - /* Horizontal GRAM Start Address */ - ili9325_WriteReg(LCD_REG_80, (Ypos)); - /* Horizontal GRAM End Address */ - ili9325_WriteReg(LCD_REG_81, (Ypos + Height - 1)); - - /* Vertical GRAM Start Address */ - ili9325_WriteReg(LCD_REG_82, ILI9325_LCD_PIXEL_WIDTH - Xpos - Width); - /* Vertical GRAM End Address */ - ili9325_WriteReg(LCD_REG_83, ILI9325_LCD_PIXEL_WIDTH - Xpos - 1); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Sent a complete line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9325_WriteReg(LCD_REG_3, 0x1010); - - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Fill a complete vertical line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9325_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays a bitmap picture. - * @param BmpAddress: Bmp picture address. - * @param Xpos: Bmp X position in the LCD - * @param Ypos: Bmp Y position in the LCD - * @retval None - */ -void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp) -{ - uint32_t index = 0, size = 0; - /* Read bitmap size */ - size = *(volatile uint16_t *) (pbmp + 2); - size |= (*(volatile uint16_t *) (pbmp + 4)) << 16; - /* Get bitmap data address offset */ - index = *(volatile uint16_t *) (pbmp + 10); - index |= (*(volatile uint16_t *) (pbmp + 12)) << 16; - size = (size - index)/2; - pbmp += index; - /* Set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : decrement, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - ili9325_WriteReg(LCD_REG_3, 0x1008); - - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2); - - /* Set GRAM write direction and BGR = 1 */ - /* I/D = 01 (Horizontal : increment, Vertical : decrement) */ - /* AM = 1 (address is updated in vertical writing direction) */ - ili9325_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays picture. - * @param pdata: picture address. - * @param Xpos: Image X position in the LCD - * @param Ypos: Image Y position in the LCD - * @param Xsize: Image X size in the LCD - * @param Ysize: Image Y size in the LCD - * @retval None - */ -void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata) -{ - uint32_t size = 0; - - size = (Xsize * Ysize); - - /* Set Cursor */ - ili9325_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pdata, size*2); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/ili9325/ili9325.h b/Drivers/BSP/Components/ili9325/ili9325.h deleted file mode 100644 index 1ffba52..0000000 --- a/Drivers/BSP/Components/ili9325/ili9325.h +++ /dev/null @@ -1,256 +0,0 @@ -/** - ****************************************************************************** - * @file ili9325.h - * @author MCD Application Team - * @version V1.2.3 - * @date 04-May-2016 - * @brief This file contains all the functions prototypes for the ili9325.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2016 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __ILI9325_H -#define __ILI9325_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/lcd.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ili9325 - * @{ - */ - -/** @defgroup ILI9325_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup ILI9325_Exported_Constants - * @{ - */ -/** - * @brief ILI9325 ID - */ -#define ILI9325_ID 0x9325 - -/** - * @brief ILI9325 Size - */ -#define ILI9325_LCD_PIXEL_WIDTH ((uint16_t)320) -#define ILI9325_LCD_PIXEL_HEIGHT ((uint16_t)240) - -/** - * @brief ILI9325 Registers - */ -#define LCD_REG_0 0x00 -#define LCD_REG_1 0x01 -#define LCD_REG_2 0x02 -#define LCD_REG_3 0x03 -#define LCD_REG_4 0x04 -#define LCD_REG_5 0x05 -#define LCD_REG_6 0x06 -#define LCD_REG_7 0x07 -#define LCD_REG_8 0x08 -#define LCD_REG_9 0x09 -#define LCD_REG_10 0x0A -#define LCD_REG_12 0x0C -#define LCD_REG_13 0x0D -#define LCD_REG_14 0x0E -#define LCD_REG_15 0x0F -#define LCD_REG_16 0x10 -#define LCD_REG_17 0x11 -#define LCD_REG_18 0x12 -#define LCD_REG_19 0x13 -#define LCD_REG_20 0x14 -#define LCD_REG_21 0x15 -#define LCD_REG_22 0x16 -#define LCD_REG_23 0x17 -#define LCD_REG_24 0x18 -#define LCD_REG_25 0x19 -#define LCD_REG_26 0x1A -#define LCD_REG_27 0x1B -#define LCD_REG_28 0x1C -#define LCD_REG_29 0x1D -#define LCD_REG_30 0x1E -#define LCD_REG_31 0x1F -#define LCD_REG_32 0x20 -#define LCD_REG_33 0x21 -#define LCD_REG_34 0x22 -#define LCD_REG_36 0x24 -#define LCD_REG_37 0x25 -#define LCD_REG_40 0x28 -#define LCD_REG_41 0x29 -#define LCD_REG_43 0x2B -#define LCD_REG_45 0x2D -#define LCD_REG_48 0x30 -#define LCD_REG_49 0x31 -#define LCD_REG_50 0x32 -#define LCD_REG_51 0x33 -#define LCD_REG_52 0x34 -#define LCD_REG_53 0x35 -#define LCD_REG_54 0x36 -#define LCD_REG_55 0x37 -#define LCD_REG_56 0x38 -#define LCD_REG_57 0x39 -#define LCD_REG_58 0x3A -#define LCD_REG_59 0x3B -#define LCD_REG_60 0x3C -#define LCD_REG_61 0x3D -#define LCD_REG_62 0x3E -#define LCD_REG_63 0x3F -#define LCD_REG_64 0x40 -#define LCD_REG_65 0x41 -#define LCD_REG_66 0x42 -#define LCD_REG_67 0x43 -#define LCD_REG_68 0x44 -#define LCD_REG_69 0x45 -#define LCD_REG_70 0x46 -#define LCD_REG_71 0x47 -#define LCD_REG_72 0x48 -#define LCD_REG_73 0x49 -#define LCD_REG_74 0x4A -#define LCD_REG_75 0x4B -#define LCD_REG_76 0x4C -#define LCD_REG_77 0x4D -#define LCD_REG_78 0x4E -#define LCD_REG_79 0x4F -#define LCD_REG_80 0x50 -#define LCD_REG_81 0x51 -#define LCD_REG_82 0x52 -#define LCD_REG_83 0x53 -#define LCD_REG_96 0x60 -#define LCD_REG_97 0x61 -#define LCD_REG_106 0x6A -#define LCD_REG_118 0x76 -#define LCD_REG_128 0x80 -#define LCD_REG_129 0x81 -#define LCD_REG_130 0x82 -#define LCD_REG_131 0x83 -#define LCD_REG_132 0x84 -#define LCD_REG_133 0x85 -#define LCD_REG_134 0x86 -#define LCD_REG_135 0x87 -#define LCD_REG_136 0x88 -#define LCD_REG_137 0x89 -#define LCD_REG_139 0x8B -#define LCD_REG_140 0x8C -#define LCD_REG_141 0x8D -#define LCD_REG_143 0x8F -#define LCD_REG_144 0x90 -#define LCD_REG_145 0x91 -#define LCD_REG_146 0x92 -#define LCD_REG_147 0x93 -#define LCD_REG_148 0x94 -#define LCD_REG_149 0x95 -#define LCD_REG_150 0x96 -#define LCD_REG_151 0x97 -#define LCD_REG_152 0x98 -#define LCD_REG_153 0x99 -#define LCD_REG_154 0x9A -#define LCD_REG_157 0x9D -#define LCD_REG_192 0xC0 -#define LCD_REG_193 0xC1 -#define LCD_REG_229 0xE5 -/** - * @} - */ - -/** @defgroup ILI9325_Exported_Functions - * @{ - */ -void ili9325_Init(void); -uint16_t ili9325_ReadID(void); -void ili9325_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue); -uint16_t ili9325_ReadReg(uint8_t LCDReg); - -void ili9325_DisplayOn(void); -void ili9325_DisplayOff(void); -void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos); -void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode); -uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos); - -void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp); -void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata); - -void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); - - -uint16_t ili9325_GetLcdPixelWidth(void); -uint16_t ili9325_GetLcdPixelHeight(void); - -/* LCD driver structure */ -extern LCD_DrvTypeDef ili9325_drv; - -/* LCD IO functions */ -void LCD_IO_Init(void); -void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size); -void LCD_IO_WriteReg(uint8_t Reg); -uint16_t LCD_IO_ReadData(uint16_t Reg); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ILI9325_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/lis302dl b/Drivers/BSP/Components/lis302dl new file mode 160000 index 0000000..39e195f --- /dev/null +++ b/Drivers/BSP/Components/lis302dl @@ -0,0 +1 @@ +Subproject commit 39e195f3f5013f09b9610c752d9a7ddb8f4339c8 diff --git a/Drivers/BSP/Components/lis302dl/Release_Notes.html b/Drivers/BSP/Components/lis302dl/Release_Notes.html deleted file mode 100644 index 1d98fd2..0000000 --- a/Drivers/BSP/Components/lis302dl/Release_Notes.html +++ /dev/null @@ -1,510 +0,0 @@ - - - - - - - - - - - - - - - - - - - Release Notes for LIS302DL Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for LIS302DL Component Driver

-

Copyright -2015 STMicroelectronics

- -

- -
-

 

- - - - - - -
-

Update History

-

V2.0.0 / 03-August-2015

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • lis302dl.h/.c:
    • Add mems accelerometer de-initialization -function: LIS302DL_DeInit()
    • NOTE: This release must be used with BSP Common -driver V4.0.0 or later

V1.0.2 / 02-December-2014

- - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • lis302dl.h: change "\" by "/" in the include path to fix compilation issue under Linux
  • -
- -

V1.0.1 / 19-June-2014

- - - - - - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • Comments clean up and typo corrections
  • -
- - - -

V1.0.0 / 18-February-2014

- - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
  • First official release
  • -
-

License

- -
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-
For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/lis302dl/lis302dl.c b/Drivers/BSP/Components/lis302dl/lis302dl.c deleted file mode 100644 index bd54e69..0000000 --- a/Drivers/BSP/Components/lis302dl/lis302dl.c +++ /dev/null @@ -1,423 +0,0 @@ -/** - ****************************************************************************** - * @file lis302dl.c - * @author MCD Application Team - * @version V2.0.0 - * @date 03-August-2015 - * @brief This file provides a set of functions needed to manage the LIS302DL - * MEMS accelerometer. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "lis302dl.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup LIS302DL - * @brief This file includes the motion sensor driver for LIS302DL motion sensor - * devices. - * @{ - */ - - -/** @defgroup LIS302DL_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup LIS302DL_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup LIS302DL_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup LIS302DL_Private_Variables - * @{ - */ - -ACCELERO_DrvTypeDef Lis302dlDrv = -{ - LIS302DL_Init, - LIS302DL_DeInit, - LIS302DL_ReadID, - LIS302DL_RebootCmd, - LIS302DL_Click_IntConfig, - 0, - 0, - 0, - 0, - LIS302DL_Click_IntClear, - LIS302DL_FilterConfig, - 0, - LIS302DL_ReadACC, -}; - -/** - * @} - */ - -/** @defgroup LIS302DL_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup LIS302DL_Private_Functions - * @{ - */ - -/** - * @brief Set LIS302DL Initialization. - * @param InitStruct: contains mask of different init parameters - * @retval None - */ -void LIS302DL_Init(uint16_t InitStruct) -{ - uint8_t ctrl = 0x00; - - /* Configure the low level interface */ - ACCELERO_IO_Init(); - - ctrl = (uint8_t) InitStruct; - - /* Write value to MEMS CTRL_REG1 register */ - ACCELERO_IO_Write(&ctrl, LIS302DL_CTRL_REG1_ADDR, 1); -} - -/** - * @brief LIS302DL De-Initialization. - * @param None - * @retval None. - */ -void LIS302DL_DeInit(void) -{ - -} - -/** - * @brief Read LIS302DL device ID. - * @param None - * @retval The Device ID (two bytes). - */ -uint8_t LIS302DL_ReadID(void) -{ - uint8_t tmp = 0; - - /* Configure the low level interface */ - ACCELERO_IO_Init(); - - /* Read WHO_AM_I register */ - ACCELERO_IO_Read(&tmp, LIS302DL_WHO_AM_I_ADDR, 1); - - /* Return the ID */ - return (uint16_t)tmp; -} - -/** - * @brief Set LIS302DL Internal High Pass Filter configuration. - * @param FilterStruct: contains data for filter config - * @retval None - */ -void LIS302DL_FilterConfig(uint8_t FilterStruct) -{ - uint8_t ctrl = 0x00; - - /* Read CTRL_REG2 register */ - ACCELERO_IO_Read(&ctrl, LIS302DL_CTRL_REG2_ADDR, 1); - - /* Clear high pass filter cut-off level, interrupt and data selection bits */ - ctrl &= (uint8_t)~(LIS302DL_FILTEREDDATASELECTION_OUTPUTREGISTER | \ - LIS302DL_HIGHPASSFILTER_LEVEL_3 | \ - LIS302DL_HIGHPASSFILTERINTERRUPT_1_2); - - ctrl |= FilterStruct; - - /* Write value to MEMS CTRL_REG2 register */ - ACCELERO_IO_Write(&ctrl, LIS302DL_CTRL_REG2_ADDR, 1); -} - -/** - * @brief Set LIS302DL Interrupt configuration. - * @param LIS302DL_InterruptConfig_TypeDef: pointer to a LIS302DL_InterruptConfig_TypeDef - * structure that contains the configuration setting for the LIS302DL Interrupt. - * @retval None - */ -void LIS302DL_InterruptConfig(LIS302DL_InterruptConfigTypeDef *LIS302DL_IntConfigStruct) -{ - uint8_t ctrl = 0x00; - - /* Read CLICK_CFG register */ - ACCELERO_IO_Read(&ctrl, LIS302DL_CLICK_CFG_REG_ADDR, 1); - - /* Configure latch Interrupt request, click interrupts and double click interrupts */ - ctrl = (uint8_t)(LIS302DL_IntConfigStruct->Latch_Request| \ - LIS302DL_IntConfigStruct->SingleClick_Axes | \ - LIS302DL_IntConfigStruct->DoubleClick_Axes); - - /* Write value to MEMS CLICK_CFG register */ - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_CFG_REG_ADDR, 1); -} - -/** - * @brief Set LIS302DL Interrupt configuration - * @param None - * @retval None - */ -void LIS302DL_Click_IntConfig(void) -{ - uint8_t ctrl = 0x00; - LIS302DL_InterruptConfigTypeDef LIS302DL_InterruptStruct; - - ACCELERO_IO_ITConfig(); - - /* Set configuration of Internal High Pass Filter of LIS302DL */ - LIS302DL_InterruptStruct.Latch_Request = LIS302DL_INTERRUPTREQUEST_LATCHED; - LIS302DL_InterruptStruct.SingleClick_Axes = LIS302DL_CLICKINTERRUPT_Z_ENABLE; - LIS302DL_InterruptStruct.DoubleClick_Axes = LIS302DL_DOUBLECLICKINTERRUPT_Z_ENABLE; - LIS302DL_InterruptConfig(&LIS302DL_InterruptStruct); - - /* Configure Interrupt control register: enable Click interrupt on INT1 and - INT2 on Z axis high event */ - ctrl = 0x3F; - ACCELERO_IO_Write(&ctrl, LIS302DL_CTRL_REG3_ADDR, 1); - - /* Enable Interrupt generation on click on Z axis */ - ctrl = 0x50; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_CFG_REG_ADDR, 1); - - /* Configure Click Threshold on X/Y axis (10 x 0.5g) */ - ctrl = 0xAA; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_THSY_X_REG_ADDR, 1); - - /* Configure Click Threshold on Z axis (10 x 0.5g) */ - ctrl = 0x0A; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_THSZ_REG_ADDR, 1); - - /* Enable interrupt on Y axis high event */ - ctrl = 0x4C; - ACCELERO_IO_Write(&ctrl, LIS302DL_FF_WU_CFG1_REG_ADDR, 1); - - /* Configure Time Limit */ - ctrl = 0x03; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_TIMELIMIT_REG_ADDR, 1); - - /* Configure Latency */ - ctrl = 0x7F; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_LATENCY_REG_ADDR, 1); - - /* Configure Click Window */ - ctrl = 0x7F; - ACCELERO_IO_Write(&ctrl, LIS302DL_CLICK_WINDOW_REG_ADDR, 1); -} - -/** - * @brief Clear LIS302DL click Interrupt - * @param None - * @retval None - */ -void LIS302DL_Click_IntClear(void) -{ - uint8_t buffer[6], clickreg = 0; - - /* Read click and status registers if the available MEMS Accelerometer is LIS302DL */ - ACCELERO_IO_Read(&clickreg, LIS302DL_CLICK_SRC_REG_ADDR, 1); - ACCELERO_IO_Read(buffer, LIS302DL_STATUS_REG_ADDR, 6); -} - -/** - * @brief Change the lowpower mode for LIS302DL - * @param LowPowerMode: New state for the low power mode. - * This parameter can be one of the following values: - * @arg LIS302DL_LOWPOWERMODE_POWERDOWN: Power down mode - * @arg LIS302DL_LOWPOWERMODE_ACTIVE: Active mode - * @retval None - */ -void LIS302DL_LowpowerCmd(uint8_t LowPowerMode) -{ - uint8_t tmpreg; - - /* Read CTRL_REG1 register */ - ACCELERO_IO_Read(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); - - /* Set new low power mode configuration */ - tmpreg &= (uint8_t)~LIS302DL_LOWPOWERMODE_ACTIVE; - tmpreg |= LowPowerMode; - - /* Write value to MEMS CTRL_REG1 register */ - ACCELERO_IO_Write(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); -} - -/** - * @brief Data Rate command - * @param DataRateValue: Data rate value - * This parameter can be one of the following values: - * @arg LIS302DL_DATARATE_100: 100 Hz output data rate - * @arg LIS302DL_DATARATE_400: 400 Hz output data rate - * @retval None - */ -void LIS302DL_DataRateCmd(uint8_t DataRateValue) -{ - uint8_t tmpreg; - - /* Read CTRL_REG1 register */ - ACCELERO_IO_Read(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); - - /* Set new Data rate configuration */ - tmpreg &= (uint8_t)~LIS302DL_DATARATE_400; - tmpreg |= DataRateValue; - - /* Write value to MEMS CTRL_REG1 register */ - ACCELERO_IO_Write(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); -} - -/** - * @brief Change the Full Scale of LIS302DL - * @param FS_value: new full scale value. - * This parameter can be one of the following values: - * @arg LIS302DL_FULLSCALE_2_3: +-2.3g - * @arg LIS302DL_FULLSCALE_9_2: +-9.2g - * @retval None - */ -void LIS302DL_FullScaleCmd(uint8_t FS_value) -{ - uint8_t tmpreg; - - /* Read CTRL_REG1 register */ - ACCELERO_IO_Read(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); - - /* Set new full scale configuration */ - tmpreg &= (uint8_t)~LIS302DL_FULLSCALE_9_2; - tmpreg |= FS_value; - - /* Write value to MEMS CTRL_REG1 register */ - ACCELERO_IO_Write(&tmpreg, LIS302DL_CTRL_REG1_ADDR, 1); -} - -/** - * @brief Reboot memory content of LIS302DL. - * @param None - * @retval None - */ -void LIS302DL_RebootCmd(void) -{ - uint8_t tmpreg; - /* Read CTRL_REG2 register */ - ACCELERO_IO_Read(&tmpreg, LIS302DL_CTRL_REG2_ADDR, 1); - - /* Enable or Disable the reboot memory */ - tmpreg |= LIS302DL_BOOT_REBOOTMEMORY; - - /* Write value to MEMS CTRL_REG2 register */ - ACCELERO_IO_Write(&tmpreg, LIS302DL_CTRL_REG2_ADDR, 1); -} - -/** - * @brief Read LIS302DL output register, and calculate the acceleration - * ACC[mg]=SENSITIVITY* (out_h*256+out_l)/16 (12 bit rappresentation) - * @param pfData: Data out pointer - * @retval None - */ -void LIS302DL_ReadACC(int16_t *pData) -{ - int8_t buffer[6]; - int16_t pnRawData[3]; - uint8_t sensitivity = LIS302DL_SENSITIVITY_2_3G; - uint8_t crtl, i = 0x00; - - ACCELERO_IO_Read(&crtl, LIS302DL_CTRL_REG1_ADDR, 1); - ACCELERO_IO_Read((uint8_t*)buffer, LIS302DL_OUT_X_ADDR, 6); - - for(i=0; i<3; i++) - { - pnRawData[i] = buffer[2*i]; - } - - switch(crtl & LIS302DL_FULLSCALE_9_2) - { - /* FS bit = 0 ==> Sensitivity typical value = 18milligals/digit*/ - case LIS302DL_FULLSCALE_2_3: - sensitivity = LIS302DL_SENSITIVITY_2_3G; - break; - - /* FS bit = 1 ==> Sensitivity typical value = 72milligals/digit*/ - case LIS302DL_FULLSCALE_9_2: - sensitivity = LIS302DL_SENSITIVITY_9_2G; - break; - - default: - break; - } - - /* Obtain the mg value for the three axis */ - for(i=0; i<3; i++) - { - pData[i]=(pnRawData[i] * sensitivity); - } -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/lis302dl/lis302dl.h b/Drivers/BSP/Components/lis302dl/lis302dl.h deleted file mode 100644 index 49f9656..0000000 --- a/Drivers/BSP/Components/lis302dl/lis302dl.h +++ /dev/null @@ -1,720 +0,0 @@ -/** - ****************************************************************************** - * @file lis302dl.h - * @author MCD Application Team - * @version V2.0.0 - * @date 03-August-2015 - * @brief This file contains all the functions prototypes for the lis302dl.c - * firmware driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2015 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __LIS302DL_H -#define __LIS302DL_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/accelero.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup LIS302DL - * @{ - */ - - -/** @defgroup LIS302DL_Exported_Types - * @{ - */ -/* LIS302DL struct */ -typedef struct -{ - uint8_t Power_Mode; /* Power-down/Active Mode */ - uint8_t Output_DataRate; /* OUT data rate 100 Hz / 400 Hz */ - uint8_t Axes_Enable; /* Axes enable */ - uint8_t Full_Scale; /* Full scale */ - uint8_t Self_Test; /* Self test */ -}LIS302DL_InitTypeDef; - -/* Interrupt struct */ -typedef struct -{ - uint8_t Latch_Request; /* Latch interrupt request into CLICK_SRC register*/ - uint8_t SingleClick_Axes; /* Single Click Axes Interrupts */ - uint8_t DoubleClick_Axes; /* Double Click Axes Interrupts */ -}LIS302DL_InterruptConfigTypeDef; - -/* High Pass Filter struct */ -typedef struct -{ - uint8_t HighPassFilter_Data_Selection; /* Internal filter bypassed or data from internal filter send to output register*/ - uint8_t HighPassFilter_CutOff_Frequency; /* High pass filter cut-off frequency */ - uint8_t HighPassFilter_Interrupt; /* High pass filter enabled for Freefall/WakeUp #1 or #2 */ -}LIS302DL_FilterConfigTypeDef; - -/** - * @} - */ - -/** @defgroup LIS302DL_Exported_Constants - * @{ - */ - -/******************************************************************************/ -/*************************** START REGISTER MAPPING **************************/ -/******************************************************************************/ - -/******************************************************************************* -* WHO_AM_I Register: Device Identification Register -* Read only register -* Default value: 0x3B -*******************************************************************************/ -#define LIS302DL_WHO_AM_I_ADDR 0x0F - -/******************************************************************************* -* CTRL_REG1 Register: Control Register 1 -* Read Write register -* Default value: 0x07 -* 7 DR: Data Rate selection. -* 0 - 100 Hz output data rate -* 1 - 400 Hz output data rate -* 6 PD: Power Down control. -* 0 - power down mode -* 1 - active mode -* 5 FS: Full Scale selection. -* 0 - Typical measurement range 2.3 -* 1 - Typical measurement range 9.2 -* 4:3 STP-STM Self Test Enable: -* STP | STM | mode -* ---------------------------- -* 0 | 0 | Normal mode -* 0 | 1 | Self Test M -* 1 | 0 | Self Test P -* 2 Zen: Z axis enable. -* 0 - Z axis disabled -* 1- Z axis enabled -* 1 Yen: Y axis enable. -* 0 - Y axis disabled -* 1- Y axis enabled -* 0 Xen: X axis enable. -* 0 - X axis disabled -* 1- X axis enabled -*******************************************************************************/ -#define LIS302DL_CTRL_REG1_ADDR 0x20 - -/******************************************************************************* -* CTRL_REG2 Regsiter: Control Register 2 -* Read Write register -* Default value: 0x00 -* 7 SIM: SPI Serial Interface Mode Selection. -* 0 - 4 wire interface -* 1 - 3 wire interface -* 6 BOOT: Reboot memory content -* 0 - normal mode -* 1 - reboot memory content -* 5 Reserved -* 4 FDS: Filtered data selection. -* 0 - internal filter bypassed -* 1 - data from internal filter sent to output register -* 3 HP FF_WU2: High pass filter enabled for FreeFall/WakeUp#2. -* 0 - filter bypassed -* 1 - filter enabled -* 2 HP FF_WU1: High pass filter enabled for FreeFall/WakeUp#1. -* 0 - filter bypassed -* 1 - filter enabled -* 1:0 HP coeff2-HP coeff1 High pass filter cut-off frequency (ft) configuration. -* ft= ODR[hz]/6*HP coeff -* HP coeff2 | HP coeff1 | HP coeff -* ------------------------------------------- -* 0 | 0 | 8 -* 0 | 1 | 16 -* 1 | 0 | 32 -* 1 | 1 | 64 -* HP coeff | ft[hz] | ft[hz] | -* |ODR 100Hz | ODR 400Hz | -* -------------------------------------------- -* 00 | 2 | 8 | -* 01 | 1 | 4 | -* 10 | 0.5 | 2 | -* 11 | 0.25 | 1 | -*******************************************************************************/ -#define LIS302DL_CTRL_REG2_ADDR 0x21 - -/******************************************************************************* -* CTRL_REG3 Register: Interrupt Control Register -* Read Write register -* Default value: 0x00 -* 7 IHL active: Interrupt active high/low. -* 0 - active high -* 1 - active low -* 6 PP_OD: push-pull/open-drain. -* 0 - push-pull -* 1 - open-drain -* 5:3 I2_CFG2 - I2_CFG0 Data signal on INT2 pad control bits -* 2:0 I1_CFG2 - I1_CFG0 Data signal on INT1 pad control bits -* I1(2)_CFG2 | I1(2)_CFG1 | I1(2)_CFG0 | INT1(2) Pad -* ---------------------------------------------------------- -* 0 | 0 | 0 | GND -* 0 | 0 | 1 | FreeFall/WakeUp#1 -* 0 | 1 | 0 | FreeFall/WakeUp#2 -* 0 | 1 | 1 | FreeFall/WakeUp#1 or FreeFall/WakeUp#2 -* 1 | 0 | 0 | Data ready -* 1 | 1 | 1 | Click interrupt -*******************************************************************************/ -#define LIS302DL_CTRL_REG3_ADDR 0x22 - -/******************************************************************************* -* HP_FILTER_RESET Register: Dummy register. Reading at this address zeroes -* instantaneously the content of the internal high pass filter. If the high pass -* filter is enabled all three axes are instantaneously set to 0g. -* This allows to overcome the settling time of the high pass filter. -* Read only register -* Default value: Dummy -*******************************************************************************/ -#define LIS302DL_HP_FILTER_RESET_REG_ADDR 0x23 - -/******************************************************************************* -* STATUS_REG Register: Status Register -* Default value: 0x00 -* 7 ZYXOR: X, Y and Z axis data overrun. -* 0: no overrun has occurred -* 1: new data has overwritten the previous one before it was read -* 6 ZOR: Z axis data overrun. -* 0: no overrun has occurred -* 1: new data for Z-axis has overwritten the previous one before it was read -* 5 yOR: y axis data overrun. -* 0: no overrun has occurred -* 1: new data for y-axis has overwritten the previous one before it was read -* 4 XOR: X axis data overrun. -* 0: no overrun has occurred -* 1: new data for X-axis has overwritten the previous one before it was read -* 3 ZYXDA: X, Y and Z axis new data available -* 0: a new set of data is not yet available -* 1: a new set of data is available -* 2 ZDA: Z axis new data available. -* 0: a new set of data is not yet available -* 1: a new data for Z axis is available -* 1 YDA: Y axis new data available -* 0: a new set of data is not yet available -* 1: a new data for Y axis is available -* 0 XDA: X axis new data available -* 0: a new set of data is not yet available -* 1: a new data for X axis is available -*******************************************************************************/ -#define LIS302DL_STATUS_REG_ADDR 0x27 - -/******************************************************************************* -* OUT_X Register: X-axis output Data -* Read only register -* Default value: output -* 7:0 XD7-XD0: X-axis output Data -*******************************************************************************/ -#define LIS302DL_OUT_X_ADDR 0x29 - -/******************************************************************************* -* OUT_Y Register: Y-axis output Data -* Read only register -* Default value: output -* 7:0 YD7-YD0: Y-axis output Data -*******************************************************************************/ -#define LIS302DL_OUT_Y_ADDR 0x2B - -/******************************************************************************* -* OUT_Z Register: Z-axis output Data -* Read only register -* Default value: output -* 7:0 ZD7-ZD0: Z-axis output Data -*******************************************************************************/ -#define LIS302DL_OUT_Z_ADDR 0x2D - -/******************************************************************************* -* FF_WW_CFG_1 Register: Configuration register for Interrupt 1 source. -* Read write register -* Default value: 0x00 -* 7 AOI: AND/OR combination of Interrupt events. -* 0: OR combination of interrupt events -* 1: AND combination of interrupt events -* 6 LIR: Latch/not latch interrupt request -* 0: interrupt request not latched -* 1: interrupt request latched -* 5 ZHIE: Enable interrupt generation on Z high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 4 ZLIE: Enable interrupt generation on Z low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -* 3 YHIE: Enable interrupt generation on Y high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 2 YLIE: Enable interrupt generation on Y low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -* 1 XHIE: Enable interrupt generation on X high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 0 XLIE: Enable interrupt generation on X low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -*******************************************************************************/ -#define LIS302DL_FF_WU_CFG1_REG_ADDR 0x30 - -/******************************************************************************* -* FF_WU_SRC_1 Register: Interrupt 1 source register. -* Reading at this address clears FF_WU_SRC_1 register and the FF, WU 1 interrupt -* and allow the refreshment of data in the FF_WU_SRC_1 register if the latched option -* was chosen. -* Read only register -* Default value: 0x00 -* 7 Reserved -* 6 IA: Interrupt active. -* 0: no interrupt has been generated -* 1: one or more interrupts have been generated -* 5 ZH: Z high. -* 0: no interrupt -* 1: ZH event has occurred -* 4 ZL: Z low. -* 0: no interrupt -* 1: ZL event has occurred -* 3 YH: Y high. -* 0: no interrupt -* 1: YH event has occurred -* 2 YL: Y low. -* 0: no interrupt -* 1: YL event has occurred -* 1 YH: X high. -* 0: no interrupt -* 1: XH event has occurred -* 0 YL: X low. -* 0: no interrupt -* 1: XL event has occurred -*******************************************************************************/ -#define LIS302DL_FF_WU_SRC1_REG_ADDR 0x31 - -/******************************************************************************* -* FF_WU_THS_1 Register: Threshold register -* Read Write register -* Default value: 0x00 -* 7 DCRM: Reset mode selection. -* 0 - counter resetted -* 1 - counter decremented -* 6 THS6-THS0: Free-fall/wake-up threshold value. -*******************************************************************************/ -#define LIS302DL_FF_WU_THS1_REG_ADDR 0x32 - -/******************************************************************************* -* FF_WU_DURATION_1 Register: duration Register -* Read Write register -* Default value: 0x00 -* 7:0 D7-D0 Duration value. (Duration steps and maximum values depend on the ODR chosen) - ******************************************************************************/ -#define LIS302DL_FF_WU_DURATION1_REG_ADDR 0x33 - -/******************************************************************************* -* FF_WW_CFG_2 Register: Configuration register for Interrupt 2 source. -* Read write register -* Default value: 0x00 -* 7 AOI: AND/OR combination of Interrupt events. -* 0: OR combination of interrupt events -* 1: AND combination of interrupt events -* 6 LIR: Latch/not latch interrupt request -* 0: interrupt request not latched -* 1: interrupt request latched -* 5 ZHIE: Enable interrupt generation on Z high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 4 ZLIE: Enable interrupt generation on Z low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -* 3 YHIE: Enable interrupt generation on Y high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 2 YLIE: Enable interrupt generation on Y low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -* 1 XHIE: Enable interrupt generation on X high event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value higher than preset threshold -* 0 XLIE: Enable interrupt generation on X low event. -* 0: disable interrupt request -* 1: enable interrupt request on measured accel. value lower than preset threshold -*******************************************************************************/ -#define LIS302DL_FF_WU_CFG2_REG_ADDR 0x34 - -/******************************************************************************* -* FF_WU_SRC_2 Register: Interrupt 2 source register. -* Reading at this address clears FF_WU_SRC_2 register and the FF, WU 2 interrupt -* and allow the refreshment of data in the FF_WU_SRC_2 register if the latched option -* was chosen. -* Read only register -* Default value: 0x00 -* 7 Reserved -* 6 IA: Interrupt active. -* 0: no interrupt has been generated -* 1: one or more interrupts have been generated -* 5 ZH: Z high. -* 0: no interrupt -* 1: ZH event has occurred -* 4 ZL: Z low. -* 0: no interrupt -* 1: ZL event has occurred -* 3 YH: Y high. -* 0: no interrupt -* 1: YH event has occurred -* 2 YL: Y low. -* 0: no interrupt -* 1: YL event has occurred -* 1 YH: X high. -* 0: no interrupt -* 1: XH event has occurred -* 0 YL: X low. -* 0: no interrupt -* 1: XL event has occurred -*******************************************************************************/ -#define LIS302DL_FF_WU_SRC2_REG_ADDR 0x35 - -/******************************************************************************* -* FF_WU_THS_2 Register: Threshold register -* Read Write register -* Default value: 0x00 -* 7 DCRM: Reset mode selection. -* 0 - counter resetted -* 1 - counter decremented -* 6 THS6-THS0: Free-fall/wake-up threshold value. -*******************************************************************************/ -#define LIS302DL_FF_WU_THS2_REG_ADDR 0x36 - -/******************************************************************************* -* FF_WU_DURATION_2 Register: duration Register -* Read Write register -* Default value: 0x00 -* 7:0 D7-D0 Duration value. (Duration steps and maximum values depend on the ODR chosen) - ******************************************************************************/ -#define LIS302DL_FF_WU_DURATION2_REG_ADDR 0x37 - -/****************************************************************************** -* CLICK_CFG Register: click Register -* Read Write register -* Default value: 0x00 -* 7 Reserved -* 6 LIR: Latch Interrupt request. -* 0: interrupt request not latched -* 1: interrupt request latched -* 5 Double_Z: Enable interrupt generation on double click event on Z axis. -* 0: disable interrupt request -* 1: enable interrupt request -* 4 Single_Z: Enable interrupt generation on single click event on Z axis. -* 0: disable interrupt request -* 1: enable interrupt request -* 3 Double_Y: Enable interrupt generation on double click event on Y axis. -* 0: disable interrupt request -* 1: enable interrupt request -* 2 Single_Y: Enable interrupt generation on single click event on Y axis. -* 0: disable interrupt request -* 1: enable interrupt request -* 1 Double_X: Enable interrupt generation on double click event on X axis. -* 0: disable interrupt request -* 1: enable interrupt request -* 0 Single_y: Enable interrupt generation on single click event on X axis. -* 0: disable interrupt request -* 1: enable interrupt request - ******************************************************************************/ -#define LIS302DL_CLICK_CFG_REG_ADDR 0x38 - -/****************************************************************************** -* CLICK_SRC Register: click status Register -* Read only register -* Default value: 0x00 -* 7 Reserved -* 6 IA: Interrupt active. -* 0: no interrupt has been generated -* 1: one or more interrupts have been generated -* 5 Double_Z: Double click on Z axis event. -* 0: no interrupt -* 1: Double Z event has occurred -* 4 Single_Z: Z low. -* 0: no interrupt -* 1: Single Z event has occurred -* 3 Double_Y: Y high. -* 0: no interrupt -* 1: Double Y event has occurred -* 2 Single_Y: Y low. -* 0: no interrupt -* 1: Single Y event has occurred -* 1 Double_X: X high. -* 0: no interrupt -* 1: Double X event has occurred -* 0 Single_X: X low. -* 0: no interrupt -* 1: Single X event has occurred -*******************************************************************************/ -#define LIS302DL_CLICK_SRC_REG_ADDR 0x39 - -/******************************************************************************* -* CLICK_THSY_X Register: Click threshold Y and X register -* Read Write register -* Default value: 0x00 -* 7:4 THSy3-THSy0: Click threshold on Y axis, step 0.5g -* 3:0 THSx3-THSx0: Click threshold on X axis, step 0.5g -*******************************************************************************/ -#define LIS302DL_CLICK_THSY_X_REG_ADDR 0x3B - -/******************************************************************************* -* CLICK_THSZ Register: Click threshold Z register -* Read Write register -* Default value: 0x00 -* 7:4 Reserved -* 3:0 THSz3-THSz0: Click threshold on Z axis, step 0.5g -*******************************************************************************/ -#define LIS302DL_CLICK_THSZ_REG_ADDR 0x3C - -/******************************************************************************* -* CLICK_TimeLimit Register: Time Limit register -* Read Write register -* Default value: 0x00 -* 7:0 Dur7-Dur0: Time Limit value, step 0.5g -*******************************************************************************/ -#define LIS302DL_CLICK_TIMELIMIT_REG_ADDR 0x3D - -/******************************************************************************* -* CLICK_Latency Register: Latency register -* Read Write register -* Default value: 0x00 -* 7:0 Lat7-Lat0: Latency value, step 1msec -*******************************************************************************/ -#define LIS302DL_CLICK_LATENCY_REG_ADDR 0x3E - -/******************************************************************************* -* CLICK_Window Register: Window register -* Read Write register -* Default value: 0x00 -* 7:0 Win7-Win0: Window value, step 1msec -*******************************************************************************/ -#define LIS302DL_CLICK_WINDOW_REG_ADDR 0x3F - -/******************************************************************************/ -/**************************** END REGISTER MAPPING ***************************/ -/******************************************************************************/ -#define I_AM_LIS302DL 0x3B - -#define LIS302DL_SENSITIVITY_2_3G 18 /* 18 mg/digit*/ -#define LIS302DL_SENSITIVITY_9_2G 72 /* 72 mg/digit*/ - -/** @defgroup Data_Rate_selection - * @{ - */ -#define LIS302DL_DATARATE_100 ((uint8_t)0x00) -#define LIS302DL_DATARATE_400 ((uint8_t)0x80) -/** - * @} - */ - -/** @defgroup Power_Mode_selection - * @{ - */ -#define LIS302DL_LOWPOWERMODE_POWERDOWN ((uint8_t)0x00) -#define LIS302DL_LOWPOWERMODE_ACTIVE ((uint8_t)0x40) -/** - * @} - */ - -/** @defgroup Full_Scale_selection - * @{ - */ -#define LIS302DL_FULLSCALE_2_3 ((uint8_t)0x00) -#define LIS302DL_FULLSCALE_9_2 ((uint8_t)0x20) -/** - * @} - */ - -/** @defgroup Self_Test_selection - * @{ - */ -#define LIS302DL_SELFTEST_NORMAL ((uint8_t)0x00) -#define LIS302DL_SELFTEST_P ((uint8_t)0x10) -#define LIS302DL_SELFTEST_M ((uint8_t)0x08) -/** - * @} - */ - -/** @defgroup Direction_XYZ_selection - * @{ - */ -#define LIS302DL_X_ENABLE ((uint8_t)0x01) -#define LIS302DL_Y_ENABLE ((uint8_t)0x02) -#define LIS302DL_Z_ENABLE ((uint8_t)0x04) -#define LIS302DL_XYZ_ENABLE ((uint8_t)0x07) -/** - * @} - */ - - /** @defgroup SPI_Serial_Interface_Mode_selection - * @{ - */ -#define LIS302DL_SERIALINTERFACE_4WIRE ((uint8_t)0x00) -#define LIS302DL_SERIALINTERFACE_3WIRE ((uint8_t)0x80) -/** - * @} - */ - - /** @defgroup Boot_Mode_selection - * @{ - */ -#define LIS302DL_BOOT_NORMALMODE ((uint8_t)0x00) -#define LIS302DL_BOOT_REBOOTMEMORY ((uint8_t)0x40) -/** - * @} - */ - - /** @defgroup Filtered_Data_Selection_Mode_selection - * @{ - */ -#define LIS302DL_FILTEREDDATASELECTION_BYPASSED ((uint8_t)0x00) -#define LIS302DL_FILTEREDDATASELECTION_OUTPUTREGISTER ((uint8_t)0x20) -/** - * @} - */ - - /** @defgroup High_Pass_Filter_Interrupt_selection - * @{ - */ -#define LIS302DL_HIGHPASSFILTERINTERRUPT_OFF ((uint8_t)0x00) -#define LIS302DL_HIGHPASSFILTERINTERRUPT_1 ((uint8_t)0x04) -#define LIS302DL_HIGHPASSFILTERINTERRUPT_2 ((uint8_t)0x08) -#define LIS302DL_HIGHPASSFILTERINTERRUPT_1_2 ((uint8_t)0x0C) -/** - * @} - */ - - /** @defgroup High_Pass_Filter_selection - * @{ - */ -#define LIS302DL_HIGHPASSFILTER_LEVEL_0 ((uint8_t)0x00) -#define LIS302DL_HIGHPASSFILTER_LEVEL_1 ((uint8_t)0x01) -#define LIS302DL_HIGHPASSFILTER_LEVEL_2 ((uint8_t)0x02) -#define LIS302DL_HIGHPASSFILTER_LEVEL_3 ((uint8_t)0x03) -/** - * @} - */ - -/** @defgroup latch_Interrupt_Request_selection - * @{ - */ -#define LIS302DL_INTERRUPTREQUEST_NOTLATCHED ((uint8_t)0x00) -#define LIS302DL_INTERRUPTREQUEST_LATCHED ((uint8_t)0x40) -/** - * @} - */ - -/** @defgroup Click_Interrupt_XYZ_selection - * @{ - */ -#define LIS302DL_CLICKINTERRUPT_XYZ_DISABLE ((uint8_t)0x00) -#define LIS302DL_CLICKINTERRUPT_X_ENABLE ((uint8_t)0x01) -#define LIS302DL_CLICKINTERRUPT_Y_ENABLE ((uint8_t)0x04) -#define LIS302DL_CLICKINTERRUPT_Z_ENABLE ((uint8_t)0x10) -#define LIS302DL_CLICKINTERRUPT_XYZ_ENABLE ((uint8_t)0x15) -/** - * @} - */ - -/** @defgroup Double_Click_Interrupt_XYZ_selection - * @{ - */ -#define LIS302DL_DOUBLECLICKINTERRUPT_XYZ_DISABLE ((uint8_t)0x00) -#define LIS302DL_DOUBLECLICKINTERRUPT_X_ENABLE ((uint8_t)0x02) -#define LIS302DL_DOUBLECLICKINTERRUPT_Y_ENABLE ((uint8_t)0x08) -#define LIS302DL_DOUBLECLICKINTERRUPT_Z_ENABLE ((uint8_t)0x20) -#define LIS302DL_DOUBLECLICKINTERRUPT_XYZ_ENABLE ((uint8_t)0x2A) -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup LIS302DL_Exported_Functions - * @{ - */ -void LIS302DL_Init(uint16_t InitStruct); -void LIS302DL_DeInit(void); -uint8_t LIS302DL_ReadID(void); -void LIS302DL_FilterConfig(uint8_t FilterStruct); -void LIS302DL_InterruptConfig(LIS302DL_InterruptConfigTypeDef *LIS302DL_IntConfigStruct); -void LIS302DL_Click_IntConfig(void); -void LIS302DL_Click_IntClear(void); -void LIS302DL_LowpowerCmd(uint8_t LowPowerMode); -void LIS302DL_FullScaleCmd(uint8_t FS_value); -void LIS302DL_DataRateCmd(uint8_t DataRateValue); -void LIS302DL_RebootCmd(void); -void LIS302DL_ReadACC(int16_t *pData); - -/* Accelerometer driver structure */ -extern ACCELERO_DrvTypeDef Lis302dlDrv; - -/* Accelerometer IO functions */ -void ACCELERO_IO_Init(void); -void ACCELERO_IO_ITConfig(void); -void ACCELERO_IO_Write(uint8_t* pBuffer, uint8_t WriteAddr, uint16_t NumByteToWrite); -void ACCELERO_IO_Read(uint8_t* pBuffer, uint8_t ReadAddr, uint16_t NumByteToRead); - -#ifdef __cplusplus -} -#endif - -#endif /* __LIS302DL_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/spfd5408 b/Drivers/BSP/Components/spfd5408 new file mode 160000 index 0000000..0d42749 --- /dev/null +++ b/Drivers/BSP/Components/spfd5408 @@ -0,0 +1 @@ +Subproject commit 0d42749f086108e82aef4401e1cccc7f2da4d552 diff --git a/Drivers/BSP/Components/spfd5408/Release_Notes.html b/Drivers/BSP/Components/spfd5408/Release_Notes.html deleted file mode 100644 index 338779b..0000000 --- a/Drivers/BSP/Components/spfd5408/Release_Notes.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - Release Notes for STM32 BSP Components Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for SPFD5408 Component Driver

-

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -

Update History

V1.1.1 -/ 26-November-2014

-

Main -Changes

- - - - - - - - - -
  • spfd5408.h: change "\" by "/" in the include -path to fix compilation issues under Linux

V1.1.0 / 11-July-2014 -

-

Main -Changes

-
  • Beta release of -SPFD5408 LCD -Component driver in -order to harmonize all LCD controllers Link usage (Change LCD_IO_WriteData to -LCD_IO_WriteMultipleData)

V1.0.0 -/ 06-May-2014

-

Main -Changes

- - - - - - - - - -
  • First official release of SPFD5408 LCD Component driver

License

-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-
For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32
-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/spfd5408/spfd5408.c b/Drivers/BSP/Components/spfd5408/spfd5408.c deleted file mode 100644 index b7cf99c..0000000 --- a/Drivers/BSP/Components/spfd5408/spfd5408.c +++ /dev/null @@ -1,496 +0,0 @@ -/** - ****************************************************************************** - * @file spfd5408.c - * @author MCD Application Team - * @version V1.1.1 - * @date 26-November-2014 - * @brief This file includes the LCD driver for SPFD5408 LCD. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "spfd5408.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @defgroup SPFD5408 - * @brief This file provides a set of functions needed to drive the - * SPFD5408 LCD. - * @{ - */ - -/** @defgroup SPFD5408_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup SPFD5408_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup SPFD5408_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup SPFD5408_Private_Variables - * @{ - */ -LCD_DrvTypeDef spfd5408_drv = -{ - spfd5408_Init, - spfd5408_ReadID, - spfd5408_DisplayOn, - spfd5408_DisplayOff, - spfd5408_SetCursor, - spfd5408_WritePixel, - spfd5408_ReadPixel, - spfd5408_SetDisplayWindow, - spfd5408_DrawHLine, - spfd5408_DrawVLine, - spfd5408_GetLcdPixelWidth, - spfd5408_GetLcdPixelHeight, - spfd5408_DrawBitmap, -}; - -static uint8_t Is_spfd5408_Initialized = 0; -static uint16_t ArrayRGB[320] = {0}; - -/** - * @} - */ - -/** @defgroup SPFD5408_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup SPFD5408_Private_Functions - * @{ - */ - -/** - * @brief Initialise the SPFD5408 LCD Component. - * @param None - * @retval None - */ -void spfd5408_Init(void) -{ - if(Is_spfd5408_Initialized == 0) - { - Is_spfd5408_Initialized = 1; - /* Initialise SPFD5408 low level bus layer --------------------------------*/ - LCD_IO_Init(); - - /* Start Initial Sequence --------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_227, 0x3008); /* Set internal timing */ - spfd5408_WriteReg(LCD_REG_231, 0x0012); /* Set internal timing */ - spfd5408_WriteReg(LCD_REG_239, 0x1231); /* Set internal timing */ - spfd5408_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */ - spfd5408_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */ - spfd5408_WriteReg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */ - spfd5408_WriteReg(LCD_REG_4, 0x0000); /* Resize register */ - spfd5408_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */ - spfd5408_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */ - spfd5408_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */ - spfd5408_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */ - spfd5408_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */ - spfd5408_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */ - /* Power On sequence -------------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - spfd5408_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */ - spfd5408_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */ - spfd5408_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */ - LCD_Delay(200); /* Dis-charge capacitor power voltage (200ms) */ - spfd5408_WriteReg(LCD_REG_17, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */ - LCD_Delay(50); /* Delay 50 ms */ - spfd5408_WriteReg(LCD_REG_16, 0x12B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ - LCD_Delay(50); /* Delay 50 ms */ - spfd5408_WriteReg(LCD_REG_18, 0x01BD); /* External reference voltage= Vci */ - LCD_Delay(50); /* Delay 50 ms */ - spfd5408_WriteReg(LCD_REG_19, 0x1400); /* VDV[4:0] for VCOM amplitude */ - spfd5408_WriteReg(LCD_REG_41, 0x000E); /* VCM[4:0] for VCOMH */ - LCD_Delay(50); /* Delay 50 ms */ - spfd5408_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */ - spfd5408_WriteReg(LCD_REG_33, 0x013F); /* GRAM Vertical Address */ - /* Adjust the Gamma Curve --------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_48, 0x0007); - spfd5408_WriteReg(LCD_REG_49, 0x0302); - spfd5408_WriteReg(LCD_REG_50, 0x0105); - spfd5408_WriteReg(LCD_REG_53, 0x0206); - spfd5408_WriteReg(LCD_REG_54, 0x0808); - spfd5408_WriteReg(LCD_REG_55, 0x0206); - spfd5408_WriteReg(LCD_REG_56, 0x0504); - spfd5408_WriteReg(LCD_REG_57, 0x0007); - spfd5408_WriteReg(LCD_REG_60, 0x0105); - spfd5408_WriteReg(LCD_REG_61, 0x0808); - /* Set GRAM area -----------------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */ - spfd5408_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */ - spfd5408_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */ - spfd5408_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */ - spfd5408_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line */ - spfd5408_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */ - spfd5408_WriteReg(LCD_REG_106, 0x0000); /* Set scrolling line */ - /* Partial Display Control -------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_128, 0x0000); - spfd5408_WriteReg(LCD_REG_129, 0x0000); - spfd5408_WriteReg(LCD_REG_130, 0x0000); - spfd5408_WriteReg(LCD_REG_131, 0x0000); - spfd5408_WriteReg(LCD_REG_132, 0x0000); - spfd5408_WriteReg(LCD_REG_133, 0x0000); - /* Panel Control -----------------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_144, 0x0010); - spfd5408_WriteReg(LCD_REG_146, 0x0000); - spfd5408_WriteReg(LCD_REG_147, 0x0003); - spfd5408_WriteReg(LCD_REG_149, 0x0110); - spfd5408_WriteReg(LCD_REG_151, 0x0000); - spfd5408_WriteReg(LCD_REG_152, 0x0000); - /* Set GRAM write direction and BGR = 1 - I/D=01 (Horizontal : increment, Vertical : decrement) - AM=1 (address is updated in vertical writing direction) */ - spfd5408_WriteReg(LCD_REG_3, 0x1018); - spfd5408_WriteReg(LCD_REG_7, 0x0112); /* 262K color and display ON */ - } - - /* Set the Cursor */ - spfd5408_SetCursor(0, 0); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); -} - -/** - * @brief Enables the Display. - * @param None - * @retval None - */ -void spfd5408_DisplayOn(void) -{ - /* Power On sequence ---------------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */ - spfd5408_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */ - spfd5408_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */ - spfd5408_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/ - LCD_Delay(10); - /* 262k/65k color selection */ - spfd5408_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */ - /* SET PANEL */ - spfd5408_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */ - - /* Display On */ - spfd5408_WriteReg(LCD_REG_40, 0x38); - LCD_Delay(60); - spfd5408_WriteReg(LCD_REG_40, 0x3C); -} - -/** - * @brief Disables the Display. - * @param None - * @retval None - */ -void spfd5408_DisplayOff(void) -{ - /* Power Off sequence ---------------------------------------------------------*/ - spfd5408_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */ - spfd5408_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */ - spfd5408_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */ - spfd5408_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */ - spfd5408_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/ - spfd5408_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */ - - /* Display Off */ - spfd5408_WriteReg(LCD_REG_40, 0x38); - LCD_Delay(60); - spfd5408_WriteReg(LCD_REG_40, 0x04); -} - -/** - * @brief Get the LCD pixel Width. - * @param None - * @retval The Lcd Pixel Width - */ -uint16_t spfd5408_GetLcdPixelWidth(void) -{ - return (uint16_t)SPFD5408_LCD_PIXEL_WIDTH; -} - -/** - * @brief Get the LCD pixel Height. - * @param None - * @retval The Lcd Pixel Height - */ -uint16_t spfd5408_GetLcdPixelHeight(void) -{ - return (uint16_t)SPFD5408_LCD_PIXEL_HEIGHT; -} - -/** - * @brief Get the SPFD5408 ID. - * @param None - * @retval The SPFD5408 ID - */ -uint16_t spfd5408_ReadID(void) -{ - LCD_IO_Init(); - - return (spfd5408_ReadReg(0x00)); -} - -/** - * @brief Set Cursor position. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @retval None - */ -void spfd5408_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - spfd5408_WriteReg(LCD_REG_32, Xpos); - spfd5408_WriteReg(LCD_REG_33, 319-Ypos); -} - -/** - * @brief Write pixel. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param RGBCode: the RGB pixel color - * @retval None - */ -void spfd5408_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode) -{ - /* Set Cursor */ - spfd5408_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2); -} - -/** - * @brief Read pixel. - * @param None - * @retval the RGB pixel color - */ -uint16_t spfd5408_ReadPixel(uint16_t Xpos, uint16_t Ypos) -{ - /* Set Cursor */ - spfd5408_SetCursor(Xpos, Ypos); - - /* Dummy read */ - LCD_IO_ReadData(LCD_REG_34); - - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCD_REG_34)); -} - -/** - * @brief Writes to the selected LCD register. - * @param LCDReg: address of the selected register. - * @param LCDRegValue: value to write to the selected register. - * @retval None - */ -void spfd5408_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue) -{ - LCD_IO_WriteReg(LCDReg); - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2); -} - -/** - * @brief Reads the selected LCD Register. - * @param LCDReg: address of the selected register. - * @retval LCD Register Value. - */ -uint16_t spfd5408_ReadReg(uint8_t LCDReg) -{ - /* Read 16-bit Reg */ - return (LCD_IO_ReadData(LCDReg)); -} - -/** - * @brief Sets a display window - * @param Xpos: specifies the X bottom left position. - * @param Ypos: specifies the Y bottom left position. - * @param Height: display window height. - * @param Width: display window width. - * @retval None - */ -void spfd5408_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - /* Horizontal GRAM Start Address */ - spfd5408_WriteReg(LCD_REG_80, Xpos); - /* Horizontal GRAM End Address */ - spfd5408_WriteReg(LCD_REG_81, Xpos + Height - 1); - - /* Vertical GRAM Start Address */ - spfd5408_WriteReg(LCD_REG_82, (SPFD5408_LCD_PIXEL_WIDTH - Ypos - Width)); - /* Vertical GRAM End Address */ - spfd5408_WriteReg(LCD_REG_83, (SPFD5408_LCD_PIXEL_WIDTH - Ypos - 1)); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void spfd5408_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint32_t i = 0; - - /* Set Cursor */ - spfd5408_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - - /* Sent a complete line */ - for(i = 0; i < Length; i++) - { - ArrayRGB[i] = RGBCode; - } - - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** - * @brief Draw vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the Line length. - * @retval None - */ -void spfd5408_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint16_t counter = 0; - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - spfd5408_WriteReg(LCD_REG_3, 0x1010); - - /* Set Cursor */ - spfd5408_SetCursor(Xpos, Ypos); - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - /* Fill a complete vertical line */ - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - - /* Write 16-bit GRAM Reg */ - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); - - /* set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : increment, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - spfd5408_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @brief Displays a bitmap picture loaded in the internal Flash. - * @param BmpAddress: Bmp picture address in the internal Flash. - * @retval None - */ -void spfd5408_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp) -{ - uint32_t index = 0, size = 0; - /* Read bitmap size */ - size = *(volatile uint16_t *) (pbmp + 2); - size |= (*(volatile uint16_t *) (pbmp + 4)) << 16; - /* Get bitmap data address offset */ - index = *(volatile uint16_t *) (pbmp + 10); - index |= (*(volatile uint16_t *) (pbmp + 12)) << 16; - size = (size - index)/2; - pbmp += index; - /* Set GRAM write direction and BGR = 1 */ - /* I/D=00 (Horizontal : decrement, Vertical : decrement) */ - /* AM=1 (address is updated in vertical writing direction) */ - spfd5408_WriteReg(LCD_REG_3, 0x1008); - - /* Set Cursor */ - spfd5408_SetCursor(Xpos, Ypos); - - /* Prepare to write GRAM */ - LCD_IO_WriteReg(LCD_REG_34); - - LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2); - - /* Set GRAM write direction and BGR = 1 */ - /* I/D = 01 (Horizontal : increment, Vertical : decrement) */ - /* AM = 1 (address is updated in vertical writing direction) */ - spfd5408_WriteReg(LCD_REG_3, 0x1018); -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/spfd5408/spfd5408.h b/Drivers/BSP/Components/spfd5408/spfd5408.h deleted file mode 100644 index 4212569..0000000 --- a/Drivers/BSP/Components/spfd5408/spfd5408.h +++ /dev/null @@ -1,278 +0,0 @@ -/** - ****************************************************************************** - * @file spfd5408.h - * @author MCD Application Team - * @version V1.1.1 - * @date 26-November-2014 - * @brief This file contains all the functions prototypes for the spfd5408.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __SPFD5408_H -#define __SPFD5408_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/lcd.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup SPFD5408 - * @{ - */ - -/** @defgroup SPFD5408_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup SPFD5408_Exported_Constants - * @{ - */ -/** - * @brief SPFD5408 ID - */ -#define SPFD5408_ID 0x5408 - -/** - * @brief SPFD5408 Size - */ -#define SPFD5408_LCD_PIXEL_WIDTH ((uint16_t)320) -#define SPFD5408_LCD_PIXEL_HEIGHT ((uint16_t)240) - -/** - * @brief SPFD5408 Registers - */ -#define LCD_REG_0 0x00 -#define LCD_REG_1 0x01 -#define LCD_REG_2 0x02 -#define LCD_REG_3 0x03 -#define LCD_REG_4 0x04 -#define LCD_REG_5 0x05 -#define LCD_REG_6 0x06 -#define LCD_REG_7 0x07 -#define LCD_REG_8 0x08 -#define LCD_REG_9 0x09 -#define LCD_REG_10 0x0A -#define LCD_REG_12 0x0C -#define LCD_REG_13 0x0D -#define LCD_REG_14 0x0E -#define LCD_REG_15 0x0F -#define LCD_REG_16 0x10 -#define LCD_REG_17 0x11 -#define LCD_REG_18 0x12 -#define LCD_REG_19 0x13 -#define LCD_REG_20 0x14 -#define LCD_REG_21 0x15 -#define LCD_REG_22 0x16 -#define LCD_REG_23 0x17 -#define LCD_REG_24 0x18 -#define LCD_REG_25 0x19 -#define LCD_REG_26 0x1A -#define LCD_REG_27 0x1B -#define LCD_REG_28 0x1C -#define LCD_REG_29 0x1D -#define LCD_REG_30 0x1E -#define LCD_REG_31 0x1F -#define LCD_REG_32 0x20 -#define LCD_REG_33 0x21 -#define LCD_REG_34 0x22 -#define LCD_REG_35 0x23 -#define LCD_REG_36 0x24 -#define LCD_REG_37 0x25 -#define LCD_REG_39 0x27 -#define LCD_REG_40 0x28 -#define LCD_REG_41 0x29 -#define LCD_REG_43 0x2B -#define LCD_REG_45 0x2D -#define LCD_REG_48 0x30 -#define LCD_REG_49 0x31 -#define LCD_REG_50 0x32 -#define LCD_REG_51 0x33 -#define LCD_REG_52 0x34 -#define LCD_REG_53 0x35 -#define LCD_REG_54 0x36 -#define LCD_REG_55 0x37 -#define LCD_REG_56 0x38 -#define LCD_REG_57 0x39 -#define LCD_REG_59 0x3B -#define LCD_REG_60 0x3C -#define LCD_REG_61 0x3D -#define LCD_REG_62 0x3E -#define LCD_REG_63 0x3F -#define LCD_REG_64 0x40 -#define LCD_REG_65 0x41 -#define LCD_REG_66 0x42 -#define LCD_REG_67 0x43 -#define LCD_REG_68 0x44 -#define LCD_REG_69 0x45 -#define LCD_REG_70 0x46 -#define LCD_REG_71 0x47 -#define LCD_REG_72 0x48 -#define LCD_REG_73 0x49 -#define LCD_REG_74 0x4A -#define LCD_REG_75 0x4B -#define LCD_REG_76 0x4C -#define LCD_REG_77 0x4D -#define LCD_REG_78 0x4E -#define LCD_REG_79 0x4F -#define LCD_REG_80 0x50 -#define LCD_REG_81 0x51 -#define LCD_REG_82 0x52 -#define LCD_REG_83 0x53 -#define LCD_REG_84 0x54 -#define LCD_REG_85 0x55 -#define LCD_REG_86 0x56 -#define LCD_REG_87 0x57 -#define LCD_REG_88 0x58 -#define LCD_REG_89 0x59 -#define LCD_REG_90 0x5A -#define LCD_REG_91 0x5B -#define LCD_REG_92 0x5C -#define LCD_REG_93 0x5D -#define LCD_REG_96 0x60 -#define LCD_REG_97 0x61 -#define LCD_REG_106 0x6A -#define LCD_REG_118 0x76 -#define LCD_REG_128 0x80 -#define LCD_REG_129 0x81 -#define LCD_REG_130 0x82 -#define LCD_REG_131 0x83 -#define LCD_REG_132 0x84 -#define LCD_REG_133 0x85 -#define LCD_REG_134 0x86 -#define LCD_REG_135 0x87 -#define LCD_REG_136 0x88 -#define LCD_REG_137 0x89 -#define LCD_REG_139 0x8B -#define LCD_REG_140 0x8C -#define LCD_REG_141 0x8D -#define LCD_REG_143 0x8F -#define LCD_REG_144 0x90 -#define LCD_REG_145 0x91 -#define LCD_REG_146 0x92 -#define LCD_REG_147 0x93 -#define LCD_REG_148 0x94 -#define LCD_REG_149 0x95 -#define LCD_REG_150 0x96 -#define LCD_REG_151 0x97 -#define LCD_REG_152 0x98 -#define LCD_REG_153 0x99 -#define LCD_REG_154 0x9A -#define LCD_REG_157 0x9D -#define LCD_REG_192 0xC0 -#define LCD_REG_193 0xC1 -#define LCD_REG_227 0xE3 -#define LCD_REG_229 0xE5 -#define LCD_REG_231 0xE7 -#define LCD_REG_239 0xEF -#define LCD_REG_232 0xE8 -#define LCD_REG_233 0xE9 -#define LCD_REG_234 0xEA -#define LCD_REG_235 0xEB -#define LCD_REG_236 0xEC -#define LCD_REG_237 0xED -#define LCD_REG_241 0xF1 -#define LCD_REG_242 0xF2 - -/** - * @} - */ - -/** @defgroup SPFD5408_Exported_Functions - * @{ - */ -void spfd5408_Init(void); -uint16_t spfd5408_ReadID(void); -void spfd5408_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue); -uint16_t spfd5408_ReadReg(uint8_t LCDReg); - -void spfd5408_DisplayOn(void); -void spfd5408_DisplayOff(void); -void spfd5408_SetCursor(uint16_t Xpos, uint16_t Ypos); -void spfd5408_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode); -uint16_t spfd5408_ReadPixel(uint16_t Xpos, uint16_t Ypos); - -void spfd5408_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void spfd5408_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void spfd5408_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp); - -void spfd5408_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); - - -uint16_t spfd5408_GetLcdPixelWidth(void); -uint16_t spfd5408_GetLcdPixelHeight(void); - -/* LCD driver structure */ -extern LCD_DrvTypeDef spfd5408_drv; - -/* LCD IO functions */ -void LCD_IO_Init(void); -void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size); -void LCD_IO_WriteReg(uint8_t Reg); -uint16_t LCD_IO_ReadData(uint16_t Reg); -void LCD_Delay (uint32_t delay); -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SPFD5408_H */ -/** - * @} - */ - -/** - * @} - */ - - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/st7735 b/Drivers/BSP/Components/st7735 new file mode 160000 index 0000000..678861b --- /dev/null +++ b/Drivers/BSP/Components/st7735 @@ -0,0 +1 @@ +Subproject commit 678861b68f4b3acf4f4afd9ef98dd6e728db781c diff --git a/Drivers/BSP/Components/st7735/Release_Notes.html b/Drivers/BSP/Components/st7735/Release_Notes.html deleted file mode 100644 index b445f09..0000000 --- a/Drivers/BSP/Components/st7735/Release_Notes.html +++ /dev/null @@ -1,307 +0,0 @@ - - - - - - - - - - - - - - - - - - - Release Notes for ST7735 Component Drivers - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
- -

Release -Notes for ST7735 Component Drivers

- -

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

V1.1.1/ 24-November-2014

- - - - - - - - - - - - - - - - -

Main -Changes

  • st7735.h: change "\" by "/" in the include path to fix compilation issues under -Linux.

V1.1.0/ 22-July-2014

- - - - - - - - - - - - - - - - -

Main -Changes

  • LCD Component driver update in order to harmonize all LCD controllers Link usage (Change LCD_IO_WriteData to LCD_IO_WriteMultipleData) 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

V1.0.0/ 22-April-2014

- - - - - - - - - - - - - - - - -

Main -Changes

  • First official release.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/st7735/st7735.c b/Drivers/BSP/Components/st7735/st7735.c deleted file mode 100644 index 10dedab..0000000 --- a/Drivers/BSP/Components/st7735/st7735.c +++ /dev/null @@ -1,471 +0,0 @@ -/** - ****************************************************************************** - * @file st7735.c - * @author MCD Application Team - * @version V1.1.1 - * @date 24-November-2014 - * @brief This file includes the driver for ST7735 LCD mounted on the Adafruit - * 1.8" TFT LCD shield (reference ID 802). - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "st7735.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ST7735 - * @brief This file provides a set of functions needed to drive the - * ST7735 LCD. - * @{ - */ - -/** @defgroup ST7735_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup ST7735_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup ST7735_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup ST7735_Private_Variables - * @{ - */ - - -LCD_DrvTypeDef st7735_drv = -{ - st7735_Init, - 0, - st7735_DisplayOn, - st7735_DisplayOff, - st7735_SetCursor, - st7735_WritePixel, - 0, - st7735_SetDisplayWindow, - st7735_DrawHLine, - st7735_DrawVLine, - st7735_GetLcdPixelWidth, - st7735_GetLcdPixelHeight, - st7735_DrawBitmap, -}; - -static uint16_t ArrayRGB[320] = {0}; - -/** -* @} -*/ - -/** @defgroup ST7735_Private_FunctionPrototypes - * @{ - */ - -/** -* @} -*/ - -/** @defgroup ST7735_Private_Functions - * @{ - */ - -/** - * @brief Initialize the ST7735 LCD Component. - * @param None - * @retval None - */ -void st7735_Init(void) -{ - uint8_t data = 0; - - /* Initialize ST7735 low level bus layer -----------------------------------*/ - LCD_IO_Init(); - /* Out of sleep mode, 0 args, no delay */ - st7735_WriteReg(LCD_REG_17, 0x00); - /* Frame rate ctrl - normal mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D)*/ - LCD_IO_WriteReg(LCD_REG_177); - data = 0x01; - LCD_IO_WriteMultipleData(&data, 1); - data = 0x2C; - LCD_IO_WriteMultipleData(&data, 1); - data = 0x2D; - LCD_IO_WriteMultipleData(&data, 1); - /* Frame rate control - idle mode, 3 args:Rate = fosc/(1x2+40) * (LINE+2C+2D) */ - st7735_WriteReg(LCD_REG_178, 0x01); - st7735_WriteReg(LCD_REG_178, 0x2C); - st7735_WriteReg(LCD_REG_178, 0x2D); - /* Frame rate ctrl - partial mode, 6 args: Dot inversion mode, Line inversion mode */ - st7735_WriteReg(LCD_REG_179, 0x01); - st7735_WriteReg(LCD_REG_179, 0x2C); - st7735_WriteReg(LCD_REG_179, 0x2D); - st7735_WriteReg(LCD_REG_179, 0x01); - st7735_WriteReg(LCD_REG_179, 0x2C); - st7735_WriteReg(LCD_REG_179, 0x2D); - /* Display inversion ctrl, 1 arg, no delay: No inversion */ - st7735_WriteReg(LCD_REG_180, 0x07); - /* Power control, 3 args, no delay: -4.6V , AUTO mode */ - st7735_WriteReg(LCD_REG_192, 0xA2); - st7735_WriteReg(LCD_REG_192, 0x02); - st7735_WriteReg(LCD_REG_192, 0x84); - /* Power control, 1 arg, no delay: VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD */ - st7735_WriteReg(LCD_REG_193, 0xC5); - /* Power control, 2 args, no delay: Opamp current small, Boost frequency */ - st7735_WriteReg(LCD_REG_194, 0x0A); - st7735_WriteReg(LCD_REG_194, 0x00); - /* Power control, 2 args, no delay: BCLK/2, Opamp current small & Medium low */ - st7735_WriteReg(LCD_REG_195, 0x8A); - st7735_WriteReg(LCD_REG_195, 0x2A); - /* Power control, 2 args, no delay */ - st7735_WriteReg(LCD_REG_196, 0x8A); - st7735_WriteReg(LCD_REG_196, 0xEE); - /* Power control, 1 arg, no delay */ - st7735_WriteReg(LCD_REG_197, 0x0E); - /* Don't invert display, no args, no delay */ - LCD_IO_WriteReg(LCD_REG_32); - /* Set color mode, 1 arg, no delay: 16-bit color */ - st7735_WriteReg(LCD_REG_58, 0x05); - /* Column addr set, 4 args, no delay: XSTART = 0, XEND = 127 */ - LCD_IO_WriteReg(LCD_REG_42); - data = 0x00; - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteMultipleData(&data, 1); - data = 0x7F; - LCD_IO_WriteMultipleData(&data, 1); - /* Row addr set, 4 args, no delay: YSTART = 0, YEND = 159 */ - LCD_IO_WriteReg(LCD_REG_43); - data = 0x00; - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteMultipleData(&data, 1); - data = 0x9F; - LCD_IO_WriteMultipleData(&data, 1); - /* Magical unicorn dust, 16 args, no delay */ - st7735_WriteReg(LCD_REG_224, 0x02); - st7735_WriteReg(LCD_REG_224, 0x1c); - st7735_WriteReg(LCD_REG_224, 0x07); - st7735_WriteReg(LCD_REG_224, 0x12); - st7735_WriteReg(LCD_REG_224, 0x37); - st7735_WriteReg(LCD_REG_224, 0x32); - st7735_WriteReg(LCD_REG_224, 0x29); - st7735_WriteReg(LCD_REG_224, 0x2d); - st7735_WriteReg(LCD_REG_224, 0x29); - st7735_WriteReg(LCD_REG_224, 0x25); - st7735_WriteReg(LCD_REG_224, 0x2B); - st7735_WriteReg(LCD_REG_224, 0x39); - st7735_WriteReg(LCD_REG_224, 0x00); - st7735_WriteReg(LCD_REG_224, 0x01); - st7735_WriteReg(LCD_REG_224, 0x03); - st7735_WriteReg(LCD_REG_224, 0x10); - /* Sparkles and rainbows, 16 args, no delay */ - st7735_WriteReg(LCD_REG_225, 0x03); - st7735_WriteReg(LCD_REG_225, 0x1d); - st7735_WriteReg(LCD_REG_225, 0x07); - st7735_WriteReg(LCD_REG_225, 0x06); - st7735_WriteReg(LCD_REG_225, 0x2E); - st7735_WriteReg(LCD_REG_225, 0x2C); - st7735_WriteReg(LCD_REG_225, 0x29); - st7735_WriteReg(LCD_REG_225, 0x2D); - st7735_WriteReg(LCD_REG_225, 0x2E); - st7735_WriteReg(LCD_REG_225, 0x2E); - st7735_WriteReg(LCD_REG_225, 0x37); - st7735_WriteReg(LCD_REG_225, 0x3F); - st7735_WriteReg(LCD_REG_225, 0x00); - st7735_WriteReg(LCD_REG_225, 0x00); - st7735_WriteReg(LCD_REG_225, 0x02); - st7735_WriteReg(LCD_REG_225, 0x10); - /* Normal display on, no args, no delay */ - st7735_WriteReg(LCD_REG_19, 0x00); - /* Main screen turn on, no delay */ - st7735_WriteReg(LCD_REG_41, 0x00); - /* Memory access control: MY = 1, MX = 1, MV = 0, ML = 0 */ - st7735_WriteReg(LCD_REG_54, 0xC0); -} - -/** - * @brief Enables the Display. - * @param None - * @retval None - */ -void st7735_DisplayOn(void) -{ - uint8_t data = 0; - LCD_IO_WriteReg(LCD_REG_19); - LCD_Delay(10); - LCD_IO_WriteReg(LCD_REG_41); - LCD_Delay(10); - LCD_IO_WriteReg(LCD_REG_54); - data = 0xC0; - LCD_IO_WriteMultipleData(&data, 1); -} - -/** - * @brief Disables the Display. - * @param None - * @retval None - */ -void st7735_DisplayOff(void) -{ - uint8_t data = 0; - LCD_IO_WriteReg(LCD_REG_19); - LCD_Delay(10); - LCD_IO_WriteReg(LCD_REG_40); - LCD_Delay(10); - LCD_IO_WriteReg(LCD_REG_54); - data = 0xC0; - LCD_IO_WriteMultipleData(&data, 1); -} - -/** - * @brief Sets Cursor position. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @retval None - */ -void st7735_SetCursor(uint16_t Xpos, uint16_t Ypos) -{ - uint8_t data = 0; - LCD_IO_WriteReg(LCD_REG_42); - data = (Xpos) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Xpos) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteReg(LCD_REG_43); - data = (Ypos) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Ypos) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); - LCD_IO_WriteReg(LCD_REG_44); -} - -/** - * @brief Writes pixel. - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param RGBCode: the RGB pixel color - * @retval None - */ -void st7735_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode) -{ - uint8_t data = 0; - if((Xpos >= ST7735_LCD_PIXEL_WIDTH) || (Ypos >= ST7735_LCD_PIXEL_HEIGHT)) - { - return; - } - - /* Set Cursor */ - st7735_SetCursor(Xpos, Ypos); - - data = RGBCode >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = RGBCode; - LCD_IO_WriteMultipleData(&data, 1); -} - - -/** - * @brief Writes to the selected LCD register. - * @param LCDReg: Address of the selected register. - * @param LCDRegValue: value to write to the selected register. - * @retval None - */ -void st7735_WriteReg(uint8_t LCDReg, uint8_t LCDRegValue) -{ - LCD_IO_WriteReg(LCDReg); - LCD_IO_WriteMultipleData(&LCDRegValue, 1); -} - -/** - * @brief Sets a display window - * @param Xpos: specifies the X bottom left position. - * @param Ypos: specifies the Y bottom left position. - * @param Height: display window height. - * @param Width: display window width. - * @retval None - */ -void st7735_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) -{ - uint8_t data = 0; - /* Column addr set, 4 args, no delay: XSTART = Xpos, XEND = (Xpos + Width - 1) */ - LCD_IO_WriteReg(LCD_REG_42); - data = (Xpos) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Xpos) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); - data = (Xpos + Width - 1) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Xpos + Width - 1) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); - /* Row addr set, 4 args, no delay: YSTART = Ypos, YEND = (Ypos + Height - 1) */ - LCD_IO_WriteReg(LCD_REG_43); - data = (Ypos) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Ypos) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); - data = (Ypos + Height - 1) >> 8; - LCD_IO_WriteMultipleData(&data, 1); - data = (Ypos + Height - 1) & 0xFF; - LCD_IO_WriteMultipleData(&data, 1); -} - -/** - * @brief Draws horizontal line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the line length. - * @retval None - */ -void st7735_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint8_t counter = 0; - - if(Xpos + Length > ST7735_LCD_PIXEL_WIDTH) return; - - /* Set Cursor */ - st7735_SetCursor(Xpos, Ypos); - - for(counter = 0; counter < Length; counter++) - { - ArrayRGB[counter] = RGBCode; - } - LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2); -} - -/** - * @brief Draws vertical line. - * @param RGBCode: Specifies the RGB color - * @param Xpos: specifies the X position. - * @param Ypos: specifies the Y position. - * @param Length: specifies the line length. - * @retval None - */ -void st7735_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length) -{ - uint8_t counter = 0; - - if(Ypos + Length > ST7735_LCD_PIXEL_HEIGHT) return; - for(counter = 0; counter < Length; counter++) - { - st7735_WritePixel(Xpos, Ypos + counter, RGBCode); - } -} - -/** - * @brief Gets the LCD pixel Width. - * @param None - * @retval The Lcd Pixel Width - */ -uint16_t st7735_GetLcdPixelWidth(void) -{ - return ST7735_LCD_PIXEL_WIDTH; -} - -/** - * @brief Gets the LCD pixel Height. - * @param None - * @retval The Lcd Pixel Height - */ -uint16_t st7735_GetLcdPixelHeight(void) -{ - return ST7735_LCD_PIXEL_HEIGHT; -} - -/** - * @brief Displays a bitmap picture loaded in the internal Flash. - * @param BmpAddress: Bmp picture address in the internal Flash. - * @retval None - */ -void st7735_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp) -{ - uint32_t index = 0, size = 0; - - /* Read bitmap size */ - size = *(volatile uint16_t *) (pbmp + 2); - size |= (*(volatile uint16_t *) (pbmp + 4)) << 16; - /* Get bitmap data address offset */ - index = *(volatile uint16_t *) (pbmp + 10); - index |= (*(volatile uint16_t *) (pbmp + 12)) << 16; - size = (size - index)/2; - pbmp += index; - - /* Set GRAM write direction and BGR = 0 */ - /* Memory access control: MY = 0, MX = 1, MV = 0, ML = 0 */ - st7735_WriteReg(LCD_REG_54, 0x40); - - /* Set Cursor */ - st7735_SetCursor(Xpos, Ypos); - - LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2); - - /* Set GRAM write direction and BGR = 0 */ - /* Memory access control: MY = 1, MX = 1, MV = 0, ML = 0 */ - st7735_WriteReg(LCD_REG_54, 0xC0); -} - -/** -* @} -*/ - -/** -* @} -*/ - -/** -* @} -*/ - -/** -* @} -*/ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/Drivers/BSP/Components/st7735/st7735.h b/Drivers/BSP/Components/st7735/st7735.h deleted file mode 100644 index 9e98be4..0000000 --- a/Drivers/BSP/Components/st7735/st7735.h +++ /dev/null @@ -1,214 +0,0 @@ -/** - ****************************************************************************** - * @file st7735.h - * @author MCD Application Team - * @version V1.1.1 - * @date 24-November-2014 - * @brief This file contains all the functions prototypes for the st7735.c - * driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __ST7735_H -#define __ST7735_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/lcd.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup ST7735 - * @{ - */ - -/** @defgroup ST7735_Exported_Types - * @{ - */ - -/** - * @} - */ - -/** @defgroup ST7735_Exported_Constants - * @{ - */ - -/** - * @brief ST7735 Size - */ -#define ST7735_LCD_PIXEL_WIDTH ((uint16_t)128) -#define ST7735_LCD_PIXEL_HEIGHT ((uint16_t)160) - -/** - * @brief ST7735 Registers - */ -#define LCD_REG_0 0x00 /* No Operation: NOP */ -#define LCD_REG_1 0x01 /* Software reset: SWRESET */ -#define LCD_REG_4 0x04 /* Read Display ID: RDDID */ -#define LCD_REG_9 0x09 /* Read Display Statu: RDDST */ -#define LCD_REG_10 0x0A /* Read Display Power: RDDPM */ -#define LCD_REG_11 0x0B /* Read Display: RDDMADCTL */ -#define LCD_REG_12 0x0C /* Read Display Pixel: RDDCOLMOD */ -#define LCD_REG_13 0x0D /* Read Display Image: RDDIM */ -#define LCD_REG_14 0x0E /* Read Display Signal: RDDSM */ -#define LCD_REG_16 0x10 /* Sleep in & booster off: SLPIN */ -#define LCD_REG_17 0x11 /* Sleep out & booster on: SLPOUT */ -#define LCD_REG_18 0x12 /* Partial mode on: PTLON */ -#define LCD_REG_19 0x13 /* Partial off (Normal): NORON */ -#define LCD_REG_32 0x20 /* Display inversion off: INVOFF */ -#define LCD_REG_33 0x21 /* Display inversion on: INVON */ -#define LCD_REG_38 0x26 /* Gamma curve select: GAMSET */ -#define LCD_REG_40 0x28 /* Display off: DISPOFF */ -#define LCD_REG_41 0x29 /* Display on: DISPON */ -#define LCD_REG_42 0x2A /* Column address set: CASET */ -#define LCD_REG_43 0x2B /* Row address set: RASET */ -#define LCD_REG_44 0x2C /* Memory write: RAMWR */ -#define LCD_REG_45 0x2D /* LUT for 4k,65k,262k color: RGBSET */ -#define LCD_REG_46 0x2E /* Memory read: RAMRD*/ -#define LCD_REG_48 0x30 /* Partial start/end address set: PTLAR */ -#define LCD_REG_52 0x34 /* Tearing effect line off: TEOFF */ -#define LCD_REG_53 0x35 /* Tearing effect mode set & on: TEON */ -#define LCD_REG_54 0x36 /* Memory data access control: MADCTL */ -#define LCD_REG_56 0x38 /* Idle mode off: IDMOFF */ -#define LCD_REG_57 0x39 /* Idle mode on: IDMON */ -#define LCD_REG_58 0x3A /* Interface pixel format: COLMOD */ -#define LCD_REG_177 0xB1 /* In normal mode (Full colors): FRMCTR1 */ -#define LCD_REG_178 0xB2 /* In Idle mode (8-colors): FRMCTR2 */ -#define LCD_REG_179 0xB3 /* In partial mode + Full colors: FRMCTR3 */ -#define LCD_REG_180 0xB4 /* Display inversion control: INVCTR */ -#define LCD_REG_192 0xC0 /* Power control setting: PWCTR1 */ -#define LCD_REG_193 0xC1 /* Power control setting: PWCTR2 */ -#define LCD_REG_194 0xC2 /* In normal mode (Full colors): PWCTR3 */ -#define LCD_REG_195 0xC3 /* In Idle mode (8-colors): PWCTR4 */ -#define LCD_REG_196 0xC4 /* In partial mode + Full colors: PWCTR5 */ -#define LCD_REG_197 0xC5 /* VCOM control 1: VMCTR1 */ -#define LCD_REG_199 0xC7 /* Set VCOM offset control: VMOFCTR */ -#define LCD_REG_209 0xD1 /* Set LCM version code: WRID2 */ -#define LCD_REG_210 0xD2 /* Customer Project code: WRID3 */ -#define LCD_REG_217 0xD9 /* NVM control status: NVCTR1 */ -#define LCD_REG_218 0xDA /* Read ID1: RDID1 */ -#define LCD_REG_219 0xDB /* Read ID2: RDID2 */ -#define LCD_REG_220 0xDC /* Read ID3: RDID3 */ -#define LCD_REG_222 0xDE /* NVM Read Command: NVCTR2 */ -#define LCD_REG_223 0xDF /* NVM Write Command: NVCTR3 */ -#define LCD_REG_224 0xE0 /* Set Gamma adjustment (+ polarity): GAMCTRP1 */ -#define LCD_REG_225 0xE1 /* Set Gamma adjustment (- polarity): GAMCTRN1 */ - -/** - * @brief LCD Lines depending on the chosen fonts. - */ -#define LCD_LINE_0 LINE(0) -#define LCD_LINE_1 LINE(1) -#define LCD_LINE_2 LINE(2) -#define LCD_LINE_3 LINE(3) -#define LCD_LINE_4 LINE(4) -#define LCD_LINE_5 LINE(5) -#define LCD_LINE_6 LINE(6) -#define LCD_LINE_7 LINE(7) -#define LCD_LINE_8 LINE(8) -#define LCD_LINE_9 LINE(9) -#define LCD_LINE_10 LINE(10) -#define LCD_LINE_11 LINE(11) -#define LCD_LINE_12 LINE(12) -#define LCD_LINE_13 LINE(13) -#define LCD_LINE_14 LINE(14) -#define LCD_LINE_15 LINE(15) -#define LCD_LINE_16 LINE(16) -#define LCD_LINE_17 LINE(17) -#define LCD_LINE_18 LINE(18) -#define LCD_LINE_19 LINE(19) - -/** - * @} - */ - -/** @defgroup ADAFRUIT_SPI_LCD_Exported_Functions - * @{ - */ -void st7735_Init(void); -uint16_t st7735_ReadID(void); - -void st7735_DisplayOn(void); -void st7735_DisplayOff(void); -void st7735_SetCursor(uint16_t Xpos, uint16_t Ypos); -void st7735_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode); -void st7735_WriteReg(uint8_t LCDReg, uint8_t LCDRegValue); -uint8_t st7735_ReadReg(uint8_t LCDReg); - -void st7735_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); -void st7735_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); -void st7735_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length); - -uint16_t st7735_GetLcdPixelWidth(void); -uint16_t st7735_GetLcdPixelHeight(void); -void st7735_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp); - -/* LCD driver structure */ -extern LCD_DrvTypeDef st7735_drv; - -/* LCD IO functions */ -void LCD_IO_Init(void); -void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size); -void LCD_IO_WriteReg(uint8_t Reg); -void LCD_Delay(uint32_t delay); -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __ST7735_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/stlm75 b/Drivers/BSP/Components/stlm75 new file mode 160000 index 0000000..683def4 --- /dev/null +++ b/Drivers/BSP/Components/stlm75 @@ -0,0 +1 @@ +Subproject commit 683def4e7a67e98107a6f33c7694de2f4a1eb776 diff --git a/Drivers/BSP/Components/stlm75/LICENSE.md b/Drivers/BSP/Components/stlm75/LICENSE.md deleted file mode 100644 index fa1b6f2..0000000 --- a/Drivers/BSP/Components/stlm75/LICENSE.md +++ /dev/null @@ -1,27 +0,0 @@ -Copyright 2016 STMicroelectronics. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors -may be used to endorse or promote products derived from this software without -specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Drivers/BSP/Components/stlm75/Release_Notes.html b/Drivers/BSP/Components/stlm75/Release_Notes.html deleted file mode 100644 index b7d899a..0000000 --- a/Drivers/BSP/Components/stlm75/Release_Notes.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - -Release Notes for STM32 STLM75 Components Drivers - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
-

Release -Notes for STLM75 Component Driver

-

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - - - - -
-

Update History

-

V1.0.2 -/ 27-January-2023

-

Main -Changes

- - - - - - - - - -
  • Fix compilation warning in STLM75_Init() with IAR version higher than V8.30.1.
  • All source files: update disclaimer to add reference to the new license agreement.

V1.0.1 -/ 24-November-2014

-

Main -Changes

- - - - - - - - - -
  • stlm75.h: change "\" by "/" in the include path to fix compilation issue under Linux

V1.0.0 -/ 06-May-2014

-

Main -Changes

- - - - - - - - - -
  • First official release of STLM75 Temperature Sensor Component driver
-
-
-
For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32
-
-

-
-
-

 

-
- \ No newline at end of file diff --git a/Drivers/BSP/Components/stlm75/stlm75.c b/Drivers/BSP/Components/stlm75/stlm75.c deleted file mode 100644 index 5a098a4..0000000 --- a/Drivers/BSP/Components/stlm75/stlm75.c +++ /dev/null @@ -1,177 +0,0 @@ -/** - ****************************************************************************** - * @file stlm75.c - * @author MCD Application Team - * @brief This file provides a set of functions needed to manage the STLM75 - * Temperature Sensor. - ****************************************************************************** - * @attention - * - * Copyright (c) 2014 STMicroelectronics. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stlm75.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @defgroup STLM75 - * @brief This file provides a set of functions needed to drive the - * STLM75 Temperature Sensor. - * @{ - */ - -/** @defgroup STLM75_Private_TypesDefinitions - * @{ - */ - -/** - * @} - */ - -/** @defgroup STLM75_Private_Defines - * @{ - */ - -/** - * @} - */ - -/** @defgroup STLM75_Private_Macros - * @{ - */ - -/** - * @} - */ - -/** @defgroup STLM75_Private_Variables - * @{ - */ -TSENSOR_DrvTypeDef Stlm75Drv = -{ - STLM75_Init, - STLM75_IsReady, - STLM75_ReadStatus, - STLM75_ReadTemp, -}; - -/** - * @} - */ - -/** @defgroup STLM75_Private_FunctionPrototypes - * @{ - */ - -/** - * @} - */ - -/** @defgroup STLM75_Private_Functions - * @{ - */ - -/** - * @brief Set STLM75 Initialization. - * @param DeviceAddr : Device ID address. - * @param pInitStruct: pointer to a STLM75_InitTypeDef structure - * that contains the configuration setting for the STLM75. - * @retval None - */ -void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct) -{ - uint8_t confreg = 0; - uint16_t tempreg = 0; - - /* Set the Configuration Register */ - confreg = (uint8_t)(pInitStruct->AlertMode | pInitStruct->ConversionMode); - TSENSOR_IO_Write(DeviceAddr, &confreg, LM75_REG_CONF, 1); - - /* Set the Temperature Registers */ - /* Keep the sign bit and shift the temperature value (as given value is integer, the 0.5 digit is not set) */ - tempreg = (((pInitStruct->TemperatureLimitHigh & 0x7F) << 8) | (pInitStruct->TemperatureLimitHigh & 0x80)); - TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TOS, 2); - - tempreg = (((pInitStruct->TemperatureLimitLow & 0x7F) << 8) | (pInitStruct->TemperatureLimitLow & 0x80)); - TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_THYS, 2); -} - -/** - * @brief Check if STLM75 sensor is ready or not - * @param DeviceAddr : Device ID address. - * @param Trials: Number of trials - * @retval READY or NOT - */ -uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials) -{ - /* Configure the low level interface ---------------------------------------*/ - TSENSOR_IO_Init(); - - /* Check is Temperature Sensor is Ready to use */ - return TSENSOR_IO_IsDeviceReady(DeviceAddr, Trials); -} - -/** - * @brief Read The Temperature Sensor Status - * @param DeviceAddr : Device ID address. - * @retval Status - */ -uint8_t STLM75_ReadStatus(uint16_t DeviceAddr) -{ - uint8_t tmp = 0; - - /* Read Status register */ - TSENSOR_IO_Read(DeviceAddr, &tmp, LM75_REG_CONF, 1); - - /* Return Temperature Sensor Status */ - return (uint8_t)(tmp); -} - -/** - * @brief Read temperature value of STLM75 - * @param DeviceAddr: Device ID address - * @retval temperature value - */ -uint16_t STLM75_ReadTemp(uint16_t DeviceAddr) -{ - uint16_t tempreg = 0; - uint16_t tmp = 0; - - /* Read Temperature registers */ - TSENSOR_IO_Read(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TEMP, 2); - - tmp = ((tempreg & 0x00FF) << 8) | ((tempreg & 0xFF00) >> 8); - tempreg = (((tmp & 0x7F80) >> 7) | (tmp & 0x8000)); - - /* Return Temperature value */ - return (tempreg); -} -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ diff --git a/Drivers/BSP/Components/stlm75/stlm75.h b/Drivers/BSP/Components/stlm75/stlm75.h deleted file mode 100644 index 0f882b5..0000000 --- a/Drivers/BSP/Components/stlm75/stlm75.h +++ /dev/null @@ -1,122 +0,0 @@ -/** - ****************************************************************************** - * @file stlm75.h - * @author MCD Application Team - * @brief This file contains all the functions prototypes for the stlm75.c - * temperature sensor driver. - ****************************************************************************** - * @attention - * - * Copyright (c) 2014 STMicroelectronics. - * All rights reserved. - * - * This software is licensed under terms that can be found in the LICENSE file - * in the root directory of this software component. - * If no LICENSE file comes with this software, it is provided AS-IS. - * - ****************************************************************************** - */ - - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STLM75_H -#define __STLM75_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/tsensor.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @addtogroup STLM75 - * @{ - */ - -/** @defgroup STLM75_Exported_Constants - * @{ - */ -/******************************************************************************/ -/*************************** START REGISTER MAPPING **************************/ -/******************************************************************************/ - -/***************************** Read Access Only *******************************/ -#define LM75_REG_TEMP 0x00 /*!< Temperature Register of LM75 */ - -/***************************** Read/Write Access ******************************/ -#define LM75_REG_CONF 0x01 /*!< Configuration Register of LM75 */ -#define LM75_REG_THYS 0x02 /*!< Temperature Register of LM75 */ -#define LM75_REG_TOS 0x03 /*!< Over-temp Shutdown threshold Register of LM75 */ - -/******************************************************************************/ -/**************************** END REGISTER MAPPING ***************************/ -/******************************************************************************/ -/** @defgroup Conversion_Mode_Selection - * @{ - */ -#define STLM75_CONTINUOUS_MODE ((uint8_t)0x00) -#define STLM75_ONE_SHOT_MODE ((uint8_t)0x01) -/** - * @} - */ - -/** @defgroup Operation_Mode - * @{ - */ -#define STLM75_COMPARATOR_MODE ((uint8_t)0x00) -#define STLM75_INTERRUPT_MODE ((uint8_t)0x02) -/** - * @} - */ - -/** - * @} - */ - -/** @defgroup STLM75_Exported_Functions - * @{ - */ -/* Sensor Configuration Functions */ -void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct); -uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials); -/* Sensor Request Functions */ -uint8_t STLM75_ReadStatus(uint16_t DeviceAddr); -uint16_t STLM75_ReadTemp(uint16_t DeviceAddr); - -/* Temperature Sensor driver structure */ -extern TSENSOR_DrvTypeDef Stlm75Drv; - -/* Temperature Sensor IO functions */ -void TSENSOR_IO_Init(void); -void TSENSOR_IO_Write(uint16_t DevAddress, uint8_t* pBuffer, uint8_t WriteAddr, uint16_t Length); -void TSENSOR_IO_Read(uint16_t DevAddress, uint8_t* pBuffer, uint8_t ReadAddr, uint16_t Length); -uint16_t TSENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials); -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus - } -#endif - -#endif /* __STTS751_H */ diff --git a/Drivers/BSP/Components/stmpe811 b/Drivers/BSP/Components/stmpe811 new file mode 160000 index 0000000..e99670f --- /dev/null +++ b/Drivers/BSP/Components/stmpe811 @@ -0,0 +1 @@ +Subproject commit e99670f7266e86bf0e65dad3ce4b47660dac7a10 diff --git a/Drivers/BSP/Components/stmpe811/Release_Notes.html b/Drivers/BSP/Components/stmpe811/Release_Notes.html deleted file mode 100644 index 75ed36c..0000000 --- a/Drivers/BSP/Components/stmpe811/Release_Notes.html +++ /dev/null @@ -1,378 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Release Notes for STMPE811 Component Driver - - - - - - - - - - -
-


-

-
- - - - - - -
- - - - - - - - - -
-

Back to Release page

-
- -

Release -Notes for STMPE811 Component Driver

- -

Copyright -2014 STMicroelectronics

-

-
-

 

- - - - - - -
- - -

Update History

-

V2.0.0 / 15-December-2014

- - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - -
    -
  • All functions: update IO_Pin parameter to uint32_t instead of uint16_t
  • Add a return valud for stmpe811_IO_Config() function
  • Important Note: This new version V2.0.0 break the compatibility with V1.0.2, and it need to be used with STM32Cube BSP Common V2.0.0

V1.0.2 / 02-December-2014

- - - - - - - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  • stmpe811.h: change "\" by "/" in the include path to fix compilation issue under Linux
    -
- -

V1.0.1 / 11-November-2014

- - - - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - -
  • Fix limitation related to the selection of alternate function for TS physical IO
    -
  • Fix wrong pins definition of the TS
  • Swap implementation of stmpe811_IO_EnableAF() and stmpe811_IO_DisableAF() functions
    -
  • Miscellaneous code cleanup of comments update
    -
- -

V1.0.0 / 18-February-2014

- - - - - - - - - - -

Main -Changes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  •  First official release
  • -

License

-
-Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met:
-
-
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions -in binary form must reproduce the above copyright notice, this list of -conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived
    -
    -
-        from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -
-

- - -
-
-

For -complete documentation on STM32 Microcontrollers -visit www.st.com/STM32

-
-

-
-
-

 

-
- - \ No newline at end of file diff --git a/Drivers/BSP/Components/stmpe811/stmpe811.c b/Drivers/BSP/Components/stmpe811/stmpe811.c deleted file mode 100644 index 325b858..0000000 --- a/Drivers/BSP/Components/stmpe811/stmpe811.c +++ /dev/null @@ -1,977 +0,0 @@ -/** - ****************************************************************************** - * @file stmpe811.c - * @author MCD Application Team - * @version V2.0.0 - * @date 15-December-2014 - * @brief This file provides a set of functions needed to manage the STMPE811 - * IO Expander devices. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stmpe811.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @defgroup STMPE811 - * @{ - */ - -/** @defgroup STMPE811_Private_Types_Definitions - * @{ - */ - -/** @defgroup STMPE811_Private_Defines - * @{ - */ -#define STMPE811_MAX_INSTANCE 2 -/** - * @} - */ - -/** @defgroup STMPE811_Private_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STMPE811_Private_Variables - * @{ - */ - -/* Touch screen driver structure initialization */ -TS_DrvTypeDef stmpe811_ts_drv = -{ - stmpe811_Init, - stmpe811_ReadID, - stmpe811_Reset, - stmpe811_TS_Start, - stmpe811_TS_DetectTouch, - stmpe811_TS_GetXY, - stmpe811_TS_EnableIT, - stmpe811_TS_ClearIT, - stmpe811_TS_ITStatus, - stmpe811_TS_DisableIT, -}; - -/* IO driver structure initialization */ -IO_DrvTypeDef stmpe811_io_drv = -{ - stmpe811_Init, - stmpe811_ReadID, - stmpe811_Reset, - stmpe811_IO_Start, - stmpe811_IO_Config, - stmpe811_IO_WritePin, - stmpe811_IO_ReadPin, - stmpe811_IO_EnableIT, - stmpe811_IO_DisableIT, - stmpe811_IO_ITStatus, - stmpe811_IO_ClearIT, -}; - -/* stmpe811 instances by address */ -uint8_t stmpe811[STMPE811_MAX_INSTANCE] = {0}; -/** - * @} - */ - -/** @defgroup STMPE811_Private_Function_Prototypes - * @{ - */ -static uint8_t stmpe811_GetInstance(uint16_t DeviceAddr); -/** - * @} - */ - -/** @defgroup STMPE811_Private_Functions - * @{ - */ - -/** - * @brief Initialize the stmpe811 and configure the needed hardware resources - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_Init(uint16_t DeviceAddr) -{ - uint8_t instance; - uint8_t empty; - - /* Check if device instance already exists */ - instance = stmpe811_GetInstance(DeviceAddr); - - /* To prevent double initialization */ - if(instance == 0xFF) - { - /* Look for empty instance */ - empty = stmpe811_GetInstance(0); - - if(empty < STMPE811_MAX_INSTANCE) - { - /* Register the current device instance */ - stmpe811[empty] = DeviceAddr; - - /* Initialize IO BUS layer */ - IOE_Init(); - - /* Generate stmpe811 Software reset */ - stmpe811_Reset(DeviceAddr); - } - } -} - -/** - * @brief Reset the stmpe811 by Software. - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_Reset(uint16_t DeviceAddr) -{ - /* Power Down the stmpe811 */ - IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL1, 2); - - /* Wait for a delay to ensure registers erasing */ - IOE_Delay(10); - - /* Power On the Codec after the power off => all registers are reinitialized */ - IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL1, 0); - - /* Wait for a delay to ensure registers erasing */ - IOE_Delay(2); -} - -/** - * @brief Read the stmpe811 IO Expander device ID. - * @param DeviceAddr: Device address on communication Bus. - * @retval The Device ID (two bytes). - */ -uint16_t stmpe811_ReadID(uint16_t DeviceAddr) -{ - /* Initialize IO BUS layer */ - IOE_Init(); - - /* Return the device ID value */ - return ((IOE_Read(DeviceAddr, STMPE811_REG_CHP_ID_LSB) << 8) |\ - (IOE_Read(DeviceAddr, STMPE811_REG_CHP_ID_MSB))); -} - -/** - * @brief Enable the Global interrupt. - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_EnableGlobalIT(uint16_t DeviceAddr) -{ - uint8_t tmp = 0; - - /* Read the Interrupt Control register */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_CTRL); - - /* Set the global interrupts to be Enabled */ - tmp |= (uint8_t)STMPE811_GIT_EN; - - /* Write Back the Interrupt Control register */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_CTRL, tmp); -} - -/** - * @brief Disable the Global interrupt. - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_DisableGlobalIT(uint16_t DeviceAddr) -{ - uint8_t tmp = 0; - - /* Read the Interrupt Control register */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_CTRL); - - /* Set the global interrupts to be Disabled */ - tmp &= ~(uint8_t)STMPE811_GIT_EN; - - /* Write Back the Interrupt Control register */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_CTRL, tmp); - -} - -/** - * @brief Enable the interrupt mode for the selected IT source - * @param DeviceAddr: Device address on communication Bus. - * @param Source: The interrupt source to be configured, could be: - * @arg STMPE811_GIT_IO: IO interrupt - * @arg STMPE811_GIT_ADC : ADC interrupt - * @arg STMPE811_GIT_FE : Touch Screen Controller FIFO Error interrupt - * @arg STMPE811_GIT_FF : Touch Screen Controller FIFO Full interrupt - * @arg STMPE811_GIT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg STMPE811_GIT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg STMPE811_GIT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval None - */ -void stmpe811_EnableITSource(uint16_t DeviceAddr, uint8_t Source) -{ - uint8_t tmp = 0; - - /* Get the current value of the INT_EN register */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_EN); - - /* Set the interrupts to be Enabled */ - tmp |= Source; - - /* Set the register */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_EN, tmp); -} - -/** - * @brief Disable the interrupt mode for the selected IT source - * @param DeviceAddr: Device address on communication Bus. - * @param Source: The interrupt source to be configured, could be: - * @arg STMPE811_GIT_IO: IO interrupt - * @arg STMPE811_GIT_ADC : ADC interrupt - * @arg STMPE811_GIT_FE : Touch Screen Controller FIFO Error interrupt - * @arg STMPE811_GIT_FF : Touch Screen Controller FIFO Full interrupt - * @arg STMPE811_GIT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg STMPE811_GIT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg STMPE811_GIT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval None - */ -void stmpe811_DisableITSource(uint16_t DeviceAddr, uint8_t Source) -{ - uint8_t tmp = 0; - - /* Get the current value of the INT_EN register */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_EN); - - /* Set the interrupts to be Enabled */ - tmp &= ~Source; - - /* Set the register */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_EN, tmp); -} - -/** - * @brief Set the global interrupt Polarity. - * @param DeviceAddr: Device address on communication Bus. - * @param Polarity: the IT mode polarity, could be one of the following values: - * @arg STMPE811_POLARITY_LOW: Interrupt line is active Low/Falling edge - * @arg STMPE811_POLARITY_HIGH: Interrupt line is active High/Rising edge - * @retval None - */ -void stmpe811_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity) -{ - uint8_t tmp = 0; - - /* Get the current register value */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_CTRL); - - /* Mask the polarity bits */ - tmp &= ~(uint8_t)0x04; - - /* Modify the Interrupt Output line configuration */ - tmp |= Polarity; - - /* Set the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_CTRL, tmp); - -} - -/** - * @brief Set the global interrupt Type. - * @param DeviceAddr: Device address on communication Bus. - * @param Type: Interrupt line activity type, could be one of the following values: - * @arg STMPE811_TYPE_LEVEL: Interrupt line is active in level model - * @arg STMPE811_TYPE_EDGE: Interrupt line is active in edge model - * @retval None - */ -void stmpe811_SetITType(uint16_t DeviceAddr, uint8_t Type) -{ - uint8_t tmp = 0; - - /* Get the current register value */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_INT_CTRL); - - /* Mask the type bits */ - tmp &= ~(uint8_t)0x02; - - /* Modify the Interrupt Output line configuration */ - tmp |= Type; - - /* Set the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_CTRL, tmp); - -} - -/** - * @brief Check the selected Global interrupt source pending bit - * @param DeviceAddr: Device address on communication Bus. - * @param Source: the Global interrupt source to be checked, could be: - * @arg STMPE811_GIT_IO: IO interrupt - * @arg STMPE811_GIT_ADC : ADC interrupt - * @arg STMPE811_GIT_FE : Touch Screen Controller FIFO Error interrupt - * @arg STMPE811_GIT_FF : Touch Screen Controller FIFO Full interrupt - * @arg STMPE811_GIT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg STMPE811_GIT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg STMPE811_GIT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval The checked Global interrupt source status. - */ -uint8_t stmpe811_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source) -{ - /* Return the global IT source status */ - return((IOE_Read(DeviceAddr, STMPE811_REG_INT_STA) & Source) == Source); -} - -/** - * @brief Return the Global interrupts status - * @param DeviceAddr: Device address on communication Bus. - * @param Source: the Global interrupt source to be checked, could be: - * @arg STMPE811_GIT_IO: IO interrupt - * @arg STMPE811_GIT_ADC : ADC interrupt - * @arg STMPE811_GIT_FE : Touch Screen Controller FIFO Error interrupt - * @arg STMPE811_GIT_FF : Touch Screen Controller FIFO Full interrupt - * @arg STMPE811_GIT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg STMPE811_GIT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg STMPE811_GIT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval The checked Global interrupt source status. - */ -uint8_t stmpe811_ReadGITStatus(uint16_t DeviceAddr, uint8_t Source) -{ - /* Return the global IT source status */ - return((IOE_Read(DeviceAddr, STMPE811_REG_INT_STA) & Source)); -} - -/** - * @brief Clear the selected Global interrupt pending bit(s) - * @param DeviceAddr: Device address on communication Bus. - * @param Source: the Global interrupt source to be cleared, could be any combination - * of the following values: - * @arg STMPE811_GIT_IO: IO interrupt - * @arg STMPE811_GIT_ADC : ADC interrupt - * @arg STMPE811_GIT_FE : Touch Screen Controller FIFO Error interrupt - * @arg STMPE811_GIT_FF : Touch Screen Controller FIFO Full interrupt - * @arg STMPE811_GIT_FOV : Touch Screen Controller FIFO Overrun interrupt - * @arg STMPE811_GIT_FTH : Touch Screen Controller FIFO Threshold interrupt - * @arg STMPE811_GIT_TOUCH : Touch Screen Controller Touch Detected interrupt - * @retval None - */ -void stmpe811_ClearGlobalIT(uint16_t DeviceAddr, uint8_t Source) -{ - /* Write 1 to the bits that have to be cleared */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_STA, Source); -} - -/** - * @brief Start the IO functionality use and disable the AF for selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO pin(s) to put in AF. This parameter can be one - * of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - uint8_t mode; - - /* Get the current register value */ - mode = IOE_Read(DeviceAddr, STMPE811_REG_SYS_CTRL2); - - /* Set the Functionalities to be Disabled */ - mode &= ~(STMPE811_IO_FCT | STMPE811_ADC_FCT); - - /* Write the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL2, mode); - - /* Disable AF for the selected IO pin(s) */ - stmpe811_IO_DisableAF(DeviceAddr, (uint8_t)IO_Pin); -} - -/** - * @brief Configures the IO pin(s) according to IO mode structure value. - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The output pin to be set or reset. This parameter can be one - * of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @param IO_Mode: The IO pin mode to configure, could be one of the following values: - * @arg IO_MODE_INPUT - * @arg IO_MODE_OUTPUT - * @arg IO_MODE_IT_RISING_EDGE - * @arg IO_MODE_IT_FALLING_EDGE - * @arg IO_MODE_IT_LOW_LEVEL - * @arg IO_MODE_IT_HIGH_LEVEL - * @retval 0 if no error, IO_Mode if error - */ -uint8_t stmpe811_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode) -{ - uint8_t error_code = 0; - - /* Configure IO pin according to selected IO mode */ - switch(IO_Mode) - { - case IO_MODE_INPUT: /* Input mode */ - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_IN); - break; - - case IO_MODE_OUTPUT: /* Output mode */ - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_OUT); - break; - - case IO_MODE_IT_RISING_EDGE: /* Interrupt rising edge mode */ - stmpe811_IO_EnableIT(DeviceAddr); - stmpe811_IO_EnablePinIT(DeviceAddr, IO_Pin); - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_IN); - stmpe811_SetITType(DeviceAddr, STMPE811_TYPE_EDGE); - stmpe811_IO_SetEdgeMode(DeviceAddr, IO_Pin, STMPE811_EDGE_RISING); - break; - - case IO_MODE_IT_FALLING_EDGE: /* Interrupt falling edge mode */ - stmpe811_IO_EnableIT(DeviceAddr); - stmpe811_IO_EnablePinIT(DeviceAddr, IO_Pin); - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_IN); - stmpe811_SetITType(DeviceAddr, STMPE811_TYPE_EDGE); - stmpe811_IO_SetEdgeMode(DeviceAddr, IO_Pin, STMPE811_EDGE_FALLING); - break; - - case IO_MODE_IT_LOW_LEVEL: /* Low level interrupt mode */ - stmpe811_IO_EnableIT(DeviceAddr); - stmpe811_IO_EnablePinIT(DeviceAddr, IO_Pin); - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_IN); - stmpe811_SetITType(DeviceAddr, STMPE811_TYPE_LEVEL); - stmpe811_SetITPolarity(DeviceAddr, STMPE811_POLARITY_LOW); - break; - - case IO_MODE_IT_HIGH_LEVEL: /* High level interrupt mode */ - stmpe811_IO_EnableIT(DeviceAddr); - stmpe811_IO_EnablePinIT(DeviceAddr, IO_Pin); - stmpe811_IO_InitPin(DeviceAddr, IO_Pin, STMPE811_DIRECTION_IN); - stmpe811_SetITType(DeviceAddr, STMPE811_TYPE_LEVEL); - stmpe811_SetITPolarity(DeviceAddr, STMPE811_POLARITY_HIGH); - break; - - default: - error_code = (uint8_t) IO_Mode; - break; - } - return error_code; -} - -/** - * @brief Initialize the selected IO pin direction. - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO pin to be configured. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: Where x can be from 0 to 7. - * @param Direction: could be STMPE811_DIRECTION_IN or STMPE811_DIRECTION_OUT. - * @retval None - */ -void stmpe811_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction) -{ - uint8_t tmp = 0; - - /* Get all the Pins direction */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_DIR); - - /* Set the selected pin direction */ - if (Direction != STMPE811_DIRECTION_IN) - { - tmp |= (uint8_t)IO_Pin; - } - else - { - tmp &= ~(uint8_t)IO_Pin; - } - - /* Write the register new value */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_DIR, tmp); -} - -/** - * @brief Disable the AF for the selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO pin to be configured. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: Where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_DisableAF(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - uint8_t tmp = 0; - - /* Get the current state of the IO_AF register */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_AF); - - /* Enable the selected pins alternate function */ - tmp |= (uint8_t)IO_Pin; - - /* Write back the new value in IO AF register */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_AF, tmp); - -} - -/** - * @brief Enable the AF for the selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO pin to be configured. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: Where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_EnableAF(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - uint8_t tmp = 0; - - /* Get the current register value */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_AF); - - /* Enable the selected pins alternate function */ - tmp &= ~(uint8_t)IO_Pin; - - /* Write back the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_AF, tmp); -} - -/** - * @brief Configure the Edge for which a transition is detectable for the - * selected pin. - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO pin to be configured. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: Where x can be from 0 to 7. - * @param Edge: The edge which will be detected. This parameter can be one or - * a combination of following values: STMPE811_EDGE_FALLING and STMPE811_EDGE_RISING . - * @retval None - */ -void stmpe811_IO_SetEdgeMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Edge) -{ - uint8_t tmp1 = 0, tmp2 = 0; - - /* Get the current registers values */ - tmp1 = IOE_Read(DeviceAddr, STMPE811_REG_IO_FE); - tmp2 = IOE_Read(DeviceAddr, STMPE811_REG_IO_RE); - - /* Disable the Falling Edge */ - tmp1 &= ~(uint8_t)IO_Pin; - - /* Disable the Falling Edge */ - tmp2 &= ~(uint8_t)IO_Pin; - - /* Enable the Falling edge if selected */ - if (Edge & STMPE811_EDGE_FALLING) - { - tmp1 |= (uint8_t)IO_Pin; - } - - /* Enable the Rising edge if selected */ - if (Edge & STMPE811_EDGE_RISING) - { - tmp2 |= (uint8_t)IO_Pin; - } - - /* Write back the new registers values */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_FE, tmp1); - IOE_Write(DeviceAddr, STMPE811_REG_IO_RE, tmp2); -} - -/** - * @brief Write a new IO pin state. - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The output pin to be set or reset. This parameter can be one - * of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @param PinState: The new IO pin state. - * @retval None - */ -void stmpe811_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState) -{ - /* Apply the bit value to the selected pin */ - if (PinState != 0) - { - /* Set the register */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_SET_PIN, (uint8_t)IO_Pin); - } - else - { - /* Set the register */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_CLR_PIN, (uint8_t)IO_Pin); - } -} - -/** - * @brief Return the state of the selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The output pin to be set or reset. This parameter can be one - * of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @retval IO pin(s) state. - */ -uint32_t stmpe811_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - return((uint32_t)(IOE_Read(DeviceAddr, STMPE811_REG_IO_MP_STA) & (uint8_t)IO_Pin)); -} - -/** - * @brief Enable the global IO interrupt source. - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_IO_EnableIT(uint16_t DeviceAddr) -{ - IOE_ITConfig(); - - /* Enable global IO IT source */ - stmpe811_EnableITSource(DeviceAddr, STMPE811_GIT_IO); - - /* Enable global interrupt */ - stmpe811_EnableGlobalIT(DeviceAddr); -} - -/** - * @brief Disable the global IO interrupt source. - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_IO_DisableIT(uint16_t DeviceAddr) -{ - /* Disable the global interrupt */ - stmpe811_DisableGlobalIT(DeviceAddr); - - /* Disable global IO IT source */ - stmpe811_DisableITSource(DeviceAddr, STMPE811_GIT_IO); -} - -/** - * @brief Enable interrupt mode for the selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO interrupt to be enabled. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - uint8_t tmp = 0; - - /* Get the IO interrupt state */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_INT_EN); - - /* Set the interrupts to be enabled */ - tmp |= (uint8_t)IO_Pin; - - /* Write the register new value */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_INT_EN, tmp); -} - -/** - * @brief Disable interrupt mode for the selected IO pin(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO interrupt to be disabled. This parameter could be any - * combination of the following values: - * @arg STMPE811_PIN_x: where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - uint8_t tmp = 0; - - /* Get the IO interrupt state */ - tmp = IOE_Read(DeviceAddr, STMPE811_REG_IO_INT_EN); - - /* Set the interrupts to be Disabled */ - tmp &= ~(uint8_t)IO_Pin; - - /* Write the register new value */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_INT_EN, tmp); -} - -/** - * @brief Check the status of the selected IO interrupt pending bit - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: The IO interrupt to be checked could be: - * @arg STMPE811_PIN_x Where x can be from 0 to 7. - * @retval Status of the checked IO pin(s). - */ -uint32_t stmpe811_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - /* Get the Interrupt status */ - return(IOE_Read(DeviceAddr, STMPE811_REG_IO_INT_STA) & (uint8_t)IO_Pin); -} - -/** - * @brief Clear the selected IO interrupt pending bit(s). - * @param DeviceAddr: Device address on communication Bus. - * @param IO_Pin: the IO interrupt to be cleared, could be: - * @arg STMPE811_PIN_x: Where x can be from 0 to 7. - * @retval None - */ -void stmpe811_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin) -{ - /* Clear the global IO IT pending bit */ - stmpe811_ClearGlobalIT(DeviceAddr, STMPE811_GIT_IO); - - /* Clear the IO IT pending bit(s) */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_INT_STA, (uint8_t)IO_Pin); - - /* Clear the Edge detection pending bit*/ - IOE_Write(DeviceAddr, STMPE811_REG_IO_ED, (uint8_t)IO_Pin); - - /* Clear the Rising edge pending bit */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_RE, (uint8_t)IO_Pin); - - /* Clear the Falling edge pending bit */ - IOE_Write(DeviceAddr, STMPE811_REG_IO_FE, (uint8_t)IO_Pin); -} - -/** - * @brief Configures the touch Screen Controller (Single point detection) - * @param DeviceAddr: Device address on communication Bus. - * @retval None. - */ -void stmpe811_TS_Start(uint16_t DeviceAddr) -{ - uint8_t mode; - - /* Get the current register value */ - mode = IOE_Read(DeviceAddr, STMPE811_REG_SYS_CTRL2); - - /* Set the Functionalities to be Enabled */ - mode &= ~(STMPE811_IO_FCT); - - /* Write the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL2, mode); - - /* Select TSC pins in TSC alternate mode */ - stmpe811_IO_EnableAF(DeviceAddr, STMPE811_TOUCH_IO_ALL); - - /* Set the Functionalities to be Enabled */ - mode &= ~(STMPE811_TS_FCT | STMPE811_ADC_FCT); - - /* Set the new register value */ - IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL2, mode); - - /* Select Sample Time, bit number and ADC Reference */ - IOE_Write(DeviceAddr, STMPE811_REG_ADC_CTRL1, 0x49); - - /* Wait for 2 ms */ - IOE_Delay(2); - - /* Select the ADC clock speed: 3.25 MHz */ - IOE_Write(DeviceAddr, STMPE811_REG_ADC_CTRL2, 0x01); - - /* Select 2 nF filter capacitor */ - /* Configuration: - - Touch average control : 4 samples - - Touch delay time : 500 uS - - Panel driver setting time: 500 uS - */ - IOE_Write(DeviceAddr, STMPE811_REG_TSC_CFG, 0x9A); - - /* Configure the Touch FIFO threshold: single point reading */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_TH, 0x01); - - /* Clear the FIFO memory content. */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x01); - - /* Put the FIFO back into operation mode */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x00); - - /* Set the range and accuracy pf the pressure measurement (Z) : - - Fractional part :7 - - Whole part :1 - */ - IOE_Write(DeviceAddr, STMPE811_REG_TSC_FRACT_XYZ, 0x01); - - /* Set the driving capability (limit) of the device for TSC pins: 50mA */ - IOE_Write(DeviceAddr, STMPE811_REG_TSC_I_DRIVE, 0x01); - - /* Touch screen control configuration (enable TSC): - - No window tracking index - - XYZ acquisition mode - */ - IOE_Write(DeviceAddr, STMPE811_REG_TSC_CTRL, 0x01); - - /* Clear all the status pending bits if any */ - IOE_Write(DeviceAddr, STMPE811_REG_INT_STA, 0xFF); - - /* Wait for 2 ms delay */ - IOE_Delay(2); -} - -/** - * @brief Return if there is touch detected or not. - * @param DeviceAddr: Device address on communication Bus. - * @retval Touch detected state. - */ -uint8_t stmpe811_TS_DetectTouch(uint16_t DeviceAddr) -{ - uint8_t state; - uint8_t ret = 0; - - state = ((IOE_Read(DeviceAddr, STMPE811_REG_TSC_CTRL) & (uint8_t)STMPE811_TS_CTRL_STATUS) == (uint8_t)0x80); - - if(state > 0) - { - if(IOE_Read(DeviceAddr, STMPE811_REG_FIFO_SIZE) > 0) - { - ret = 1; - } - } - else - { - /* Reset FIFO */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x01); - /* Enable the FIFO again */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x00); - } - - return ret; -} - -/** - * @brief Get the touch screen X and Y positions values - * @param DeviceAddr: Device address on communication Bus. - * @param X: Pointer to X position value - * @param Y: Pointer to Y position value - * @retval None. - */ -void stmpe811_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y) -{ - uint8_t dataXYZ[4]; - uint32_t uldataXYZ; - - IOE_ReadMultiple(DeviceAddr, STMPE811_REG_TSC_DATA_NON_INC, dataXYZ, sizeof(dataXYZ)) ; - - /* Calculate positions values */ - uldataXYZ = (dataXYZ[0] << 24)|(dataXYZ[1] << 16)|(dataXYZ[2] << 8)|(dataXYZ[3] << 0); - *X = (uldataXYZ >> 20) & 0x00000FFF; - *Y = (uldataXYZ >> 8) & 0x00000FFF; - - /* Reset FIFO */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x01); - /* Enable the FIFO again */ - IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x00); -} - -/** - * @brief Configure the selected source to generate a global interrupt or not - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_TS_EnableIT(uint16_t DeviceAddr) -{ - IOE_ITConfig(); - - /* Enable global TS IT source */ - stmpe811_EnableITSource(DeviceAddr, STMPE811_TS_IT); - - /* Enable global interrupt */ - stmpe811_EnableGlobalIT(DeviceAddr); -} - -/** - * @brief Configure the selected source to generate a global interrupt or not - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_TS_DisableIT(uint16_t DeviceAddr) -{ - /* Disable global interrupt */ - stmpe811_DisableGlobalIT(DeviceAddr); - - /* Disable global TS IT source */ - stmpe811_DisableITSource(DeviceAddr, STMPE811_TS_IT); -} - -/** - * @brief Configure the selected source to generate a global interrupt or not - * @param DeviceAddr: Device address on communication Bus. - * @retval TS interrupts status - */ -uint8_t stmpe811_TS_ITStatus(uint16_t DeviceAddr) -{ - /* Return TS interrupts status */ - return(stmpe811_ReadGITStatus(DeviceAddr, STMPE811_TS_IT)); -} - -/** - * @brief Configure the selected source to generate a global interrupt or not - * @param DeviceAddr: Device address on communication Bus. - * @retval None - */ -void stmpe811_TS_ClearIT(uint16_t DeviceAddr) -{ - /* Clear the global TS IT source */ - stmpe811_ClearGlobalIT(DeviceAddr, STMPE811_TS_IT); -} - -/** - * @brief Check if the device instance of the selected address is already registered - * and return its index - * @param DeviceAddr: Device address on communication Bus. - * @retval Index of the device instance if registered, 0xFF if not. - */ -static uint8_t stmpe811_GetInstance(uint16_t DeviceAddr) -{ - uint8_t idx = 0; - - /* Check all the registered instances */ - for(idx = 0; idx < STMPE811_MAX_INSTANCE ; idx ++) - { - if(stmpe811[idx] == DeviceAddr) - { - return idx; - } - } - - return 0xFF; -} - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/Drivers/BSP/Components/stmpe811/stmpe811.h b/Drivers/BSP/Components/stmpe811/stmpe811.h deleted file mode 100644 index 0ef74f3..0000000 --- a/Drivers/BSP/Components/stmpe811/stmpe811.h +++ /dev/null @@ -1,291 +0,0 @@ -/** - ****************************************************************************** - * @file stmpe811.h - * @author MCD Application Team - * @version V2.0.0 - * @date 15-December-2014 - * @brief This file contains all the functions prototypes for the - * stmpe811.c IO expander driver. - ****************************************************************************** - * @attention - * - *

© COPYRIGHT(c) 2014 STMicroelectronics

- * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STMPE811_H -#define __STMPE811_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Includes ------------------------------------------------------------------*/ -#include "../Common/ts.h" -#include "../Common/io.h" - -/** @addtogroup BSP - * @{ - */ - -/** @addtogroup Components - * @{ - */ - -/** @defgroup STMPE811 - * @{ - */ - -/** @defgroup STMPE811_Exported_Types - * @{ - */ -/** - * @} - */ - -/** @defgroup STMPE811_Exported_Constants - * @{ - */ - -/* Chip IDs */ -#define STMPE811_ID 0x0811 - -/* Identification registers & System Control */ -#define STMPE811_REG_CHP_ID_LSB 0x00 -#define STMPE811_REG_CHP_ID_MSB 0x01 -#define STMPE811_REG_ID_VER 0x02 - -/* Global interrupt Enable bit */ -#define STMPE811_GIT_EN 0x01 - -/* IO expander functionalities */ -#define STMPE811_ADC_FCT 0x01 -#define STMPE811_TS_FCT 0x02 -#define STMPE811_IO_FCT 0x04 -#define STMPE811_TEMPSENS_FCT 0x08 - -/* Global Interrupts definitions */ -#define STMPE811_GIT_IO 0x80 /* IO interrupt */ -#define STMPE811_GIT_ADC 0x40 /* ADC interrupt */ -#define STMPE811_GIT_TEMP 0x20 /* Not implemented */ -#define STMPE811_GIT_FE 0x10 /* FIFO empty interrupt */ -#define STMPE811_GIT_FF 0x08 /* FIFO full interrupt */ -#define STMPE811_GIT_FOV 0x04 /* FIFO overflowed interrupt */ -#define STMPE811_GIT_FTH 0x02 /* FIFO above threshold interrupt */ -#define STMPE811_GIT_TOUCH 0x01 /* Touch is detected interrupt */ -#define STMPE811_ALL_GIT 0x1F /* All global interrupts */ -#define STMPE811_TS_IT (STMPE811_GIT_TOUCH | STMPE811_GIT_FTH | STMPE811_GIT_FOV | STMPE811_GIT_FF | STMPE811_GIT_FE) /* Touch screen interrupts */ - -/* General Control Registers */ -#define STMPE811_REG_SYS_CTRL1 0x03 -#define STMPE811_REG_SYS_CTRL2 0x04 -#define STMPE811_REG_SPI_CFG 0x08 - -/* Interrupt system Registers */ -#define STMPE811_REG_INT_CTRL 0x09 -#define STMPE811_REG_INT_EN 0x0A -#define STMPE811_REG_INT_STA 0x0B -#define STMPE811_REG_IO_INT_EN 0x0C -#define STMPE811_REG_IO_INT_STA 0x0D - -/* IO Registers */ -#define STMPE811_REG_IO_SET_PIN 0x10 -#define STMPE811_REG_IO_CLR_PIN 0x11 -#define STMPE811_REG_IO_MP_STA 0x12 -#define STMPE811_REG_IO_DIR 0x13 -#define STMPE811_REG_IO_ED 0x14 -#define STMPE811_REG_IO_RE 0x15 -#define STMPE811_REG_IO_FE 0x16 -#define STMPE811_REG_IO_AF 0x17 - -/* ADC Registers */ -#define STMPE811_REG_ADC_INT_EN 0x0E -#define STMPE811_REG_ADC_INT_STA 0x0F -#define STMPE811_REG_ADC_CTRL1 0x20 -#define STMPE811_REG_ADC_CTRL2 0x21 -#define STMPE811_REG_ADC_CAPT 0x22 -#define STMPE811_REG_ADC_DATA_CH0 0x30 -#define STMPE811_REG_ADC_DATA_CH1 0x32 -#define STMPE811_REG_ADC_DATA_CH2 0x34 -#define STMPE811_REG_ADC_DATA_CH3 0x36 -#define STMPE811_REG_ADC_DATA_CH4 0x38 -#define STMPE811_REG_ADC_DATA_CH5 0x3A -#define STMPE811_REG_ADC_DATA_CH6 0x3B -#define STMPE811_REG_ADC_DATA_CH7 0x3C - -/* Touch Screen Registers */ -#define STMPE811_REG_TSC_CTRL 0x40 -#define STMPE811_REG_TSC_CFG 0x41 -#define STMPE811_REG_WDM_TR_X 0x42 -#define STMPE811_REG_WDM_TR_Y 0x44 -#define STMPE811_REG_WDM_BL_X 0x46 -#define STMPE811_REG_WDM_BL_Y 0x48 -#define STMPE811_REG_FIFO_TH 0x4A -#define STMPE811_REG_FIFO_STA 0x4B -#define STMPE811_REG_FIFO_SIZE 0x4C -#define STMPE811_REG_TSC_DATA_X 0x4D -#define STMPE811_REG_TSC_DATA_Y 0x4F -#define STMPE811_REG_TSC_DATA_Z 0x51 -#define STMPE811_REG_TSC_DATA_XYZ 0x52 -#define STMPE811_REG_TSC_FRACT_XYZ 0x56 -#define STMPE811_REG_TSC_DATA_INC 0x57 -#define STMPE811_REG_TSC_DATA_NON_INC 0xD7 -#define STMPE811_REG_TSC_I_DRIVE 0x58 -#define STMPE811_REG_TSC_SHIELD 0x59 - -/* Touch Screen Pins definition */ -#define STMPE811_TOUCH_YD STMPE811_PIN_7 -#define STMPE811_TOUCH_XD STMPE811_PIN_6 -#define STMPE811_TOUCH_YU STMPE811_PIN_5 -#define STMPE811_TOUCH_XU STMPE811_PIN_4 -#define STMPE811_TOUCH_IO_ALL (uint32_t)(STMPE811_TOUCH_YD | STMPE811_TOUCH_XD | STMPE811_TOUCH_YU | STMPE811_TOUCH_XU) - -/* IO Pins definition */ -#define STMPE811_PIN_0 0x01 -#define STMPE811_PIN_1 0x02 -#define STMPE811_PIN_2 0x04 -#define STMPE811_PIN_3 0x08 -#define STMPE811_PIN_4 0x10 -#define STMPE811_PIN_5 0x20 -#define STMPE811_PIN_6 0x40 -#define STMPE811_PIN_7 0x80 -#define STMPE811_PIN_ALL 0xFF - -/* IO Pins directions */ -#define STMPE811_DIRECTION_IN 0x00 -#define STMPE811_DIRECTION_OUT 0x01 - -/* IO IT types */ -#define STMPE811_TYPE_LEVEL 0x00 -#define STMPE811_TYPE_EDGE 0x02 - -/* IO IT polarity */ -#define STMPE811_POLARITY_LOW 0x00 -#define STMPE811_POLARITY_HIGH 0x04 - -/* IO Pin IT edge modes */ -#define STMPE811_EDGE_FALLING 0x01 -#define STMPE811_EDGE_RISING 0x02 - -/* TS registers masks */ -#define STMPE811_TS_CTRL_ENABLE 0x01 -#define STMPE811_TS_CTRL_STATUS 0x80 -/** - * @} - */ - -/** @defgroup STMPE811_Exported_Macros - * @{ - */ -/** - * @} - */ - -/** @defgroup STMPE811_Exported_Functions - * @{ - */ - -/** - * @brief STMPE811 Control functions - */ -void stmpe811_Init(uint16_t DeviceAddr); -void stmpe811_Reset(uint16_t DeviceAddr); -uint16_t stmpe811_ReadID(uint16_t DeviceAddr); -void stmpe811_EnableGlobalIT(uint16_t DeviceAddr); -void stmpe811_DisableGlobalIT(uint16_t DeviceAddr); -void stmpe811_EnableITSource(uint16_t DeviceAddr, uint8_t Source); -void stmpe811_DisableITSource(uint16_t DeviceAddr, uint8_t Source); -void stmpe811_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity); -void stmpe811_SetITType(uint16_t DeviceAddr, uint8_t Type); -uint8_t stmpe811_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source); -uint8_t stmpe811_ReadGITStatus(uint16_t DeviceAddr, uint8_t Source); -void stmpe811_ClearGlobalIT(uint16_t DeviceAddr, uint8_t Source); - -/** - * @brief STMPE811 IO functionalities functions - */ -void stmpe811_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin); -uint8_t stmpe811_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode); -void stmpe811_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction); -void stmpe811_IO_EnableAF(uint16_t DeviceAddr, uint32_t IO_Pin); -void stmpe811_IO_DisableAF(uint16_t DeviceAddr, uint32_t IO_Pin); -void stmpe811_IO_SetEdgeMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Edge); -void stmpe811_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState); -uint32_t stmpe811_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin); -void stmpe811_IO_EnableIT(uint16_t DeviceAddr); -void stmpe811_IO_DisableIT(uint16_t DeviceAddr); -void stmpe811_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin); -void stmpe811_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin); -uint32_t stmpe811_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin); -void stmpe811_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin); - -/** - * @brief STMPE811 Touch screen functionalities functions - */ -void stmpe811_TS_Start(uint16_t DeviceAddr); -uint8_t stmpe811_TS_DetectTouch(uint16_t DeviceAddr); -void stmpe811_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y); -void stmpe811_TS_EnableIT(uint16_t DeviceAddr); -void stmpe811_TS_DisableIT(uint16_t DeviceAddr); -uint8_t stmpe811_TS_ITStatus (uint16_t DeviceAddr); -void stmpe811_TS_ClearIT (uint16_t DeviceAddr); - -void IOE_Init(void); -void IOE_ITConfig (void); -void IOE_Delay(uint32_t delay); -void IOE_Write(uint8_t addr, uint8_t reg, uint8_t value); -uint8_t IOE_Read(uint8_t addr, uint8_t reg); -uint16_t IOE_ReadMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length); - -/* Touch screen driver structure */ -extern TS_DrvTypeDef stmpe811_ts_drv; - -/* IO driver structure */ -extern IO_DrvTypeDef stmpe811_io_drv; - -#ifdef __cplusplus -} -#endif -#endif /* __STMPE811_H */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/** - * @} - */ - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/