Pārlūkot izejas kodu

[BSP][STM32F411RE]
1. Target board: STM32F411RE-Nucleo
2. Using STM32 HAL library version 1.4.3 (STM32Cube_FW_F4_V1.10.0)

ardafu 10 gadi atpakaļ
vecāks
revīzija
313c775b22
100 mainītis faili ar 43010 papildinājumiem un 0 dzēšanām
  1. 182 0
      bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/Release_Notes.html
  2. 1060 0
      bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_lcd.c
  3. 197 0
      bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_lcd.h
  4. 1030 0
      bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_sd.c
  5. 240 0
      bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_sd.h
  6. 233 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/Release_Notes.html
  7. 143 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/accelero.h
  8. 122 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/audio.h
  9. 141 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/camera.h
  10. 115 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/epd.h
  11. 145 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/gyro.h
  12. 168 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/idd.h
  13. 150 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/io.h
  14. 114 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/lcd.h
  15. 125 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/magneto.h
  16. 107 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/ts.h
  17. 118 0
      bsp/stm32f411RE/Libraries/BSP/Components/Common/tsensor.h
  18. 231 0
      bsp/stm32f411RE/Libraries/BSP/Components/ampire480272/Release_Notes.html
  19. 121 0
      bsp/stm32f411RE/Libraries/BSP/Components/ampire480272/ampire480272.h
  20. 232 0
      bsp/stm32f411RE/Libraries/BSP/Components/ampire640480/Release_Notes.html
  21. 121 0
      bsp/stm32f411RE/Libraries/BSP/Components/ampire640480/ampire640480.h
  22. 659 0
      bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/Release_Notes.html
  23. 494 0
      bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/cs43l22.c
  24. 228 0
      bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/cs43l22.h
  25. 162 0
      bsp/stm32f411RE/Libraries/BSP/Components/exc7200/Release_Notes.html
  26. 242 0
      bsp/stm32f411RE/Libraries/BSP/Components/exc7200/exc7200.c
  27. 137 0
      bsp/stm32f411RE/Libraries/BSP/Components/exc7200/exc7200.h
  28. 156 0
      bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/Release_Notes.html
  29. 516 0
      bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/ft6x06.c
  30. 467 0
      bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/ft6x06.h
  31. 447 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9325/Release_Notes.html
  32. 531 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9325/ili9325.c
  33. 256 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9325/ili9325.h
  34. 417 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9341/Release_Notes.html
  35. 346 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9341/ili9341.c
  36. 249 0
      bsp/stm32f411RE/Libraries/BSP/Components/ili9341/ili9341.h
  37. 461 0
      bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/Release_Notes.html
  38. 416 0
      bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/l3gd20.c
  39. 324 0
      bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/l3gd20.h
  40. 510 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/Release_Notes.html
  41. 423 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/lis302dl.c
  42. 720 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/lis302dl.h
  43. 514 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/Release_Notes.html
  44. 431 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/lis3dsh.c
  45. 1255 0
      bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/lis3dsh.h
  46. 365 0
      bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/Release_Notes.html
  47. 578 0
      bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/lsm303dlhc.c
  48. 498 0
      bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/lsm303dlhc.h
  49. 259 0
      bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/Release_Notes.html
  50. 1584 0
      bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/mfxstm32l152.c
  51. 668 0
      bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/mfxstm32l152.h
  52. 157 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q128a/Release_Notes.html
  53. 219 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q128a/n25q128a.h
  54. 157 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q256a/Release_Notes.html
  55. 261 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q256a/n25q256a.h
  56. 158 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q512a/Release_Notes.html
  57. 261 0
      bsp/stm32f411RE/Libraries/BSP/Components/n25q512a/n25q512a.h
  58. 156 0
      bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/Release_Notes.html
  59. 449 0
      bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/otm8009a.c
  60. 224 0
      bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/otm8009a.h
  61. 426 0
      bsp/stm32f411RE/Libraries/BSP/Components/ov2640/Release_Notes.html
  62. 1351 0
      bsp/stm32f411RE/Libraries/BSP/Components/ov2640/ov2640.c
  63. 226 0
      bsp/stm32f411RE/Libraries/BSP/Components/ov2640/ov2640.h
  64. 158 0
      bsp/stm32f411RE/Libraries/BSP/Components/s25fl512s/Release_Notes.html
  65. 261 0
      bsp/stm32f411RE/Libraries/BSP/Components/s25fl512s/s25fl512s.h
  66. 1081 0
      bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/Release_Notes.html
  67. 3450 0
      bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/s5k5cag.c
  68. 148 0
      bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/s5k5cag.h
  69. 307 0
      bsp/stm32f411RE/Libraries/BSP/Components/st7735/Release_Notes.html
  70. 471 0
      bsp/stm32f411RE/Libraries/BSP/Components/st7735/st7735.c
  71. 214 0
      bsp/stm32f411RE/Libraries/BSP/Components/st7735/st7735.h
  72. 336 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/Release_Notes.html
  73. 604 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/stmpe1600.c
  74. 213 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/stmpe1600.h
  75. 378 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/Release_Notes.html
  76. 977 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/stmpe811.c
  77. 291 0
      bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/stmpe811.h
  78. 278 0
      bsp/stm32f411RE/Libraries/BSP/Components/ts3510/Release_Notes.html
  79. 256 0
      bsp/stm32f411RE/Libraries/BSP/Components/ts3510/ts3510.c
  80. 141 0
      bsp/stm32f411RE/Libraries/BSP/Components/ts3510/ts3510.h
  81. 238 0
      bsp/stm32f411RE/Libraries/BSP/Components/wm8994/Release_Notes.html
  82. 924 0
      bsp/stm32f411RE/Libraries/BSP/Components/wm8994/wm8994.c
  83. 187 0
      bsp/stm32f411RE/Libraries/BSP/Components/wm8994/wm8994.h
  84. 171 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/Release_Notes.html
  85. 1362 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval.c
  86. 407 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval.h
  87. 1368 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_audio.c
  88. 328 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_audio.h
  89. 686 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_camera.c
  90. 150 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_camera.h
  91. 478 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_eeprom.c
  92. 140 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_eeprom.h
  93. 327 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_io.c
  94. 159 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_io.h
  95. 1088 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_lcd.c
  96. 202 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_lcd.h
  97. 831 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_qspi.c
  98. 176 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_qspi.h
  99. 612 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_sd.c
  100. 159 0
      bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_sd.h

+ 182 - 0
bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/Release_Notes.html

@@ -0,0 +1,182 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for Adafruit_Shield Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for Adafruit_Shield&nbsp;&nbsp;Drivers</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.1 / 04-November-2015</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            
+            <ul style="margin-top: 0cm;" type="square"><li><span style="font-size: 10pt; font-family: Verdana;">Fix GNU GCC warning on missing break instruction in <span style="font-style: italic;">SD_GetDataResponse()</span></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 10-September-2015</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            
+            <ul style="margin-top: 0cm;" type="square"><li><span style="font-size: 10pt; font-family: Verdana;">Improve SD over SPI protocol implementation<span style="font-style: italic;"></span></span></li><li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">Note:</span> This new implementation requires to increase Heap_Size by 0x200&nbsp;</span></li><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">Note:</span> This driver version needs BSP Nucleo&nbsp;driver V2.0.0 and later</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 22-July-2014</span></h3>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            
+            <ul style="margin-top: 0cm;" type="square">
+              <li><span style="font-size: 10pt; font-family: Verdana;">Add new user API <span style="font-style: italic;">BSP_LCD_DrawBitmap()</span> to draw a bitmap picture loaded in the STM32 MCU internal memory</span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Add new static API <span style="font-style: italic;">SetDisplayWindow()</span>, needed by </span><span style="font-size: 10pt; font-family: Verdana;"> BSP_LCD_DrawBitmap() </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span><br>
+                </span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Update static API <span style="font-style: italic;">DrawChar()</span></span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">Note:</span> This driver version needs ST7735 component driver V1.1.0 and later.<span style="font-style: italic;"><br>
+                </span></span></li>
+
+            </ul>
+<h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 22-April-2014</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+            <ul style="margin-top: 0cm;" type="square"><li><span style="font-size: 10pt; font-family: Verdana;">First official release.</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span></h2>
+            <div style="text-align: justify;">
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></div>
+<span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span> <b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 1060 - 0
bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_lcd.c

@@ -0,0 +1,1060 @@
+/**
+  ******************************************************************************
+  * @file    stm32_adafruit_lcd.c
+  * @author  MCD Application Team
+  * @version V2.0.1
+  * @date    04-November-2015
+  * @brief   This file includes the driver for Liquid Crystal Display (LCD) module
+  *          mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802), 
+  *          that is used with the STM32 Nucleo board through SPI interface.     
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* File Info : -----------------------------------------------------------------
+                                   User NOTES
+1. How To use this driver:
+--------------------------
+   - The LCD st7735 component driver MUST be included with this driver.  
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the LCD using the BSP_LCD_Init() function.
+  
+  + Display on LCD
+     o Clear the whole LCD using the BSP_LCD_Clear() function or only one specified 
+       string line using the BSP_LCD_ClearStringLine() function.
+     o Display a character on the specified line and column using the BSP_LCD_DisplayChar()
+       function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
+     o Display a string line on the specified position (x,y in pixel) and align mode
+       using the BSP_LCD_DisplayStringAtLine() function.          
+     o Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, ..) 
+       on LCD using a set of functions.    
+ 
+------------------------------------------------------------------------------*/
+    
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_adafruit_lcd.h"
+#include "../../../Utilities/Fonts/fonts.h"
+#include "../../../Utilities/Fonts/font24.c"
+#include "../../../Utilities/Fonts/font20.c"
+#include "../../../Utilities/Fonts/font16.c"
+#include "../../../Utilities/Fonts/font12.c"
+#include "../../../Utilities/Fonts/font8.c"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32_ADAFRUIT
+  * @{
+  */
+    
+/** @addtogroup STM32_ADAFRUIT_LCD
+  * @{
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_LCD_Private_TypesDefinitions
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_LCD_Private_Defines
+  * @{
+  */
+#define POLY_X(Z)             ((int32_t)((Points + (Z))->X))
+#define POLY_Y(Z)             ((int32_t)((Points + (Z))->Y))
+#define NULL                  (void *)0
+
+#define MAX_HEIGHT_FONT         17
+#define MAX_WIDTH_FONT          24
+#define OFFSET_BITMAP           54
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_LCD_Private_Macros
+  * @{
+  */
+#define ABS(X) ((X) > 0 ? (X) : -(X)) 
+
+/**
+  * @}
+  */ 
+    
+/** @defgroup STM32_ADAFRUIT_LCD_Private_Variables
+  * @{
+  */ 
+LCD_DrawPropTypeDef DrawProp;
+
+static LCD_DrvTypeDef  *lcd_drv; 
+
+/* Max size of bitmap will based on a font24 (17x24) */
+static uint8_t bitmap[MAX_HEIGHT_FONT*MAX_WIDTH_FONT*2+OFFSET_BITMAP] = {0};
+
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_LCD_Private_FunctionPrototypes
+  * @{
+  */ 
+static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c);
+static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3);
+static void SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+/**
+  * @}
+  */ 
+
+
+/** @defgroup STM32_ADAFRUIT_LCD_Private_Functions
+  * @{
+  */
+  
+/**
+  * @brief  Initializes the LCD.
+  * @param  None
+  * @retval LCD state
+  */
+uint8_t BSP_LCD_Init(void)
+{ 
+  uint8_t ret = LCD_ERROR;
+  
+  /* Default value for draw propriety */
+  DrawProp.BackColor = 0xFFFF;
+  DrawProp.pFont     = &Font24;
+  DrawProp.TextColor = 0x0000;
+  
+  lcd_drv = &st7735_drv;
+  
+  /* LCD Init */   
+  lcd_drv->Init();
+  
+  /* Clear the LCD screen */
+  BSP_LCD_Clear(LCD_COLOR_WHITE);
+  
+  /* Initialize the font */
+  BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+  
+  ret = LCD_OK;
+  
+  return ret;
+}
+
+/**
+  * @brief  Gets the LCD X size.
+  * @param  None    
+  * @retval Used LCD X size
+  */
+uint32_t BSP_LCD_GetXSize(void)
+{
+  return(lcd_drv->GetLcdPixelWidth());
+}
+
+/**
+  * @brief  Gets the LCD Y size.
+  * @param  None   
+  * @retval Used LCD Y size
+  */
+uint32_t BSP_LCD_GetYSize(void)
+{
+  return(lcd_drv->GetLcdPixelHeight());
+}
+
+/**
+  * @brief  Gets the LCD text color.
+  * @param  None 
+  * @retval Used text color.
+  */
+uint16_t BSP_LCD_GetTextColor(void)
+{
+  return DrawProp.TextColor;
+}
+
+/**
+  * @brief  Gets the LCD background color.
+  * @param  None
+  * @retval Used background color
+  */
+uint16_t BSP_LCD_GetBackColor(void)
+{
+  return DrawProp.BackColor;
+}
+
+/**
+  * @brief  Sets the LCD text color.
+  * @param  Color: Text color code RGB(5-6-5)
+  * @retval None
+  */
+void BSP_LCD_SetTextColor(uint16_t Color)
+{
+  DrawProp.TextColor = Color;
+}
+
+/**
+  * @brief  Sets the LCD background color.
+  * @param  Color: Background color code RGB(5-6-5)
+  * @retval None
+  */
+void BSP_LCD_SetBackColor(uint16_t Color)
+{
+  DrawProp.BackColor = Color;
+}
+
+/**
+  * @brief  Sets the LCD text font.
+  * @param  fonts: Font to be used
+  * @retval None
+  */
+void BSP_LCD_SetFont(sFONT *pFonts)
+{
+  DrawProp.pFont = pFonts;
+}
+
+/**
+  * @brief  Gets the LCD text font.
+  * @param  None
+  * @retval Used font
+  */
+sFONT *BSP_LCD_GetFont(void)
+{
+  return DrawProp.pFont;
+}
+
+/**
+  * @brief  Clears the hole LCD.
+  * @param  Color: Color of the background
+  * @retval None
+  */
+void BSP_LCD_Clear(uint16_t Color)
+{ 
+  uint32_t counter = 0;
+  uint32_t color_backup = DrawProp.TextColor; 
+  DrawProp.TextColor = Color;
+  
+  for(counter = 0; counter < BSP_LCD_GetYSize(); counter++)
+  {
+    BSP_LCD_DrawHLine(0, counter, BSP_LCD_GetXSize());
+  }
+  DrawProp.TextColor = color_backup; 
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+}
+
+/**
+  * @brief  Clears the selected line.
+  * @param  Line: Line to be cleared
+  *          This parameter can be one of the following values:
+  *            @arg  0..9: if the Current fonts is Font16x24
+  *            @arg  0..19: if the Current fonts is Font12x12 or Font8x12
+  *            @arg  0..29: if the Current fonts is Font8x8
+  * @retval None
+  */
+void BSP_LCD_ClearStringLine(uint16_t Line)
+{ 
+  uint32_t color_backup = DrawProp.TextColor; 
+  DrawProp.TextColor = DrawProp.BackColor;;
+    
+  /* Draw a rectangle with background color */
+  BSP_LCD_FillRect(0, (Line * DrawProp.pFont->Height), BSP_LCD_GetXSize(), DrawProp.pFont->Height);
+  
+  DrawProp.TextColor = color_backup;
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+}
+
+/**
+  * @brief  Displays one character.
+  * @param  Xpos: Start column address
+  * @param  Ypos: Line where to display the character shape.
+  * @param  Ascii: Character ascii code
+  *           This parameter must be a number between Min_Data = 0x20 and Max_Data = 0x7E 
+  * @retval None
+  */
+void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii)
+{
+  DrawChar(Xpos, Ypos, &DrawProp.pFont->table[(Ascii-' ') *\
+    DrawProp.pFont->Height * ((DrawProp.pFont->Width + 7) / 8)]);
+}
+
+/**
+  * @brief  Displays characters on the LCD.
+  * @param  Xpos: X position (in pixel)
+  * @param  Ypos: Y position (in pixel)   
+  * @param  Text: Pointer to string to display on LCD
+  * @param  Mode: Display mode
+  *          This parameter can be one of the following values:
+  *            @arg  CENTER_MODE
+  *            @arg  RIGHT_MODE
+  *            @arg  LEFT_MODE   
+  * @retval None
+  */
+void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode)
+{
+  uint16_t refcolumn = 1, i = 0;
+  uint32_t size = 0, xsize = 0; 
+  uint8_t  *ptr = Text;
+  
+  /* Get the text size */
+  while (*ptr++) size ++ ;
+  
+  /* Characters number per line */
+  xsize = (BSP_LCD_GetXSize()/DrawProp.pFont->Width);
+  
+  switch (Mode)
+  {
+  case CENTER_MODE:
+    {
+      refcolumn = Xpos + ((xsize - size)* DrawProp.pFont->Width) / 2;
+      break;
+    }
+  case LEFT_MODE:
+    {
+      refcolumn = Xpos;
+      break;
+    }
+  case RIGHT_MODE:
+    {
+      refcolumn =  - Xpos + ((xsize - size)*DrawProp.pFont->Width);
+      break;
+    }    
+  default:
+    {
+      refcolumn = Xpos;
+      break;
+    }
+  }
+  
+  /* Send the string character by character on lCD */
+  while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp.pFont->Width)) & 0xFFFF) >= DrawProp.pFont->Width))
+  {
+    /* Display one character on LCD */
+    BSP_LCD_DisplayChar(refcolumn, Ypos, *Text);
+    /* Decrement the column position by 16 */
+    refcolumn += DrawProp.pFont->Width;
+    /* Point on the next character */
+    Text++;
+    i++;
+  }
+}
+
+/**
+  * @brief  Displays a character on the LCD.
+  * @param  Line: Line where to display the character shape
+  *          This parameter can be one of the following values:
+  *            @arg  0..19: if the Current fonts is Font8
+  *            @arg  0..12: if the Current fonts is Font12
+  *            @arg  0...9: if the Current fonts is Font16
+  *            @arg  0...7: if the Current fonts is Font20
+  *            @arg  0...5: if the Current fonts is Font24
+  * @param  ptr: Pointer to string to display on LCD
+  * @retval None
+  */
+void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr)
+{
+  BSP_LCD_DisplayStringAt(0, LINE(Line), ptr, LEFT_MODE);
+}
+
+/**
+  * @brief  Draws a pixel on LCD.
+  * @param  Xpos: X position 
+  * @param  Ypos: Y position
+  * @param  RGB_Code: Pixel color in RGB mode (5-6-5)  
+  * @retval None
+  */
+void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code)
+{
+  if(lcd_drv->WritePixel != NULL)
+  {
+    lcd_drv->WritePixel(Xpos, Ypos, RGB_Code);
+  }
+}
+  
+/**
+  * @brief  Draws an horizontal line.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Length: Line length
+  * @retval None
+  */
+void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint32_t index = 0;
+  
+  if(lcd_drv->DrawHLine != NULL)
+  {
+    lcd_drv->DrawHLine(DrawProp.TextColor, Xpos, Ypos, Length);
+  }
+  else
+  {
+    for(index = 0; index < Length; index++)
+    {
+      BSP_LCD_DrawPixel((Xpos + index), Ypos, DrawProp.TextColor);
+    }
+  }
+}
+
+/**
+  * @brief  Draws a vertical line.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Length: Line length
+  * @retval None
+  */
+void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint32_t index = 0;
+  
+  if(lcd_drv->DrawVLine != NULL)
+  {
+    lcd_drv->DrawVLine(DrawProp.TextColor, Xpos, Ypos, Length);
+  }
+  else
+  {
+    for(index = 0; index < Length; index++)
+    {
+      BSP_LCD_DrawPixel(Xpos, Ypos + index, DrawProp.TextColor);
+    }
+  }
+}
+
+/**
+  * @brief  Draws an uni-line (between two points).
+  * @param  x1: Point 1 X position
+  * @param  y1: Point 1 Y position
+  * @param  x2: Point 2 X position
+  * @param  y2: Point 2 Y position
+  * @retval None
+  */
+void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
+{
+  int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, 
+  yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, 
+  curpixel = 0;
+  
+  deltax = ABS(x2 - x1);        /* The difference between the x's */
+  deltay = ABS(y2 - y1);        /* The difference between the y's */
+  x = x1;                       /* Start x off at the first pixel */
+  y = y1;                       /* Start y off at the first pixel */
+  
+  if (x2 >= x1)                 /* The x-values are increasing */
+  {
+    xinc1 = 1;
+    xinc2 = 1;
+  }
+  else                          /* The x-values are decreasing */
+  {
+    xinc1 = -1;
+    xinc2 = -1;
+  }
+  
+  if (y2 >= y1)                 /* The y-values are increasing */
+  {
+    yinc1 = 1;
+    yinc2 = 1;
+  }
+  else                          /* The y-values are decreasing */
+  {
+    yinc1 = -1;
+    yinc2 = -1;
+  }
+  
+  if (deltax >= deltay)         /* There is at least one x-value for every y-value */
+  {
+    xinc1 = 0;                  /* Don't change the x when numerator >= denominator */
+    yinc2 = 0;                  /* Don't change the y for every iteration */
+    den = deltax;
+    num = deltax / 2;
+    numadd = deltay;
+    numpixels = deltax;         /* There are more x-values than y-values */
+  }
+  else                          /* There is at least one y-value for every x-value */
+  {
+    xinc2 = 0;                  /* Don't change the x for every iteration */
+    yinc1 = 0;                  /* Don't change the y when numerator >= denominator */
+    den = deltay;
+    num = deltay / 2;
+    numadd = deltax;
+    numpixels = deltay;         /* There are more y-values than x-values */
+  }
+  
+  for (curpixel = 0; curpixel <= numpixels; curpixel++)
+  {
+    BSP_LCD_DrawPixel(x, y, DrawProp.TextColor);  /* Draw the current pixel */
+    num += numadd;                            /* Increase the numerator by the top of the fraction */
+    if (num >= den)                           /* Check if numerator >= denominator */
+    {
+      num -= den;                             /* Calculate the new numerator value */
+      x += xinc1;                             /* Change the x as appropriate */
+      y += yinc1;                             /* Change the y as appropriate */
+    }
+    x += xinc2;                               /* Change the x as appropriate */
+    y += yinc2;                               /* Change the y as appropriate */
+  }
+}
+
+/**
+  * @brief  Draws a rectangle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Width: Rectangle width  
+  * @param  Height: Rectangle height
+  * @retval None
+  */
+void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  /* Draw horizontal lines */
+  BSP_LCD_DrawHLine(Xpos, Ypos, Width);
+  BSP_LCD_DrawHLine(Xpos, (Ypos+ Height), Width);
+  
+  /* Draw vertical lines */
+  BSP_LCD_DrawVLine(Xpos, Ypos, Height);
+  BSP_LCD_DrawVLine((Xpos + Width), Ypos, Height);
+}
+                            
+/**
+  * @brief  Draws a circle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Radius: Circle radius
+  * @retval None
+  */
+void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
+{
+  int32_t  D;       /* Decision Variable */ 
+  uint32_t  CurX;   /* Current X Value */
+  uint32_t  CurY;   /* Current Y Value */ 
+  
+  D = 3 - (Radius << 1);
+  CurX = 0;
+  CurY = Radius;
+  
+  while (CurX <= CurY)
+  {
+    BSP_LCD_DrawPixel((Xpos + CurX), (Ypos - CurY), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - CurX), (Ypos - CurY), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + CurY), (Ypos - CurX), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - CurY), (Ypos - CurX), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + CurX), (Ypos + CurY), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - CurX), (Ypos + CurY), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + CurY), (Ypos + CurX), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - CurY), (Ypos + CurX), DrawProp.TextColor);   
+
+    /* Initialize the font */
+    BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+
+    if (D < 0)
+    { 
+      D += (CurX << 2) + 6;
+    }
+    else
+    {
+      D += ((CurX - CurY) << 2) + 10;
+      CurY--;
+    }
+    CurX++;
+  } 
+}
+
+/**
+  * @brief  Draws an poly-line (between many points).
+  * @param  Points: Pointer to the points array
+  * @param  PointCount: Number of points
+  * @retval None
+  */
+void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount)
+{
+  int16_t X = 0, Y = 0;
+
+  if(PointCount < 2)
+  {
+    return;
+  }
+
+  BSP_LCD_DrawLine(Points->X, Points->Y, (Points+PointCount-1)->X, (Points+PointCount-1)->Y);
+  
+  while(--PointCount)
+  {
+    X = Points->X;
+    Y = Points->Y;
+    Points++;
+    BSP_LCD_DrawLine(X, Y, Points->X, Points->Y);
+  }
+}
+
+/**
+  * @brief  Draws an ellipse on LCD.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  XRadius: Ellipse X radius
+  * @param  YRadius: Ellipse Y radius
+  * @retval None
+  */
+void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
+{
+  int x = 0, y = -YRadius, err = 2-2*XRadius, e2;
+  float K = 0, rad1 = 0, rad2 = 0;
+  
+  rad1 = XRadius;
+  rad2 = YRadius;
+  
+  K = (float)(rad2/rad1);
+  
+  do {      
+    BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/K)), (Ypos+y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos+y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos-y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/K)), (Ypos-y), DrawProp.TextColor);      
+    
+    e2 = err;
+    if (e2 <= x) {
+      err += ++x*2+1;
+      if (-y == x && e2 <= y) e2 = 0;
+    }
+    if (e2 > y) err += ++y*2+1;     
+  }
+  while (y <= 0);
+}
+
+/**
+  * @brief  Draws a bitmap picture loaded in the STM32 MCU internal memory.
+  * @param  Xpos: Bmp X position in the LCD
+  * @param  Ypos: Bmp Y position in the LCD
+  * @param  pBmp: Pointer to Bmp picture address
+  * @retval None
+  */
+void BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pBmp)
+{
+  uint32_t height = 0, width  = 0;
+  
+  /* Read bitmap width */
+  width = *(uint16_t *) (pBmp + 18);
+  width |= (*(uint16_t *) (pBmp + 20)) << 16;
+  
+  /* Read bitmap height */
+  height = *(uint16_t *) (pBmp + 22);
+  height |= (*(uint16_t *) (pBmp + 24)) << 16; 
+  
+  /* Remap Ypos, st7735 works with inverted X in case of bitmap */
+  /* X = 0, cursor is on Top corner */
+  if(lcd_drv == &st7735_drv)
+  {
+    Ypos = BSP_LCD_GetYSize() - Ypos - height;
+  }
+  
+  SetDisplayWindow(Xpos, Ypos, width, height);
+  
+  if(lcd_drv->DrawBitmap != NULL)
+  {
+    lcd_drv->DrawBitmap(Xpos, Ypos, pBmp);
+  } 
+  SetDisplayWindow(0, 0, BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
+}
+
+/**
+  * @brief  Draws a full rectangle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Width: Rectangle width  
+  * @param  Height: Rectangle height
+  * @retval None
+  */
+void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+  do
+  {
+    BSP_LCD_DrawHLine(Xpos, Ypos++, Width);    
+  }
+  while(Height--);
+}
+
+/**
+  * @brief  Draws a full circle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Radius: Circle radius
+  * @retval None
+  */
+void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
+{
+  int32_t  D;        /* Decision Variable */ 
+  uint32_t  CurX;    /* Current X Value */
+  uint32_t  CurY;    /* Current Y Value */ 
+  
+  D = 3 - (Radius << 1);
+
+  CurX = 0;
+  CurY = Radius;
+  
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+
+  while (CurX <= CurY)
+  {
+    if(CurY > 0) 
+    {
+      BSP_LCD_DrawHLine(Xpos - CurY, Ypos + CurX, 2*CurY);
+      BSP_LCD_DrawHLine(Xpos - CurY, Ypos - CurX, 2*CurY);
+    }
+
+    if(CurX > 0) 
+    {
+      BSP_LCD_DrawHLine(Xpos - CurX, Ypos - CurY, 2*CurX);
+      BSP_LCD_DrawHLine(Xpos - CurX, Ypos + CurY, 2*CurX);
+    }
+    if (D < 0)
+    { 
+      D += (CurX << 2) + 6;
+    }
+    else
+    {
+      D += ((CurX - CurY) << 2) + 10;
+      CurY--;
+    }
+    CurX++;
+  }
+
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+  BSP_LCD_DrawCircle(Xpos, Ypos, Radius);
+}
+
+/**
+  * @brief  Draws a full poly-line (between many points).
+  * @param  Points: Pointer to the points array
+  * @param  PointCount: Number of points
+  * @retval None
+  */
+void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount)
+{
+  int16_t X = 0, Y = 0, X2 = 0, Y2 = 0, X_center = 0, Y_center = 0, X_first = 0, Y_first = 0, pixelX = 0, pixelY = 0, counter = 0;
+  uint16_t  IMAGE_LEFT = 0, IMAGE_RIGHT = 0, IMAGE_TOP = 0, IMAGE_BOTTOM = 0;  
+  
+  IMAGE_LEFT = IMAGE_RIGHT = Points->X;
+  IMAGE_TOP= IMAGE_BOTTOM = Points->Y;
+  
+  for(counter = 1; counter < PointCount; counter++)
+  {
+    pixelX = POLY_X(counter);
+    if(pixelX < IMAGE_LEFT)
+    {
+      IMAGE_LEFT = pixelX;
+    }
+    if(pixelX > IMAGE_RIGHT)
+    {
+      IMAGE_RIGHT = pixelX;
+    }
+    
+    pixelY = POLY_Y(counter);
+    if(pixelY < IMAGE_TOP)
+    {
+      IMAGE_TOP = pixelY;
+    }
+    if(pixelY > IMAGE_BOTTOM)
+    {
+      IMAGE_BOTTOM = pixelY;
+    }
+  }  
+  
+  if(PointCount < 2)
+  {
+    return;
+  }
+  
+  X_center = (IMAGE_LEFT + IMAGE_RIGHT)/2;
+  Y_center = (IMAGE_BOTTOM + IMAGE_TOP)/2;
+  
+  X_first = Points->X;
+  Y_first = Points->Y;
+  
+  while(--PointCount)
+  {
+    X = Points->X;
+    Y = Points->Y;
+    Points++;
+    X2 = Points->X;
+    Y2 = Points->Y;    
+    
+    FillTriangle(X, X2, X_center, Y, Y2, Y_center);
+    FillTriangle(X, X_center, X2, Y, Y_center, Y2);
+    FillTriangle(X_center, X2, X, Y_center, Y2, Y);   
+  }
+  
+  FillTriangle(X_first, X2, X_center, Y_first, Y2, Y_center);
+  FillTriangle(X_first, X_center, X2, Y_first, Y_center, Y2);
+  FillTriangle(X_center, X2, X_first, Y_center, Y2, Y_first);   
+}
+
+/**
+  * @brief  Draws a full ellipse.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  XRadius: Ellipse X radius
+  * @param  YRadius: Ellipse Y radius  
+  * @retval None
+  */
+void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
+{
+  int x = 0, y = -YRadius, err = 2-2*XRadius, e2;
+  float K = 0, rad1 = 0, rad2 = 0;
+  
+  rad1 = XRadius;
+  rad2 = YRadius;
+  
+  K = (float)(rad2/rad1);    
+  
+  do 
+  { 
+    BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/K)), (Ypos+y), (2*(uint16_t)(x/K) + 1));
+    BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/K)), (Ypos-y), (2*(uint16_t)(x/K) + 1));
+    
+    e2 = err;
+    if (e2 <= x) 
+    {
+      err += ++x*2+1;
+      if (-y == x && e2 <= y) e2 = 0;
+    }
+    if (e2 > y) err += ++y*2+1;
+  }
+  while (y <= 0);
+}
+
+/**
+  * @brief  Enables the display.
+  * @param  None
+  * @retval None
+  */
+void BSP_LCD_DisplayOn(void)
+{
+  lcd_drv->DisplayOn();
+}
+
+/**
+  * @brief  Disables the display.
+  * @param  None
+  * @retval None
+  */
+void BSP_LCD_DisplayOff(void)
+{
+  lcd_drv->DisplayOff();
+}
+
+/*******************************************************************************
+                            Static Functions
+*******************************************************************************/
+
+/**
+  * @brief  Draws a character on LCD.
+  * @param  Xpos: Line where to display the character shape
+  * @param  Ypos: Start column address
+  * @param  pChar: Pointer to the character data
+  * @retval None
+  */
+static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *pChar)
+{
+  uint32_t counterh = 0, counterw = 0, index = 0;
+  uint16_t height = 0, width = 0;
+  uint8_t offset = 0;
+  uint8_t *pchar = NULL;
+  uint32_t line = 0;
+  
+  height = DrawProp.pFont->Height;
+  width  = DrawProp.pFont->Width;
+  
+  /* Fill bitmap header*/
+  *(uint16_t *) (bitmap + 2) = (uint16_t)(height*width*2+OFFSET_BITMAP);
+  *(uint16_t *) (bitmap + 4) = (uint16_t)((height*width*2+OFFSET_BITMAP)>>16);
+  *(uint16_t *) (bitmap + 10) = OFFSET_BITMAP;
+  *(uint16_t *) (bitmap + 18) = (uint16_t)(width);
+  *(uint16_t *) (bitmap + 20) = (uint16_t)((width)>>16);
+  *(uint16_t *) (bitmap + 22) = (uint16_t)(height);
+  *(uint16_t *) (bitmap + 24) = (uint16_t)((height)>>16);
+  
+  offset =  8 *((width + 7)/8) - width ;
+  
+  for(counterh = 0; counterh < height; counterh++)
+  {
+    pchar = ((uint8_t *)pChar + (width + 7)/8 * counterh);
+    
+    if(((width + 7)/8) == 3)
+    {
+      line =  (pchar[0]<< 16) | (pchar[1]<< 8) | pchar[2];
+    }
+    
+    if(((width + 7)/8) == 2)
+    {
+      line =  (pchar[0]<< 8) | pchar[1];
+    }
+    
+    if(((width + 7)/8) == 1)
+    {
+      line =  pchar[0];
+    }    
+    
+    for (counterw = 0; counterw < width; counterw++)
+    {
+      /* Image in the bitmap is written from the bottom to the top */
+      /* Need to invert image in the bitmap */
+      index = (((height-counterh-1)*width)+(counterw))*2+OFFSET_BITMAP;
+      if(line & (1 << (width- counterw + offset- 1))) 
+      {
+        bitmap[index] = (uint8_t)DrawProp.TextColor;
+        bitmap[index+1] = (uint8_t)(DrawProp.TextColor >> 8);
+      }
+      else
+      {
+        bitmap[index] = (uint8_t)DrawProp.BackColor;
+        bitmap[index+1] = (uint8_t)(DrawProp.BackColor >> 8);
+      } 
+    }
+  }
+  
+  BSP_LCD_DrawBitmap(Xpos, Ypos, bitmap);
+}
+
+/**
+  * @brief  Fills a triangle (between 3 points).
+  * @param  Points: Pointer to the points array
+  * @param  x1: Point 1 X position
+  * @param  y1: Point 1 Y position
+  * @param  x2: Point 2 X position
+  * @param  y2: Point 2 Y position
+  * @param  x3: Point 3 X position
+  * @param  y3: Point 3 Y position
+  * @retval None
+  */
+static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3)
+{ 
+  int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, 
+  yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, 
+  curpixel = 0;
+  
+  deltax = ABS(x2 - x1);        /* The difference between the x's */
+  deltay = ABS(y2 - y1);        /* The difference between the y's */
+  x = x1;                       /* Start x off at the first pixel */
+  y = y1;                       /* Start y off at the first pixel */
+  
+  if (x2 >= x1)                 /* The x-values are increasing */
+  {
+    xinc1 = 1;
+    xinc2 = 1;
+  }
+  else                          /* The x-values are decreasing */
+  {
+    xinc1 = -1;
+    xinc2 = -1;
+  }
+  
+  if (y2 >= y1)                 /* The y-values are increasing */
+  {
+    yinc1 = 1;
+    yinc2 = 1;
+  }
+  else                          /* The y-values are decreasing */
+  {
+    yinc1 = -1;
+    yinc2 = -1;
+  }
+  
+  if (deltax >= deltay)         /* There is at least one x-value for every y-value */
+  {
+    xinc1 = 0;                  /* Don't change the x when numerator >= denominator */
+    yinc2 = 0;                  /* Don't change the y for every iteration */
+    den = deltax;
+    num = deltax / 2;
+    numadd = deltay;
+    numpixels = deltax;         /* There are more x-values than y-values */
+  }
+  else                          /* There is at least one y-value for every x-value */
+  {
+    xinc2 = 0;                  /* Don't change the x for every iteration */
+    yinc1 = 0;                  /* Don't change the y when numerator >= denominator */
+    den = deltay;
+    num = deltay / 2;
+    numadd = deltax;
+    numpixels = deltay;         /* There are more y-values than x-values */
+  }
+  
+  for (curpixel = 0; curpixel <= numpixels; curpixel++)
+  {
+    BSP_LCD_DrawLine(x, y, x3, y3);
+    
+    num += numadd;              /* Increase the numerator by the top of the fraction */
+    if (num >= den)             /* Check if numerator >= denominator */
+    {
+      num -= den;               /* Calculate the new numerator value */
+      x += xinc1;               /* Change the x as appropriate */
+      y += yinc1;               /* Change the y as appropriate */
+    }
+    x += xinc2;                 /* Change the x as appropriate */
+    y += yinc2;                 /* Change the y as appropriate */
+  } 
+}
+
+/**
+  * @brief  Sets display window.
+  * @param  LayerIndex: layer index
+  * @param  Xpos: LCD X position
+  * @param  Ypos: LCD Y position
+  * @param  Width: LCD window width
+  * @param  Height: LCD window height  
+  * @retval None
+  */
+static void SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  if(lcd_drv->SetDisplayWindow != NULL)
+  {
+    lcd_drv->SetDisplayWindow(Xpos, Ypos, Width, Height);
+  }  
+}
+
+/**
+  * @}
+  */  
+  
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */     
+
+/**
+  * @}
+  */  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 197 - 0
bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_lcd.h

@@ -0,0 +1,197 @@
+/**
+  ******************************************************************************
+  * @file    stm32_adafruit_lcd.h
+  * @author  MCD Application Team
+  * @version V2.0.1
+  * @date    04-November-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32_adafruit_lcd.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32_ADAFRUIT_LCD_H
+#define __STM32_ADAFRUIT_LCD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Components/st7735/st7735.h"
+#include "../../../Utilities/Fonts/fonts.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32_ADAFRUIT
+  * @{
+  */
+ 
+/** @addtogroup STM32_ADAFRUIT_LCD
+  * @{
+  */ 
+
+
+/** @defgroup STM32_ADAFRUIT_LCD_Exported_Types
+  * @{
+  */
+   
+/** 
+  * @brief  Draw Properties structures definition
+  */ 
+typedef struct 
+{ 
+  uint32_t TextColor;
+  uint32_t BackColor;
+  sFONT    *pFont; 
+
+}LCD_DrawPropTypeDef;
+
+/** 
+  * @brief  Point structures definition
+  */ 
+typedef struct 
+{
+  int16_t X;
+  int16_t Y;
+
+}Point, * pPoint;
+
+/** 
+  * @brief  Line mode structures definition
+  */ 
+typedef enum
+{
+  CENTER_MODE             = 0x01,    /*!< Center mode */
+  RIGHT_MODE              = 0x02,    /*!< Right mode  */
+  LEFT_MODE               = 0x03     /*!< Left mode   */
+
+}Line_ModeTypdef;
+
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_LCD_Exported_Constants
+  * @{
+  */
+  
+#define __IO    volatile  
+
+/** 
+  * @brief  LCD status structure definition  
+  */     
+#define LCD_OK         0x00
+#define LCD_ERROR      0x01
+#define LCD_TIMEOUT    0x02
+
+/** 
+  * @brief  LCD color  
+  */
+#define LCD_COLOR_BLACK         0x0000
+#define LCD_COLOR_GREY          0xF7DE          
+#define LCD_COLOR_BLUE          0x001F
+#define LCD_COLOR_RED           0xF800
+#define LCD_COLOR_GREEN         0x07E0
+#define LCD_COLOR_CYAN          0x07FF
+#define LCD_COLOR_MAGENTA       0xF81F
+#define LCD_COLOR_YELLOW        0xFFE0
+#define LCD_COLOR_WHITE         0xFFFF
+
+/** 
+  * @brief LCD default font 
+  */ 
+#define LCD_DEFAULT_FONT         Font8
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32_ADAFRUIT_LCD_Exported_Functions
+  * @{
+  */   
+uint8_t  BSP_LCD_Init(void);
+uint32_t BSP_LCD_GetXSize(void);
+uint32_t BSP_LCD_GetYSize(void);
+ 
+uint16_t BSP_LCD_GetTextColor(void);
+uint16_t BSP_LCD_GetBackColor(void);
+void     BSP_LCD_SetTextColor(__IO uint16_t Color);
+void     BSP_LCD_SetBackColor(__IO uint16_t Color);
+void     BSP_LCD_SetFont(sFONT *fonts);
+sFONT    *BSP_LCD_GetFont(void);
+
+void     BSP_LCD_Clear(uint16_t Color);
+void     BSP_LCD_ClearStringLine(uint16_t Line);
+void     BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
+void     BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
+void     BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
+
+void     BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
+void     BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
+void     BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
+void     BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
+void     BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+void     BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
+void     BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
+void     BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
+void     BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pBmp);
+void     BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+void     BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
+void     BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
+void     BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
+
+void     BSP_LCD_DisplayOff(void);
+void     BSP_LCD_DisplayOn(void);
+
+/**
+  * @}
+  */
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32_ADAFRUIT_LCD_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 1030 - 0
bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_sd.c

@@ -0,0 +1,1030 @@
+/**
+  ******************************************************************************
+  * @file    stm32_adafruit_sd.c
+  * @author  MCD Application Team
+  * @version V2.0.1
+  * @date    04-November-2015
+  * @brief   This file provides a set of functions needed to manage the SD card
+  *          mounted on the Adafruit 1.8" TFT LCD shield (reference ID 802),
+  *          that is used with the STM32 Nucleo board through SPI interface.
+  *          It implements a high level communication layer for read and write 
+  *          from/to this memory. The needed STM32XXxx hardware resources (SPI and 
+  *          GPIO) are defined in stm32XXxx_nucleo.h file, and the initialization is 
+  *          performed in SD_IO_Init() function declared in stm32XXxx_nucleo.c 
+  *          file.
+  *          You can easily tailor this driver to any other development board, 
+  *          by just adapting the defines for hardware resources and 
+  *          SD_IO_Init() function.
+  *            
+  *          +-------------------------------------------------------+
+  *          |                     Pin assignment                    |
+  *          +-------------------------+---------------+-------------+
+  *          |  STM32XXxx SPI Pins     |     SD        |    Pin      |
+  *          +-------------------------+---------------+-------------+
+  *          | SD_SPI_CS_PIN           |   ChipSelect  |    1        |
+  *          | SD_SPI_MOSI_PIN / MOSI  |   DataIn      |    2        |
+  *          |                         |   GND         |    3 (0 V)  |
+  *          |                         |   VDD         |    4 (3.3 V)|
+  *          | SD_SPI_SCK_PIN / SCLK   |   Clock       |    5        |
+  *          |                         |   GND         |    6 (0 V)  |
+  *          | SD_SPI_MISO_PIN / MISO  |   DataOut     |    7        |
+  *          +-------------------------+---------------+-------------+
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* File Info : -----------------------------------------------------------------
+                                   User NOTES
+1. How to use this driver:
+--------------------------
+   - This driver does not need a specific component driver for the micro SD device
+     to be included with.
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the micro SD card using the BSP_SD_Init() function. 
+     o Checking the SD card presence is not managed because SD detection pin is
+       not physically mapped on the Adafruit shield.
+     o The function BSP_SD_GetCardInfo() is used to get the micro SD card information 
+       which is stored in the structure "SD_CardInfo".
+  
+  + Micro SD card operations
+     o The micro SD card can be accessed with read/write block(s) operations once 
+       it is ready for access. The access can be performed in polling 
+       mode by calling the functions BSP_SD_ReadBlocks()/BSP_SD_WriteBlocks()
+       
+     o The SD erase block(s) is performed using the function BSP_SD_Erase() with 
+       specifying the number of blocks to erase.
+     o The SD runtime status is returned when calling the function BSP_SD_GetStatus().
+     
+------------------------------------------------------------------------------*/ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32_adafruit_sd.h"
+#include "stdlib.h"
+#include "string.h"
+#include "stdio.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32_ADAFRUIT
+  * @{
+  */ 
+  
+/** @defgroup STM32_ADAFRUIT_SD
+  * @{
+  */ 
+  
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup STM32_ADAFRUIT_SD_Private_Types_Definitions
+  * @{
+  */ 
+typedef struct {
+  uint8_t r1;
+  uint8_t r2;
+  uint8_t r3;
+  uint8_t r4;
+  uint8_t r5;
+} SD_CmdAnswer_typedef;
+  
+/**
+  * @}
+  */
+  
+/* Private define ------------------------------------------------------------*/
+
+/** @defgroup STM32_ADAFRUIT_SD_Private_Defines
+  * @{
+  */
+#define SD_DUMMY_BYTE            0xFF
+
+#define SD_MAX_FRAME_LENGTH        17    /* Lenght = 16 + 1 */
+#define SD_CMD_LENGTH               6
+
+#define SD_MAX_TRY                100    /* Number of try */
+
+#define SD_CSD_STRUCT_V1          0x2    /* CSD struct version V1 */
+#define SD_CSD_STRUCT_V2          0x1    /* CSD struct version V2 */
+
+
+/**
+  * @brief  SD ansewer format
+  */ 
+typedef enum {
+ SD_ANSWER_R1_EXPECTED,
+ SD_ANSWER_R1B_EXPECTED,
+ SD_ANSWER_R2_EXPECTED,
+ SD_ANSWER_R3_EXPECTED,
+ SD_ANSWER_R4R5_EXPECTED,
+ SD_ANSWER_R7_EXPECTED,
+}SD_Answer_type;
+
+/**
+  * @brief  Start Data tokens:
+  *         Tokens (necessary because at nop/idle (and CS active) only 0xff is 
+  *         on the data/command line)  
+  */ 
+#define SD_TOKEN_START_DATA_SINGLE_BLOCK_READ    0xFE  /* Data token start byte, Start Single Block Read */
+#define SD_TOKEN_START_DATA_MULTIPLE_BLOCK_READ  0xFE  /* Data token start byte, Start Multiple Block Read */
+#define SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE   0xFE  /* Data token start byte, Start Single Block Write */
+#define SD_TOKEN_START_DATA_MULTIPLE_BLOCK_WRITE 0xFD  /* Data token start byte, Start Multiple Block Write */
+#define SD_TOKEN_STOP_DATA_MULTIPLE_BLOCK_WRITE  0xFD  /* Data toke stop byte, Stop Multiple Block Write */
+
+/**
+  * @brief  Commands: CMDxx = CMD-number | 0x40
+  */
+#define SD_CMD_GO_IDLE_STATE          0   /* CMD0 = 0x40  */
+#define SD_CMD_SEND_OP_COND           1   /* CMD1 = 0x41  */
+#define SD_CMD_SEND_IF_COND           8   /* CMD8 = 0x48  */
+#define SD_CMD_SEND_CSD               9   /* CMD9 = 0x49  */
+#define SD_CMD_SEND_CID               10  /* CMD10 = 0x4A */
+#define SD_CMD_STOP_TRANSMISSION      12  /* CMD12 = 0x4C */
+#define SD_CMD_SEND_STATUS            13  /* CMD13 = 0x4D */
+#define SD_CMD_SET_BLOCKLEN           16  /* CMD16 = 0x50 */
+#define SD_CMD_READ_SINGLE_BLOCK      17  /* CMD17 = 0x51 */
+#define SD_CMD_READ_MULT_BLOCK        18  /* CMD18 = 0x52 */
+#define SD_CMD_SET_BLOCK_COUNT        23  /* CMD23 = 0x57 */
+#define SD_CMD_WRITE_SINGLE_BLOCK     24  /* CMD24 = 0x58 */
+#define SD_CMD_WRITE_MULT_BLOCK       25  /* CMD25 = 0x59 */
+#define SD_CMD_PROG_CSD               27  /* CMD27 = 0x5B */
+#define SD_CMD_SET_WRITE_PROT         28  /* CMD28 = 0x5C */
+#define SD_CMD_CLR_WRITE_PROT         29  /* CMD29 = 0x5D */
+#define SD_CMD_SEND_WRITE_PROT        30  /* CMD30 = 0x5E */
+#define SD_CMD_SD_ERASE_GRP_START     32  /* CMD32 = 0x60 */
+#define SD_CMD_SD_ERASE_GRP_END       33  /* CMD33 = 0x61 */
+#define SD_CMD_UNTAG_SECTOR           34  /* CMD34 = 0x62 */
+#define SD_CMD_ERASE_GRP_START        35  /* CMD35 = 0x63 */
+#define SD_CMD_ERASE_GRP_END          36  /* CMD36 = 0x64 */
+#define SD_CMD_UNTAG_ERASE_GROUP      37  /* CMD37 = 0x65 */
+#define SD_CMD_ERASE                  38  /* CMD38 = 0x66 */
+#define SD_CMD_SD_APP_OP_COND         41  /* CMD41 = 0x69 */
+#define SD_CMD_APP_CMD                55  /* CMD55 = 0x77 */
+#define SD_CMD_READ_OCR               58  /* CMD55 = 0x79 */
+
+/**
+  * @brief  SD reponses and error flags
+  */
+typedef enum
+{
+/* R1 answer value */  
+  SD_R1_NO_ERROR            = (0x00),
+  SD_R1_IN_IDLE_STATE       = (0x01),
+  SD_R1_ERASE_RESET         = (0x02),
+  SD_R1_ILLEGAL_COMMAND     = (0x04),
+  SD_R1_COM_CRC_ERROR       = (0x08),
+  SD_R1_ERASE_SEQUENCE_ERROR= (0x10),
+  SD_R1_ADDRESS_ERROR       = (0x20),
+  SD_R1_PARAMETER_ERROR     = (0x40),
+
+/* R2 answer value */
+  SD_R2_NO_ERROR            = 0x00,
+  SD_R2_CARD_LOCKED         = 0x01,
+  SD_R2_LOCKUNLOCK_ERROR    = 0x02,
+  SD_R2_ERROR               = 0x04,
+  SD_R2_CC_ERROR            = 0x08,
+  SD_R2_CARD_ECC_FAILED     = 0x10,
+  SD_R2_WP_VIOLATION        = 0x20,
+  SD_R2_ERASE_PARAM         = 0x40,
+  SD_R2_OUTOFRANGE          = 0x80,
+  
+/**
+  * @brief  Data response error
+  */
+  SD_DATA_OK                = (0x05),
+  SD_DATA_CRC_ERROR         = (0x0B),
+  SD_DATA_WRITE_ERROR       = (0x0D),
+  SD_DATA_OTHER_ERROR       = (0xFF)
+} SD_Error;
+
+/**
+  * @}
+  */
+  
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup STM32_ADAFRUIT_SD_Private_Macros
+  * @{
+  */  
+
+/**
+  * @}
+  */
+  
+/* Private variables ---------------------------------------------------------*/
+
+/** @defgroup STM32_ADAFRUIT_SD_Private_Variables
+  * @{
+  */       
+__IO uint8_t SdStatus = SD_NOT_PRESENT;
+
+/* flag_SDHC :
+      0 :  Standard capacity
+      1 : High capacity
+*/
+uint16_t flag_SDHC = 0; 
+
+/**
+  * @}
+  */ 
+
+/* Private function prototypes -----------------------------------------------*/
+static uint8_t SD_GetCIDRegister(SD_CID* Cid);
+static uint8_t SD_GetCSDRegister(SD_CSD* Csd);
+static uint8_t SD_GetDataResponse(void);
+static uint8_t SD_GoIdleState(void);
+static SD_CmdAnswer_typedef SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Answer);
+static uint8_t SD_WaitData(uint8_t data);
+static uint8_t SD_ReadData(void);
+/** @defgroup STM32_ADAFRUIT_SD_Private_Function_Prototypes
+  * @{
+  */ 
+/**
+  * @}
+  */
+ 
+/* Private functions ---------------------------------------------------------*/
+    
+/** @defgroup STM32_ADAFRUIT_SD_Private_Functions
+  * @{
+  */ 
+  
+/**
+  * @brief  Initializes the SD/SD communication.
+  * @param  None
+  * @retval The SD Response: 
+  *         - MSD_ERROR: Sequence failed
+  *         - MSD_OK: Sequence succeed
+  */
+uint8_t BSP_SD_Init(void)
+{ 
+  /* Configure IO functionalities for SD pin */
+  SD_IO_Init();
+
+  /* SD detection pin is not physically mapped on the Adafruit shield */
+  SdStatus = SD_PRESENT;
+  
+  /* SD initialized and set to SPI mode properly */
+  return SD_GoIdleState();
+}
+
+/**
+  * @brief  Returns information about specific card.
+  * @param  pCardInfo: Pointer to a SD_CardInfo structure that contains all SD 
+  *         card information.
+  * @retval The SD Response:
+  *         - MSD_ERROR: Sequence failed
+  *         - MSD_OK: Sequence succeed
+  */
+uint8_t BSP_SD_GetCardInfo(SD_CardInfo *pCardInfo)
+{
+  uint8_t status;
+
+  status = SD_GetCSDRegister(&(pCardInfo->Csd));
+  status|= SD_GetCIDRegister(&(pCardInfo->Cid));
+  if(flag_SDHC == 1 )
+  {
+    pCardInfo->CardBlockSize = 512;
+    pCardInfo->CardCapacity = (pCardInfo->Csd.version.v2.DeviceSize + 1) * pCardInfo->CardBlockSize;
+  }
+  else
+  {
+    pCardInfo->CardCapacity = (pCardInfo->Csd.version.v1.DeviceSize + 1) ;
+    pCardInfo->CardCapacity *= (1 << (pCardInfo->Csd.version.v1.DeviceSizeMul + 2));
+    pCardInfo->CardBlockSize = 1 << (pCardInfo->Csd.RdBlockLen);
+    pCardInfo->CardCapacity *= pCardInfo->CardBlockSize;
+  }
+  
+  return status;
+}
+
+/**
+  * @brief  Reads block(s) from a specified address in the SD card, in polling mode. 
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  ReadAddr: Address from where data is to be read  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to read 
+  * @retval SD status
+  */
+uint8_t BSP_SD_ReadBlocks(uint32_t* pData, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
+{
+  uint32_t offset = 0;
+  uint8_t retr = BSP_SD_ERROR;
+  uint8_t *ptr = NULL;
+  SD_CmdAnswer_typedef response;
+  
+  /* Send CMD16 (SD_CMD_SET_BLOCKLEN) to set the size of the block and 
+     Check if the SD acknowledged the set block length command: R1 response (0x00: no errors) */
+  response = SD_SendCmd(SD_CMD_SET_BLOCKLEN, BlockSize, 0xFF, SD_ANSWER_R1_EXPECTED);
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  if ( response.r1 != SD_R1_NO_ERROR)
+  {
+     goto error;
+  }
+  
+  ptr = malloc(sizeof(uint8_t)*BlockSize);
+  if( ptr == NULL )
+  {
+     goto error;
+  }
+  memset(ptr, SD_DUMMY_BYTE, sizeof(uint8_t)*BlockSize);
+
+  /* Data transfer */
+  while (NumberOfBlocks--)
+  {
+    /* Send CMD17 (SD_CMD_READ_SINGLE_BLOCK) to read one block */
+    /* Check if the SD acknowledged the read block command: R1 response (0x00: no errors) */
+    response = SD_SendCmd(SD_CMD_READ_SINGLE_BLOCK, (ReadAddr + offset)/(flag_SDHC == 1 ?BlockSize: 1), 0xFF, SD_ANSWER_R1_EXPECTED);
+    if ( response.r1 != SD_R1_NO_ERROR)
+    {
+      goto error;
+    }
+
+    /* Now look for the data token to signify the start of the data */
+    if (SD_WaitData(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ) == BSP_SD_OK)
+    {
+      /* Read the SD block data : read NumByteToRead data */
+      SD_IO_WriteReadData(ptr, (uint8_t*)pData + offset, BlockSize);
+
+      /* Set next read address*/
+      offset += BlockSize;
+      /* get CRC bytes (not really needed by us, but required by SD) */
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);      
+    }
+    else
+    {
+      goto error;
+    }
+    
+    /* End the command data read cycle */
+    SD_IO_CSState(1);
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+  }
+  
+  retr = BSP_SD_OK;
+  
+error :  
+  /* Send dummy byte: 8 Clock pulses of delay */
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  if(ptr != NULL) free(ptr);
+  
+  /* Return the reponse */
+  return retr;
+}
+
+/**
+  * @brief  Writes block(s) to a specified address in the SD card, in polling mode. 
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  WriteAddr: Address from where data is to be written  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to write
+  * @retval SD status
+  */
+uint8_t BSP_SD_WriteBlocks(uint32_t* pData, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
+{
+  uint32_t offset = 0;
+  uint8_t retr = BSP_SD_ERROR;
+  uint8_t *ptr = NULL;
+  SD_CmdAnswer_typedef response;
+  
+  /* Send CMD16 (SD_CMD_SET_BLOCKLEN) to set the size of the block and 
+     Check if the SD acknowledged the set block length command: R1 response (0x00: no errors) */
+  response = SD_SendCmd(SD_CMD_SET_BLOCKLEN, BlockSize, 0xFF, SD_ANSWER_R1_EXPECTED);
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  if ( response.r1 != SD_R1_NO_ERROR)
+  {
+    goto error;
+  }
+  
+  ptr = malloc(sizeof(uint8_t)*BlockSize);
+  if (ptr == NULL)
+  {
+    goto error;
+  }
+  
+  /* Data transfer */
+  while (NumberOfBlocks--)
+  {
+    /* Send CMD24 (SD_CMD_WRITE_SINGLE_BLOCK) to write blocks  and
+       Check if the SD acknowledged the write block command: R1 response (0x00: no errors) */
+    response = SD_SendCmd(SD_CMD_WRITE_SINGLE_BLOCK, (WriteAddr + offset)/(flag_SDHC == 1 ? BlockSize: 1), 0xFF, SD_ANSWER_R1_EXPECTED);
+    if (response.r1 != SD_R1_NO_ERROR)
+    {
+      goto error;
+    }
+    
+    /* Send dummy byte for NWR timing : one byte between CMDWRITE and TOKEN */
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+
+    /* Send the data token to signify the start of the data */
+    SD_IO_WriteByte(SD_TOKEN_START_DATA_SINGLE_BLOCK_WRITE);
+
+    /* Write the block data to SD */
+    SD_IO_WriteReadData((uint8_t*)pData + offset, ptr, BlockSize);
+    
+    /* Set next write address */
+    offset += BlockSize;
+
+    /* Put CRC bytes (not really needed by us, but required by SD) */
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+
+    /* Read data response */
+    if (SD_GetDataResponse() != SD_DATA_OK)
+    {
+      /* Set response value to failure */
+      goto error;
+    }
+
+    SD_IO_CSState(1);    
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+  }
+  retr = BSP_SD_OK;
+  
+error :
+  if(ptr != NULL) free(ptr);
+  /* Send dummy byte: 8 Clock pulses of delay */
+  SD_IO_CSState(1);    
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  
+  /* Return the reponse */
+  return retr;
+}
+
+/**
+  * @brief  Erases the specified memory area of the given SD card. 
+  * @param  StartAddr: Start byte address
+  * @param  EndAddr: End byte address
+  * @retval SD status
+  */
+uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr)
+{
+  uint8_t retr = BSP_SD_ERROR;
+  SD_CmdAnswer_typedef response;
+
+  /* Send CMD32 (Erase group start) and check if the SD acknowledged the erase command: R1 response (0x00: no errors) */
+  response = SD_SendCmd(SD_CMD_SD_ERASE_GRP_START, StartAddr, 0xFF, SD_ANSWER_R1_EXPECTED);
+  SD_IO_CSState(1);    
+  SD_IO_WriteByte(SD_DUMMY_BYTE);  if (response.r1 == SD_R1_NO_ERROR)
+  {
+    /* Send CMD33 (Erase group end) and Check if the SD acknowledged the erase command: R1 response (0x00: no errors) */
+    response = SD_SendCmd(SD_CMD_SD_ERASE_GRP_END, EndAddr, 0xFF, SD_ANSWER_R1_EXPECTED);
+    SD_IO_CSState(1);    
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+    if (response.r1 == SD_R1_NO_ERROR)
+    {
+      /* Send CMD38 (Erase) and Check if the SD acknowledged the erase command: R1 response (0x00: no errors) */
+      response = SD_SendCmd(SD_CMD_ERASE, 0, 0xFF, SD_ANSWER_R1B_EXPECTED);
+      if (response.r1 == SD_R1_NO_ERROR)
+      {
+        retr = BSP_SD_OK;
+      }
+      SD_IO_CSState(1);    
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+    }
+  }
+  
+  /* Return the reponse */
+  return retr;
+}
+
+/**
+  * @brief  Returns the SD status.
+  * @param  None
+  * @retval The SD status.
+  */
+uint8_t BSP_SD_GetStatus(void)
+{
+  SD_CmdAnswer_typedef retr;
+  
+  /* Send CMD13 (SD_SEND_STATUS) to get SD status */
+  retr = SD_SendCmd(SD_CMD_SEND_STATUS, 0, 0xFF, SD_ANSWER_R2_EXPECTED);
+  SD_IO_CSState(1);    
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  
+  /* Find SD status according to card state */
+  if(( retr.r1 == SD_R1_NO_ERROR) && ( retr.r2 == SD_R2_NO_ERROR))
+  {
+    return BSP_SD_OK;
+  }
+
+  return BSP_SD_ERROR;
+}
+
+/**
+  * @brief  Reads the SD card SCD register.
+  *         Reading the contents of the CSD register in SPI mode is a simple 
+  *         read-block transaction.
+  * @param  Csd: pointer on an SCD register structure
+  * @retval SD status
+  */
+uint8_t SD_GetCSDRegister(SD_CSD* Csd)
+{
+  uint16_t counter = 0;
+  uint8_t CSD_Tab[16];
+  uint8_t retr = BSP_SD_ERROR;
+  SD_CmdAnswer_typedef response;
+  
+  /* Send CMD9 (CSD register) or CMD10(CSD register) and Wait for response in the R1 format (0x00 is no errors) */
+  response = SD_SendCmd(SD_CMD_SEND_CSD, 0, 0xFF, SD_ANSWER_R1_EXPECTED);
+  if(response.r1 == SD_R1_NO_ERROR)
+  {
+    if (SD_WaitData(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ) == BSP_SD_OK)
+    {
+      for (counter = 0; counter < 16; counter++)
+      {
+        /* Store CSD register value on CSD_Tab */
+        CSD_Tab[counter] = SD_IO_WriteByte(SD_DUMMY_BYTE);
+      }
+      
+      /* Get CRC bytes (not really needed by us, but required by SD) */
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+
+      /*************************************************************************
+        CSD header decoding 
+      *************************************************************************/
+      
+      /* Byte 0 */
+      Csd->CSDStruct = (CSD_Tab[0] & 0xC0) >> 6;
+      Csd->Reserved1 =  CSD_Tab[0] & 0x3F;
+      
+      /* Byte 1 */
+      Csd->TAAC = CSD_Tab[1];
+      
+      /* Byte 2 */
+      Csd->NSAC = CSD_Tab[2];
+      
+      /* Byte 3 */
+      Csd->MaxBusClkFrec = CSD_Tab[3];
+      
+      /* Byte 4/5 */
+      Csd->CardComdClasses = (CSD_Tab[4] << 4) | ((CSD_Tab[5] & 0xF0) >> 4);
+      Csd->RdBlockLen = CSD_Tab[5] & 0x0F;
+      
+      /* Byte 6 */
+      Csd->PartBlockRead   = (CSD_Tab[6] & 0x80) >> 7;
+      Csd->WrBlockMisalign = (CSD_Tab[6] & 0x40) >> 6;
+      Csd->RdBlockMisalign = (CSD_Tab[6] & 0x20) >> 5;
+      Csd->DSRImpl         = (CSD_Tab[6] & 0x10) >> 4;
+
+      /*************************************************************************
+        CSD v1/v2 decoding  
+      *************************************************************************/
+     
+      if(flag_SDHC == 0)
+      {
+        Csd->version.v1.Reserved1 = ((CSD_Tab[6] & 0x0C) >> 2);
+        
+        Csd->version.v1.DeviceSize =  ((CSD_Tab[6] & 0x03) << 10) 
+                                    |  (CSD_Tab[7] << 2)
+                                    | ((CSD_Tab[8] & 0xC0) >> 6);
+        Csd->version.v1.MaxRdCurrentVDDMin = (CSD_Tab[8] & 0x38) >> 3;
+        Csd->version.v1.MaxRdCurrentVDDMax = (CSD_Tab[8] & 0x07);
+        Csd->version.v1.MaxWrCurrentVDDMin = (CSD_Tab[9] & 0xE0) >> 5;
+        Csd->version.v1.MaxWrCurrentVDDMax = (CSD_Tab[9] & 0x1C) >> 2;
+        Csd->version.v1.DeviceSizeMul = ((CSD_Tab[9] & 0x03) << 1)
+                                       |((CSD_Tab[10] & 0x80) >> 7);
+      }
+      else
+      {
+        Csd->version.v2.Reserved1 = ((CSD_Tab[6] & 0x0F) << 2) | ((CSD_Tab[7] & 0xC0) >> 6);
+        Csd->version.v2.DeviceSize= ((CSD_Tab[7] & 0x3F) << 16) | (CSD_Tab[8] << 8) | CSD_Tab[9];    
+        Csd->version.v2.Reserved2 = ((CSD_Tab[10] & 0x80) >> 8);
+      }    
+            
+      Csd->EraseSingleBlockEnable = (CSD_Tab[10] & 0x40) >> 6;
+      Csd->EraseSectorSize   = ((CSD_Tab[10] & 0x3F) << 1)
+                              |((CSD_Tab[11] & 0x80) >> 7);
+      Csd->WrProtectGrSize   = (CSD_Tab[11] & 0x7F);
+      Csd->WrProtectGrEnable = (CSD_Tab[12] & 0x80) >> 7;
+      Csd->Reserved2         = (CSD_Tab[12] & 0x60) >> 5;
+      Csd->WrSpeedFact       = (CSD_Tab[12] & 0x1C) >> 2;
+      Csd->MaxWrBlockLen     = ((CSD_Tab[12] & 0x03) << 2)
+                              |((CSD_Tab[13] & 0xC0) >> 6);
+      Csd->WriteBlockPartial = (CSD_Tab[13] & 0x20) >> 5;
+      Csd->Reserved3         = (CSD_Tab[13] & 0x1F);
+      Csd->FileFormatGrouop  = (CSD_Tab[14] & 0x80) >> 7;
+      Csd->CopyFlag          = (CSD_Tab[14] & 0x40) >> 6;
+      Csd->PermWrProtect     = (CSD_Tab[14] & 0x20) >> 5;
+      Csd->TempWrProtect     = (CSD_Tab[14] & 0x10) >> 4;
+      Csd->FileFormat        = (CSD_Tab[14] & 0x0C) >> 2;
+      Csd->Reserved4         = (CSD_Tab[14] & 0x03);
+      Csd->crc               = (CSD_Tab[15] & 0xFE) >> 1;
+      Csd->Reserved5         = (CSD_Tab[15] & 0x01);
+      
+      retr = BSP_SD_OK;
+    }
+  }
+  
+  /* Send dummy byte: 8 Clock pulses of delay */
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  
+  /* Return the reponse */
+  return retr;
+}
+
+/**
+  * @brief  Reads the SD card CID register.
+  *         Reading the contents of the CID register in SPI mode is a simple 
+  *         read-block transaction.
+  * @param  Cid: pointer on an CID register structure
+  * @retval SD status
+  */
+uint8_t SD_GetCIDRegister(SD_CID* Cid)
+{
+  uint32_t counter = 0;
+  uint8_t retr = BSP_SD_ERROR;
+  uint8_t CID_Tab[16];
+  SD_CmdAnswer_typedef response;
+  
+  /* Send CMD10 (CID register) and Wait for response in the R1 format (0x00 is no errors) */
+  response = SD_SendCmd(SD_CMD_SEND_CID, 0, 0xFF, SD_ANSWER_R1_EXPECTED);
+  if(response.r1 == SD_R1_NO_ERROR)
+  {
+    if(SD_WaitData(SD_TOKEN_START_DATA_SINGLE_BLOCK_READ) == BSP_SD_OK)
+    {
+      /* Store CID register value on CID_Tab */
+      for (counter = 0; counter < 16; counter++)
+      {
+        CID_Tab[counter] = SD_IO_WriteByte(SD_DUMMY_BYTE);
+      }
+      
+      /* Get CRC bytes (not really needed by us, but required by SD) */
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      
+      /* Byte 0 */
+      Cid->ManufacturerID = CID_Tab[0];
+      
+      /* Byte 1 */
+      Cid->OEM_AppliID = CID_Tab[1] << 8;
+      
+      /* Byte 2 */
+      Cid->OEM_AppliID |= CID_Tab[2];
+      
+      /* Byte 3 */
+      Cid->ProdName1 = CID_Tab[3] << 24;
+      
+      /* Byte 4 */
+      Cid->ProdName1 |= CID_Tab[4] << 16;
+      
+      /* Byte 5 */
+      Cid->ProdName1 |= CID_Tab[5] << 8;
+      
+      /* Byte 6 */
+      Cid->ProdName1 |= CID_Tab[6];
+      
+      /* Byte 7 */
+      Cid->ProdName2 = CID_Tab[7];
+      
+      /* Byte 8 */
+      Cid->ProdRev = CID_Tab[8];
+      
+      /* Byte 9 */
+      Cid->ProdSN = CID_Tab[9] << 24;
+      
+      /* Byte 10 */
+      Cid->ProdSN |= CID_Tab[10] << 16;
+      
+      /* Byte 11 */
+      Cid->ProdSN |= CID_Tab[11] << 8;
+      
+      /* Byte 12 */
+      Cid->ProdSN |= CID_Tab[12];
+      
+      /* Byte 13 */
+      Cid->Reserved1 |= (CID_Tab[13] & 0xF0) >> 4;
+      Cid->ManufactDate = (CID_Tab[13] & 0x0F) << 8;
+      
+      /* Byte 14 */
+      Cid->ManufactDate |= CID_Tab[14];
+      
+      /* Byte 15 */
+      Cid->CID_CRC = (CID_Tab[15] & 0xFE) >> 1;
+      Cid->Reserved2 = 1;
+
+      retr = BSP_SD_OK;
+    }
+  }
+  
+  /* Send dummy byte: 8 Clock pulses of delay */
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  
+  /* Return the reponse */
+  return retr;
+}
+
+/**
+  * @brief  Sends 5 bytes command to the SD card and get response
+  * @param  Cmd: The user expected command to send to SD card.
+  * @param  Arg: The command argument.
+  * @param  Crc: The CRC.
+  * @param  Answer: SD_ANSWER_NOT_EXPECTED or SD_ANSWER_EXPECTED
+  * @retval SD status
+  */
+SD_CmdAnswer_typedef SD_SendCmd(uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Answer)
+{
+  uint8_t frame[SD_CMD_LENGTH], frameout[SD_CMD_LENGTH];
+  SD_CmdAnswer_typedef retr = {0xFF, 0xFF , 0xFF, 0xFF, 0xFF};
+
+  /* R1 Lenght = NCS(0)+ 6 Bytes command + NCR(min1 max8) + 1 Bytes answer + NEC(0) = 15bytes */
+  /* R1b identical to R1 + Busy information                                                   */
+  /* R2 Lenght = NCS(0)+ 6 Bytes command + NCR(min1 max8) + 2 Bytes answer + NEC(0) = 16bytes */
+  
+  /* Prepare Frame to send */
+  frame[0] = (Cmd | 0x40);         /* Construct byte 1 */
+  frame[1] = (uint8_t)(Arg >> 24); /* Construct byte 2 */
+  frame[2] = (uint8_t)(Arg >> 16); /* Construct byte 3 */
+  frame[3] = (uint8_t)(Arg >> 8);  /* Construct byte 4 */
+  frame[4] = (uint8_t)(Arg);       /* Construct byte 5 */
+  frame[5] = (Crc | 0x01);         /* Construct byte 6 */
+    
+  /* Send the command */
+  SD_IO_CSState(0);
+  SD_IO_WriteReadData(frame, frameout, SD_CMD_LENGTH); /* Send the Cmd bytes */
+  
+  switch(Answer)
+  {
+  case SD_ANSWER_R1_EXPECTED :
+    retr.r1 = SD_ReadData();
+    break;
+  case SD_ANSWER_R1B_EXPECTED :
+    retr.r1 = SD_ReadData();
+    retr.r2 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    /* Set CS High */
+    SD_IO_CSState(1);
+    HAL_Delay(1);
+    /* Set CS Low */
+    SD_IO_CSState(0);
+    
+    /* Wait IO line return 0xFF */
+    while (SD_IO_WriteByte(SD_DUMMY_BYTE) != 0xFF); 
+    break;
+  case SD_ANSWER_R2_EXPECTED :
+    retr.r1 = SD_ReadData();
+    retr.r2 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    break;
+  case SD_ANSWER_R3_EXPECTED :
+  case SD_ANSWER_R7_EXPECTED :
+    retr.r1 = SD_ReadData();
+    retr.r2 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    retr.r3 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    retr.r4 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    retr.r5 = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    break;
+  default :
+    break;
+  }  
+  return retr;
+}
+
+/**
+  * @brief  Gets the SD card data response and check the busy flag.
+  * @param  None
+  * @retval The SD status: Read data response xxx0<status>1
+  *         - status 010: Data accecpted
+  *         - status 101: Data rejected due to a crc error
+  *         - status 110: Data rejected due to a Write error.
+  *         - status 111: Data rejected due to other error.
+  */
+uint8_t SD_GetDataResponse(void)
+{
+  uint8_t dataresponse;
+  uint8_t rvalue = SD_DATA_OTHER_ERROR;
+  
+  dataresponse = SD_IO_WriteByte(SD_DUMMY_BYTE);
+  SD_IO_WriteByte(SD_DUMMY_BYTE); /* read the busy response byte*/
+ 
+  /* Mask unused bits */
+  switch (dataresponse & 0x1F)
+  {
+  case SD_DATA_OK:
+    rvalue = SD_DATA_OK;
+    
+    /* Set CS High */
+    SD_IO_CSState(1);
+    /* Set CS Low */
+    SD_IO_CSState(0);
+
+    /* Wait IO line return 0xFF */
+    while (SD_IO_WriteByte(SD_DUMMY_BYTE) != 0xFF);
+    break;
+  case SD_DATA_CRC_ERROR:
+    rvalue =  SD_DATA_CRC_ERROR;
+    break;
+  case SD_DATA_WRITE_ERROR:
+    rvalue = SD_DATA_WRITE_ERROR;
+    break;
+  default:
+    break;
+  }
+  
+  /* Return response */
+  return rvalue;
+}
+
+
+/**
+  * @brief  Put the SD in Idle state.
+  * @param  None
+  * @retval SD status
+  */
+uint8_t SD_GoIdleState(void)
+{
+  SD_CmdAnswer_typedef response;
+  __IO uint8_t counter = 0;
+  /* Send CMD0 (SD_CMD_GO_IDLE_STATE) to put SD in SPI mode and 
+     wait for In Idle State Response (R1 Format) equal to 0x01 */
+  do{
+    counter++;
+    response = SD_SendCmd(SD_CMD_GO_IDLE_STATE, 0, 0x95, SD_ANSWER_R1_EXPECTED);
+    SD_IO_CSState(1);
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+    if(counter >= SD_MAX_TRY)
+    {
+      return BSP_SD_ERROR;
+    }
+  }
+  while(response.r1 != SD_R1_IN_IDLE_STATE);
+  
+    
+  /* Send CMD8 (SD_CMD_SEND_IF_COND) to check the power supply status 
+     and wait until response (R7 Format) equal to 0xAA and */
+  response = SD_SendCmd(SD_CMD_SEND_IF_COND, 0x1AA, 0x87, SD_ANSWER_R7_EXPECTED);
+  SD_IO_CSState(1);
+  SD_IO_WriteByte(SD_DUMMY_BYTE);
+  if((response.r1  & SD_R1_ILLEGAL_COMMAND) == SD_R1_ILLEGAL_COMMAND)
+  {
+    /* initialise card V1 */
+    do
+    {
+      /* initialise card V1 */
+      /* Send CMD55 (SD_CMD_APP_CMD) before any ACMD command: R1 response (0x00: no errors) */ 
+      response = SD_SendCmd(SD_CMD_APP_CMD, 0x00000000, 0xFF, SD_ANSWER_R1_EXPECTED);
+      SD_IO_CSState(1);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      
+      /* Send ACMD41 (SD_CMD_SD_APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors) */
+      response = SD_SendCmd(SD_CMD_SD_APP_OP_COND, 0x00000000, 0xFF, SD_ANSWER_R1_EXPECTED);
+      SD_IO_CSState(1);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+    }
+    while(response.r1 == SD_R1_IN_IDLE_STATE);
+    flag_SDHC = 0;
+  } 
+  else if(response.r1 == SD_R1_IN_IDLE_STATE)
+  {
+      /* initialise card V2 */
+    do {
+      
+      /* Send CMD55 (SD_CMD_APP_CMD) before any ACMD command: R1 response (0x00: no errors) */ 
+      response = SD_SendCmd(SD_CMD_APP_CMD, 0, 0xFF, SD_ANSWER_R1_EXPECTED);
+      SD_IO_CSState(1);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+      
+      /* Send ACMD41 (SD_CMD_SD_APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors) */
+      response = SD_SendCmd(SD_CMD_SD_APP_OP_COND, 0x40000000, 0xFF, SD_ANSWER_R1_EXPECTED);
+      SD_IO_CSState(1);
+      SD_IO_WriteByte(SD_DUMMY_BYTE);
+    }
+    while(response.r1 == SD_R1_IN_IDLE_STATE);
+    
+    if((response.r1 & SD_R1_ILLEGAL_COMMAND) == SD_R1_ILLEGAL_COMMAND)
+    {
+      do {
+        /* Send CMD55 (SD_CMD_APP_CMD) before any ACMD command: R1 response (0x00: no errors) */ 
+        response = SD_SendCmd(SD_CMD_APP_CMD, 0, 0xFF, SD_ANSWER_R1_EXPECTED);
+        SD_IO_CSState(1);
+        SD_IO_WriteByte(SD_DUMMY_BYTE);
+        if(response.r1 != SD_R1_IN_IDLE_STATE)
+        {
+          return BSP_SD_ERROR;
+        }
+        /* Send ACMD41 (SD_CMD_SD_APP_OP_COND) to initialize SDHC or SDXC cards: R1 response (0x00: no errors) */
+        response = SD_SendCmd(SD_CMD_SD_APP_OP_COND, 0x00000000, 0xFF, SD_ANSWER_R1_EXPECTED);
+        SD_IO_CSState(1);
+        SD_IO_WriteByte(SD_DUMMY_BYTE);
+      }
+      while(response.r1 == SD_R1_IN_IDLE_STATE);        
+    }  
+    
+    /* Send CMD58 (SD_CMD_READ_OCR) to initialize SDHC or SDXC cards: R3 response (0x00: no errors) */
+    response = SD_SendCmd(SD_CMD_READ_OCR, 0x00000000, 0xFF, SD_ANSWER_R3_EXPECTED);
+    SD_IO_CSState(1);
+    SD_IO_WriteByte(SD_DUMMY_BYTE);
+    if(response.r1 != SD_R1_NO_ERROR)
+    {
+      return BSP_SD_ERROR;
+    } 
+    flag_SDHC = (response.r2 & 0x40) >> 6;
+  }
+  else
+  {
+    return BSP_SD_ERROR;
+  }
+  
+  return BSP_SD_OK; 
+}
+
+/**
+  * @brief  Waits a data until a value different from SD_DUMMY_BITE
+  * @param  None
+  * @retval the value read
+  */
+uint8_t SD_ReadData(void)
+{
+  uint8_t timeout = 0x08;
+  uint8_t readvalue;
+ 
+  /* Check if response is got or a timeout is happen */
+  do {
+    readvalue = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    timeout--;
+    
+  }while ((readvalue == SD_DUMMY_BYTE) && timeout);
+
+  /* Right response got */
+  return readvalue;
+}
+
+/**
+  * @brief  Waits a data from the SD card
+  * @param  data : Expected data from the SD card
+  * @retval BSP_SD_OK or BSP_SD_TIMEOUT
+  */
+uint8_t SD_WaitData(uint8_t data)
+{
+  uint16_t timeout = 0xFFFF;
+  uint8_t readvalue;
+  
+  /* Check if response is got or a timeout is happen */
+  
+  do {
+    readvalue = SD_IO_WriteByte(SD_DUMMY_BYTE);
+    timeout--;
+  }while ((readvalue != data) && timeout);
+
+  if (timeout == 0)
+  {
+    /* After time out */
+    return BSP_SD_TIMEOUT;
+  }
+
+  /* Right response got */
+  return BSP_SD_OK;
+}
+
+/**
+  * @}
+  */  
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 240 - 0
bsp/stm32f411RE/Libraries/BSP/Adafruit_Shield/stm32_adafruit_sd.h

@@ -0,0 +1,240 @@
+/**
+  ******************************************************************************
+  * @file    stm32_adafruit_sd.h
+  * @author  MCD Application Team
+  * @version V2.0.1
+  * @date    04-November-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32_adafruit_sd.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32_ADAFRUIT_SD_H
+#define __STM32_ADAFRUIT_SD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include <stdint.h>
+
+/** @addtogroup BSP
+  * @{
+  */ 
+#define __IO    volatile   
+   
+/** @addtogroup STM32_ADAFRUIT
+  * @{
+  */
+    
+/** @defgroup STM32_ADAFRUIT_SD
+  * @{
+  */    
+
+/** @defgroup STM32_ADAFRUIT_SD_Exported_Types
+  * @{
+  */
+   
+/** 
+  * @brief  SD status structure definition  
+  */     
+enum {    
+      BSP_SD_OK = 0x00,      
+      MSD_OK = 0x00,
+      BSP_SD_ERROR = 0x01,
+      BSP_SD_TIMEOUT
+};
+   
+typedef struct              
+{
+  uint8_t  Reserved1:2;               /* Reserved */
+  uint16_t DeviceSize:12;             /* Device Size */
+  uint8_t  MaxRdCurrentVDDMin:3;      /* Max. read current @ VDD min */
+  uint8_t  MaxRdCurrentVDDMax:3;      /* Max. read current @ VDD max */
+  uint8_t  MaxWrCurrentVDDMin:3;      /* Max. write current @ VDD min */
+  uint8_t  MaxWrCurrentVDDMax:3;      /* Max. write current @ VDD max */
+  uint8_t  DeviceSizeMul:3;           /* Device size multiplier */
+} struct_v1;
+
+
+typedef struct              
+{
+  uint8_t  Reserved1:6;               /* Reserved */
+  uint32_t DeviceSize:22;             /* Device Size */
+  uint8_t  Reserved2:1;               /* Reserved */
+} struct_v2;
+
+/** 
+  * @brief  Card Specific Data: CSD Register
+  */ 
+typedef struct
+{
+  /* Header part */
+  uint8_t  CSDStruct:2;            /* CSD structure */
+  uint8_t  Reserved1:6;            /* Reserved */
+  uint8_t  TAAC:8;                 /* Data read access-time 1 */
+  uint8_t  NSAC:8;                 /* Data read access-time 2 in CLK cycles */
+  uint8_t  MaxBusClkFrec:8;        /* Max. bus clock frequency */
+  uint16_t CardComdClasses:12;      /* Card command classes */
+  uint8_t  RdBlockLen:4;           /* Max. read data block length */
+  uint8_t  PartBlockRead:1;        /* Partial blocks for read allowed */
+  uint8_t  WrBlockMisalign:1;      /* Write block misalignment */
+  uint8_t  RdBlockMisalign:1;      /* Read block misalignment */
+  uint8_t  DSRImpl:1;              /* DSR implemented */
+  
+  /* v1 or v2 struct */
+  union csd_version {
+    struct_v1 v1;
+    struct_v2 v2;
+  } version;
+  
+  uint8_t  EraseSingleBlockEnable:1;  /* Erase single block enable */
+  uint8_t  EraseSectorSize:7;         /* Erase group size multiplier */
+  uint8_t  WrProtectGrSize:7;         /* Write protect group size */
+  uint8_t  WrProtectGrEnable:1;       /* Write protect group enable */
+  uint8_t  Reserved2:2;               /* Reserved */
+  uint8_t  WrSpeedFact:3;             /* Write speed factor */
+  uint8_t  MaxWrBlockLen:4;           /* Max. write data block length */
+  uint8_t  WriteBlockPartial:1;       /* Partial blocks for write allowed */
+  uint8_t  Reserved3:5;               /* Reserved */
+  uint8_t  FileFormatGrouop:1;        /* File format group */
+  uint8_t  CopyFlag:1;                /* Copy flag (OTP) */
+  uint8_t  PermWrProtect:1;           /* Permanent write protection */
+  uint8_t  TempWrProtect:1;           /* Temporary write protection */
+  uint8_t  FileFormat:2;              /* File Format */
+  uint8_t  Reserved4:2;               /* Reserved */
+  uint8_t  crc:7;                     /* Reserved */
+  uint8_t  Reserved5:1;               /* always 1*/
+  
+} SD_CSD;
+
+/** 
+  * @brief  Card Identification Data: CID Register   
+  */
+typedef struct
+{
+  __IO uint8_t  ManufacturerID;       /* ManufacturerID */
+  __IO uint16_t OEM_AppliID;          /* OEM/Application ID */
+  __IO uint32_t ProdName1;            /* Product Name part1 */
+  __IO uint8_t  ProdName2;            /* Product Name part2*/
+  __IO uint8_t  ProdRev;              /* Product Revision */
+  __IO uint32_t ProdSN;               /* Product Serial Number */
+  __IO uint8_t  Reserved1;            /* Reserved1 */
+  __IO uint16_t ManufactDate;         /* Manufacturing Date */
+  __IO uint8_t  CID_CRC;              /* CID CRC */
+  __IO uint8_t  Reserved2;            /* always 1 */
+} SD_CID;
+
+/** 
+  * @brief SD Card information 
+  */
+typedef struct
+{
+  SD_CSD Csd;
+  SD_CID Cid;
+  uint32_t CardCapacity;  /* Card Capacity */
+  uint32_t CardBlockSize; /* Card Block Size */
+} SD_CardInfo;
+
+/**
+  * @}
+  */
+  
+/** @defgroup STM32_ADAFRUIT_SPI_SD_Exported_Constants
+  * @{
+  */ 
+  
+/**
+  * @brief  Block Size
+  */
+#define SD_BLOCK_SIZE    0x200
+
+/**
+  * @brief  SD detection on its memory slot
+  */
+#define SD_PRESENT               ((uint8_t)0x01)
+#define SD_NOT_PRESENT           ((uint8_t)0x00)
+   
+/**
+  * @}
+  */
+  
+/** @defgroup STM32_ADAFRUIT_SD_Exported_Macro
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32_ADAFRUIT_SD_Exported_Functions
+  * @{
+  */   
+uint8_t BSP_SD_Init(void);
+uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks);
+uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks);
+uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
+uint8_t BSP_SD_GetStatus(void);
+uint8_t BSP_SD_GetCardInfo(SD_CardInfo *pCardInfo);
+   
+/* Link functions for SD Card peripheral*/
+void    SD_IO_Init(void);
+void    SD_IO_CSState(uint8_t state);
+void    SD_IO_WriteReadData(const uint8_t *DataIn, uint8_t *DataOut, uint16_t DataLength);
+uint8_t SD_IO_WriteByte(uint8_t Data);
+
+/* Link function for HAL delay */
+void HAL_Delay(__IO uint32_t Delay);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32_ADAFRUIT_SD_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 233 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/Release_Notes.html


+ 143 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/accelero.h

@@ -0,0 +1,143 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 122 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/audio.h

@@ -0,0 +1,122 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 141 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/camera.h

@@ -0,0 +1,141 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 115 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/epd.h

@@ -0,0 +1,115 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 145 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/gyro.h

@@ -0,0 +1,145 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 168 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/idd.h

@@ -0,0 +1,168 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 150 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/io.h

@@ -0,0 +1,150 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 114 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/lcd.h

@@ -0,0 +1,114 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+   
+/** @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****/

+ 125 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/magneto.h

@@ -0,0 +1,125 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 107 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/ts.h

@@ -0,0 +1,107 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h> 
+
+/** @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****/

+ 118 - 0
bsp/stm32f411RE/Libraries/BSP/Components/Common/tsensor.h

@@ -0,0 +1,118 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 <stdint.h>
+
+/** @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****/

+ 231 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ampire480272/Release_Notes.html

@@ -0,0 +1,231 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for Ampire480272 LCD Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for Ampire480272 LCD Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+              <li>
+
+            <span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank"></a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 121 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ampire480272/ampire480272.h

@@ -0,0 +1,121 @@
+/**
+  ******************************************************************************
+  * @file    ampire480272.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    18-February-2014
+  * @brief   This file contains all the constants parameters for the ampire480272
+  *          LCD component.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __AMPIRE480272_H
+#define __AMPIRE480272_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/  
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup ampire480272
+  * @{
+  */
+
+/** @defgroup AMPIRE480272_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup AMPIRE480272_Exported_Constants
+  * @{
+  */
+  
+/** 
+  * @brief  AMPIRE480272 Size  
+  */     
+#define  AMPIRE480272_WIDTH    ((uint16_t)480)          /* LCD PIXEL WIDTH            */
+#define  AMPIRE480272_HEIGHT   ((uint16_t)272)          /* LCD PIXEL HEIGHT           */
+
+/** 
+  * @brief  AMPIRE480272 Timing  
+  */     
+#define  AMPIRE480272_HSYNC            ((uint16_t)41)   /* Horizontal synchronization */
+#define  AMPIRE480272_HBP              ((uint16_t)2)    /* Horizontal back porch      */ 
+#define  AMPIRE480272_HFP              ((uint16_t)2)    /* Horizontal front porch     */
+#define  AMPIRE480272_VSYNC            ((uint16_t)10)   /* Vertical synchronization   */
+#define  AMPIRE480272_VBP              ((uint16_t)2)    /* Vertical back porch        */
+#define  AMPIRE480272_VFP              ((uint16_t)2)    /* Vertical front porch       */
+
+/** 
+  * @brief  AMPIRE480272 frequency divider  
+  */    
+#define  AMPIRE480272_FREQUENCY_DIVIDER    5            /* LCD Frequency divider      */
+/**
+  * @}
+  */
+  
+/** @defgroup AMPIRE480272_Exported_Functions
+  * @{
+  */    
+
+/**
+  * @}
+  */    
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AMPIRE480272_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 232 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ampire640480/Release_Notes.html

@@ -0,0 +1,232 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for Ampire480272 LCD Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for Ampire640480 LCD Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 121 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ampire640480/ampire640480.h

@@ -0,0 +1,121 @@
+/**
+  ******************************************************************************
+  * @file    ampire640480.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    18-February-2014
+  * @brief   This file contains all the constants parameters for the ampire640480
+  *          LCD component.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __AMPIRE640480_H
+#define __AMPIRE640480_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/  
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup ampire640480
+  * @{
+  */
+
+/** @defgroup AMPIRE640480_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup AMPIRE640480_Exported_Constants
+  * @{
+  */
+  
+/** 
+  * @brief  AMPIRE640480 Size  
+  */    
+#define  AMPIRE640480_WIDTH    ((uint16_t)640)             /* LCD PIXEL WIDTH            */
+#define  AMPIRE640480_HEIGHT   ((uint16_t)480)             /* LCD PIXEL HEIGHT           */
+
+/** 
+  * @brief  AMPIRE640480 Timing  
+  */    
+#define  AMPIRE640480_HSYNC            ((uint16_t)30)      /* Horizontal synchronization */
+#define  AMPIRE640480_HBP              ((uint16_t)114)     /* Horizontal back porch      */
+#define  AMPIRE640480_HFP              ((uint16_t)16)      /* Horizontal front porch     */
+#define  AMPIRE640480_VSYNC            ((uint16_t)3)       /* Vertical synchronization   */
+#define  AMPIRE640480_VBP              ((uint16_t)32)      /* Vertical back porch        */
+#define  AMPIRE640480_VFP              ((uint16_t)10)      /* Vertical front porch       */
+
+/** 
+  * @brief  AMPIRE640480 frequency divider  
+  */    
+#define  AMPIRE640480_FREQUENCY_DIVIDER     3              /* LCD Frequency divider      */
+/**
+  * @}
+  */
+  
+/** @defgroup AMPIRE640480_Exported_Functions
+  * @{
+  */    
+
+/**
+  * @}
+  */    
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AMPIRE640480_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 659 - 0
bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/Release_Notes.html

@@ -0,0 +1,659 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for CS43L22 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for CS43L22 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.2 / 02-October-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">cs43l22.c/.h:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Move VOLUME_CONVERT macro from cs43l22.h to cs43l22.c as internally used to convert volume.</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add literals instead of magic number for cs34l22 registers.</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.1 / 16-September-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">cs43l22.c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Enable the digital soft ramp to avoid clac noise.</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Improve mute/unmute by muting/unmuting also the DAC inputs.&nbsp;</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 24-June-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">cs43l22.h/.c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add codec de-initialization function: cs43l22_DeInit()</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add Audio IO </span><span style="font-size: 10pt; font-family: Verdana;">de-initialization function prototype: AUDIO_IO_DeInit()</span></li><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0 or later</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 10-February-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">cs43l22.h/.c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add AUDIO_FREQUENCY_xxx defines for frequencies capabilities (8K to 192K)</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add codec reset function: cs43l22_Reset()<br></span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">cs43l22.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release of CS43L22 audio codec &nbsp;</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 494 - 0
bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/cs43l22.c

@@ -0,0 +1,494 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 228 - 0
bsp/stm32f411RE/Libraries/BSP/Components/cs43l22/cs43l22.h

@@ -0,0 +1,228 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 162 - 0
bsp/stm32f411RE/Libraries/BSP/Components/exc7200/Release_Notes.html

@@ -0,0 +1,162 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP EXC7200 Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for EXC7200 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><br><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1
+/ 21-September-2015 <o:p></o:p></span></h3>
+<b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes</span></u></b><br><ul><li><span style="font-family: Verdana; font-size: 10pt;">exc7200.c:</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Update the I2C slave read address within exc7200_TS_DetectTouch() function.</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Update exc7200_TS_GetXY() function to return correct Touch Screen positions.</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 28-April-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-family: Verdana; font-size: 10pt;"></span> </li></ul><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"><br>
+</td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 242 - 0
bsp/stm32f411RE/Libraries/BSP/Components/exc7200/exc7200.c

@@ -0,0 +1,242 @@
+/**
+  ******************************************************************************
+  * @file    exc7200.c
+  * @author  MCD Application Team
+  * @version V1.0.1
+  * @date    21-September-2015
+  * @brief   This file provides a set of functions needed to manage the EXC7200
+  *          Touch-screen controller.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "exc7200.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */ 
+  
+/** @defgroup EXC7200
+  * @{
+  */   
+  
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup EXC7200_Private_Types_Definitions
+  * @{
+  */ 
+ 
+/* Private define ------------------------------------------------------------*/
+
+/** @defgroup EXC7200_Private_Defines
+  * @{
+  */ 
+  
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup EXC7200_Private_Macros
+  * @{
+  */ 
+  
+/* Private variables ---------------------------------------------------------*/
+
+/** @defgroup EXC7200_Private_Variables
+  * @{
+  */ 
+  
+/* Touch screen driver structure initialization */  
+TS_DrvTypeDef exc7200_ts_drv = 
+{
+  exc7200_Init,
+  exc7200_ReadID,
+  exc7200_Reset,
+  
+  exc7200_TS_Start,
+  exc7200_TS_DetectTouch,
+  exc7200_TS_GetXY,
+  
+  exc7200_TS_EnableIT,
+  exc7200_TS_ClearIT,
+  exc7200_TS_ITStatus,
+  exc7200_TS_DisableIT,
+};
+
+uint8_t aBufferTS[10];
+
+/**
+  * @}
+  */ 
+    
+/* Private function prototypes -----------------------------------------------*/
+
+/** @defgroup exc7200_Private_Function_Prototypes
+  * @{
+  */
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup exc7200_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Initialize the exc7200 and configure the needed hardware resources
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void exc7200_Init(uint16_t DeviceAddr)
+{
+  /* Initialize IO BUS layer */
+  IOE_Init(); 
+  
+}
+ 
+/**
+  * @brief  Reset the exc7200 by Software.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void exc7200_Reset(uint16_t DeviceAddr)
+{
+
+}
+
+/**
+  * @brief  Read the exc7200 IO Expander device ID.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval The Device ID (two bytes).
+  */
+uint16_t exc7200_ReadID(uint16_t DeviceAddr)
+{
+  return 0;
+}
+
+/**
+  * @brief  Configures the touch Screen Controller (Single point detection)
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void exc7200_TS_Start(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @brief  Return if there is touch detected or not.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Touch detected state.
+  */
+uint8_t exc7200_TS_DetectTouch(uint16_t DeviceAddr)
+{
+  /* Read TS data : Send I2C Slave address + 1 Bit0=1 for:read */
+  IOE_ReadMultiple(DeviceAddr | 1, EXC7200_READ_CMD, aBufferTS, 10);  
+
+  /* check for first byte */
+  if (aBufferTS[1]==0x83)
+  {	
+    return 1;
+  }
+  
+  return 0;
+}
+
+/**
+  * @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 exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
+{
+  /* Calculate positions */
+  *X = (((aBufferTS[3]&0x00ff) << 4) | ((aBufferTS[2]&0x00f0) >> 4)) << 1;
+  *Y = (((aBufferTS[5]&0x00ff) << 4) | ((aBufferTS[4]&0x00f0) >> 4)) << 1;
+  
+  /* Dummy Read to deactivate read mode */
+  IOE_ReadMultiple(DeviceAddr, EXC7200_READ_CMD, aBufferTS, 10);    
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void exc7200_TS_EnableIT(uint16_t DeviceAddr)
+{  
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @retval None
+  */
+void exc7200_TS_DisableIT(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @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 exc7200_TS_ITStatus(uint16_t DeviceAddr)
+{
+  return 0;
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void exc7200_TS_ClearIT(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */      
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 137 - 0
bsp/stm32f411RE/Libraries/BSP/Components/exc7200/exc7200.h

@@ -0,0 +1,137 @@
+/**
+  ******************************************************************************
+  * @file    exc7200.h
+  * @author  MCD Application Team
+  * @version V1.0.1
+  * @date    21-September-2015
+  * @brief   This file contains all the functions prototypes for the
+  *          exc7200.c IO expander driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __EXC7200_H
+#define __EXC7200_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif   
+   
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/ts.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Component
+  * @{
+  */
+    
+/** @defgroup EXC7200
+  * @{
+  */    
+
+/* Exported types ------------------------------------------------------------*/
+
+/** @defgroup EXC7200_Exported_Types
+  * @{
+  */ 
+
+/* Exported constants --------------------------------------------------------*/
+  
+/** @defgroup EXC7200_Exported_Constants
+  * @{
+  */ 
+
+/*  */   
+#define EXC7200_READ_CMD                             0x09  
+
+/**
+  * @}
+  */ 
+  
+/* Exported macro ------------------------------------------------------------*/
+   
+/** @defgroup exc7200_Exported_Macros
+  * @{
+  */ 
+
+/* Exported functions --------------------------------------------------------*/
+  
+/** @defgroup exc7200_Exported_Functions
+  * @{
+  */
+
+/** 
+  * @brief exc7200 Control functions
+  */
+void     exc7200_Init(uint16_t DeviceAddr);
+void     exc7200_Reset(uint16_t DeviceAddr);
+uint16_t exc7200_ReadID(uint16_t DeviceAddr);
+void     exc7200_TS_Start(uint16_t DeviceAddr);
+uint8_t  exc7200_TS_DetectTouch(uint16_t DeviceAddr);
+void     exc7200_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
+void     exc7200_TS_EnableIT(uint16_t DeviceAddr);
+void     exc7200_TS_DisableIT(uint16_t DeviceAddr);
+uint8_t  exc7200_TS_ITStatus (uint16_t DeviceAddr);
+void     exc7200_TS_ClearIT (uint16_t DeviceAddr);
+
+void     IOE_Init(void);
+void     IOE_Delay(uint32_t delay);
+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);
+void     IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
+
+/* Touch screen driver structure */
+extern TS_DrvTypeDef exc7200_ts_drv;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __EXC7200_H */
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */       
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 156 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/Release_Notes.html

@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for FT6X06 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/&nbsp;03-August-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"></td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 516 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/ft6x06.c

@@ -0,0 +1,516 @@
+/**
+  ******************************************************************************
+  * @file    ft6x06.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    03-August-2015
+  * @brief   This file provides a set of functions needed to manage the FT6X06
+  *          IO Expander devices.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "ft6x06.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */
+
+/** @defgroup FT6X06
+  * @{
+  */
+
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup FT6X06_Private_Defines FT6X06 Private Defines
+  * @{
+  */
+#define FT6x06_MAX_INSTANCE  2
+/**
+  * @}
+  */
+
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup FT6X06_Private_Variables FT6X06 Private Variables
+  * @{
+  */
+
+/* Touch screen driver structure initialization */
+TS_DrvTypeDef ft6x06_ts_drv =
+{
+  ft6x06_Init,
+  ft6x06_ReadID,
+  ft6x06_Reset,
+
+  ft6x06_TS_Start,
+  ft6x06_TS_DetectTouch,
+  ft6x06_TS_GetXY,
+
+  ft6x06_TS_EnableIT,
+  ft6x06_TS_ClearIT,
+  ft6x06_TS_ITStatus,
+  ft6x06_TS_DisableIT
+
+};
+
+/* ft6x06 instances by address */
+uint8_t ft6x06[FT6x06_MAX_INSTANCE] = {0};
+
+/* Global ft6x06 handle */
+static ft6x06_handle_TypeDef ft6x06_handle = { FT6206_I2C_NOT_INITIALIZED, 0, 0};
+
+/**
+  * @}
+  */
+
+/** @defgroup ft6x06_Private_Function_Prototypes ft6x06 Private Function Prototypes
+  * @{
+  */
+static uint8_t ft6x06_GetInstance(uint16_t DeviceAddr);
+/* Private functions prototypes-----------------------------------------------*/
+#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
+/**
+  * @brief  Start TouchScreen calibration phase
+  * @param  DeviceAddr: FT6206 Device address for communication on I2C Bus.
+  * @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
+  */
+static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr);
+#endif /* TS_AUTO_CALIBRATION_SUPPORTED == 1 */
+
+/**
+  * @brief  Basic static configuration of TouchScreen
+  * @param  DeviceAddr: FT6206 Device address for communication on I2C Bus.
+  * @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
+  */
+static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr);
+
+/**
+  * @}
+  */
+
+/** @defgroup ft6x06_Private_Functions ft6x06 Private Functions
+  * @{
+  */
+
+/**
+  * @brief  Initialize the ft6x06 communication bus
+  *         from MCU to FT6206 : ie I2C channel initialization (if required).
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+  * @retval None
+  */
+void ft6x06_Init(uint16_t DeviceAddr)
+{  
+  uint8_t instance;
+  uint8_t empty;
+  
+  /* Check if device instance already exists */
+  instance = ft6x06_GetInstance(DeviceAddr);
+  
+  /* To prevent double initialization */
+  if(instance == 0xFF)
+  {
+    /* Look for empty instance */
+    empty = ft6x06_GetInstance(0);
+    
+    if(empty < FT6x06_MAX_INSTANCE)
+    {
+      /* Register the current device instance */
+      ft6x06[empty] = DeviceAddr;
+      
+      /* Initialize IO BUS layer */
+      TS_IO_Init(); 
+    }
+  }        
+}
+
+/**
+  * @brief  Software Reset the ft6x06.
+  *         @note : Not applicable to FT6206.
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+  * @retval None
+  */
+void ft6x06_Reset(uint16_t DeviceAddr)
+{
+  /* Do nothing */
+  /* No software reset sequence available in FT6206 IC */
+}
+
+/**
+  * @brief  Read the ft6x06 device ID, pre initialize I2C in case of need to be
+  *         able to read the FT6206 device ID, and verify this is a FT6206.
+  * @param  DeviceAddr: I2C FT6x06 Slave address.
+  * @retval The Device ID (two bytes).
+  */
+uint16_t ft6x06_ReadID(uint16_t DeviceAddr)
+{
+  /* Initialize I2C link if needed */
+  TS_IO_Init();
+  
+  /* Return the device ID value */
+  return (TS_IO_Read(DeviceAddr, FT6206_CHIP_ID_REG));
+}
+
+/**
+  * @brief  Configures the touch Screen IC device to start detecting touches
+  *         It goes through an internal calibration process (Hw calibration sequence of
+  *         the touch screen).
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address).
+  * @retval None.
+  */
+void ft6x06_TS_Start(uint16_t DeviceAddr)
+{
+#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
+  /* Hw Calibration sequence start : should be done once after each power up */
+  /* This is called internal calibration of the touch screen                 */
+  ft6x06_TS_Calibration(DeviceAddr);
+#endif
+  /* Minimum static configuration of FT6206 */
+  ft6x06_TS_Configure(DeviceAddr);
+
+  /* By default set FT6206 IC in Polling mode : no INT generation on FT6206 for new touch available */
+  /* Note TS_INT is active low                                                                      */
+  ft6x06_TS_DisableIT(DeviceAddr);
+}
+
+/**
+  * @brief  Return if there is touches detected or not.
+  *         Try to detect new touches and forget the old ones (reset internal global
+  *         variables).
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval : Number of active touches detected (can be 0, 1 or 2).
+  */
+uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr)
+{
+  volatile uint8_t nbTouch = 0;
+
+  /* Read register FT6206_TD_STAT_REG to check number of touches detection */
+  nbTouch = TS_IO_Read(DeviceAddr, FT6206_TD_STAT_REG);
+  nbTouch &= FT6206_TD_STAT_MASK;
+
+  if(nbTouch > FT6206_MAX_DETECTABLE_TOUCH)
+  {
+    /* If invalid number of touch detected, set it to zero */
+    nbTouch = 0;
+  }
+
+  /* Update ft6x06 driver internal global : current number of active touches */
+  ft6x06_handle.currActiveTouchNb = nbTouch;
+
+  /* Reset current active touch index on which to work on */
+  ft6x06_handle.currActiveTouchIdx = 0;
+
+  return(nbTouch);
+}
+
+/**
+  * @brief  Get the touch screen X and Y positions values
+  *         Manage multi touch thanks to touch Index global
+  *         variable 'ft6x06_handle.currActiveTouchIdx'.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  X: Pointer to X position value
+  * @param  Y: Pointer to Y position value
+  * @retval None.
+  */
+void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
+{
+  uint8_t regAddress = 0;
+  uint8_t  dataxy[4];
+  
+  if(ft6x06_handle.currActiveTouchIdx < ft6x06_handle.currActiveTouchNb)
+  {
+    switch(ft6x06_handle.currActiveTouchIdx)
+    {
+    case 0 :    
+      regAddress = FT6206_P1_XH_REG; 
+      break;
+    case 1 :
+      regAddress = FT6206_P2_XH_REG; 
+      break;
+
+    default :
+      break;
+    }
+    
+    /* Read X and Y positions */
+    TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy)); 
+
+    /* Send back ready X position to caller */
+    *X = ((dataxy[0] & FT6206_MSB_MASK) << 8) | (dataxy[1] & FT6206_LSB_MASK);
+    
+    /* Send back ready Y position to caller */
+    *Y = ((dataxy[2] & FT6206_MSB_MASK) << 8) | (dataxy[3] & FT6206_LSB_MASK);
+    
+    ft6x06_handle.currActiveTouchIdx++;
+  }
+}
+
+/**
+  * @brief  Configure the FT6206 device to generate IT on given INT pin
+  *         connected to MCU as EXTI.
+  * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
+  * @retval None
+  */
+void ft6x06_TS_EnableIT(uint16_t DeviceAddr)
+{
+  uint8_t regValue = 0;
+  regValue = (FT6206_G_MODE_INTERRUPT_TRIGGER & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT;
+  
+  /* Set interrupt trigger mode in FT6206_GMODE_REG */
+  TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue);
+}
+
+/**
+  * @brief  Configure the FT6206 device to stop generating IT on the given INT pin
+  *         connected to MCU as EXTI.
+  * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
+  * @retval None
+  */
+void ft6x06_TS_DisableIT(uint16_t DeviceAddr)
+{
+  uint8_t regValue = 0;
+  regValue = (FT6206_G_MODE_INTERRUPT_POLLING & (FT6206_G_MODE_INTERRUPT_MASK >> FT6206_G_MODE_INTERRUPT_SHIFT)) << FT6206_G_MODE_INTERRUPT_SHIFT;
+
+  /* Set interrupt polling mode in FT6206_GMODE_REG */
+  TS_IO_Write(DeviceAddr, FT6206_GMODE_REG, regValue);
+}
+
+/**
+  * @brief  Get IT status from FT6206 interrupt status registers
+  *         Should be called Following an EXTI coming to the MCU to know the detailed
+  *         reason of the interrupt.
+  *         @note : This feature is not applicable to FT6206.
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+  * @retval TS interrupts status : always return 0 here
+  */
+uint8_t ft6x06_TS_ITStatus(uint16_t DeviceAddr)
+{
+  /* Always return 0 as feature not applicable to FT6206 */
+  return 0;
+}
+
+/**
+  * @brief  Clear IT status in FT6206 interrupt status clear registers
+  *         Should be called Following an EXTI coming to the MCU.
+  *         @note : This feature is not applicable to FT6206.
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+  * @retval None
+  */
+void ft6x06_TS_ClearIT(uint16_t DeviceAddr)
+{
+  /* Nothing to be done here for FT6206 */
+}
+
+/**** NEW FEATURES enabled when Multi-touch support is enabled ****/
+
+#if (TS_MULTI_TOUCH_SUPPORTED == 1)
+
+/**
+  * @brief  Get the last touch gesture identification (zoom, move up/down...).
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
+  * @param  pGestureId : Pointer to get last touch gesture Identification.
+  * @retval None.
+  */
+void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId)
+{
+  volatile uint8_t ucReadData = 0;
+
+  ucReadData = TS_IO_Read(DeviceAddr, FT6206_GEST_ID_REG);
+
+  * pGestureId = ucReadData;
+}
+
+/**
+  * @brief  Get the touch detailed informations on touch number 'touchIdx' (0..1)
+  *         This touch detailed information contains :
+  *         - weight that was applied to this touch
+  *         - sub-area of the touch in the touch panel
+  *         - event of linked to the touch (press down, lift up, ...)
+  * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
+  * @param  touchIdx : Passed index of the touch (0..1) on which we want to get the
+  *                    detailed information.
+  * @param  pWeight : Pointer to to get the weight information of 'touchIdx'.
+  * @param  pArea   : Pointer to to get the sub-area information of 'touchIdx'.
+  * @param  pEvent  : Pointer to to get the event information of 'touchIdx'.
+
+  * @retval None.
+  */
+void ft6x06_TS_GetTouchInfo(uint16_t   DeviceAddr,
+                            uint32_t   touchIdx,
+                            uint32_t * pWeight,
+                            uint32_t * pArea,
+                            uint32_t * pEvent)
+{
+  uint8_t regAddress = 0;
+  uint8_t dataxy[3];
+  
+  if(touchIdx < ft6x06_handle.currActiveTouchNb)
+  {
+    switch(touchIdx)
+    {
+    case 0 : 
+      regAddress = FT6206_P1_WEIGHT_REG;
+      break;
+      
+    case 1 :
+      regAddress = FT6206_P2_WEIGHT_REG;
+      break;
+      
+    default :
+      break;
+      
+    } /* end switch(touchIdx) */
+    
+    /* Read weight, area and Event Id of touch index */
+    TS_IO_ReadMultiple(DeviceAddr, regAddress, dataxy, sizeof(dataxy)); 
+    
+    /* Return weight of touch index */
+    * pWeight = (dataxy[0] & FT6206_TOUCH_WEIGHT_MASK) >> FT6206_TOUCH_WEIGHT_SHIFT;
+    /* Return area of touch index */
+    * pArea = (dataxy[1] & FT6206_TOUCH_AREA_MASK) >> FT6206_TOUCH_AREA_SHIFT;
+    /* Return Event Id  of touch index */
+    * pEvent = (dataxy[2] & FT6206_TOUCH_EVT_FLAG_MASK) >> FT6206_TOUCH_EVT_FLAG_SHIFT;
+    
+  } /* of if(touchIdx < ft6x06_handle.currActiveTouchNb) */
+}
+
+#endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
+
+#if (TS_AUTO_CALIBRATION_SUPPORTED == 1)
+/**
+  * @brief  Start TouchScreen calibration phase
+  * @param  DeviceAddr: FT6206 Device address for communication on I2C Bus.
+  * @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
+  */
+static uint32_t ft6x06_TS_Calibration(uint16_t DeviceAddr)
+{
+  uint32_t nbAttempt = 0;
+  volatile uint8_t ucReadData;
+  volatile uint8_t regValue;
+  uint32_t status = FT6206_STATUS_OK;
+  uint8_t bEndCalibration = 0;
+
+  /* >> Calibration sequence start */
+
+  /* Switch FT6206 back to factory mode to calibrate */
+  regValue = (FT6206_DEV_MODE_FACTORY & FT6206_DEV_MODE_MASK) << FT6206_DEV_MODE_SHIFT;
+  TS_IO_Write(DeviceAddr, FT6206_DEV_MODE_REG, regValue); /* 0x40 */
+
+  /* Read back the same register FT6206_DEV_MODE_REG */
+  ucReadData = TS_IO_Read(DeviceAddr, FT6206_DEV_MODE_REG);
+  TS_IO_Delay(300); /* Wait 300 ms */
+
+  if(((ucReadData & (FT6206_DEV_MODE_MASK << FT6206_DEV_MODE_SHIFT)) >> FT6206_DEV_MODE_SHIFT) != FT6206_DEV_MODE_FACTORY )
+  {
+    /* Return error to caller */
+    return(FT6206_STATUS_NOT_OK);
+  }
+
+  /* Start calibration command */
+  TS_IO_Write(DeviceAddr, FT6206_TD_STAT_REG, 0x04);
+  TS_IO_Delay(300); /* Wait 300 ms */
+
+  /* 100 attempts to wait switch from factory mode (calibration) to working mode */
+  for (nbAttempt=0; ((nbAttempt < 100) && (!bEndCalibration)) ; nbAttempt++)
+  {
+    ucReadData = TS_IO_Read(DeviceAddr, FT6206_DEV_MODE_REG);
+    ucReadData = (ucReadData & (FT6206_DEV_MODE_MASK << FT6206_DEV_MODE_SHIFT)) >> FT6206_DEV_MODE_SHIFT;
+    if(ucReadData == FT6206_DEV_MODE_WORKING)
+    {
+      /* Auto Switch to FT6206_DEV_MODE_WORKING : means calibration have ended */
+      bEndCalibration = 1; /* exit for loop */
+    }
+    
+    TS_IO_Delay(200); /* Wait 200 ms */
+  }
+
+  /* Calibration sequence end << */
+
+  return(status);
+}
+#endif /* TS_AUTO_CALIBRATION_SUPPORTED == 1 */
+
+/**
+  * @brief  Basic static configuration of TouchScreen
+  * @param  DeviceAddr: FT6206 Device address for communication on I2C Bus.
+  * @retval Status FT6206_STATUS_OK or FT6206_STATUS_NOT_OK.
+  */
+static uint32_t ft6x06_TS_Configure(uint16_t DeviceAddr)
+{
+  uint32_t status = FT6206_STATUS_OK;
+
+  /* Nothing special to be done for FT6206 */
+
+  return(status);
+}
+
+/**
+  * @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 ft6x06_GetInstance(uint16_t DeviceAddr)
+{
+  uint8_t idx = 0;
+  
+  /* Check all the registered instances */
+  for(idx = 0; idx < FT6x06_MAX_INSTANCE ; idx ++)
+  {
+    if(ft6x06[idx] == DeviceAddr)
+    {
+      return idx; 
+    }
+  }
+  
+  return 0xFF;
+}
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 467 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ft6x06/ft6x06.h

@@ -0,0 +1,467 @@
+/**
+ ******************************************************************************
+ * @file    ft6x06.h
+ * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    03-August-2015
+ * @brief   This file contains all the functions prototypes for the
+ *          ft6x06.c IO expander driver.
+ ******************************************************************************
+ * @attention
+ *
+ * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+ *
+ * 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 __FT6X06_H
+#define __FT6X06_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Set Multi-touch as non supported */
+#ifndef TS_MULTI_TOUCH_SUPPORTED
+  #define TS_MULTI_TOUCH_SUPPORTED 0
+#endif
+
+/* Set Auto-calibration as non supported */  
+#ifndef TS_AUTO_CALIBRATION_SUPPORTED
+  #define TS_AUTO_CALIBRATION_SUPPORTED 0
+#endif
+  
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/ts.h"
+
+/* Macros --------------------------------------------------------------------*/
+
+/** @typedef ft6x06_handle_TypeDef
+ *  ft6x06 Handle definition.
+ */
+typedef struct
+{
+  uint8_t i2cInitialized;
+
+  /* field holding the current number of simultaneous active touches */
+  uint8_t currActiveTouchNb;
+
+  /* field holding the touch index currently managed */
+  uint8_t currActiveTouchIdx;
+
+} ft6x06_handle_TypeDef;
+
+  /** @addtogroup BSP
+   * @{
+   */
+
+  /** @addtogroup Component
+   * @{
+   */
+
+  /** @defgroup FT6X06
+   * @{
+   */
+
+  /* Exported types ------------------------------------------------------------*/
+
+  /** @defgroup FT6X06_Exported_Types
+   * @{
+   */
+
+  /* Exported constants --------------------------------------------------------*/
+
+  /** @defgroup FT6X06_Exported_Constants
+   * @{
+   */
+
+  /* Maximum border values of the touchscreen pad */
+#define  FT_6206_MAX_WIDTH              ((uint16_t)800)     /* Touchscreen pad max width   */
+#define  FT_6206_MAX_HEIGHT             ((uint16_t)480)     /* Touchscreen pad max height  */
+
+  /* Possible values of driver functions return status */
+#define FT6206_STATUS_OK                0
+#define FT6206_STATUS_NOT_OK            1
+
+  /* Possible values of global variable 'TS_I2C_Initialized' */
+#define FT6206_I2C_NOT_INITIALIZED      0
+#define FT6206_I2C_INITIALIZED          1
+
+  /* Max detectable simultaneous touches */
+#define FT6206_MAX_DETECTABLE_TOUCH     2
+
+  /**
+   * @brief : Definitions for FT6206 I2C register addresses on 8 bit
+   **/
+
+  /* Current mode register of the FT6206 (R/W) */
+#define FT6206_DEV_MODE_REG             0x00
+
+  /* Possible values of FT6206_DEV_MODE_REG */
+#define FT6206_DEV_MODE_WORKING         0x00
+#define FT6206_DEV_MODE_FACTORY         0x04
+
+#define FT6206_DEV_MODE_MASK            0x7
+#define FT6206_DEV_MODE_SHIFT           4
+
+  /* Gesture ID register */
+#define FT6206_GEST_ID_REG              0x01
+
+  /* Possible values of FT6206_GEST_ID_REG */
+#define FT6206_GEST_ID_NO_GESTURE       0x00
+#define FT6206_GEST_ID_MOVE_UP          0x10
+#define FT6206_GEST_ID_MOVE_RIGHT       0x14
+#define FT6206_GEST_ID_MOVE_DOWN        0x18
+#define FT6206_GEST_ID_MOVE_LEFT        0x1C
+#define FT6206_GEST_ID_ZOOM_IN          0x48
+#define FT6206_GEST_ID_ZOOM_OUT         0x49
+
+  /* Touch Data Status register : gives number of active touch points (0..2) */
+#define FT6206_TD_STAT_REG              0x02
+
+  /* Values related to FT6206_TD_STAT_REG */
+#define FT6206_TD_STAT_MASK             0x0F
+#define FT6206_TD_STAT_SHIFT            0x00
+
+  /* Values Pn_XH and Pn_YH related */
+#define FT6206_TOUCH_EVT_FLAG_PRESS_DOWN 0x00
+#define FT6206_TOUCH_EVT_FLAG_LIFT_UP    0x01
+#define FT6206_TOUCH_EVT_FLAG_CONTACT    0x02
+#define FT6206_TOUCH_EVT_FLAG_NO_EVENT   0x03
+
+#define FT6206_TOUCH_EVT_FLAG_SHIFT     6
+#define FT6206_TOUCH_EVT_FLAG_MASK      (3 << FT6206_TOUCH_EVT_FLAG_SHIFT)
+
+#define FT6206_MSB_MASK                 0x0F
+#define FT6206_MSB_SHIFT                0
+
+  /* Values Pn_XL and Pn_YL related */
+#define FT6206_LSB_MASK                 0xFF
+#define FT6206_LSB_SHIFT                0
+
+#define FT6206_P1_XH_REG                0x03
+#define FT6206_P1_XL_REG                0x04
+#define FT6206_P1_YH_REG                0x05
+#define FT6206_P1_YL_REG                0x06
+
+  /* Touch Pressure register value (R) */
+#define FT6206_P1_WEIGHT_REG            0x07
+
+  /* Values Pn_WEIGHT related  */
+#define FT6206_TOUCH_WEIGHT_MASK        0xFF
+#define FT6206_TOUCH_WEIGHT_SHIFT       0
+
+  /* Touch area register */
+#define FT6206_P1_MISC_REG              0x08
+
+  /* Values related to FT6206_Pn_MISC_REG */
+#define FT6206_TOUCH_AREA_MASK         (0x04 << 4)
+#define FT6206_TOUCH_AREA_SHIFT        0x04
+
+#define FT6206_P2_XH_REG               0x09
+#define FT6206_P2_XL_REG               0x0A
+#define FT6206_P2_YH_REG               0x0B
+#define FT6206_P2_YL_REG               0x0C
+#define FT6206_P2_WEIGHT_REG           0x0D
+#define FT6206_P2_MISC_REG             0x0E
+
+  /* Threshold for touch detection */
+#define FT6206_TH_GROUP_REG            0x80
+
+  /* Values FT6206_TH_GROUP_REG : threshold related  */
+#define FT6206_THRESHOLD_MASK          0xFF
+#define FT6206_THRESHOLD_SHIFT         0
+
+  /* Filter function coefficients */
+#define FT6206_TH_DIFF_REG             0x85
+
+  /* Control register */
+#define FT6206_CTRL_REG                0x86
+
+  /* Values related to FT6206_CTRL_REG */
+
+  /* Will keep the Active mode when there is no touching */
+#define FT6206_CTRL_KEEP_ACTIVE_MODE    0x00
+
+  /* Switching from Active mode to Monitor mode automatically when there is no touching */
+#define FT6206_CTRL_KEEP_AUTO_SWITCH_MONITOR_MODE  0x01
+
+  /* The time period of switching from Active mode to Monitor mode when there is no touching */
+#define FT6206_TIMEENTERMONITOR_REG     0x87
+
+  /* Report rate in Active mode */
+#define FT6206_PERIODACTIVE_REG         0x88
+
+  /* Report rate in Monitor mode */
+#define FT6206_PERIODMONITOR_REG        0x89
+
+  /* The value of the minimum allowed angle while Rotating gesture mode */
+#define FT6206_RADIAN_VALUE_REG         0x91
+
+  /* Maximum offset while Moving Left and Moving Right gesture */
+#define FT6206_OFFSET_LEFT_RIGHT_REG    0x92
+
+  /* Maximum offset while Moving Up and Moving Down gesture */
+#define FT6206_OFFSET_UP_DOWN_REG       0x93
+
+  /* Minimum distance while Moving Left and Moving Right gesture */
+#define FT6206_DISTANCE_LEFT_RIGHT_REG  0x94
+
+  /* Minimum distance while Moving Up and Moving Down gesture */
+#define FT6206_DISTANCE_UP_DOWN_REG     0x95
+
+  /* Maximum distance while Zoom In and Zoom Out gesture */
+#define FT6206_DISTANCE_ZOOM_REG        0x96
+
+  /* High 8-bit of LIB Version info */
+#define FT6206_LIB_VER_H_REG            0xA1
+
+  /* Low 8-bit of LIB Version info */
+#define FT6206_LIB_VER_L_REG            0xA2
+
+  /* Chip Selecting */
+#define FT6206_CIPHER_REG               0xA3
+
+  /* Interrupt mode register (used when in interrupt mode) */
+#define FT6206_GMODE_REG                0xA4
+
+#define FT6206_G_MODE_INTERRUPT_MASK    0x03
+#define FT6206_G_MODE_INTERRUPT_SHIFT   0x00
+
+  /* Possible values of FT6206_GMODE_REG */
+#define FT6206_G_MODE_INTERRUPT_POLLING 0x00
+#define FT6206_G_MODE_INTERRUPT_TRIGGER 0x01
+
+  /* Current power mode the FT6206 system is in (R) */
+#define FT6206_PWR_MODE_REG             0xA5
+
+  /* FT6206 firmware version */
+#define FT6206_FIRMID_REG               0xA6
+
+  /* FT6206 Chip identification register */
+#define FT6206_CHIP_ID_REG              0xA8
+
+  /*  Possible values of FT6206_CHIP_ID_REG */
+#define FT6206_ID_VALUE                 0x11
+
+  /* Release code version */
+#define FT6206_RELEASE_CODE_ID_REG      0xAF
+
+  /* Current operating mode the FT6206 system is in (R) */
+#define FT6206_STATE_REG                0xBC
+
+  /**
+   * @}
+   */
+
+  /* Exported macro ------------------------------------------------------------*/
+
+  /** @defgroup ft6x06_Exported_Macros
+   * @{
+   */
+
+  /* Exported functions --------------------------------------------------------*/
+
+  /** @defgroup ft6x06_Exported_Functions
+   * @{
+   */
+
+  /**
+   * @brief ft6x06 Control functions
+   */
+
+
+/**
+ * @brief  Initialize the ft6x06 communication bus
+ *         from MCU to FT6206 : ie I2C channel initialization (if required).
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+ * @retval None
+ */
+void ft6x06_Init(uint16_t DeviceAddr);
+
+/**
+ * @brief  Software Reset the ft6x06.
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+ * @retval None
+ */
+void ft6x06_Reset(uint16_t DeviceAddr);
+
+/**
+ * @brief  Read the ft6x06 device ID, pre intitalize I2C in case of need to be
+ *         able to read the FT6206 device ID, and verify this is a FT6206.
+ * @param  DeviceAddr: I2C FT6x06 Slave address.
+ * @retval The Device ID (two bytes).
+ */
+uint16_t ft6x06_ReadID(uint16_t DeviceAddr);
+
+/**
+ * @brief  Configures the touch Screen IC device to start detecting touches
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address).
+ * @retval None.
+ */
+void ft6x06_TS_Start(uint16_t DeviceAddr);
+
+/**
+ * @brief  Return if there is touches detected or not.
+ *         Try to detect new touches and forget the old ones (reset internal global
+ *         variables).
+ * @param  DeviceAddr: Device address on communication Bus.
+ * @retval : Number of active touches detected (can be 0, 1 or 2).
+ */
+uint8_t ft6x06_TS_DetectTouch(uint16_t DeviceAddr);
+
+/**
+ * @brief  Get the touch screen X and Y positions values
+ *         Manage multi touch thanks to touch Index global
+ *         variable 'ft6x06_handle.currActiveTouchIdx'.
+ * @param  DeviceAddr: Device address on communication Bus.
+ * @param  X: Pointer to X position value
+ * @param  Y: Pointer to Y position value
+ * @retval None.
+ */
+void ft6x06_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
+
+/**
+ * @brief  Configure the FT6206 device to generate IT on given INT pin
+ *         connected to MCU as EXTI.
+ * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
+ * @retval None
+ */
+void ft6x06_TS_EnableIT(uint16_t DeviceAddr);
+
+/**
+ * @brief  Configure the FT6206 device to stop generating IT on the given INT pin
+ *         connected to MCU as EXTI.
+ * @param  DeviceAddr: Device address on communication Bus (Slave I2C address of FT6206).
+ * @retval None
+ */
+void ft6x06_TS_DisableIT(uint16_t DeviceAddr);
+
+/**
+ * @brief  Get IT status from FT6206 interrupt status registers
+ *         Should be called Following an EXTI coming to the MCU to know the detailed
+ *         reason of the interrupt.
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+ * @retval TS interrupts status
+ */
+uint8_t ft6x06_TS_ITStatus (uint16_t DeviceAddr);
+
+/**
+ * @brief  Clear IT status in FT6206 interrupt status clear registers
+ *         Should be called Following an EXTI coming to the MCU.
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6206).
+ * @retval TS interrupts status
+ */
+void ft6x06_TS_ClearIT (uint16_t DeviceAddr);
+
+/**** NEW FEATURES enabled when Multi-touch support is enabled ****/
+
+#if (TS_MULTI_TOUCH_SUPPORTED == 1)
+
+/**
+ * @brief  Get the last touch gesture identification (zoom, move up/down...).
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
+ * @param  pGestureId : Pointer to get last touch gesture Identification.
+ * @retval None.
+ */
+void ft6x06_TS_GetGestureID(uint16_t DeviceAddr, uint32_t * pGestureId);
+
+/**
+ * @brief  Get the touch detailed informations on touch number 'touchIdx' (0..1)
+ *         This touch detailed information contains :
+ *         - weight that was applied to this touch
+ *         - sub-area of the touch in the touch panel
+ *         - event of linked to the touch (press down, lift up, ...)
+ * @param  DeviceAddr: Device address on communication Bus (I2C slave address of FT6x06).
+ * @param  touchIdx : Passed index of the touch (0..1) on which we want to get the
+ *                    detailed information.
+ * @param  pWeight : Pointer to to get the weight information of 'touchIdx'.
+ * @param  pArea   : Pointer to to get the sub-area information of 'touchIdx'.
+ * @param  pEvent  : Pointer to to get the event information of 'touchIdx'.
+
+ * @retval None.
+ */
+void ft6x06_TS_GetTouchInfo(uint16_t   DeviceAddr,
+                            uint32_t   touchIdx,
+                            uint32_t * pWeight,
+                            uint32_t * pArea,
+                            uint32_t * pEvent);
+
+#endif /* TS_MULTI_TOUCH_SUPPORTED == 1 */
+
+/* Imported TS IO functions --------------------------------------------------------*/
+
+/** @defgroup ft6x06_Imported_Functions
+ * @{
+ */
+
+/* TouchScreen (TS) external IO functions */
+extern void     TS_IO_Init(void);
+extern void     TS_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
+extern uint8_t  TS_IO_Read(uint8_t Addr, uint8_t Reg);
+extern uint16_t TS_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
+extern void     TS_IO_Delay(uint32_t Delay);
+
+  /**
+   * @}
+   */
+
+  /* Imported global variables --------------------------------------------------------*/
+
+  /** @defgroup ft6x06_Imported_Globals
+   * @{
+   */
+
+
+/* Touch screen driver structure */
+extern TS_DrvTypeDef ft6x06_ts_drv;
+
+  /**
+   * @}
+   */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __FT6X06_H */
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 447 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9325/Release_Notes.html

@@ -0,0 +1,447 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for ILI9325 BSP Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for ILI9325 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">ili9325.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 19-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">Align driver with the STM32Cube BSP architecture by removing check for initialization in ili9325_Init()&nbsp; <br>
+                </span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Initializes
+only the LCD IO in read ID APIs instead of all initialization sequence
+and remove the check for initialization in ili9325_ReadID() function</span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Comments clean up and typo corrections</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 531 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9325/ili9325.c

@@ -0,0 +1,531 @@
+/**
+  ******************************************************************************
+  * @file    ili9325.c
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file includes the LCD driver for ILI9325 LCD.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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,  
+};
+
+/**
+  * @}
+  */ 
+  
+/** @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  RGB_Code: the RGB pixel color
+  * @retval None
+  */
+void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code)
+{
+  /* Set Cursor */
+  ili9325_SetCursor(Xpos, Ypos);
+  
+  /* Prepare to write GRAM */
+  LCD_IO_WriteReg(LCD_REG_34);
+
+  /* Write 16-bit GRAM Reg */
+  LCD_IO_WriteData(RGB_Code);
+}
+
+/**
+  * @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);
+  
+  /* Prepare to write GRAM */
+  LCD_IO_WriteReg(LCD_REG_34);
+  
+  /* Dummy read */
+  LCD_IO_ReadData();
+  
+  /* Read 16-bit Reg */
+  return (LCD_IO_ReadData());
+}
+
+/**
+  * @brief  Writes to the selected LCD register.
+  * @param  LCD_Reg: Address of the selected register.
+  * @param  LCD_RegValue: Value to write to the selected register.
+  * @retval None
+  */
+void ili9325_WriteReg(uint8_t LCD_Reg, uint16_t LCD_RegValue)
+{
+  LCD_IO_WriteReg(LCD_Reg);
+  
+  /* Write 16-bit GRAM Reg */
+  LCD_IO_WriteData(LCD_RegValue);
+}
+
+/**
+  * @brief  Reads the selected LCD Register.
+  * @param  LCD_Reg: address of the selected register.
+  * @retval LCD Register Value.
+  */
+uint16_t ili9325_ReadReg(uint8_t LCD_Reg)
+{
+  /* Write 16-bit Index (then Read Reg) */
+  LCD_IO_WriteReg(LCD_Reg);
+  
+  /* Read 16-bit Reg */
+  return (LCD_IO_ReadData());
+}
+
+/**
+  * @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  RGB_Code: 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 RGB_Code, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint16_t i = 0;
+  
+  /* Set Cursor */
+  ili9325_SetCursor(Xpos, Ypos); 
+  
+  /* Prepare to write GRAM */
+  LCD_IO_WriteReg(LCD_REG_34);
+
+  for(i = 0; i < Length; i++)
+  {
+    /* Write 16-bit GRAM Reg */
+    LCD_IO_WriteData(RGB_Code);
+  }  
+}
+
+/**
+  * @brief  Draw vertical line.
+  * @param  RGB_Code: 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 RGB_Code, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint16_t i = 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);
+
+  for(i = 0; i < Length; i++)
+  {
+    /* Write 16-bit GRAM Reg */
+    LCD_IO_WriteData(RGB_Code);
+  }
+  
+  /* 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);
+ 
+  for(index = 0; index < size; index++)
+  {
+    /* Write 16-bit GRAM Reg */
+    LCD_IO_WriteData(*(volatile uint16_t *)pbmp);
+    pbmp += 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 index = 0, size = 0;
+
+  size = (Xsize * Ysize);
+
+  /* Set Cursor */
+  ili9325_SetCursor(Xpos, Ypos);  
+  
+  /* Prepare to write GRAM */
+  LCD_IO_WriteReg(LCD_REG_34);
+ 
+  for(index = 0; index < size; index++)
+  {
+    /* Write 16-bit GRAM Reg */
+    LCD_IO_WriteData(*(volatile uint16_t *)pdata);
+    pdata += 2;
+  }
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 256 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9325/ili9325.h

@@ -0,0 +1,256 @@
+/**
+  ******************************************************************************
+  * @file    ili9325.h
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file contains all the functions prototypes for the ili9325.c
+  *          driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 LCD_Reg, uint16_t LCD_RegValue);
+uint16_t ili9325_ReadReg(uint8_t LCD_Reg);
+
+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 RGB_Code);
+uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos);
+
+void     ili9325_DrawHLine(uint16_t RGB_Code, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
+void     ili9325_DrawVLine(uint16_t RGB_Code, 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_WriteData(uint16_t RegValue);
+void     LCD_IO_WriteReg(uint8_t Reg);
+uint16_t LCD_IO_ReadData(void);
+
+/**
+  * @}
+  */ 
+      
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ILI9325_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 417 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9341/Release_Notes.html

@@ -0,0 +1,417 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for ILI9341 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for ILI9341 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">ili9341.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 19-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">Align driver with the STM32Cube BSP architecture by removing check for initialization in ili9341_Init()&nbsp; <br>
+    </span></li><li><span style="font-size: 10pt; font-family: Verdana;">Initializes
+only the LCD IO in read ID APIs instead of all initialization sequence
+and remove the check for initialization in ili9341_ReadID() function</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Comments clean up and typo corrections</span></li>
+            </ul>
+
+
+            
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+            <ul style="margin-top: 0cm;" type="square"><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 346 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9341/ili9341.c

@@ -0,0 +1,346 @@
+/**
+  ******************************************************************************
+  * @file    ili9341.c
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file includes the LCD driver for ILI9341 LCD.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 "ili9341.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup ILI9341
+  * @brief This file provides a set of functions needed to drive the 
+  *        ILI9341 LCD.
+  * @{
+  */
+
+/** @defgroup ILI9341_Private_TypesDefinitions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup ILI9341_Private_Defines
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup ILI9341_Private_Macros
+  * @{
+  */
+/**
+  * @}
+  */  
+
+/** @defgroup ILI9341_Private_Variables
+  * @{
+  */ 
+
+LCD_DrvTypeDef   ili9341_drv = 
+{
+  ili9341_Init,
+  ili9341_ReadID,
+  ili9341_DisplayOn,
+  ili9341_DisplayOff,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  ili9341_GetLcdPixelWidth,
+  ili9341_GetLcdPixelHeight,
+  0,
+  0,    
+};
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup ILI9341_Private_FunctionPrototypes
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup ILI9341_Private_Functions
+  * @{
+  */   
+
+/**
+  * @brief  Power on the LCD.
+  * @param  None
+  * @retval None
+  */
+void ili9341_Init(void)
+{
+  /* Initialize ILI9341 low level bus layer ----------------------------------*/
+  LCD_IO_Init();
+  
+  /* Configure LCD */
+  ili9341_WriteReg(0xCA);
+  ili9341_WriteData(0xC3);
+  ili9341_WriteData(0x08);
+  ili9341_WriteData(0x50);
+  ili9341_WriteReg(LCD_POWERB);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0xC1);
+  ili9341_WriteData(0x30);
+  ili9341_WriteReg(LCD_POWER_SEQ);
+  ili9341_WriteData(0x64);
+  ili9341_WriteData(0x03);
+  ili9341_WriteData(0x12);
+  ili9341_WriteData(0x81);
+  ili9341_WriteReg(LCD_DTCA);
+  ili9341_WriteData(0x85);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x78);
+  ili9341_WriteReg(LCD_POWERA);
+  ili9341_WriteData(0x39);
+  ili9341_WriteData(0x2C);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x34);
+  ili9341_WriteData(0x02);
+  ili9341_WriteReg(LCD_PRC);
+  ili9341_WriteData(0x20);
+  ili9341_WriteReg(LCD_DTCB);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x00);
+  ili9341_WriteReg(LCD_FRMCTR1);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x1B);
+  ili9341_WriteReg(LCD_DFC);
+  ili9341_WriteData(0x0A);
+  ili9341_WriteData(0xA2);
+  ili9341_WriteReg(LCD_POWER1);
+  ili9341_WriteData(0x10);
+  ili9341_WriteReg(LCD_POWER2);
+  ili9341_WriteData(0x10);
+  ili9341_WriteReg(LCD_VCOM1);
+  ili9341_WriteData(0x45);
+  ili9341_WriteData(0x15);
+  ili9341_WriteReg(LCD_VCOM2);
+  ili9341_WriteData(0x90);
+  ili9341_WriteReg(LCD_MAC);
+  ili9341_WriteData(0xC8);
+  ili9341_WriteReg(LCD_3GAMMA_EN);
+  ili9341_WriteData(0x00);
+  ili9341_WriteReg(LCD_RGB_INTERFACE);
+  ili9341_WriteData(0xC2);
+  ili9341_WriteReg(LCD_DFC);
+  ili9341_WriteData(0x0A);
+  ili9341_WriteData(0xA7);
+  ili9341_WriteData(0x27);
+  ili9341_WriteData(0x04);
+  
+  /* Colomn address set */
+  ili9341_WriteReg(LCD_COLUMN_ADDR);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0xEF);
+  /* Page address set */
+  ili9341_WriteReg(LCD_PAGE_ADDR);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x01);
+  ili9341_WriteData(0x3F);
+  ili9341_WriteReg(LCD_INTERFACE);
+  ili9341_WriteData(0x01);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x06);
+  
+  ili9341_WriteReg(LCD_GRAM);
+  LCD_Delay(200);
+  
+  ili9341_WriteReg(LCD_GAMMA);
+  ili9341_WriteData(0x01);
+  
+  ili9341_WriteReg(LCD_PGAMMA);
+  ili9341_WriteData(0x0F);
+  ili9341_WriteData(0x29);
+  ili9341_WriteData(0x24);
+  ili9341_WriteData(0x0C);
+  ili9341_WriteData(0x0E);
+  ili9341_WriteData(0x09);
+  ili9341_WriteData(0x4E);
+  ili9341_WriteData(0x78);
+  ili9341_WriteData(0x3C);
+  ili9341_WriteData(0x09);
+  ili9341_WriteData(0x13);
+  ili9341_WriteData(0x05);
+  ili9341_WriteData(0x17);
+  ili9341_WriteData(0x11);
+  ili9341_WriteData(0x00);
+  ili9341_WriteReg(LCD_NGAMMA);
+  ili9341_WriteData(0x00);
+  ili9341_WriteData(0x16);
+  ili9341_WriteData(0x1B);
+  ili9341_WriteData(0x04);
+  ili9341_WriteData(0x11);
+  ili9341_WriteData(0x07);
+  ili9341_WriteData(0x31);
+  ili9341_WriteData(0x33);
+  ili9341_WriteData(0x42);
+  ili9341_WriteData(0x05);
+  ili9341_WriteData(0x0C);
+  ili9341_WriteData(0x0A);
+  ili9341_WriteData(0x28);
+  ili9341_WriteData(0x2F);
+  ili9341_WriteData(0x0F);
+  
+  ili9341_WriteReg(LCD_SLEEP_OUT);
+  LCD_Delay(200);
+  ili9341_WriteReg(LCD_DISPLAY_ON);
+  /* GRAM start writing */
+  ili9341_WriteReg(LCD_GRAM);
+}
+
+/**
+  * @brief  Disables the Display.
+  * @param  None
+  * @retval LCD Register Value.
+  */
+uint16_t ili9341_ReadID(void)
+{
+  LCD_IO_Init();
+  return ((uint16_t)ili9341_ReadData(LCD_READ_ID4, LCD_READ_ID4_SIZE));
+}
+
+/**
+  * @brief  Enables the Display.
+  * @param  None
+  * @retval None
+  */
+void ili9341_DisplayOn(void)
+{
+  /* Display On */
+  ili9341_WriteReg(LCD_DISPLAY_ON);
+}
+
+/**
+  * @brief  Disables the Display.
+  * @param  None
+  * @retval None
+  */
+void ili9341_DisplayOff(void)
+{
+  /* Display Off */
+  ili9341_WriteReg(LCD_DISPLAY_OFF);
+}
+
+/**
+  * @brief  Writes  to the selected LCD register.
+  * @param  LCD_Reg: address of the selected register.
+  * @retval None
+  */
+void ili9341_WriteReg(uint8_t LCD_Reg)
+{
+  LCD_IO_WriteReg(LCD_Reg);
+}
+
+/**
+  * @brief  Writes data to the selected LCD register.
+  * @param  LCD_Reg: address of the selected register.
+  * @retval None
+  */
+void ili9341_WriteData(uint16_t RegValue)
+{
+  LCD_IO_WriteData(RegValue);
+}
+
+/**
+  * @brief  Reads the selected LCD Register.
+  * @param  RegValue: Address of the register to read
+  * @param  ReadSize: Number of bytes to read
+  * @retval LCD Register Value.
+  */
+uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize)
+{
+  /* Read a max of 4 bytes */
+  return (LCD_IO_ReadData(RegValue, ReadSize));
+}
+
+/**
+  * @brief  Get LCD PIXEL WIDTH.
+  * @param  None
+  * @retval LCD PIXEL WIDTH.
+  */
+uint16_t ili9341_GetLcdPixelWidth(void)
+{
+  /* Return LCD PIXEL WIDTH */
+  return ILI9341_LCD_PIXEL_WIDTH;
+}
+
+/**
+  * @brief  Get LCD PIXEL HEIGHT.
+  * @param  None
+  * @retval LCD PIXEL HEIGHT.
+  */
+uint16_t ili9341_GetLcdPixelHeight(void)
+{
+  /* Return LCD PIXEL HEIGHT */
+  return ILI9341_LCD_PIXEL_HEIGHT;
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 249 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ili9341/ili9341.h

@@ -0,0 +1,249 @@
+/**
+  ******************************************************************************
+  * @file    ili9341.h
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file contains all the functions prototypes for the ili9341.c
+  *          driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __ILI9341_H
+#define __ILI9341_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/lcd.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup ILI9341
+  * @{
+  */
+
+/** @defgroup ILI9341_Exported_Types
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+/** @defgroup ILI9341_Exported_Constants
+  * @{
+  */
+
+/** 
+  * @brief ILI9341 chip IDs  
+  */ 
+#define ILI9341_ID                  0x9341
+
+/** 
+  * @brief  ILI9341 Size  
+  */  
+#define  ILI9341_LCD_PIXEL_WIDTH    ((uint16_t)240)
+#define  ILI9341_LCD_PIXEL_HEIGHT   ((uint16_t)320)
+
+/** 
+  * @brief  ILI9341 Timing  
+  */     
+/* Timing configuration  (Typical configuration from ILI9341 datasheet)
+  HSYNC=10 (9+1)
+  HBP=20 (29-10+1)
+  ActiveW=240 (269-20-10+1)
+  HFP=10 (279-240-20-10+1)
+
+  VSYNC=2 (1+1)
+  VBP=2 (3-2+1)
+  ActiveH=320 (323-2-2+1)
+  VFP=4 (327-320-2-2+1)
+*/
+#define  ILI9341_HSYNC            ((uint32_t)9)   /* Horizontal synchronization */
+#define  ILI9341_HBP              ((uint32_t)29)    /* Horizontal back porch      */ 
+#define  ILI9341_HFP              ((uint32_t)2)    /* Horizontal front porch     */
+#define  ILI9341_VSYNC            ((uint32_t)1)   /* Vertical synchronization   */
+#define  ILI9341_VBP              ((uint32_t)3)    /* Vertical back porch        */
+#define  ILI9341_VFP              ((uint32_t)2)    /* Vertical front porch       */
+
+/** 
+  * @brief  ILI9341 Registers  
+  */
+
+/* Level 1 Commands */
+#define LCD_SWRESET             0x01   /* Software Reset */
+#define LCD_READ_DISPLAY_ID     0x04   /* Read display identification information */
+#define LCD_RDDST               0x09   /* Read Display Status */
+#define LCD_RDDPM               0x0A   /* Read Display Power Mode */
+#define LCD_RDDMADCTL           0x0B   /* Read Display MADCTL */
+#define LCD_RDDCOLMOD           0x0C   /* Read Display Pixel Format */
+#define LCD_RDDIM               0x0D   /* Read Display Image Format */
+#define LCD_RDDSM               0x0E   /* Read Display Signal Mode */
+#define LCD_RDDSDR              0x0F   /* Read Display Self-Diagnostic Result */
+#define LCD_SPLIN               0x10   /* Enter Sleep Mode */
+#define LCD_SLEEP_OUT           0x11   /* Sleep out register */
+#define LCD_PTLON               0x12   /* Partial Mode ON */
+#define LCD_NORMAL_MODE_ON      0x13   /* Normal Display Mode ON */
+#define LCD_DINVOFF             0x20   /* Display Inversion OFF */
+#define LCD_DINVON              0x21   /* Display Inversion ON */
+#define LCD_GAMMA               0x26   /* Gamma register */
+#define LCD_DISPLAY_OFF         0x28   /* Display off register */
+#define LCD_DISPLAY_ON          0x29   /* Display on register */
+#define LCD_COLUMN_ADDR         0x2A   /* Colomn address register */ 
+#define LCD_PAGE_ADDR           0x2B   /* Page address register */ 
+#define LCD_GRAM                0x2C   /* GRAM register */   
+#define LCD_RGBSET              0x2D   /* Color SET */   
+#define LCD_RAMRD               0x2E   /* Memory Read */   
+#define LCD_PLTAR               0x30   /* Partial Area */   
+#define LCD_VSCRDEF             0x33   /* Vertical Scrolling Definition */   
+#define LCD_TEOFF               0x34   /* Tearing Effect Line OFF */   
+#define LCD_TEON                0x35   /* Tearing Effect Line ON */   
+#define LCD_MAC                 0x36   /* Memory Access Control register*/
+#define LCD_VSCRSADD            0x37   /* Vertical Scrolling Start Address */   
+#define LCD_IDMOFF              0x38   /* Idle Mode OFF */   
+#define LCD_IDMON               0x39   /* Idle Mode ON */   
+#define LCD_PIXEL_FORMAT        0x3A   /* Pixel Format register */
+#define LCD_WRITE_MEM_CONTINUE  0x3C   /* Write Memory Continue */   
+#define LCD_READ_MEM_CONTINUE   0x3E   /* Read Memory Continue */   
+#define LCD_SET_TEAR_SCANLINE   0x44   /* Set Tear Scanline */   
+#define LCD_GET_SCANLINE        0x45   /* Get Scanline */   
+#define LCD_WDB                 0x51   /* Write Brightness Display register */
+#define LCD_RDDISBV             0x52   /* Read Display Brightness */   
+#define LCD_WCD                 0x53   /* Write Control Display register*/
+#define LCD_RDCTRLD             0x54   /* Read CTRL Display */   
+#define LCD_WRCABC              0x55   /* Write Content Adaptive Brightness Control */   
+#define LCD_RDCABC              0x56   /* Read Content Adaptive Brightness Control */   
+#define LCD_WRITE_CABC          0x5E   /* Write CABC Minimum Brightness */   
+#define LCD_READ_CABC           0x5F   /* Read CABC Minimum Brightness */   
+#define LCD_READ_ID1            0xDA   /* Read ID1 */
+#define LCD_READ_ID2            0xDB   /* Read ID2 */
+#define LCD_READ_ID3            0xDC   /* Read ID3 */
+
+/* Level 2 Commands */
+#define LCD_RGB_INTERFACE       0xB0   /* RGB Interface Signal Control */
+#define LCD_FRMCTR1             0xB1   /* Frame Rate Control (In Normal Mode) */
+#define LCD_FRMCTR2             0xB2   /* Frame Rate Control (In Idle Mode) */
+#define LCD_FRMCTR3             0xB3   /* Frame Rate Control (In Partial Mode) */
+#define LCD_INVTR               0xB4   /* Display Inversion Control */
+#define LCD_BPC                 0xB5   /* Blanking Porch Control register */
+#define LCD_DFC                 0xB6   /* Display Function Control register */
+#define LCD_ETMOD               0xB7   /* Entry Mode Set */
+#define LCD_BACKLIGHT1          0xB8   /* Backlight Control 1 */
+#define LCD_BACKLIGHT2          0xB9   /* Backlight Control 2 */
+#define LCD_BACKLIGHT3          0xBA   /* Backlight Control 3 */
+#define LCD_BACKLIGHT4          0xBB   /* Backlight Control 4 */
+#define LCD_BACKLIGHT5          0xBC   /* Backlight Control 5 */
+#define LCD_BACKLIGHT7          0xBE   /* Backlight Control 7 */
+#define LCD_BACKLIGHT8          0xBF   /* Backlight Control 8 */
+#define LCD_POWER1              0xC0   /* Power Control 1 register */
+#define LCD_POWER2              0xC1   /* Power Control 2 register */
+#define LCD_VCOM1               0xC5   /* VCOM Control 1 register */
+#define LCD_VCOM2               0xC7   /* VCOM Control 2 register */
+#define LCD_NVMWR               0xD0   /* NV Memory Write */
+#define LCD_NVMPKEY             0xD1   /* NV Memory Protection Key */
+#define LCD_RDNVM               0xD2   /* NV Memory Status Read */
+#define LCD_READ_ID4            0xD3   /* Read ID4 */
+#define LCD_PGAMMA              0xE0   /* Positive Gamma Correction register */
+#define LCD_NGAMMA              0xE1   /* Negative Gamma Correction register */
+#define LCD_DGAMCTRL1           0xE2   /* Digital Gamma Control 1 */
+#define LCD_DGAMCTRL2           0xE3   /* Digital Gamma Control 2 */
+#define LCD_INTERFACE           0xF6   /* Interface control register */
+
+/* Extend register commands */
+#define LCD_POWERA               0xCB   /* Power control A register */
+#define LCD_POWERB               0xCF   /* Power control B register */
+#define LCD_DTCA                 0xE8   /* Driver timing control A */
+#define LCD_DTCB                 0xEA   /* Driver timing control B */
+#define LCD_POWER_SEQ            0xED   /* Power on sequence register */
+#define LCD_3GAMMA_EN            0xF2   /* 3 Gamma enable register */
+#define LCD_PRC                  0xF7   /* Pump ratio control register */
+
+/* Size of read registers */
+#define LCD_READ_ID4_SIZE        3      /* Size of Read ID4 */
+
+/**
+  * @}
+  */
+  
+/** @defgroup ILI9341_Exported_Functions
+  * @{
+  */ 
+void     ili9341_Init(void);
+uint16_t ili9341_ReadID(void);
+void     ili9341_WriteReg(uint8_t LCD_Reg);
+void     ili9341_WriteData(uint16_t RegValue);
+uint32_t ili9341_ReadData(uint16_t RegValue, uint8_t ReadSize);
+void     ili9341_DisplayOn(void);
+void     ili9341_DisplayOff(void);
+uint16_t ili9341_GetLcdPixelWidth(void);
+uint16_t ili9341_GetLcdPixelHeight(void);
+
+/* LCD driver structure */
+extern LCD_DrvTypeDef   ili9341_drv;
+
+/* LCD IO functions */
+void     LCD_IO_Init(void);
+void     LCD_IO_WriteData(uint16_t RegValue);
+void     LCD_IO_WriteReg(uint8_t Reg);
+uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
+void     LCD_Delay (uint32_t delay);
+      
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ILI9341_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 461 - 0
bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/Release_Notes.html

@@ -0,0 +1,461 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for L3GD20 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for L3GD20 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 24-June-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+
+
+
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">l3gd20.h/.c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add gyroscope de-initialization function: L3GD20_DeInit()</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add gyroscope low power configuration</span><span style="font-size: 10pt; font-family: Verdana;"> function:&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">L3GD20_LowPower</span><span style="font-size: 10pt; font-family: Verdana;">()</span></li><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0 or later</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.1 / 27-November-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">l3gd20.h: change "\" by "/" in the include path to fix compilation issue under Linux</span><br>
+                <span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">Miscellaneous formatting and comments update</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 10-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">Update to support new revision of L3GD20 component having new device ID 0xD5 (new define added: I_AM_L3GD20_TR)</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <ul style="margin-top: 0cm;" type="square"><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;">First official release of L3GD20 gyroscope </span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"><br>
+</td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 416 - 0
bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/l3gd20.c

@@ -0,0 +1,416 @@
+/**
+  ******************************************************************************
+  * @file    l3gd20.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    26-June-2015
+  * @brief   This file provides a set of functions needed to manage the L3GD20,
+  *          ST MEMS motion sensor, 3-axis digital output gyroscope.  
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "l3gd20.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup L3GD20
+  * @{
+  */
+
+/** @defgroup L3GD20_Private_TypesDefinitions
+  * @{
+  */
+  
+/**
+  * @}
+  */
+
+/** @defgroup L3GD20_Private_Defines
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup L3GD20_Private_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup L3GD20_Private_Variables
+  * @{
+  */ 
+GYRO_DrvTypeDef L3gd20Drv =
+{
+  L3GD20_Init,
+  L3GD20_DeInit,
+  L3GD20_ReadID,
+  L3GD20_RebootCmd,
+  L3GD20_LowPower,
+  L3GD20_INT1InterruptConfig,
+  L3GD20_EnableIT,
+  L3GD20_DisableIT,
+  0,
+  0,
+  L3GD20_FilterConfig,
+  L3GD20_FilterCmd,
+  L3GD20_ReadXYZAngRate
+};
+
+/**
+  * @}
+  */
+
+/** @defgroup L3GD20_Private_FunctionPrototypes
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup L3GD20_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Set L3GD20 Initialization.
+  * @param  L3GD20_InitStruct: pointer to a L3GD20_InitTypeDef structure 
+  *         that contains the configuration setting for the L3GD20.
+  * @retval None
+  */
+void L3GD20_Init(uint16_t InitStruct)
+{  
+  uint8_t ctrl = 0x00;
+  
+  /* Configure the low level interface */
+  GYRO_IO_Init();
+  
+  /* Write value to MEMS CTRL_REG1 register */
+  ctrl = (uint8_t) InitStruct;
+  GYRO_IO_Write(&ctrl, L3GD20_CTRL_REG1_ADDR, 1);
+  
+  /* Write value to MEMS CTRL_REG4 register */  
+  ctrl = (uint8_t) (InitStruct >> 8);
+  GYRO_IO_Write(&ctrl, L3GD20_CTRL_REG4_ADDR, 1);
+}
+
+
+
+/**
+  * @brief L3GD20 De-initialization
+  * @param  None
+  * @retval None
+  */
+void L3GD20_DeInit(void)
+{
+}
+
+/**
+  * @brief  Read ID address of L3GD20
+  * @param  None
+  * @retval ID name
+  */
+uint8_t L3GD20_ReadID(void)
+{
+  uint8_t tmp;
+  
+  /* Configure the low level interface */
+  GYRO_IO_Init();
+  
+  /* Read WHO I AM register */
+  GYRO_IO_Read(&tmp, L3GD20_WHO_AM_I_ADDR, 1);
+  
+  /* Return the ID */
+  return (uint8_t)tmp;
+}
+
+/**
+  * @brief  Reboot memory content of L3GD20
+  * @param  None
+  * @retval None
+  */
+void L3GD20_RebootCmd(void)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG5 register */
+  GYRO_IO_Read(&tmpreg, L3GD20_CTRL_REG5_ADDR, 1);
+  
+  /* Enable or Disable the reboot memory */
+  tmpreg |= L3GD20_BOOT_REBOOTMEMORY;
+  
+  /* Write value to MEMS CTRL_REG5 register */
+  GYRO_IO_Write(&tmpreg, L3GD20_CTRL_REG5_ADDR, 1);
+}
+
+/**
+  * @brief Set L3GD20 in low-power mode
+  * @param 
+  * @retval  None
+  */
+void L3GD20_LowPower(uint16_t InitStruct)
+{  
+  uint8_t ctrl = 0x00;
+
+  /* Write value to MEMS CTRL_REG1 register */
+  ctrl = (uint8_t) InitStruct;
+  GYRO_IO_Write(&ctrl, L3GD20_CTRL_REG1_ADDR, 1);
+}
+
+/**
+  * @brief  Set L3GD20 Interrupt INT1 configuration
+  * @param  Int1Config: the configuration setting for the L3GD20 Interrupt.
+  * @retval None
+  */
+void L3GD20_INT1InterruptConfig(uint16_t Int1Config)
+{
+  uint8_t ctrl_cfr = 0x00, ctrl3 = 0x00;
+  
+  /* Read INT1_CFG register */
+  GYRO_IO_Read(&ctrl_cfr, L3GD20_INT1_CFG_ADDR, 1);
+  
+  /* Read CTRL_REG3 register */
+  GYRO_IO_Read(&ctrl3, L3GD20_CTRL_REG3_ADDR, 1);
+  
+  ctrl_cfr &= 0x80;
+  ctrl_cfr |= ((uint8_t) Int1Config >> 8);
+  
+  ctrl3 &= 0xDF;
+  ctrl3 |= ((uint8_t) Int1Config);   
+  
+  /* Write value to MEMS INT1_CFG register */
+  GYRO_IO_Write(&ctrl_cfr, L3GD20_INT1_CFG_ADDR, 1);
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  GYRO_IO_Write(&ctrl3, L3GD20_CTRL_REG3_ADDR, 1);
+}
+
+/**
+  * @brief  Enable INT1 or INT2 interrupt
+  * @param  IntSel: choice of INT1 or INT2 
+  *      This parameter can be: 
+  *        @arg L3GD20_INT1
+  *        @arg L3GD20_INT2   
+  * @retval None
+  */
+void L3GD20_EnableIT(uint8_t IntSel)
+{  
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG3 register */
+  GYRO_IO_Read(&tmpreg, L3GD20_CTRL_REG3_ADDR, 1);
+  
+  if(IntSel == L3GD20_INT1)
+  {
+    tmpreg &= 0x7F;	
+    tmpreg |= L3GD20_INT1INTERRUPT_ENABLE;
+  }
+  else if(IntSel == L3GD20_INT2)
+  {
+    tmpreg &= 0xF7;
+    tmpreg |= L3GD20_INT2INTERRUPT_ENABLE;
+  }
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  GYRO_IO_Write(&tmpreg, L3GD20_CTRL_REG3_ADDR, 1);
+}
+
+/**
+  * @brief  Disable  INT1 or INT2 interrupt
+  * @param  IntSel: choice of INT1 or INT2 
+  *      This parameter can be: 
+  *        @arg L3GD20_INT1
+  *        @arg L3GD20_INT2   
+  * @retval None
+  */
+void L3GD20_DisableIT(uint8_t IntSel)
+{  
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG3 register */
+  GYRO_IO_Read(&tmpreg, L3GD20_CTRL_REG3_ADDR, 1);
+  
+  if(IntSel == L3GD20_INT1)
+  {
+    tmpreg &= 0x7F;	
+    tmpreg |= L3GD20_INT1INTERRUPT_DISABLE;
+  }
+  else if(IntSel == L3GD20_INT2)
+  {
+    tmpreg &= 0xF7;
+    tmpreg |= L3GD20_INT2INTERRUPT_DISABLE;
+  }
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  GYRO_IO_Write(&tmpreg, L3GD20_CTRL_REG3_ADDR, 1);
+}
+
+/**
+  * @brief  Set High Pass Filter Modality
+  * @param  FilterStruct: contains the configuration setting for the L3GD20.        
+  * @retval None
+  */
+void L3GD20_FilterConfig(uint8_t FilterStruct) 
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG2 register */
+  GYRO_IO_Read(&tmpreg, L3GD20_CTRL_REG2_ADDR, 1);
+  
+  tmpreg &= 0xC0;
+  
+  /* Configure MEMS: mode and cutoff frequency */
+  tmpreg |= FilterStruct;
+  
+  /* Write value to MEMS CTRL_REG2 register */
+  GYRO_IO_Write(&tmpreg, L3GD20_CTRL_REG2_ADDR, 1);
+}
+
+/**
+  * @brief  Enable or Disable High Pass Filter
+  * @param  HighPassFilterState: new state of the High Pass Filter feature.
+  *      This parameter can be: 
+  *         @arg: L3GD20_HIGHPASSFILTER_DISABLE 
+  *         @arg: L3GD20_HIGHPASSFILTER_ENABLE          
+  * @retval None
+  */
+void L3GD20_FilterCmd(uint8_t HighPassFilterState)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG5 register */
+  GYRO_IO_Read(&tmpreg, L3GD20_CTRL_REG5_ADDR, 1);
+  
+  tmpreg &= 0xEF;
+  
+  tmpreg |= HighPassFilterState;
+  
+  /* Write value to MEMS CTRL_REG5 register */
+  GYRO_IO_Write(&tmpreg, L3GD20_CTRL_REG5_ADDR, 1);
+}
+
+/**
+  * @brief  Get status for L3GD20 data
+  * @param  None         
+  * @retval Data status in a L3GD20 Data
+  */
+uint8_t L3GD20_GetDataStatus(void)
+{
+  uint8_t tmpreg;
+  
+  /* Read STATUS_REG register */
+  GYRO_IO_Read(&tmpreg, L3GD20_STATUS_REG_ADDR, 1);
+  
+  return tmpreg;
+}
+
+/**
+* @brief  Calculate the L3GD20 angular data.
+* @param  pfData: Data out pointer
+* @retval None
+*/
+void L3GD20_ReadXYZAngRate(float *pfData)
+{
+  uint8_t tmpbuffer[6] ={0};
+  int16_t RawData[3] = {0};
+  uint8_t tmpreg = 0;
+  float sensitivity = 0;
+  int i =0;
+  
+  GYRO_IO_Read(&tmpreg,L3GD20_CTRL_REG4_ADDR,1);
+  
+  GYRO_IO_Read(tmpbuffer,L3GD20_OUT_X_L_ADDR,6);
+  
+  /* check in the control register 4 the data alignment (Big Endian or Little Endian)*/
+  if(!(tmpreg & L3GD20_BLE_MSB))
+  {
+    for(i=0; i<3; i++)
+    {
+      RawData[i]=(int16_t)(((uint16_t)tmpbuffer[2*i+1] << 8) + tmpbuffer[2*i]);
+    }
+  }
+  else
+  {
+    for(i=0; i<3; i++)
+    {
+      RawData[i]=(int16_t)(((uint16_t)tmpbuffer[2*i] << 8) + tmpbuffer[2*i+1]);
+    }
+  }
+  
+  /* Switch the sensitivity value set in the CRTL4 */
+  switch(tmpreg & L3GD20_FULLSCALE_SELECTION)
+  {
+  case L3GD20_FULLSCALE_250:
+    sensitivity=L3GD20_SENSITIVITY_250DPS;
+    break;
+    
+  case L3GD20_FULLSCALE_500:
+    sensitivity=L3GD20_SENSITIVITY_500DPS;
+    break;
+    
+  case L3GD20_FULLSCALE_2000:
+    sensitivity=L3GD20_SENSITIVITY_2000DPS;
+    break;
+  }
+  /* Divide by sensitivity */
+  for(i=0; i<3; i++)
+  {
+    pfData[i]=(float)(RawData[i] * sensitivity);
+  }
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/     

+ 324 - 0
bsp/stm32f411RE/Libraries/BSP/Components/l3gd20/l3gd20.h

@@ -0,0 +1,324 @@
+/**
+  ******************************************************************************
+  * @file    l3gd20.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    26-June-2015
+  * @brief   This file contains all the functions prototypes for the l3gd20.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __L3GD20_H
+#define __L3GD20_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/gyro.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup L3GD20
+  * @{
+  */
+  
+/** @defgroup L3GD20_Exported_Constants
+  * @{
+  */
+
+/******************************************************************************/
+/*************************** START REGISTER MAPPING  **************************/
+/******************************************************************************/
+#define L3GD20_WHO_AM_I_ADDR          0x0F  /* device identification register */
+#define L3GD20_CTRL_REG1_ADDR         0x20  /* Control register 1 */
+#define L3GD20_CTRL_REG2_ADDR         0x21  /* Control register 2 */
+#define L3GD20_CTRL_REG3_ADDR         0x22  /* Control register 3 */
+#define L3GD20_CTRL_REG4_ADDR         0x23  /* Control register 4 */
+#define L3GD20_CTRL_REG5_ADDR         0x24  /* Control register 5 */
+#define L3GD20_REFERENCE_REG_ADDR     0x25  /* Reference register */
+#define L3GD20_OUT_TEMP_ADDR          0x26  /* Out temp register */
+#define L3GD20_STATUS_REG_ADDR        0x27  /* Status register */
+#define L3GD20_OUT_X_L_ADDR           0x28  /* Output Register X */
+#define L3GD20_OUT_X_H_ADDR           0x29  /* Output Register X */
+#define L3GD20_OUT_Y_L_ADDR           0x2A  /* Output Register Y */
+#define L3GD20_OUT_Y_H_ADDR           0x2B  /* Output Register Y */
+#define L3GD20_OUT_Z_L_ADDR           0x2C  /* Output Register Z */
+#define L3GD20_OUT_Z_H_ADDR           0x2D  /* Output Register Z */ 
+#define L3GD20_FIFO_CTRL_REG_ADDR     0x2E  /* Fifo control Register */
+#define L3GD20_FIFO_SRC_REG_ADDR      0x2F  /* Fifo src Register */
+
+#define L3GD20_INT1_CFG_ADDR          0x30  /* Interrupt 1 configuration Register */
+#define L3GD20_INT1_SRC_ADDR          0x31  /* Interrupt 1 source Register */
+#define L3GD20_INT1_TSH_XH_ADDR       0x32  /* Interrupt 1 Threshold X register */
+#define L3GD20_INT1_TSH_XL_ADDR       0x33  /* Interrupt 1 Threshold X register */
+#define L3GD20_INT1_TSH_YH_ADDR       0x34  /* Interrupt 1 Threshold Y register */
+#define L3GD20_INT1_TSH_YL_ADDR       0x35  /* Interrupt 1 Threshold Y register */
+#define L3GD20_INT1_TSH_ZH_ADDR       0x36  /* Interrupt 1 Threshold Z register */
+#define L3GD20_INT1_TSH_ZL_ADDR       0x37  /* Interrupt 1 Threshold Z register */
+#define L3GD20_INT1_DURATION_ADDR     0x38  /* Interrupt 1 DURATION register */
+
+/******************************************************************************/
+/**************************** END REGISTER MAPPING  ***************************/
+/******************************************************************************/
+
+#define I_AM_L3GD20                 ((uint8_t)0xD4)
+#define I_AM_L3GD20_TR              ((uint8_t)0xD5)
+
+/** @defgroup Power_Mode_selection 
+  * @{
+  */
+#define L3GD20_MODE_POWERDOWN       ((uint8_t)0x00)
+#define L3GD20_MODE_ACTIVE          ((uint8_t)0x08)
+/**
+  * @}
+  */
+
+/** @defgroup OutPut_DataRate_Selection 
+  * @{
+  */
+#define L3GD20_OUTPUT_DATARATE_1    ((uint8_t)0x00)
+#define L3GD20_OUTPUT_DATARATE_2    ((uint8_t)0x40)
+#define L3GD20_OUTPUT_DATARATE_3    ((uint8_t)0x80)
+#define L3GD20_OUTPUT_DATARATE_4    ((uint8_t)0xC0)
+/**
+  * @}
+  */
+
+/** @defgroup Axes_Selection 
+  * @{
+  */
+#define L3GD20_X_ENABLE            ((uint8_t)0x02)
+#define L3GD20_Y_ENABLE            ((uint8_t)0x01)
+#define L3GD20_Z_ENABLE            ((uint8_t)0x04)
+#define L3GD20_AXES_ENABLE         ((uint8_t)0x07)
+#define L3GD20_AXES_DISABLE        ((uint8_t)0x00)
+/**
+  * @}
+  */
+
+/** @defgroup Bandwidth_Selection 
+  * @{
+  */
+#define L3GD20_BANDWIDTH_1         ((uint8_t)0x00)
+#define L3GD20_BANDWIDTH_2         ((uint8_t)0x10)
+#define L3GD20_BANDWIDTH_3         ((uint8_t)0x20)
+#define L3GD20_BANDWIDTH_4         ((uint8_t)0x30)
+/**
+  * @}
+  */
+
+/** @defgroup Full_Scale_Selection 
+  * @{
+  */
+#define L3GD20_FULLSCALE_250       ((uint8_t)0x00)
+#define L3GD20_FULLSCALE_500       ((uint8_t)0x10)
+#define L3GD20_FULLSCALE_2000      ((uint8_t)0x20) 
+#define L3GD20_FULLSCALE_SELECTION ((uint8_t)0x30)
+/**
+  * @}
+  */
+
+/** @defgroup Full_Scale_Sensitivity 
+  * @{
+  */
+#define L3GD20_SENSITIVITY_250DPS  ((float)8.75f)         /*!< gyroscope sensitivity with 250 dps full scale [DPS/LSB]  */
+#define L3GD20_SENSITIVITY_500DPS  ((float)17.50f)        /*!< gyroscope sensitivity with 500 dps full scale [DPS/LSB]  */
+#define L3GD20_SENSITIVITY_2000DPS ((float)70.00f)        /*!< gyroscope sensitivity with 2000 dps full scale [DPS/LSB] */
+/**
+  * @}
+  */
+
+  
+/** @defgroup Block_Data_Update 
+  * @{
+  */  
+#define L3GD20_BlockDataUpdate_Continous   ((uint8_t)0x00)
+#define L3GD20_BlockDataUpdate_Single      ((uint8_t)0x80)
+/**
+  * @}
+  */
+  
+/** @defgroup Endian_Data_selection
+  * @{
+  */  
+#define L3GD20_BLE_LSB                     ((uint8_t)0x00)
+#define L3GD20_BLE_MSB	                   ((uint8_t)0x40)
+/**
+  * @}
+  */
+  
+/** @defgroup High_Pass_Filter_status 
+  * @{
+  */   
+#define L3GD20_HIGHPASSFILTER_DISABLE      ((uint8_t)0x00)
+#define L3GD20_HIGHPASSFILTER_ENABLE	     ((uint8_t)0x10)
+/**
+  * @}
+  */
+
+/** @defgroup INT1_INT2_selection 
+  * @{
+  */   
+#define L3GD20_INT1                        ((uint8_t)0x00)
+#define L3GD20_INT2                        ((uint8_t)0x01)
+/**
+  * @}
+  */
+
+/** @defgroup INT1_Interrupt_status 
+  * @{
+  */   
+#define L3GD20_INT1INTERRUPT_DISABLE       ((uint8_t)0x00)
+#define L3GD20_INT1INTERRUPT_ENABLE        ((uint8_t)0x80)
+/**
+  * @}
+  */
+
+/** @defgroup INT2_Interrupt_status 
+  * @{
+  */   
+#define L3GD20_INT2INTERRUPT_DISABLE       ((uint8_t)0x00)
+#define L3GD20_INT2INTERRUPT_ENABLE        ((uint8_t)0x08)
+/**
+  * @}
+  */
+
+/** @defgroup INT1_Interrupt_ActiveEdge 
+  * @{
+  */   
+#define L3GD20_INT1INTERRUPT_LOW_EDGE      ((uint8_t)0x20)
+#define L3GD20_INT1INTERRUPT_HIGH_EDGE     ((uint8_t)0x00)
+/**
+  * @}
+  */
+  
+/** @defgroup Boot_Mode_selection 
+  * @{
+  */
+#define L3GD20_BOOT_NORMALMODE             ((uint8_t)0x00)
+#define L3GD20_BOOT_REBOOTMEMORY           ((uint8_t)0x80)
+/**
+  * @}
+  */  
+ 
+/** @defgroup High_Pass_Filter_Mode 
+  * @{
+  */   
+#define L3GD20_HPM_NORMAL_MODE_RES         ((uint8_t)0x00)
+#define L3GD20_HPM_REF_SIGNAL              ((uint8_t)0x10)
+#define L3GD20_HPM_NORMAL_MODE             ((uint8_t)0x20)
+#define L3GD20_HPM_AUTORESET_INT           ((uint8_t)0x30)
+/**
+  * @}
+  */
+
+/** @defgroup High_Pass_CUT OFF_Frequency 
+  * @{
+  */   
+#define L3GD20_HPFCF_0              0x00
+#define L3GD20_HPFCF_1              0x01
+#define L3GD20_HPFCF_2              0x02
+#define L3GD20_HPFCF_3              0x03
+#define L3GD20_HPFCF_4              0x04
+#define L3GD20_HPFCF_5              0x05
+#define L3GD20_HPFCF_6              0x06
+#define L3GD20_HPFCF_7              0x07
+#define L3GD20_HPFCF_8              0x08
+#define L3GD20_HPFCF_9              0x09
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+/** @defgroup L3GD20_Exported_Functions
+  * @{
+  */
+/* Sensor Configuration Functions */ 
+void    L3GD20_Init(uint16_t InitStruct);
+void    L3GD20_DeInit(void);
+void    L3GD20_LowPower(uint16_t InitStruct);
+uint8_t L3GD20_ReadID(void);
+void    L3GD20_RebootCmd(void);
+
+/* Interrupt Configuration Functions */
+void    L3GD20_INT1InterruptConfig(uint16_t Int1Config);
+void    L3GD20_EnableIT(uint8_t IntSel);
+void    L3GD20_DisableIT(uint8_t IntSel);
+
+/* High Pass Filter Configuration Functions */
+void    L3GD20_FilterConfig(uint8_t FilterStruct);
+void    L3GD20_FilterCmd(uint8_t HighPassFilterState);
+void    L3GD20_ReadXYZAngRate(float *pfData);
+uint8_t L3GD20_GetDataStatus(void);
+
+/* Gyroscope IO functions */
+void    GYRO_IO_Init(void);
+void    GYRO_IO_DeInit(void);
+void    GYRO_IO_Write(uint8_t *pBuffer, uint8_t WriteAddr, uint16_t NumByteToWrite);
+void    GYRO_IO_Read(uint8_t *pBuffer, uint8_t ReadAddr, uint16_t NumByteToRead);
+
+/* Gyroscope driver structure */
+extern GYRO_DrvTypeDef L3gd20Drv;
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+  }
+#endif
+  
+#endif /* __L3GD20_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 

+ 510 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/Release_Notes.html

@@ -0,0 +1,510 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for LIS302DL Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for LIS302DL Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 900px; height: 418px;" border="0" cellpadding="0">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 03-August-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">lis302dl.h/.c:</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">Add mems accelerometer&nbsp;de-initialization 
+function: LIS302DL_DeInit()</span></li><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0 or later</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">lis302dl.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 19-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+
+            
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">Comments clean up and typo corrections</span></li>
+            </ul>
+
+
+            
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li>
+            </ul>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License</span></h2>
+
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div></td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 423 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/lis302dl.c

@@ -0,0 +1,423 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 720 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis302dl/lis302dl.h

@@ -0,0 +1,720 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 514 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/Release_Notes.html

@@ -0,0 +1,514 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for LIS3DSH Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for LIS3DSH Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 03-August-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">lis3dsh.h/c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">Add mems accelerometer&nbsp;de-initialization 
+function: LIS3DSH_DeInit()</span></li></ul><ul><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0 or later</span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">lis3dsh.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 19-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">Comments clean up and typo corrections</span></li>
+            </ul>
+
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li>
+            </ul>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><br><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 431 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/lis3dsh.c

@@ -0,0 +1,431 @@
+/**
+  ******************************************************************************
+  * @file    lis3dsh.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 LIS3DSH
+  *          MEMS Accelerometer.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "lis3dsh.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup LIS3DSH
+  * @brief  This file includes the motion sensor driver for LIS3DSH motion sensor 
+  *         devices.
+  * @{
+  */
+
+/** @defgroup LIS3DSH_Private_TypesDefinitions
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup LIS3DSH_Private_Defines
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup LIS3DSH_Private_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup LIS3DSH_Private_Variables
+  * @{
+  */
+ACCELERO_DrvTypeDef Lis3dshDrv =
+{
+  LIS3DSH_Init,
+  LIS3DSH_DeInit,
+  LIS3DSH_ReadID,
+  LIS3DSH_RebootCmd,
+  LIS3DSH_Click_IntConfig,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  LIS3DSH_ReadACC,
+};
+
+/**
+  * @}
+  */
+
+/** @defgroup LIS3DSH_Private_FunctionPrototypes
+  * @{
+  */
+  
+/**
+  * @}
+  */
+
+/** @defgroup LIS3DSH_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Set LIS3DSH Initialization.
+  * @param  InitStruct: contains mask of different init parameters
+  * @retval None
+  */
+void LIS3DSH_Init(uint16_t InitStruct)
+{
+  uint8_t ctrl = 0x00;
+  
+  /* Configure the low level interface */
+  ACCELERO_IO_Init();
+
+  /* Configure MEMS: power mode(ODR) and axes enable */
+  ctrl = (uint8_t) (InitStruct);
+  
+  /* Write value to MEMS CTRL_REG4 register */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_CTRL_REG4_ADDR, 1);
+  
+  /* Configure MEMS: full scale and self test */
+  ctrl = (uint8_t) (InitStruct >> 8);
+  
+  /* Write value to MEMS CTRL_REG5 register */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_CTRL_REG5_ADDR, 1);
+}
+
+/**
+  * @brief  LIS3DSH De-Initialization.
+  * @param  None
+  * @retval None.
+  */
+void LIS3DSH_DeInit(void)
+{
+  
+}
+
+/**
+  * @brief  Read LIS3DSH device ID.
+  * @param  None
+  * @retval The Device ID (two bytes).
+  */
+uint8_t LIS3DSH_ReadID(void)
+{
+  uint8_t tmp = 0;
+
+  /* Configure the low level interface */
+  ACCELERO_IO_Init();
+
+  /* Read WHO_AM_I register */
+  ACCELERO_IO_Read(&tmp, LIS3DSH_WHO_AM_I_ADDR, 1);
+  
+  /* Return the ID */
+  return (uint16_t)tmp;
+}
+
+/**
+  * @brief  Set LIS3DSH Interrupt configuration
+  * @param  LIS3DSH_InterruptConfig_TypeDef: pointer to a LIS3DSH_InterruptConfig_TypeDef 
+  *         structure that contains the configuration setting for the LIS3DSH Interrupt.
+  * @retval None
+  */
+void LIS3DSH_InterruptConfig(LIS3DSH_InterruptConfigTypeDef *LIS3DSH_IntConfigStruct)
+{
+  uint8_t ctrl = 0x00;
+  
+  /* Configure Interrupt Selection , Request and Signal */                   
+  ctrl = (uint8_t)(LIS3DSH_IntConfigStruct->Interrupt_Selection_Enable | \
+                   LIS3DSH_IntConfigStruct->Interrupt_Request | \
+                   LIS3DSH_IntConfigStruct->Interrupt_Signal);
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_CTRL_REG3_ADDR, 1);
+  
+  /* Configure State Machine 1 */                   
+  ctrl = (uint8_t)(LIS3DSH_IntConfigStruct->State_Machine1_Enable | \
+                   LIS3DSH_IntConfigStruct->State_Machine1_Interrupt);
+  
+  /* Write value to MEMS CTRL_REG1 register */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_CTRL_REG1_ADDR, 1);
+  
+  /* Configure State Machine 2 */                   
+  ctrl = (uint8_t)(LIS3DSH_IntConfigStruct->State_Machine2_Enable | \
+                   LIS3DSH_IntConfigStruct->State_Machine2_Interrupt);
+  
+  /* Write value to MEMS CTRL_REG2 register */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_CTRL_REG2_ADDR, 1);
+}
+
+/**
+  * @brief  Set LIS3DSH for click detection
+  * @param  None
+  * @retval None
+  */
+void LIS3DSH_Click_IntConfig(void)
+{
+  uint8_t ctrl = 0x00;
+  LIS3DSH_InterruptConfigTypeDef   LIS3DSH_InterruptStruct; 
+
+  ACCELERO_IO_ITConfig();
+
+  /* Set LIS3DSH Interrupt configuration */
+  LIS3DSH_InterruptStruct.Interrupt_Selection_Enable = LIS3DSH_INTERRUPT_2_ENABLE;
+  LIS3DSH_InterruptStruct.Interrupt_Request = LIS3DSH_INTERRUPT_REQUEST_LATCHED;
+  LIS3DSH_InterruptStruct.Interrupt_Signal = LIS3DSH_INTERRUPT_SIGNAL_HIGH;
+  LIS3DSH_InterruptStruct.State_Machine1_Enable = LIS3DSH_SM_DISABLE;
+  LIS3DSH_InterruptStruct.State_Machine2_Enable = LIS3DSH_SM_ENABLE;
+  LIS3DSH_InterruptStruct.State_Machine2_Interrupt = LIS3DSH_SM_INT1;
+  LIS3DSH_InterruptConfig(&LIS3DSH_InterruptStruct);
+    
+  /* Set LIS3DSH State Machines configuration */
+  ctrl=0x03; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_TIM2_1_L_ADDR,1);
+  ctrl=0xC8; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_TIM1_1_L_ADDR,1);
+  ctrl=0x45; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_THRS2_1_ADDR,1);
+  ctrl=0xFC; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_MASK1_A_ADDR,1);
+  ctrl=0xA1; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_SETT1_ADDR,1);
+  ctrl=0x01; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_PR1_ADDR,1);
+
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_SETT2_ADDR,1);
+  
+  /* Configure State Machine 2 to detect single click */
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_ST2_1_ADDR,1);
+  ctrl=0x06; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_ST2_2_ADDR,1);
+  ctrl=0x28; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_ST2_3_ADDR,1);
+  ctrl=0x11; 
+  ACCELERO_IO_Write(&ctrl, LIS3DSH_ST2_4_ADDR,1);
+}
+
+/**
+  * @brief  Change the lowpower mode for LIS3DSH.
+  * @param  LowPowerMode: new state for the lowpower mode.
+  *   This parameter can be one of the following values:
+  *     @arg LIS3DSH_DATARATE_POWERDOWN: Power down mode
+  *     @arg LIS3DSH_DATARATE_3_125: Normal mode. ODR: 3.125 Hz
+  *     @arg LIS3DSH_DATARATE_6_25: Normal mode. ODR: 6.25 Hz
+  *     @arg LIS3DSH_DATARATE_12_5: Normal mode. ODR: 12.5 Hz
+  *     @arg LIS3DSH_DATARATE_25: Normal mode. ODR: 25 Hz
+  *     @arg LIS3DSH_DATARATE_50: Normal mode. ODR: 50 Hz
+  *     @arg LIS3DSH_DATARATE_100: Normal mode. ODR: 100 Hz
+  *     @arg LIS3DSH_DATARATE_400: Normal mode. ODR: 400 Hz
+  *     @arg LIS3DSH_DATARATE_800: Normal mode. ODR: 800 Hz
+  *     @arg LIS3DSH_DATARATE_1600: Normal mode. ODR: 1600 Hz
+  * @retval None
+  */
+void LIS3DSH_ODR_LowpowerCmd(uint8_t ODR_LowPowerMode)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG4 register */
+  ACCELERO_IO_Read(&tmpreg, LIS3DSH_CTRL_REG4_ADDR, 1);
+  
+  /* Set new low power mode configuration */
+  tmpreg &= (uint8_t)~LIS3DSH_DATARATE_100;
+  tmpreg |= ODR_LowPowerMode;
+  
+  /* Write value to MEMS CTRL_REG4 register */
+  ACCELERO_IO_Write(&tmpreg, LIS3DSH_CTRL_REG4_ADDR, 1);
+}
+
+/**
+  * @brief  Data Rate command. 
+  * @param  DataRateValue: Data rate value.
+  *   This parameter can be one of the following values:
+  *     @arg LIS3DSH_DATARATE_3_125: 3.125 Hz output data rate 
+  *     @arg LIS3DSH_DATARATE_6_25: 6.25 Hz output data rate
+  *     @arg LIS3DSH_DATARATE_12_5: 12.5  Hz output data rate
+  *     @arg LIS3DSH_DATARATE_25: 25 Hz output data rate
+  *     @arg LIS3DSH_DATARATE_50: 50 Hz output data rate 
+  *     @arg LIS3DSH_DATARATE_100: 100 Hz output data rate
+  *     @arg LIS3DSH_DATARATE_400: 400 Hz output data rate 
+  *     @arg LIS3DSH_DATARATE_800: 800 Hz output data rate
+  *     @arg LIS3DSH_DATARATE_1600: 1600 Hz output data rate
+  * @retval None
+  */
+void LIS3DSH_DataRateCmd(uint8_t DataRateValue)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG4 register */
+  ACCELERO_IO_Read(&tmpreg, LIS3DSH_CTRL_REG4_ADDR, 1);
+  
+  /* Set new data rate configuration from 100 to 400Hz */
+  tmpreg &= (uint8_t)~LIS3DSH_DATARATE_400; 
+  tmpreg |= DataRateValue;
+  
+  /* Write value to MEMS CTRL_REG4 register */
+  ACCELERO_IO_Write(&tmpreg, LIS3DSH_CTRL_REG4_ADDR, 1);
+}
+
+/**
+  * @brief  Change the Full Scale of LIS3DSH.
+  * @param  FS_value: new full scale value. 
+  *   This parameter can be one of the following values:
+  *     @arg LIS3DSH_FULLSCALE_2: +-2g
+  *     @arg LIS3DSH_FULLSCALE_4: +-4g
+  *     @arg LIS3DSH_FULLSCALE_6: +-6g
+  *     @arg LIS3DSH_FULLSCALE_8: +-8g
+  *     @arg LIS3DSH_FULLSCALE_16: +-16g
+  * @retval None
+  */
+void LIS3DSH_FullScaleCmd(uint8_t FS_value)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG5 register */
+  ACCELERO_IO_Read(&tmpreg, LIS3DSH_CTRL_REG5_ADDR, 1);
+  
+  /* Set new full scale configuration */
+  tmpreg &= (uint8_t)~LIS3DSH_FULLSCALE_16;
+  tmpreg |= FS_value;
+  
+  /* Write value to MEMS CTRL_REG5 register */
+  ACCELERO_IO_Write(&tmpreg, LIS3DSH_CTRL_REG5_ADDR, 1);
+}
+
+/**
+  * @brief  Reboot memory content of LIS3DSH.
+  * @param  None
+  * @retval None
+  */
+void LIS3DSH_RebootCmd(void)
+{
+  uint8_t tmpreg;
+  /* Read CTRL_REG6 register */
+  ACCELERO_IO_Read(&tmpreg, LIS3DSH_CTRL_REG6_ADDR, 1);
+  
+  /* Enable or Disable the reboot memory */
+  tmpreg |= LIS3DSH_BOOT_FORCED;
+  
+  /* Write value to MEMS CTRL_REG6 register */
+  ACCELERO_IO_Write(&tmpreg, LIS3DSH_CTRL_REG6_ADDR, 1);
+}
+
+/**
+  * @brief  Read LIS3DSH output register, and calculate the acceleration 
+  *         ACC[mg]=SENSITIVITY* (out_h*256+out_l)/16 (12 bit representation).
+  * @param  pointer on floating buffer.
+  * @retval None
+  */
+void LIS3DSH_ReadACC(int16_t *pData)
+{
+  int8_t buffer[6];
+  uint8_t crtl, i = 0x00;
+  float sensitivity = LIS3DSH_SENSITIVITY_0_06G;
+  float valueinfloat = 0;
+  
+  ACCELERO_IO_Read(&crtl, LIS3DSH_CTRL_REG5_ADDR, 1);  
+  ACCELERO_IO_Read((uint8_t*)&buffer[0], LIS3DSH_OUT_X_L_ADDR, 1);
+  ACCELERO_IO_Read((uint8_t*)&buffer[1], LIS3DSH_OUT_X_H_ADDR, 1);
+  ACCELERO_IO_Read((uint8_t*)&buffer[2], LIS3DSH_OUT_Y_L_ADDR, 1);
+  ACCELERO_IO_Read((uint8_t*)&buffer[3], LIS3DSH_OUT_Y_H_ADDR, 1);
+  ACCELERO_IO_Read((uint8_t*)&buffer[4], LIS3DSH_OUT_Z_L_ADDR, 1);
+  ACCELERO_IO_Read((uint8_t*)&buffer[5], LIS3DSH_OUT_Z_H_ADDR, 1);
+  
+  switch(crtl & LIS3DSH__FULLSCALE_SELECTION) 
+  {
+    /* FS bit = 000 ==> Sensitivity typical value = 0.06milligals/digit */ 
+  case LIS3DSH_FULLSCALE_2:
+    sensitivity = LIS3DSH_SENSITIVITY_0_06G;
+    break;
+    
+    /* FS bit = 001 ==> Sensitivity typical value = 0.12milligals/digit */ 
+  case LIS3DSH_FULLSCALE_4:
+    sensitivity = LIS3DSH_SENSITIVITY_0_12G;
+    break;
+    
+    /* FS bit = 010 ==> Sensitivity typical value = 0.18milligals/digit */ 
+  case LIS3DSH_FULLSCALE_6:
+    sensitivity = LIS3DSH_SENSITIVITY_0_18G;
+    break;
+    
+    /* FS bit = 011 ==> Sensitivity typical value = 0.24milligals/digit */ 
+  case LIS3DSH_FULLSCALE_8:
+    sensitivity = LIS3DSH_SENSITIVITY_0_24G;
+    break;
+    
+    /* FS bit = 100 ==> Sensitivity typical value = 0.73milligals/digit */ 
+  case LIS3DSH_FULLSCALE_16:
+    sensitivity = LIS3DSH_SENSITIVITY_0_73G;
+    break;
+    
+  default:
+    break;
+  }
+  
+  /* Obtain the mg value for the three axis */
+  for(i=0; i<3; i++)
+  {
+    valueinfloat = ((buffer[2*i+1] << 8) + buffer[2*i]) * sensitivity;
+    pData[i] = (int16_t)valueinfloat;
+  }
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 1255 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lis3dsh/lis3dsh.h

@@ -0,0 +1,1255 @@
+/**
+  ******************************************************************************
+  * @file    lis3dsh.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    03-August-2015
+  * @brief   This file contains all the functions prototypes for the lis3dsh.c
+  *          firmware driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __LIS3DSH_H
+#define __LIS3DSH_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/accelero.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup LIS302DL
+  * @{
+  */
+
+/** @defgroup LIS3DSH_Exported_Types
+  * @{
+  */
+/* LIS3DSH struct */
+typedef struct
+{
+  uint8_t Output_DataRate;              /* Output Data Rate into CTRL_REG4 register */
+  uint8_t Axes_Enable;                  /* Axes enable into CTRL_REG4 register */
+  uint8_t SPI_Wire;                     /* SPI Wire into CTRL_REG5 register */
+  uint8_t Self_Test;                    /* Self test into CTRL_REG5 register */  
+  uint8_t Full_Scale;                   /* Full scale into CTRL_REG5 register */
+  uint8_t Filter_BW;                    /* Filter BW into CTRL_REG5 register */
+}LIS3DSH_InitTypeDef;
+
+/* LIS3DSH Interrupt struct */
+typedef struct
+{
+  uint8_t Interrupt_Request;            /* Latch/Pulse Interrupt request into CTRL_REG3 register */
+  uint8_t Interrupt_Selection_Enable;   /* Interrupt1/2 selection enable into CTRL_REG3 register */
+  uint8_t Interrupt_Signal;             /* Interrupt signal active Low/High into CTRL_REG3 register */  
+  uint8_t State_Machine1_Enable;        /* State Machine 1 enable/disable into CTRL_REG1 register */ 
+  uint8_t State_Machine1_Interrupt;     /* State Machine 1 routed Interrupt into CTRL_REG1 register */
+  uint8_t State_Machine2_Enable;        /* State Machine 2 enable/disable into CTRL_REG2 register */  
+  uint8_t State_Machine2_Interrupt;     /* State Machine 2 routed Interrupt into CTRL_REG1 register */
+}LIS3DSH_InterruptConfigTypeDef;  
+/**
+  * @}
+  */
+  
+/** @defgroup LIS3DSH_Exported_Constants
+  * @{
+  */
+
+/******************************************************************************/
+/*************************** START REGISTER MAPPING  **************************/
+/******************************************************************************/
+
+/*******************************************************************************
+*  OUT_T Register: Temperature Output Register
+*  Read only register
+*  Default value: 0x21
+*  7:0 Temp7-Temp0: Temperature output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_T_ADDR                   0x0C
+
+/*******************************************************************************
+*  INFO1 Register: Information Register 1
+*  Read only register
+*  Default value: 0x21
+*******************************************************************************/
+#define LIS3DSH_INFO1_ADDR                   0x0D
+
+/*******************************************************************************
+*  INFO2 Register: Information Register 2
+*  Read only register
+*  Default value: 0x00
+*******************************************************************************/
+#define LIS3DSH_INFO2_ADDR                   0x0E
+
+/*******************************************************************************
+*  WHO_AM_I Register: Device Identification Register
+*  Read only register
+*  Default value: 0x3F
+*******************************************************************************/
+#define LIS3DSH_WHO_AM_I_ADDR                0x0F
+
+/*******************************************************************************
+*  OFF_X Register: X-axis Offset Compensation Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 OFFx_7-OFFx_0: X-axis Offset Compensation Value
+*******************************************************************************/
+#define LIS3DSH_OFF_X_ADDR                   0x10
+
+/*******************************************************************************
+*  OFF_Y Register: Y-axis Offset Compensation Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 OFFy_7-OFFy_0: Y-axis Offset Compensation Value
+*******************************************************************************/
+#define LIS3DSH_OFF_Y_ADDR                   0x11
+
+/*******************************************************************************
+*  OFF_Z Register: Z-axis Offset Compensation Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 OFFz_7-OFFz_0: Z-axis Offset Compensation Value
+*******************************************************************************/
+#define LIS3DSH_OFF_Z_ADDR                   0x12
+
+/*******************************************************************************
+*  CS_X Register: X-axis Constant Shift Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 CS_7-CS_0: X-axis Constant Shift Value
+*******************************************************************************/
+#define LIS3DSH_CS_X_ADDR                    0x13
+
+/*******************************************************************************
+*  CS_Y Register: Y-axis Constant Shift Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 CS_7-CS_0: Y-axis Constant Shift Value
+*******************************************************************************/
+#define LIS3DSH_CS_Y_ADDR                    0x14
+
+/*******************************************************************************
+*  CS_Z Register: Z-axis Constant Shift Value Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 CS_7-CS_0: Z-axis Constant Shift Value
+*******************************************************************************/
+#define LIS3DSH_CS_Z_ADDR                    0x15
+
+/*******************************************************************************
+*  LC_L Register: Long Counter Low Register
+*  Read Write register
+*  Default value: 0x01
+*  7:0 LC_L_7-LC_L_0: Long Counter Low Value
+*******************************************************************************/
+#define LIS3DSH_LC_L_ADDR                    0x16
+
+/*******************************************************************************
+*  LC_H Register: Long Counter High Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 LC_H_7-LC_H_0: Long Counter Low Value
+*******************************************************************************/
+#define LIS3DSH_LC_H_ADDR                    0x17
+
+/*******************************************************************************
+*  STAT Register: State Machine Register
+*  Read only register
+*  Default value: 0x00
+*  7 LONG: LONG flag common to both State Machines
+*          0 - no interrupt
+*          1 - LongCounter interrupt flag
+*  6 SYNCW: Common information for OUTW host action waiting
+*           0 - no action waiting from Host
+*           1 - Host action is waiting after OUTW command
+*  5 SYNC1: 
+*           0 - State Machine 1 running normally
+*           1 - SM1 stopped and waiting for restart request from SM2
+*  4 SYNC2: 
+*           0 - State Machine 2 running normally
+*           1 - SM2 stopped and waiting for restart request from SM1
+*  3 INT_SM1: Interrupt signal on SM1 is reset when OUTS1 register is read  
+*             0 - no interrupt on State Machine 1 
+*             1 - State Machine 1 interrupt happened       
+*  2 INT_SM2: Interrupt signal on SM2 is reset when OUTS2 register is read  
+*             0 - no interrupt on State Machine 2 
+*             1 - State Machine 2 interrupt happened
+*  1 DOR: Data OverRun bit 
+*         0 - no overrun 
+*         1 - data overrun
+*  0 DRDY: New data are ready in output registers
+*         0 - data not ready
+*         1 - data ready
+*******************************************************************************/
+#define LIS3DSH_STAT_ADDR                    0x18
+
+/*******************************************************************************
+*  PEAK1 Register: Peak 1 Register
+*  Read only register
+*  Default value: 0x00
+*  7:0 PKx_7-PKx_0: Peak 1 Value for SM1
+*******************************************************************************/
+#define LIS3DSH_PEAK1_ADDR                   0x19
+
+/*******************************************************************************
+*  PEAK2 Register: Peak 2 Register
+*  Read only register
+*  Default value: 0x00
+*  7:0 PKx_7-PKx_0: Peak 2 value for SM2
+*******************************************************************************/
+#define LIS3DSH_PEAK2_ADDR                   0x1A
+
+/*******************************************************************************
+*  VFC_1 Register: Vector Filter Coefficient 1 Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 VFC1_7-VFC1_0: Vector Filter Coefficient 1 Value
+*******************************************************************************/
+#define LIS3DSH_VFC_1_ADDR                   0x1B
+
+/*******************************************************************************
+*  VFC_2 Register: Vector Filter Coefficient 2 Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 VFC2_7-VFC2_0: Vector Filter Coefficient 2 Value
+*******************************************************************************/
+#define LIS3DSH_VFC_2_ADDR                   0x1C
+
+/*******************************************************************************
+*  VFC_3 Register: Vector Filter Coefficient 3 Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 VFC3_7-VFC3_0: Vector Filter Coefficient 3 Value
+*******************************************************************************/
+#define LIS3DSH_VFC_3_ADDR                   0x1D
+
+/*******************************************************************************
+*  VFC_4 Register: Vector Filter Coefficient 4 Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 VFC4_7-VFC4_0: Vector Filter Coefficient 4 Value
+*******************************************************************************/
+#define LIS3DSH_VFC_4_ADDR                   0x1E
+
+/*******************************************************************************
+*  THRS3 Register: Threshold Value 3 Register
+*  Read Write register
+*  Default value: 0x00
+*  7:0 THRS3_7-THRS3_0: Common Threshold for Overrun Detection Value
+*******************************************************************************/
+#define LIS3DSH_THRS3_ADDR                   0x1F
+
+/*******************************************************************************
+*  CTRL_REG4 Register: Control Register 4
+*  Read Write register
+*  Default value: 0x07
+*  7:4 ODR3-ODR0: Data rate selection
+*            ODR3 | ODR2 | ODR1 | ORD0 | ORD Selection
+*            -------------------------------------------
+*              0  |  0   |  0   |  0   | Power Down (Default)
+*              0  |  0   |  0   |  1   | 3.125 Hz
+*              0  |  0   |  1   |  0   | 6.25 Hz
+*              0  |  0   |  1   |  1   | 12.5 Hz
+*              0  |  1   |  0   |  0   | 25 Hz
+*              0  |  1   |  0   |  1   | 50 Hz
+*              0  |  1   |  1   |  0   | 100 Hz
+*              0  |  1   |  1   |  1   | 400 Hz
+*              1  |  0   |  0   |  0   | 800 Hz
+*              1  |  0   |  0   |  1   | 1600 Hz
+*
+*  3 BDU: Block data update
+*         0: Output register not updated until High and Low reading (Default)
+*         1: Continuous update
+*  2 ZEN: 
+*         0: Z-axis disable (Default)
+*         1: Z-axis enable
+*  1 YEN:  
+*         0: Y-axis disable (Default)
+*         1: Y-axis enable
+*  0 XEN:  
+*         0: Y-axis disable (Default)
+*         1: Y-axis enable
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG4_ADDR               0x20
+
+/*******************************************************************************
+*  CTRL_REG1 Register: Control Register 1 (SM1 interrupt configuration register)
+*  Read Write register
+*  Default value: 0x00
+*  7:5 HYST1_2-HYST1_0: Hysteresis which is added or subtracted from the  
+*                       threshold values (THRS1_1 and THRS2_1) of SM1.
+*                       000 = 0 (Default)
+*                       111 = 7 (maximum Hysteresis)
+*  4 Reserved
+*  3 SM1_INT: 
+*            0: State Machine 1 interrupt routed to INT1 (Default)
+*            1: State Machine 1 interrupt routed to INT2
+*  2 Reserved
+*  1 Reserved
+*  0 SM1_EN: 
+*           0: State Machine 1 disabled. Temporary memories and registers 
+*              related to this State Machine are left intact. (Default)
+*           1: State Machine 1 enabled. 
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG1_ADDR               0x21
+
+/*******************************************************************************
+*  CTRL_REG2 Register: Control Register 2 (SM2 interrupt configuration register)
+*  Read Write register
+*  Default value: 0x00
+*  7:5 HYST2_2-HYST2_0: Hysteresis which is added or subtracted from the  
+*                       threshold values (THRS1_2 and THRS2_2) of SM1.
+*                       000 = 0 (Default)
+*                       111 = 7 (maximum Hysteresis)
+*  4 Reserved
+*  3 SM2_INT: 
+*            0: State Machine 2 interrupt routed to INT1 (Default)
+*            1: State Machine 2 interrupt routed to INT2
+*  2 Reserved
+*  1 Reserved
+*  0 SM2_EN: 
+*           0: State Machine 2 disabled. Temporary memories and registers 
+*              related to this State Machine are left intact. (Default)
+*           1: State Machine 2 enabled. 
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG2_ADDR               0x22
+
+/*******************************************************************************
+*  CTRL_REG3 Register: Control Register 3
+*  Read Write register
+*  Default value: 0x00
+*  7 DR_EN: Data-ready interrupt
+*          0 - Data-ready interrupt disabled (Default)
+*          1 - Data-ready interrupt enabled and routed to INT1
+*  6 IEA:  
+*         0 - Interrupt signal active LOW (Default)
+*         1 - Interrupt signal active HIGH
+*  5 IEL: 
+*         0 - Interrupt latched (Default)
+*         1 - Interrupt pulsed
+*  4 INT2_EN: 
+*             0 - INT2 signal disabled (High-Z state) (Default)
+*             1 - INT2 signal enabled (signal pin fully functional)
+*  3 INT1_EN:  
+*             0 - INT1 (DRDY) signal disabled (High-Z state) (Default)
+*             1 - INT1 (DRDY) signal enabled (signal pin fully functional) DR_EN bit in CTRL_REG3 register should be taken into account too
+*  2 VLIFT:  
+*           0 - Vector filter disabled (Default)
+*           1 - Vector filter enabled
+*  1 Reserved  
+*  0 STRT: Soft Reset  
+*          0 - (Default)
+*          1 - it resets the whole internal logic circuitry. It automatically returns to 0.
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG3_ADDR               0x23              
+
+/*******************************************************************************
+*  CTRL_REG5 Register: Control Register 5
+*  Read Write register
+*  Default value: 0x00
+*  7:6 BW2-BW1: Anti aliasing filter bandwidth
+*            BW2 | BW1 | BW Selection
+*            -------------------------
+*             0  |  0  | 800 Hz (Default)
+*             0  |  1  | 40 Hz
+*             1  |  0  | 200 Hz
+*             1  |  1  | 50 Hz
+*
+*  5:3 FSCALE2-FSCALE0: Full scale selection
+*            FSCALE2 | FSCALE1 | FSCALE0 | Full scale selection
+*            --------------------------------------------------
+*               0    |    0    |    0    | +/-2g (Default)
+*               0    |    0    |    1    | +/-4g
+*               0    |    1    |    0    | +/-6g
+*               0    |    1    |    1    | +/-8g
+*               1    |    0    |    0    | +/-16g
+*
+*  2:1 ST2_ST1: Self-test Enable
+*            ST2 | ST1 | ST Selection
+*            -------------------------
+*             0  |  0  | Normal Mode (Default)
+*             0  |  1  | Positive sign self-test
+*             1  |  0  | Negative sign-test
+*             1  |  1  | Not Allowed
+*
+*  0 SIM: SPI serial internal interface mode selection  
+*         0: 4-wire interface (Default)
+*         1: 3-wire interface
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG5_ADDR               0x24
+
+/*******************************************************************************
+*  CTRL_REG6 Register: Control Register 6
+*  Read Write register
+*  Default value: 0x00
+*  7 BOOT: Force reboot, cleared as soon as the reboot is finished. Active High. 
+*  6 FIFO_EN: FIFO Enable 
+*             0: disable (Default)
+*             1: enable
+*  5 STP_WTM: Stop on Watermark - FIFO depth can be limited at the Watermark value, by setting to “1” the STP_WTM bit. 
+*             0: disable (Default)
+*             1: enable
+*  4 IF_ADD_INC: Register address automatically increased during a multiple byte access with a serial interface (I2C or SPI)
+*                0: disable (Default)
+*                1: enable
+*  3 I1_EMPTY: Enable FIFO Empty indication on INT1 pin.
+*              0: disable (Default)
+*              1: enable
+*  2 I1_WTM: FIFO Watermark interrupt on INT1 pin.
+*            0: disable (Default)
+*            1: enable
+*  1 I1_OVERRUN: FIFO Overrun interrupt on INT1 pin.
+*                0: disable (Default)
+*                1: enable
+*  0 I2_BOOT: BOOT interrupt on INT2 pin. 
+*                0: disable (Default)
+*                1: enable
+*******************************************************************************/
+#define LIS3DSH_CTRL_REG6_ADDR               0x25
+
+/*******************************************************************************
+*  STATUS Register: Status Data Register
+*  Read only register
+*  Default value: 0x00
+*  7 ZYXOR: X, Y and Z-axis Data Overrun.  
+*           0: no Overrun has occurred (Default)
+*           1: a new set of data has overwritten the previous ones
+*  6 ZOR: Z-axis Data Overrun.  
+*         0: no Overrun has occurred (Default)
+*         1: a new data for the Z-axis has overwritten the previous ones
+*  5 YOR: Y-axis Data Overrun.  
+*         0: no Overrun has occurred (Default)
+*         1: a new data for the Y-axis has overwritten the previous ones
+*  4 XOR: X-axis Data Overrun.  
+*         0: no Overrun has occurred (Default)
+*         1: a new data for the X-axis has overwritten the previous ones
+*  3 ZYXDA: X, Y and Z-axis new Data Available.  
+*           0: a new set of data is not yet available (Default)
+*           1: a new set of data is available
+*  2 ZDA: Z-axis new data available.  
+*         0: a new data for the Z-axis is not yet available (Default)
+*         1: a new data for Z-axis is available
+*  1 YDA: Y-axis new data available.  
+*         0: a new data for the Y-axis is not yet available (Default)
+*         1: a new data for Y-axis is available
+*  0 XDA: X-axis new data available.  
+*         0: a new data for the X-axis is not yet available (Default)
+*         1: a new data for X-axis is available
+*******************************************************************************/
+#define LIS3DSH_STATUS_ADDR                  0x27
+
+/*******************************************************************************
+*  OUT_X_L Register: X-axis Output Acceleration Low Data
+*  Read only register
+*  Default value: output
+*  7:0 XD7-XD0: X-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_X_L_ADDR                 0x28
+
+/*******************************************************************************
+*  OUT_X_H Register: X-axis Output Acceleration High Data
+*  Read only register
+*  Default value: output
+*  15:8 XD15-XD8: X-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_X_H_ADDR                 0x29
+
+/*******************************************************************************
+*  OUT_Y_L Register: Y-axis Output Acceleration Low Data
+*  Read only register
+*  Default value: output
+*  7:0 YD7-YD0: Y-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_Y_L_ADDR                 0x2A
+
+/*******************************************************************************
+*  OUT_Y_H Register: Y-axis Output Acceleration High Data
+*  Read only register
+*  Default value: output
+*  15:8 YD15-YD8: Y-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_Y_H_ADDR                 0x2B
+
+/*******************************************************************************
+*  OUT_Z_L Register: Z-axis Output Acceleration Low Data
+*  Read only register
+*  Default value: output
+*  7:0 ZD7-ZD0: Z-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_Z_L_ADDR                 0x2C
+
+/*******************************************************************************
+*  OUT_Z_H Register: Z-axis Output Acceleration High Data
+*  Read only register
+*  Default value: output
+*  15:8 ZD15-ZD8: Z-axis output Data
+*******************************************************************************/
+#define LIS3DSH_OUT_Z_H_ADDR                 0x2D
+
+/*******************************************************************************
+*  FIFO_CTRL Register: FIFO Control Register
+*  Read/Write register
+*  Default value: 0x00
+*  7:5 FMODE2-FMODE0: FIFO mode
+*        FMODE2 | FMODE1 | FMODE0 | Mode description
+*        --------------------------------------------------
+*          0    |    0   |    0   | Bypass mode. FIFO turned off. (Default)
+*          0    |    0   |    1   | FIFO mode. Stop collecting data when FIFO is full.
+*          0    |    1   |    0   | Stream mode. If the FIFO is full, the new sample overwrites the older one (circular buffer). 
+*          0    |    1   |    1   | Stream mode until trigger is de-asserted, then FIFO mode.
+*          1    |    0   |    0   | Bypass mode until trigger is de-asserted, then Stream mode.
+*          1    |    0   |    1   | Not to use.
+*          1    |    1   |    0   | Not to use. 
+*          1    |    1   |    1   | Bypass mode until trigger is de-asserted, then FIFO mode.
+*
+*  4:0 WTMP4-WTMP0: FIFO Watermark pointer. It is the FIFO depth when the Watermark is enabled
+*******************************************************************************/
+#define LIS3DSH_FIFO_CTRL_ADDR               0x2E
+
+/*******************************************************************************
+*  FIFO_SRC Register: FIFO Source Register
+*  Read only register
+*  Default value: 0x00
+*  7 WTM: Watermark status.  
+*         0: FIFO filling is lower than WTM level (Default)
+*         1: FIFO filling is equal or higher than WTM level 
+*  6 OVRN_FIFO: Overrun bit status.  
+*               0: FIFO is not completely filled (Default)
+*               1: FIFO is completely filled
+*  5 EMPTY: Overrun bit status.  
+*           0: FIFO not empty (Default)
+*           1: FIFO empty
+*  4:0 FSS: Number of samples stored in the FIFO - 1
+*******************************************************************************/
+#define LIS3DSH_FIFO_SRC_ADDR                0x2F
+
+/*******************************************************************************
+*  ST1_X Register: State Machine 1 Code Registers
+*  Write only register
+*  Default value: 0x00
+*  7:0 ST1_7-ST1_0: State Machine 1 Code Registers
+*******************************************************************************/
+#define LIS3DSH_ST1_1_ADDR                   0x40
+#define LIS3DSH_ST1_2_ADDR                   0x41
+#define LIS3DSH_ST1_3_ADDR                   0x42
+#define LIS3DSH_ST1_4_ADDR                   0x43
+#define LIS3DSH_ST1_5_ADDR                   0x44
+#define LIS3DSH_ST1_6_ADDR                   0x45
+#define LIS3DSH_ST1_7_ADDR                   0x46
+#define LIS3DSH_ST1_8_ADDR                   0x47
+#define LIS3DSH_ST1_9_ADDR                   0x48
+#define LIS3DSH_ST1_10_ADDR                  0x49
+#define LIS3DSH_ST1_11_ADDR                  0x4A
+#define LIS3DSH_ST1_12_ADDR                  0x4B
+#define LIS3DSH_ST1_13_ADDR                  0x4C
+#define LIS3DSH_ST1_14_ADDR                  0x4D
+#define LIS3DSH_ST1_15_ADDR                  0x4E
+#define LIS3DSH_ST1_16_ADDR                  0x4F
+
+/*******************************************************************************
+*  TIM4_1 Register: SM1 General Timer 4 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM1 Timer 4 Counter 1 Value
+*******************************************************************************/
+#define LIS3DSH_TIM4_1_ADDR                  0x50
+
+/*******************************************************************************
+*  TIM3_1 Register: SM1 General Timer 3 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM1 Timer 3 Counter 1 Value
+*******************************************************************************/
+#define LIS3DSH_TIM3_1_ADDR                  0x51 
+
+/*******************************************************************************
+*  TIM2_1_L Register: SM1 General Timer 2 Low Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM1 Timer 2 Counter 1 Low Value
+*******************************************************************************/
+#define LIS3DSH_TIM2_1_L_ADDR                0x52 
+
+/*******************************************************************************
+*  TIM2_1_H Register: SM1 General Timer 2 High Register
+*  Write only register
+*  Default value: 0x00
+*  15:8 TM_15-TM_8: SM1 Timer 2 Counter 1 High Value
+*******************************************************************************/
+#define LIS3DSH_TIM2_1_H_ADDR                0x53 
+
+/*******************************************************************************
+*  TIM1_1_L Register: SM1 General Timer 1 Low Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM1 Timer 1 Counter 1 Low Value
+*******************************************************************************/
+#define LIS3DSH_TIM1_1_L_ADDR                0x54
+
+/*******************************************************************************
+*  TIM1_1_H Register: SM1 General Timer 1 High Register
+*  Write only register
+*  Default value: 0x00
+*  15:8 TM_15-TM_8: SM1 Timer 1 Counter 1 High Value
+*******************************************************************************/
+#define LIS3DSH_TIM1_1_H_ADDR                0x55
+
+/*******************************************************************************
+*  THRS2_1 Register: SM1 Threshold Value 1 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 THS7-THS0: SM1 Threshold Value 1
+*******************************************************************************/
+#define LIS3DSH_THRS2_1_ADDR                 0x56
+
+/*******************************************************************************
+*  THRS1_1 Register: SM1 Threshold Value 2 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 THS7-THS0: SM1 Threshold Value 2
+*******************************************************************************/
+#define LIS3DSH_THRS1_1_ADDR                 0x57
+
+/*******************************************************************************
+*  MASK1_B Register: SM1 Swap Axis and Sign Mask Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_X: X-Axis Positive Motion Detection 
+*         0: X+ disabled 
+*         1: X+ enabled
+*  6 N_X: X-Axis Negative Motion Detection 
+*         0: X- disabled 
+*         1: X- enabled
+*  5 P_Y: Y-Axis Positive Motion Detection 
+*         0: Y+ disabled 
+*         1: Y+ enabled
+*  4 N_Y: Y-Axis Negative Motion Detection 
+*         0: Y- disabled 
+*         1: Y- enabled
+*  3 P_Z: X-Axis Positive Motion Detection 
+*         0: Z+ disabled 
+*         1: Z+ enabled
+*  2 N_Z: X-Axis Negative Motion Detection 
+*         0: Z- disabled 
+*         1: Z- enabled
+*  1 P_V: 
+*         0: V+ disabled 
+*         1: V+ enabled
+*  0 N_V:  
+*         0: V- disabled 
+*         1: V- enabled
+*******************************************************************************/
+#define LIS3DSH_MASK1_B_ADDR                 0x59
+
+/*******************************************************************************
+*  MASK1_A Register: SM1 Default Axis and Sign Mask Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_X: X-Axis Positive Motion Detection 
+*         0: X+ disabled 
+*         1: X+ enabled
+*  6 N_X: X-Axis Negative Motion Detection 
+*         0: X- disabled 
+*         1: X- enabled
+*  5 P_Y: Y-Axis Positive Motion Detection 
+*         0: Y+ disabled 
+*         1: Y+ enabled
+*  4 N_Y: Y-Axis Negative Motion Detection 
+*         0: Y- disabled 
+*         1: Y- enabled
+*  3 P_Z: X-Axis Positive Motion Detection 
+*         0: Z+ disabled 
+*         1: Z+ enabled
+*  2 N_Z: X-Axis Negative Motion Detection 
+*         0: Z- disabled 
+*         1: Z- enabled
+*  1 P_V: 
+*         0: V+ disabled 
+*         1: V+ enabled
+*  0 N_V:  
+*         0: V- disabled 
+*         1: V- enabled
+*******************************************************************************/
+#define LIS3DSH_MASK1_A_ADDR                 0x5A
+
+/*******************************************************************************
+*  SETT1 Register: SM1 Detection Settings Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_DET: SM1 peak detection bit 
+*           0: peak detection disabled (Default) 
+*           1: peak detection enabled
+*  6 THR3_SA:  
+*             0: no action (Default)
+*             1: threshold 3 enabled for axis and sign mask reset (MASK1_B)
+*  5 ABS:  
+*         0: unsigned thresholds THRSx (Default)
+*         1: signed thresholds THRSx
+*  4 Reserved
+*  3 Reserved
+*  2 THR3_MA:  
+*             0: no action (Default)
+*             1: threshold 3 enabled for axis and sign mask reset (MASK1_A)
+*  1 R_TAM: Next condition validation flag
+*           0: mask frozen on the axis that triggers the condition (Default)
+*           1: standard mask always evaluated
+*  0 SITR:  
+*          0: no actions (Default) 
+*          1: STOP and CONT commands generate an interrupt and perform output 
+*             actions as OUTC command.
+*******************************************************************************/
+#define LIS3DSH_SETT1_ADDR                   0x5B
+
+/*******************************************************************************
+*  PR1 Register: SM1 Program and Reset Pointers Register
+*  Read only register
+*  Default value: 0x00
+*  7:4 PP3-PP0: SM1 program pointer address
+*  3:0 RP3-RP0: SM1 reset pointer address
+*******************************************************************************/
+#define LIS3DSH_PR1_ADDR                     0x5C
+
+/*******************************************************************************
+*  TC1_L Register: SM1 General Timer Counter Low Register
+*  Read only register
+*  Default value: 0x00
+*  7:0 TC1_7-TC1_0: SM1 General Timer Counter Low Value
+*******************************************************************************/
+#define LIS3DSH_TC1_L_ADDR                   0x5D
+
+/*******************************************************************************
+*  TC1_H Register: SM1 General Timer Counter High Register
+*  Read only register
+*  Default value: 0x00
+*  15:8 TC1_15-TC1_8: SM1 General Timer Counter High Value
+*******************************************************************************/
+#define LIS3DSH_TC1_H_ADDR                   0x5E
+
+/*******************************************************************************
+*  OUTS1 Register: SM1 Output Set Flag Register
+*  Read only register
+*  Default value: 0x00
+*  7 P_X: 
+*         0: X+ noshow 
+*         1: X+ show
+*  6 N_X: 
+*         0: X- noshow
+*         1: X- show
+*  5 P_Y:  
+*         0: Y+ noshow 
+*         1: Y+ show
+*  4 N_Y:  
+*         0: Y- noshow
+*         1: Y- show
+*  3 P_Z:  
+*         0: Z+ noshow 
+*         1: Z+ show
+*  2 N_Z:  
+*         0: Z- noshow
+*         1: Z- show
+*  1 P_V: 
+*         0: V+ noshow
+*         1: V+ show
+*  0 N_V:  
+*         0: V- noshow
+*         1: V- show
+*******************************************************************************/
+#define LIS3DSH_OUTS1_ADDR                   0x5F
+
+/*******************************************************************************
+*  ST2_X Register: State Machine 2 Code Registers
+*  Write only register
+*  Default value: 0x00
+*  7:0 ST2_7-ST2_0: State Machine 2 Code Registers
+*******************************************************************************/
+#define LIS3DSH_ST2_1_ADDR                   0x60
+#define LIS3DSH_ST2_2_ADDR                   0x61
+#define LIS3DSH_ST2_3_ADDR                   0x62
+#define LIS3DSH_ST2_4_ADDR                   0x63
+#define LIS3DSH_ST2_5_ADDR                   0x64
+#define LIS3DSH_ST2_6_ADDR                   0x65
+#define LIS3DSH_ST2_7_ADDR                   0x66
+#define LIS3DSH_ST2_8_ADDR                   0x67
+#define LIS3DSH_ST2_9_ADDR                   0x68
+#define LIS3DSH_ST2_10_ADDR                  0x69
+#define LIS3DSH_ST2_11_ADDR                  0x6A
+#define LIS3DSH_ST2_12_ADDR                  0x6B
+#define LIS3DSH_ST2_13_ADDR                  0x6C
+#define LIS3DSH_ST2_14_ADDR                  0x6D
+#define LIS3DSH_ST2_15_ADDR                  0x6E
+#define LIS3DSH_ST2_16_ADDR                  0x6F
+
+/*******************************************************************************
+*  TIM4_2 Register: SM2 General Timer 4 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM2 Timer 4 Counter 1 Value
+*******************************************************************************/
+#define LIS3DSH_TIM4_2_ADDR                  0x70 
+
+/*******************************************************************************
+*  TIM3_2 Register: SM2 General Timer 3 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM2 Timer 3 Counter 2 Value
+*******************************************************************************/
+#define LIS3DSH_TIM3_2_ADDR                  0x71
+
+/*******************************************************************************
+*  TIM2_2_L Register: SM2 General Timer 2 Low Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM2 Timer 2 Counter 2 Low Value
+*******************************************************************************/
+#define LIS3DSH_TIM2_2_L_ADDR                0x72
+
+/*******************************************************************************
+*  TIM2_2_H Register: SM2 General Timer 2 High Register
+*  Write only register
+*  Default value: 0x00
+*  15:8 TM_15-TM_8: SM2 Timer 2 Counter 2 High Value
+*******************************************************************************/
+#define LIS3DSH_TIM2_2_H_ADDR                0x73
+
+/*******************************************************************************
+*  TIM1_2_L Register: SM2 General Timer 1 Low Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 TM_7-TM_0: SM2 Timer 1 Counter 2 Low Value
+*******************************************************************************/
+#define LIS3DSH_TIM1_2_L_ADDR                0x74
+
+/*******************************************************************************
+*  TIM1_2_H Register: SM2 General Timer 1 High Register
+*  Write only register
+*  Default value: 0x00
+*  15:8 TM_15-TM_8: SM2 Timer 1 Counter 2 High Value
+*******************************************************************************/
+#define LIS3DSH_TIM1_2_H_ADDR                0x75
+
+/*******************************************************************************
+*  THRS2_2 Register: SM2 Threshold Value 1 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 THS7-THS0: SM2 Threshold Value
+*******************************************************************************/
+#define LIS3DSH_THRS2_2_ADDR                 0x76
+
+/*******************************************************************************
+*  THRS1_2 Register: SM2 Threshold Value 2 Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 THS7-THS0: SM2 Threshold Value
+*******************************************************************************/
+#define LIS3DSH_THRS1_2_ADDR                 0x77
+
+/*******************************************************************************
+*  DES2 Register: SM2 Decimation Counter Value Register
+*  Write only register
+*  Default value: 0x00
+*  7:0 D7-D0: SM2 Decimation Counter Value
+*******************************************************************************/
+#define LIS3DSH_DES2_ADDR                    0x78
+
+/*******************************************************************************
+*  MASK2_B Register: SM2 Axis and Sign Mask Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_X: X-Axis Positive Motion Detection 
+*         0: X+ disabled 
+*         1: X+ enabled
+*  6 N_X: X-Axis Negative Motion Detection 
+*         0: X- disabled 
+*         1: X- enabled
+*  5 P_Y: Y-Axis Positive Motion Detection 
+*         0: Y+ disabled 
+*         1: Y+ enabled
+*  4 N_Y: Y-Axis Negative Motion Detection 
+*         0: Y- disabled 
+*         1: Y- enabled
+*  3 P_Z: X-Axis Positive Motion Detection 
+*         0: Z+ disabled 
+*         1: Z+ enabled
+*  2 N_Z: X-Axis Negative Motion Detection 
+*         0: Z- disabled 
+*         1: Z- enabled
+*  1 P_V: 
+*         0: V+ disabled 
+*         1: V+ enabled
+*  0 N_V:  
+*         0: V- disabled 
+*         1: V- enabled
+*******************************************************************************/
+#define LIS3DSH_MASK2_B_ADDR                 0x79
+
+/*******************************************************************************
+*  MASK2_A Register: SM2 Axis and Sign Mask Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_X: X-Axis Positive Motion Detection 
+*         0: X+ disabled 
+*         1: X+ enabled
+*  6 N_X: X-Axis Negative Motion Detection 
+*         0: X- disabled 
+*         1: X- enabled
+*  5 P_Y: Y-Axis Positive Motion Detection 
+*         0: Y+ disabled 
+*         1: Y+ enabled
+*  4 N_Y: Y-Axis Negative Motion Detection 
+*         0: Y- disabled 
+*         1: Y- enabled
+*  3 P_Z: X-Axis Positive Motion Detection 
+*         0: Z+ disabled 
+*         1: Z+ enabled
+*  2 N_Z: X-Axis Negative Motion Detection 
+*         0: Z- disabled 
+*         1: Z- enabled
+*  1 P_V: 
+*         0: V+ disabled 
+*         1: V+ enabled
+*  0 N_V:  
+*         0: V- disabled 
+*         1: V- enabled
+*******************************************************************************/
+#define LIS3DSH_MASK2_A_ADDR                 0x7A
+
+/*******************************************************************************
+*  SETT2 Register: SM2 Detection Settings Register
+*  Write only register
+*  Default value: 0x00
+*  7 P_DET: SM2 peak detection 
+*           0: peak detection disabled (Default) 
+*           1: peak detection enabled
+*  6 THR3_SA:  
+*             0: no action (Default)
+*             1: threshold 3 limit value for axis and sign mask reset (MASK2_B)
+*  5 ABS:  
+*         0: unsigned thresholds (Default)
+*         1: signed thresholds
+*  4 RADI:  
+*          0: raw data 
+*          1: diff data for State Machine 2 
+*  3 D_CS:  
+*          0: DIFF2 enabled (difference between current data and previous data)
+*          1: constant shift enabled (difference between current data and constant values)     
+*  2 THR3_MA:  
+*             0: no action (Default)
+*             1: threshold 3 enabled for axis and sign mask reset (MASK2_A)
+*  1 R_TAM: Next condition validation flag
+*           0: mask frozen on the axis that triggers the condition (Default)
+*           1: standard mask always evaluated
+*  0 SITR:  
+*          0: no actions (Default) 
+*          1: STOP and CONT commands generate an interrupt and perform output 
+*             actions as OUTC command.
+*******************************************************************************/
+#define LIS3DSH_SETT2_ADDR                   0x7B
+
+/*******************************************************************************
+*  PR2 Register: SM2 Program and Reset Pointers Register
+*  Read only register
+*  Default value: 0x00
+*  7:4 PP3-PP0: SM1 program pointer address
+*  3:0 RP3-RP0: SM1 reset pointer address
+*******************************************************************************/
+#define LIS3DSH_PR2_ADDR                     0x7C
+
+/*******************************************************************************
+*  TC2_L Register: SM2 General Timer Counter Low Register
+*  Read only register
+*  Default value: 0x00
+*  7:0 TC2_7-TC2_0: SM2 General Timer Counter Low Value
+*******************************************************************************/
+#define LIS3DSH_TC2_L_ADDR                   0x7D
+
+/*******************************************************************************
+*  TC2_H Register: SM2 General Timer Counter High Register
+*  Read only register
+*  Default value: 0x00
+*  15:8 TC2_15-TC2_8: SM2 General Timer Counter High Value
+*******************************************************************************/
+#define LIS3DSH_TC2_H_ADDR                   0x7E
+
+/*******************************************************************************
+*  OUTS2 Register: SM2 Output Set Flag Register
+*  Read only register
+*  Default value: 0x00
+*  7 P_X: 
+*         0: X+ noshow 
+*         1: X+ show
+*  6 N_X: 
+*         0: X- noshow
+*         1: X- show
+*  5 P_Y:  
+*         0: Y+ noshow 
+*         1: Y+ show
+*  4 N_Y:  
+*         0: Y- noshow
+*         1: Y- show
+*  3 P_Z:  
+*         0: Z+ noshow 
+*         1: Z+ show
+*  2 N_Z:  
+*         0: Z- noshow
+*         1: Z- show
+*  1 P_V: 
+*         0: V+ noshow
+*         1: V+ show
+*  0 N_V:  
+*         0: V- noshow
+*         1: V- show
+*******************************************************************************/
+#define LIS3DSH_OUTS2_ADDR                   0x7F
+
+/******************************************************************************/
+/**************************** END REGISTER MAPPING  ***************************/
+/******************************************************************************/
+#define I_AM_LIS3DSH                         0x3F
+
+/** @defgroup Sensitivity_selection               
+  * @{
+  */
+#define LIS3DSH_SENSITIVITY_0_06G            0.06  /* 0.06 mg/digit*/
+#define LIS3DSH_SENSITIVITY_0_12G            0.12  /* 0.12 mg/digit*/
+#define LIS3DSH_SENSITIVITY_0_18G            0.18  /* 0.18 mg/digit*/
+#define LIS3DSH_SENSITIVITY_0_24G            0.24  /* 0.24 mg/digit*/
+#define LIS3DSH_SENSITIVITY_0_73G            0.73  /* 0.73 mg/digit*/
+/**
+  * @}
+  */
+
+/** @defgroup Data_Rate_Power_Mode_selection                
+  * @{
+  */
+#define LIS3DSH_DATARATE_POWERDOWN           ((uint8_t)0x00)  /* Power Down Mode*/
+#define LIS3DSH_DATARATE_3_125               ((uint8_t)0x10)  /* 3.125 Hz Normal Mode */
+#define LIS3DSH_DATARATE_6_25                ((uint8_t)0x20)  /* 6.25  Hz Normal Mode */
+#define LIS3DSH_DATARATE_12_5                ((uint8_t)0x30)  /* 12.5  Hz Normal Mode */
+#define LIS3DSH_DATARATE_25                  ((uint8_t)0x40)  /* 25    Hz Normal Mode */
+#define LIS3DSH_DATARATE_50                  ((uint8_t)0x50)  /* 50    Hz Normal Mode */
+#define LIS3DSH_DATARATE_100                 ((uint8_t)0x60)  /* 100   Hz Normal Mode */
+#define LIS3DSH_DATARATE_400                 ((uint8_t)0x70)  /* 400   Hz Normal Mode */
+#define LIS3DSH_DATARATE_800                 ((uint8_t)0x80)  /* 800   Hz Normal Mode */
+#define LIS3DSH_DATARATE_1600                ((uint8_t)0x90)  /* 1600  Hz Normal Mode */
+/**
+  * @}
+  */
+  
+/** @defgroup Full_Scale_selection 
+  * @{
+  */
+#define LIS3DSH_FULLSCALE_2                  ((uint8_t)0x00)  /* 2 g  */
+#define LIS3DSH_FULLSCALE_4                  ((uint8_t)0x08)  /* 4 g  */
+#define LIS3DSH_FULLSCALE_6                  ((uint8_t)0x10)  /* 6 g  */
+#define LIS3DSH_FULLSCALE_8                  ((uint8_t)0x18)  /* 8 g  */
+#define LIS3DSH_FULLSCALE_16                 ((uint8_t)0x20)  /* 16 g */
+#define LIS3DSH__FULLSCALE_SELECTION         ((uint8_t)0x38)
+/**
+  * @}
+  */
+    
+/** @defgroup Anti-Aliasing_Filter_Bandwidth 
+  * @{
+  */
+#define LIS3DSH_FILTER_BW_800                ((uint8_t)0x00)  /* 800 Hz */
+#define LIS3DSH_FILTER_BW_40                 ((uint8_t)0x08)  /* 40 Hz  */
+#define LIS3DSH_FILTER_BW_200                ((uint8_t)0x10)  /* 200 Hz */
+#define LIS3DSH_FILTER_BW_50                 ((uint8_t)0x18)  /* 50 Hz  */
+/**
+  * @}
+  */
+  
+/** @defgroup Self_Test_selection
+  * @{
+  */
+#define LIS3DSH_SELFTEST_NORMAL              ((uint8_t)0x00)
+#define LIS3DSH_SELFTEST_P                   ((uint8_t)0x02)
+#define LIS3DSH_SELFTEST_M                   ((uint8_t)0x04)
+/**
+  * @}
+  */  
+
+/** @defgroup Direction_XYZ_selection  
+  * @{
+  */
+#define LIS3DSH_X_ENABLE                     ((uint8_t)0x01)
+#define LIS3DSH_Y_ENABLE                     ((uint8_t)0x02)
+#define LIS3DSH_Z_ENABLE                     ((uint8_t)0x04)
+#define LIS3DSH_XYZ_ENABLE                   ((uint8_t)0x07)
+/**
+  * @}
+  */
+ 
+/** @defgroup SPI_Serial_Interface_Mode_selection  
+  * @{
+  */
+#define LIS3DSH_SERIALINTERFACE_4WIRE        ((uint8_t)0x00)
+#define LIS3DSH_SERIALINTERFACE_3WIRE        ((uint8_t)0x01)
+/**
+  * @}
+  */ 
+
+/** @defgroup Interrupt_Request_selection    Interrupt_Selection_Enable
+  * @{
+  */
+#define LIS3DSH_INTERRUPT_REQUEST_LATCHED    ((uint8_t)0x00)
+#define LIS3DSH_INTERRUPT_REQUEST_PULSED     ((uint8_t)0x20)
+/**
+  * @}
+  */ 
+
+/** @defgroup Interrupt_Selection_Enable
+  * @{
+  */
+#define LIS3DSH_INTERRUPT_1_ENABLE           ((uint8_t)0x88)
+#define LIS3DSH_INTERRUPT_2_ENABLE           ((uint8_t)0x00)
+#define LIS3DSH_INTERRUPT_1_2_ENABLE         ((uint8_t)0x88)
+/**
+  * @}
+  */ 
+
+/** @defgroup Interrupt_Signal_Active_Selection
+  * @{
+  */
+#define LIS3DSH_INTERRUPT_SIGNAL_LOW         ((uint8_t)0x00)
+#define LIS3DSH_INTERRUPT_SIGNAL_HIGH        ((uint8_t)0x40)
+/**
+  * @}
+  */ 
+
+/** @defgroup State_Machine_Enable
+  * @{
+  */
+#define LIS3DSH_SM_ENABLE                   ((uint8_t)0x01)
+#define LIS3DSH_SM_DISABLE                  ((uint8_t)0x00)
+/**
+  * @}
+  */ 
+     
+/** @defgroup State_Machine_Routed_Interrupt
+  * @{
+  */
+#define LIS3DSH_SM_INT1                     ((uint8_t)0x00)
+#define LIS3DSH_SM_INT2                     ((uint8_t)0x08)
+/**
+  * @}
+  */ 
+
+/** @defgroup Boot_Mode_selection
+  * @{
+  */
+#define LIS3DSH_BOOT_NORMALMODE              ((uint8_t)0x00)
+#define LIS3DSH_BOOT_FORCED                  ((uint8_t)0x80)
+/**
+  * @}
+  */   
+
+
+/** @defgroup FIFO_Mode_selection 
+  * @{
+  */
+#define LIS3DSH_FIFO_BYPASS_MODE             ((uint8_t)0x00)
+#define LIS3DSH_FIFO_MODE                    ((uint8_t)0x20)
+#define LIS3DSH_FIFO_STREAM_MODE             ((uint8_t)0x40)
+#define LIS3DSH_FIFO_SF_TRIGGER_MODE         ((uint8_t)0x60)
+#define LIS3DSH_FIFO_BS_TRIGGER_MODE         ((uint8_t)0x80)
+#define LIS3DSH_FIFO_BF_TRIGGER_MODE         ((uint8_t)0xE0)
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup LIS3DSH_Exported_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+
+/** @defgroup LIS3DSH_Exported_Functions
+  * @{
+  */ 
+void    LIS3DSH_Init(uint16_t InitStruct);
+void    LIS3DSH_DeInit(void);
+uint8_t LIS3DSH_ReadID(void);
+void    LIS3DSH_InterruptConfig(LIS3DSH_InterruptConfigTypeDef *LIS3DSH_IntConfigStruct);
+void    LIS3DSH_Click_IntConfig(void);
+void    LIS3DSH_ODR_LowpowerCmd(uint8_t ODR_LowPowerMode);
+void    LIS3DSH_DataRateCmd(uint8_t DataRateValue);
+void    LIS3DSH_FullScaleCmd(uint8_t FS_value);
+void    LIS3DSH_RebootCmd(void);
+void    LIS3DSH_ReadACC(int16_t *pData);
+
+/* Accelerometer driver structure */
+extern ACCELERO_DrvTypeDef Lis3dshDrv;
+
+/* 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 /* __LIS3DSH_H */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 365 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/Release_Notes.html

@@ -0,0 +1,365 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for LSM303DLHC Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for LSM303DLHC Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 24-June-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">lsm303dlhc.c:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add accelerometer de-initialization function: LSM303DLHC_AccDeInit()</span></li></ul><ul><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0</span><br>
+                <span style="font-size: 10pt; font-family: Verdana;"></span></li></ul></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 20-November-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            
+            <ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">lsm303dlhc.h: change "\" by "/" in the include path to fix compilation issue under Linux</span><br>
+                <span style="font-size: 10pt; font-family: Verdana;"></span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Miscellaneous comments update</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <ul style="margin-top: 0cm;" type="square"><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Arial; color: white;"><o:p></o:p></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 160px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 578 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/lsm303dlhc.c

@@ -0,0 +1,578 @@
+/**
+  ******************************************************************************
+  * @file    lsm303dlhc.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file provides a set of functions needed to manage the lsm303dlhc
+  *          MEMS accelerometer.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "lsm303dlhc.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup LSM303DLHC
+  * @{
+  */
+
+/** @defgroup LSM303DLHC_Private_TypesDefinitions
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup LSM303DLHC_Private_Defines
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup LSM303DLHC_Private_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup LSM303DLHC_Private_Variables
+  * @{
+  */ 
+ACCELERO_DrvTypeDef Lsm303dlhcDrv =
+{
+  LSM303DLHC_AccInit,
+  LSM303DLHC_AccDeInit,
+  LSM303DLHC_AccReadID,
+  LSM303DLHC_AccRebootCmd,
+  0,
+  LSM303DLHC_AccZClickITConfig,
+  0,
+  0,
+  0,
+  0,
+  LSM303DLHC_AccFilterConfig,
+  LSM303DLHC_AccFilterCmd,
+  LSM303DLHC_AccReadXYZ
+};
+
+/**
+  * @}
+  */
+
+/** @defgroup LSM303DLHC_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Set LSM303DLHC Initialization.
+  * @param  InitStruct: Init parameters
+  * @retval None
+  */
+void LSM303DLHC_AccInit(uint16_t InitStruct)
+{  
+  uint8_t ctrl = 0x00;
+  
+  /*  Low level init */
+  COMPASSACCELERO_IO_Init();
+  
+  /* Write value to ACC MEMS CTRL_REG1 register */
+  ctrl = (uint8_t) InitStruct;
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG1_A, ctrl);
+  
+  /* Write value to ACC MEMS CTRL_REG4 register */
+  ctrl = (uint8_t) (InitStruct << 8);
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG4_A, ctrl);
+}
+
+/**
+  * @brief  LSM303DLHC De-initialization.
+  * @param  None
+  * @retval None
+  */
+void LSM303DLHC_AccDeInit(void)
+{  
+}
+
+/**
+  * @brief  Read LSM303DLHC ID.
+  * @param  None
+  * @retval ID 
+  */
+uint8_t LSM303DLHC_AccReadID(void)
+{  
+  uint8_t ctrl = 0x00;
+  
+  /* Low level init */
+  COMPASSACCELERO_IO_Init();
+  
+  /* Read value at Who am I register address */
+  ctrl = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_WHO_AM_I_ADDR);
+  
+  return ctrl;
+}
+
+/**
+  * @brief  Reboot memory content of LSM303DLHC
+  * @param  None
+  * @retval None
+  */
+void LSM303DLHC_AccRebootCmd(void)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG5 register */
+  tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A);
+  
+  /* Enable or Disable the reboot memory */
+  tmpreg |= LSM303DLHC_BOOT_REBOOTMEMORY;
+  
+  /* Write value to ACC MEMS CTRL_REG5 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A, tmpreg);
+}
+
+/**
+  * @brief  Set High Pass Filter Modality
+  * @param  FilterStruct: contains data for filter config
+  * @retval None
+  */
+void LSM303DLHC_AccFilterConfig(uint8_t FilterStruct) 
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG2 register */
+  tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A);
+  
+  tmpreg &= 0x0C;
+  tmpreg |= FilterStruct;
+  
+  /* Write value to ACC MEMS CTRL_REG2 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg);
+}
+
+/**
+  * @brief  Enable or Disable High Pass Filter
+  * @param  HighPassFilterState: new state of the High Pass Filter feature.
+  *      This parameter can be: 
+  *         @arg: LSM303DLHC_HIGHPASSFILTER_DISABLE 
+  *         @arg: LSM303DLHC_HIGHPASSFILTER_ENABLE
+  * @retval None
+  */
+void LSM303DLHC_AccFilterCmd(uint8_t HighPassFilterState)
+{
+  uint8_t tmpreg;
+  
+  /* Read CTRL_REG2 register */
+  tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A);
+  
+  tmpreg &= 0xF7;
+  
+  tmpreg |= HighPassFilterState;
+  
+  /* Write value to ACC MEMS CTRL_REG2 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg);
+}
+
+/**
+  * @brief  Read X, Y & Z Acceleration values 
+  * @param  pData: Data out pointer
+  * @retval None
+  */
+void LSM303DLHC_AccReadXYZ(int16_t* pData)
+{
+  int16_t pnRawData[3];
+  uint8_t ctrlx[2]={0,0};
+  int8_t buffer[6];
+  uint8_t i = 0;
+  uint8_t sensitivity = LSM303DLHC_ACC_SENSITIVITY_2G;
+  
+  /* Read the acceleration control register content */
+  ctrlx[0] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG4_A);
+  ctrlx[1] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG5_A);
+  
+  /* Read output register X, Y & Z acceleration */
+  buffer[0] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_X_L_A); 
+  buffer[1] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_X_H_A);
+  buffer[2] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Y_L_A);
+  buffer[3] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Y_H_A);
+  buffer[4] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Z_L_A);
+  buffer[5] = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_OUT_Z_H_A);
+  
+  /* Check in the control register4 the data alignment*/
+  if(!(ctrlx[0] & LSM303DLHC_BLE_MSB)) 
+  {
+    for(i=0; i<3; i++)
+    {
+      pnRawData[i]=((int16_t)((uint16_t)buffer[2*i+1] << 8) + buffer[2*i]);
+    }
+  }
+  else /* Big Endian Mode */
+  {
+    for(i=0; i<3; i++)
+    {
+      pnRawData[i]=((int16_t)((uint16_t)buffer[2*i] << 8) + buffer[2*i+1]);
+    }
+  }
+  
+  /* Normal mode */
+  /* Switch the sensitivity value set in the CRTL4 */
+  switch(ctrlx[0] & LSM303DLHC_FULLSCALE_16G)
+  {
+  case LSM303DLHC_FULLSCALE_2G:
+    sensitivity = LSM303DLHC_ACC_SENSITIVITY_2G;
+    break;
+  case LSM303DLHC_FULLSCALE_4G:
+    sensitivity = LSM303DLHC_ACC_SENSITIVITY_4G;
+    break;
+  case LSM303DLHC_FULLSCALE_8G:
+    sensitivity = LSM303DLHC_ACC_SENSITIVITY_8G;
+    break;
+  case LSM303DLHC_FULLSCALE_16G:
+    sensitivity = LSM303DLHC_ACC_SENSITIVITY_16G;
+    break;
+  }
+  
+  /* Obtain the mg value for the three axis */
+  for(i=0; i<3; i++)
+  {
+    pData[i]=(pnRawData[i] * sensitivity);
+  }
+}
+
+/**
+  * @brief  Enable or Disable High Pass Filter on CLick
+  * @param  HighPassFilterState: new state of the High Pass Filter feature.
+  *      This parameter can be: 
+  *         @arg: LSM303DLHC_HPF_CLICK_DISABLE 
+  *         @arg: LSM303DLHC_HPF_CLICK_ENABLE
+  * @retval None
+  */
+void LSM303DLHC_AccFilterClickCmd(uint8_t HighPassFilterClickState)
+{
+  uint8_t tmpreg = 0x00;
+  
+  /* Read CTRL_REG2 register */
+  tmpreg = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A);
+  
+  tmpreg &= ~(LSM303DLHC_HPF_CLICK_ENABLE);
+  
+  tmpreg |= HighPassFilterClickState;
+  
+  /* Write value to ACC MEMS CTRL_REG2 regsister */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG2_A, tmpreg);
+}
+
+/**
+  * @brief Enable LSM303DLHC Interrupt1
+  * @param  LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be enabled.
+  *           This parameter can be any combination of the following values: 
+  *         @arg   LSM303DLHC_IT1_CLICK
+  *         @arg   LSM303DLHC_IT1_AOI1
+  *         @arg   LSM303DLHC_IT1_AOI2
+  *         @arg   LSM303DLHC_IT1_DRY1
+  *         @arg   LSM303DLHC_IT1_DRY2
+  *         @arg   LSM303DLHC_IT1_WTM
+  *         @arg   LSM303DLHC_IT1_OVERRUN
+  * @retval None
+  */
+void LSM303DLHC_AccIT1Enable(uint8_t LSM303DLHC_IT)
+{
+  uint8_t tmpval = 0x00;
+  
+  /* Read CTRL_REG3 register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A);
+  
+  /* Enable IT1 */
+  tmpval |= LSM303DLHC_IT;
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A, tmpval);
+}
+
+/**
+  * @brief Disable LSM303DLHC Interrupt1
+  * @param  LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be disabled.
+  *           This parameter can be any combination of the following values: 
+  *         @arg   LSM303DLHC_IT1_CLICK
+  *         @arg   LSM303DLHC_IT1_AOI1
+  *         @arg   LSM303DLHC_IT1_AOI2
+  *         @arg   LSM303DLHC_IT1_DRY1
+  *         @arg   LSM303DLHC_IT1_DRY2
+  *         @arg   LSM303DLHC_IT1_WTM
+  *         @arg   LSM303DLHC_IT1_OVERRUN
+  * @retval None
+  */
+void LSM303DLHC_AccIT1Disable(uint8_t LSM303DLHC_IT)
+{
+  uint8_t tmpval = 0x00;
+  
+  /* Read CTRL_REG3 register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A);
+  
+  /* Disable IT1 */
+  tmpval &= ~LSM303DLHC_IT;
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG3_A, tmpval);
+}
+
+/**
+  * @brief Enable LSM303DLHC Interrupt2 
+  * @param  LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be enabled.
+  *           This parameter can be any combination of the following values: 
+  *         @arg   LSM303DLHC_IT2_CLICK
+  *         @arg   LSM303DLHC_IT2_INT1
+  *         @arg   LSM303DLHC_IT2_INT2
+  *         @arg   LSM303DLHC_IT2_BOOT
+  *         @arg   LSM303DLHC_IT2_ACT
+  *         @arg   LSM303DLHC_IT2_HLACTIVE
+  * @retval None
+  */
+void LSM303DLHC_AccIT2Enable(uint8_t LSM303DLHC_IT)
+{
+  uint8_t tmpval = 0x00;
+  
+  /* Read CTRL_REG3 register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A);
+  
+  /* Enable IT2 */
+  tmpval |= LSM303DLHC_IT;
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A, tmpval);
+}
+
+/**
+  * @brief Disable LSM303DLHC Interrupt2
+  * @param  LSM303DLHC_IT: specifies the LSM303DLHC interrupt source to be disabled.
+  *           This parameter can be any combination of the following values: 
+  *         @arg   LSM303DLHC_IT2_CLICK
+  *         @arg   LSM303DLHC_IT2_INT1
+  *         @arg   LSM303DLHC_IT2_INT2
+  *         @arg   LSM303DLHC_IT2_BOOT
+  *         @arg   LSM303DLHC_IT2_ACT
+  *         @arg   LSM303DLHC_IT2_HLACTIVE
+  * @retval None
+  */
+void LSM303DLHC_AccIT2Disable(uint8_t LSM303DLHC_IT)
+{
+  uint8_t tmpval = 0x00;
+  
+  /* Read CTRL_REG3 register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A);
+  
+  /* Disable IT2 */
+  tmpval &= ~LSM303DLHC_IT;
+  
+  /* Write value to MEMS CTRL_REG3 register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CTRL_REG6_A, tmpval);
+}
+
+/**
+  * @brief  INT1 interrupt enable
+  * @param  ITCombination: Or or And combination
+  *         ITAxes: Axes to be enabled 
+  * @retval None
+  */
+void LSM303DLHC_AccINT1InterruptEnable(uint8_t ITCombination, uint8_t ITAxes)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read INT1_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A);
+  
+  /* Enable the selected interrupt */
+  tmpval |= (ITAxes | ITCombination);
+  
+  /* Write value to MEMS INT1_CFR register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A, tmpval);  
+}
+
+/**
+  * @brief  INT1 interrupt disable
+  * @param  ITCombination: Or or And combination
+  *         ITAxes: Axes to be enabled 
+  * @retval None
+  */
+void LSM303DLHC_AccINT1InterruptDisable(uint8_t ITCombination, uint8_t ITAxes)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read INT1_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A);
+  
+  /* Disable the selected interrupt */
+  tmpval &= ~(ITAxes | ITCombination);
+  
+  /* Write value to MEMS INT1_CFR register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT1_CFG_A, tmpval);
+}
+
+/**
+  * @brief  INT2 interrupt enable
+  * @param  ITCombination: Or or And combination
+  *         ITAxes: axes to be enabled 
+  * @retval None
+  */
+void LSM303DLHC_AccINT2InterruptEnable(uint8_t ITCombination, uint8_t ITAxes)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read INT2_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A);
+  
+  /* Enable the selected interrupt */
+  tmpval |= (ITAxes | ITCombination);
+  
+  /* Write value to MEMS INT2_CFR register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A, tmpval);
+}
+
+/**
+  * @brief  INT2 interrupt config
+  * @param  ITCombination: Or or And combination
+  *         ITAxes: axes to be enabled 
+  * @retval None
+  */
+void LSM303DLHC_AccINT2InterruptDisable(uint8_t ITCombination, uint8_t ITAxes)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read INT2_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A);
+  
+  /* Disable the selected interrupt */
+  tmpval &= ~(ITAxes | ITCombination);
+  
+  /* Write value to MEMS INT2_CFR register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_INT2_CFG_A, tmpval);
+}
+
+/**
+  * @brief  Click interrupt enable
+  * @param  ITClick: the selected interrupt to enable
+  * @retval None
+  */
+void LSM303DLHC_AccClickITEnable(uint8_t ITClick)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read CLICK_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A);
+  
+  /* Enable the selected interrupt */
+  tmpval |= ITClick;
+  
+  /* Write value to MEMS CLICK CFG register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A, tmpval);
+  
+  /* Configure Click Threshold on Z axis */
+  tmpval = 0x0A;
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_THS_A, tmpval);
+  
+  /* Configure Time Limit */
+  tmpval = 0x05;
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_LIMIT_A, tmpval);
+  
+  /* Configure Latency */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_LATENCY_A, tmpval);
+  
+  /* Configure Click Window */
+  tmpval = 0x32;
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_TIME_WINDOW_A, tmpval);
+}
+
+/**
+  * @brief  Click interrupt disable
+  * @param  ITClick: the selected click interrupt to disable
+  * @retval None
+  */
+void LSM303DLHC_AccClickITDisable(uint8_t ITClick)
+{  
+  uint8_t tmpval = 0x00;
+  
+  /* Read CLICK_CFR register */
+  tmpval = COMPASSACCELERO_IO_Read(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A);
+  
+  /* Disable the selected interrupt */
+  tmpval &= ~ITClick;
+  
+  /* Write value to MEMS CLICK_CFR register */
+  COMPASSACCELERO_IO_Write(ACC_I2C_ADDRESS, LSM303DLHC_CLICK_CFG_A, tmpval);
+}
+
+/**
+  * @brief  Click on Z axis interrupt config
+  * @param  None
+  * @retval None
+  */
+void LSM303DLHC_AccZClickITConfig(void)
+{  
+  /* Configure low level IT config */
+  COMPASSACCELERO_IO_ITConfig();
+  
+  /* Select click IT as INT1 interrupt */
+  LSM303DLHC_AccIT1Enable(LSM303DLHC_IT1_CLICK);
+  
+  /* Enable High pass filter for click IT */
+  LSM303DLHC_AccFilterClickCmd(LSM303DLHC_HPF_CLICK_ENABLE);
+  
+  /* Enable simple click IT on Z axis, */
+  LSM303DLHC_AccClickITEnable(LSM303DLHC_Z_SINGLE_CLICK);
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/     

+ 498 - 0
bsp/stm32f411RE/Libraries/BSP/Components/lsm303dlhc/lsm303dlhc.h

@@ -0,0 +1,498 @@
+/**
+  ******************************************************************************
+  * @file    lsm303dlhc.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file contains all the functions prototypes for the lsm303dlhc.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __LSM303DLHC_H
+#define __LSM303DLHC_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/accelero.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+   
+/** @addtogroup LSM303DLHC
+  * @{
+  */
+  
+/** @defgroup LSM303DLHC_Exported_Types
+  * @{
+  */
+
+/**
+  * @}
+  */
+ 
+/******************************************************************************/
+/*************************** START REGISTER MAPPING  **************************/
+/******************************************************************************/
+/* Exported constant IO ------------------------------------------------------*/
+#define ACC_I2C_ADDRESS                      0x32
+#define MAG_I2C_ADDRESS                      0x3C
+
+/* Acceleration Registers */
+#define LSM303DLHC_WHO_AM_I_ADDR             0x0F  /* device identification register */
+#define LSM303DLHC_CTRL_REG1_A               0x20  /* Control register 1 acceleration */
+#define LSM303DLHC_CTRL_REG2_A               0x21  /* Control register 2 acceleration */
+#define LSM303DLHC_CTRL_REG3_A               0x22  /* Control register 3 acceleration */
+#define LSM303DLHC_CTRL_REG4_A               0x23  /* Control register 4 acceleration */
+#define LSM303DLHC_CTRL_REG5_A               0x24  /* Control register 5 acceleration */
+#define LSM303DLHC_CTRL_REG6_A               0x25  /* Control register 6 acceleration */
+#define LSM303DLHC_REFERENCE_A               0x26  /* Reference register acceleration */
+#define LSM303DLHC_STATUS_REG_A              0x27  /* Status register acceleration */
+#define LSM303DLHC_OUT_X_L_A                 0x28  /* Output Register X acceleration */
+#define LSM303DLHC_OUT_X_H_A                 0x29  /* Output Register X acceleration */
+#define LSM303DLHC_OUT_Y_L_A                 0x2A  /* Output Register Y acceleration */
+#define LSM303DLHC_OUT_Y_H_A                 0x2B  /* Output Register Y acceleration */
+#define LSM303DLHC_OUT_Z_L_A                 0x2C  /* Output Register Z acceleration */
+#define LSM303DLHC_OUT_Z_H_A                 0x2D  /* Output Register Z acceleration */ 
+#define LSM303DLHC_FIFO_CTRL_REG_A           0x2E  /* Fifo control Register acceleration */
+#define LSM303DLHC_FIFO_SRC_REG_A            0x2F  /* Fifo src Register acceleration */
+
+#define LSM303DLHC_INT1_CFG_A                0x30  /* Interrupt 1 configuration Register acceleration */
+#define LSM303DLHC_INT1_SOURCE_A             0x31  /* Interrupt 1 source Register acceleration */
+#define LSM303DLHC_INT1_THS_A                0x32  /* Interrupt 1 Threshold register acceleration */
+#define LSM303DLHC_INT1_DURATION_A           0x33  /* Interrupt 1 DURATION register acceleration */
+
+#define LSM303DLHC_INT2_CFG_A                0x34  /* Interrupt 2 configuration Register acceleration */
+#define LSM303DLHC_INT2_SOURCE_A             0x35  /* Interrupt 2 source Register acceleration */
+#define LSM303DLHC_INT2_THS_A                0x36  /* Interrupt 2 Threshold register acceleration */
+#define LSM303DLHC_INT2_DURATION_A           0x37  /* Interrupt 2 DURATION register acceleration */
+
+#define LSM303DLHC_CLICK_CFG_A               0x38  /* Click configuration Register acceleration */
+#define LSM303DLHC_CLICK_SOURCE_A            0x39  /* Click 2 source Register acceleration */
+#define LSM303DLHC_CLICK_THS_A               0x3A  /* Click 2 Threshold register acceleration */
+
+#define LSM303DLHC_TIME_LIMIT_A              0x3B  /* Time Limit Register acceleration */
+#define LSM303DLHC_TIME_LATENCY_A            0x3C  /* Time Latency Register acceleration */
+#define LSM303DLHC_TIME_WINDOW_A             0x3D  /* Time window register acceleration */
+
+/* Magnetic field Registers */
+#define LSM303DLHC_CRA_REG_M                 0x00  /* Control register A magnetic field */
+#define LSM303DLHC_CRB_REG_M                 0x01  /* Control register B magnetic field */
+#define LSM303DLHC_MR_REG_M                  0x02  /* Control register MR magnetic field */
+#define LSM303DLHC_OUT_X_H_M                 0x03  /* Output Register X magnetic field */
+#define LSM303DLHC_OUT_X_L_M                 0x04  /* Output Register X magnetic field */
+#define LSM303DLHC_OUT_Z_H_M                 0x05  /* Output Register Z magnetic field */
+#define LSM303DLHC_OUT_Z_L_M                 0x06  /* Output Register Z magnetic field */ 
+#define LSM303DLHC_OUT_Y_H_M                 0x07  /* Output Register Y magnetic field */
+#define LSM303DLHC_OUT_Y_L_M                 0x08  /* Output Register Y magnetic field */
+
+#define LSM303DLHC_SR_REG_M                  0x09  /* Status Register magnetic field */
+#define LSM303DLHC_IRA_REG_M                 0x0A  /* IRA Register magnetic field */
+#define LSM303DLHC_IRB_REG_M                 0x0B  /* IRB Register magnetic field */
+#define LSM303DLHC_IRC_REG_M                 0x0C  /* IRC Register magnetic field */
+
+#define LSM303DLHC_TEMP_OUT_H_M              0x31  /* Temperature Register magnetic field */
+#define LSM303DLHC_TEMP_OUT_L_M              0x32  /* Temperature Register magnetic field */
+
+/******************************************************************************/
+/**************************** END REGISTER MAPPING  ***************************/
+/******************************************************************************/
+
+#define I_AM_LMS303DLHC                   ((uint8_t)0x33)
+
+/** @defgroup Acc_Power_Mode_selection
+  * @{
+  */
+#define LSM303DLHC_NORMAL_MODE            ((uint8_t)0x00)
+#define LSM303DLHC_LOWPOWER_MODE          ((uint8_t)0x08)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_OutPut_DataRate_Selection
+  * @{
+  */
+#define LSM303DLHC_ODR_1_HZ                ((uint8_t)0x10)  /*!< Output Data Rate = 1 Hz */
+#define LSM303DLHC_ODR_10_HZ               ((uint8_t)0x20)  /*!< Output Data Rate = 10 Hz */
+#define LSM303DLHC_ODR_25_HZ               ((uint8_t)0x30)  /*!< Output Data Rate = 25 Hz */
+#define LSM303DLHC_ODR_50_HZ               ((uint8_t)0x40)  /*!< Output Data Rate = 50 Hz */
+#define LSM303DLHC_ODR_100_HZ              ((uint8_t)0x50)  /*!< Output Data Rate = 100 Hz */
+#define LSM303DLHC_ODR_200_HZ              ((uint8_t)0x60)  /*!< Output Data Rate = 200 Hz */
+#define LSM303DLHC_ODR_400_HZ              ((uint8_t)0x70)  /*!< Output Data Rate = 400 Hz */
+#define LSM303DLHC_ODR_1620_HZ_LP          ((uint8_t)0x80)  /*!< Output Data Rate = 1620 Hz only in Low Power Mode */
+#define LSM303DLHC_ODR_1344_HZ             ((uint8_t)0x90)  /*!< Output Data Rate = 1344 Hz in Normal mode and 5376 Hz in Low Power Mode */
+/**
+  * @}
+  */
+
+/** @defgroup Acc_Axes_Selection
+  * @{
+  */
+#define LSM303DLHC_X_ENABLE                ((uint8_t)0x01)
+#define LSM303DLHC_Y_ENABLE                ((uint8_t)0x02)
+#define LSM303DLHC_Z_ENABLE                ((uint8_t)0x04)
+#define LSM303DLHC_AXES_ENABLE             ((uint8_t)0x07)
+#define LSM303DLHC_AXES_DISABLE            ((uint8_t)0x00)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_High_Resolution
+  * @{
+  */
+#define LSM303DLHC_HR_ENABLE               ((uint8_t)0x08)
+#define LSM303DLHC_HR_DISABLE              ((uint8_t)0x00)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_Full_Scale_Selection
+  * @{
+  */
+#define LSM303DLHC_FULLSCALE_2G            ((uint8_t)0x00)  /*!< ±2 g */
+#define LSM303DLHC_FULLSCALE_4G            ((uint8_t)0x10)  /*!< ±4 g */
+#define LSM303DLHC_FULLSCALE_8G            ((uint8_t)0x20)  /*!< ±8 g */
+#define LSM303DLHC_FULLSCALE_16G           ((uint8_t)0x30)  /*!< ±16 g */
+/**
+  * @}
+  */
+
+/** @defgroup Acc_Full_Scale_Selection
+  * @{
+  */
+#define LSM303DLHC_ACC_SENSITIVITY_2G     ((uint8_t)1)  /*!< accelerometer sensitivity with 2 g full scale [mg/LSB] */
+#define LSM303DLHC_ACC_SENSITIVITY_4G     ((uint8_t)2)  /*!< accelerometer sensitivity with 4 g full scale [mg/LSB] */
+#define LSM303DLHC_ACC_SENSITIVITY_8G     ((uint8_t)4)  /*!< accelerometer sensitivity with 8 g full scale [mg/LSB] */
+#define LSM303DLHC_ACC_SENSITIVITY_16G    ((uint8_t)12) /*!< accelerometer sensitivity with 12 g full scale [mg/LSB] */
+/**
+  * @}
+  */
+
+/** @defgroup Acc_Block_Data_Update
+  * @{
+  */  
+#define LSM303DLHC_BlockUpdate_Continous   ((uint8_t)0x00) /*!< Continuos Update */
+#define LSM303DLHC_BlockUpdate_Single      ((uint8_t)0x80) /*!< Single Update: output registers not updated until MSB and LSB reading */
+/**
+  * @}
+  */
+  
+/** @defgroup Acc_Endian_Data_selection
+  * @{
+  */  
+#define LSM303DLHC_BLE_LSB                 ((uint8_t)0x00) /*!< Little Endian: data LSB @ lower address */
+#define LSM303DLHC_BLE_MSB                 ((uint8_t)0x40) /*!< Big Endian: data MSB @ lower address */
+/**
+  * @}
+  */
+  
+/** @defgroup Acc_Boot_Mode_selection
+  * @{
+  */
+#define LSM303DLHC_BOOT_NORMALMODE         ((uint8_t)0x00)
+#define LSM303DLHC_BOOT_REBOOTMEMORY       ((uint8_t)0x80)
+/**
+  * @}
+  */  
+ 
+/** @defgroup Acc_High_Pass_Filter_Mode
+  * @{
+  */   
+#define LSM303DLHC_HPM_NORMAL_MODE_RES     ((uint8_t)0x00)
+#define LSM303DLHC_HPM_REF_SIGNAL          ((uint8_t)0x40)
+#define LSM303DLHC_HPM_NORMAL_MODE         ((uint8_t)0x80)
+#define LSM303DLHC_HPM_AUTORESET_INT       ((uint8_t)0xC0)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_High_Pass_CUT OFF_Frequency
+  * @{
+  */   
+#define LSM303DLHC_HPFCF_8                 ((uint8_t)0x00)
+#define LSM303DLHC_HPFCF_16                ((uint8_t)0x10)
+#define LSM303DLHC_HPFCF_32                ((uint8_t)0x20)
+#define LSM303DLHC_HPFCF_64                ((uint8_t)0x30)
+/**
+  * @}
+  */
+    
+/** @defgroup Acc_High_Pass_Filter_status
+  * @{
+  */   
+#define LSM303DLHC_HIGHPASSFILTER_DISABLE  ((uint8_t)0x00)
+#define LSM303DLHC_HIGHPASSFILTER_ENABLE   ((uint8_t)0x08)
+/**
+  * @}
+  */
+  
+/** @defgroup Acc_High_Pass_Filter_Click_status
+  * @{
+  */   
+#define LSM303DLHC_HPF_CLICK_DISABLE       ((uint8_t)0x00)
+#define LSM303DLHC_HPF_CLICK_ENABLE        ((uint8_t)0x04)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_High_Pass_Filter_AOI1_status
+  * @{
+  */   
+#define LSM303DLHC_HPF_AOI1_DISABLE        ((uint8_t)0x00)
+#define LSM303DLHC_HPF_AOI1_ENABLE	       ((uint8_t)0x01)
+/**
+  * @}
+  */
+  
+/** @defgroup Acc_High_Pass_Filter_AOI2_status
+  * @{
+  */   
+#define LSM303DLHC_HPF_AOI2_DISABLE        ((uint8_t)0x00)
+#define LSM303DLHC_HPF_AOI2_ENABLE         ((uint8_t)0x02)
+/**
+  * @}
+  */ 
+
+/** @defgroup Acc_Interrupt1_Configuration_definition
+  * @{
+  */
+#define LSM303DLHC_IT1_CLICK               ((uint8_t)0x80)
+#define LSM303DLHC_IT1_AOI1                ((uint8_t)0x40)
+#define LSM303DLHC_IT1_AOI2                ((uint8_t)0x20)
+#define LSM303DLHC_IT1_DRY1                ((uint8_t)0x10)
+#define LSM303DLHC_IT1_DRY2                ((uint8_t)0x08)
+#define LSM303DLHC_IT1_WTM                 ((uint8_t)0x04)
+#define LSM303DLHC_IT1_OVERRUN             ((uint8_t)0x02)
+/**
+  * @}
+  */  
+ 
+/** @defgroup Acc_Interrupt2_Configuration_definition
+  * @{
+  */
+#define LSM303DLHC_IT2_CLICK               ((uint8_t)0x80)
+#define LSM303DLHC_IT2_INT1                ((uint8_t)0x40)
+#define LSM303DLHC_IT2_INT2                ((uint8_t)0x20)
+#define LSM303DLHC_IT2_BOOT                ((uint8_t)0x10)
+#define LSM303DLHC_IT2_ACT                 ((uint8_t)0x08)
+#define LSM303DLHC_IT2_HLACTIVE            ((uint8_t)0x02)
+/**
+  * @}
+  */ 
+
+/** @defgroup Acc_INT_Combination_Status
+  * @{
+  */   
+#define LSM303DLHC_OR_COMBINATION          ((uint8_t)0x00)  /*!< OR combination of enabled IRQs */
+#define LSM303DLHC_AND_COMBINATION         ((uint8_t)0x80)  /*!< AND combination of enabled IRQs */
+#define LSM303DLHC_MOV_RECOGNITION         ((uint8_t)0x40)  /*!< 6D movement recognition */
+#define LSM303DLHC_POS_RECOGNITION         ((uint8_t)0xC0)  /*!< 6D position recognition */
+/**
+  * @}
+  */
+
+/** @defgroup Acc_INT_Axes
+  * @{
+  */   
+#define LSM303DLHC_Z_HIGH                  ((uint8_t)0x20)  /*!< Z High enabled IRQs */
+#define LSM303DLHC_Z_LOW                   ((uint8_t)0x10)  /*!< Z low enabled IRQs */
+#define LSM303DLHC_Y_HIGH                  ((uint8_t)0x08)  /*!< Y High enabled IRQs */
+#define LSM303DLHC_Y_LOW                   ((uint8_t)0x04)  /*!< Y low enabled IRQs */
+#define LSM303DLHC_X_HIGH                  ((uint8_t)0x02)  /*!< X High enabled IRQs */
+#define LSM303DLHC_X_LOW                   ((uint8_t)0x01)  /*!< X low enabled IRQs */
+/**
+  * @}
+  */
+      
+/** @defgroup Acc_INT_Click
+* @{
+*/   
+#define LSM303DLHC_Z_DOUBLE_CLICK          ((uint8_t)0x20)  /*!< Z double click IRQs */
+#define LSM303DLHC_Z_SINGLE_CLICK          ((uint8_t)0x10)  /*!< Z single click IRQs */
+#define LSM303DLHC_Y_DOUBLE_CLICK          ((uint8_t)0x08)  /*!< Y double click IRQs */
+#define LSM303DLHC_Y_SINGLE_CLICK          ((uint8_t)0x04)  /*!< Y single click IRQs */
+#define LSM303DLHC_X_DOUBLE_CLICK          ((uint8_t)0x02)  /*!< X double click IRQs */
+#define LSM303DLHC_X_SINGLE_CLICK          ((uint8_t)0x01)  /*!< X single click IRQs */
+/**
+* @}
+*/
+  
+/** @defgroup Acc_INT1_Interrupt_status
+  * @{
+  */   
+#define LSM303DLHC_INT1INTERRUPT_DISABLE   ((uint8_t)0x00)
+#define LSM303DLHC_INT1INTERRUPT_ENABLE    ((uint8_t)0x80)
+/**
+  * @}
+  */
+
+/** @defgroup Acc_INT1_Interrupt_ActiveEdge
+  * @{
+  */   
+#define LSM303DLHC_INT1INTERRUPT_LOW_EDGE  ((uint8_t)0x20)
+#define LSM303DLHC_INT1INTERRUPT_HIGH_EDGE ((uint8_t)0x00)
+/**
+  * @}
+  */
+
+/** @defgroup Mag_Data_Rate
+  * @{
+  */ 
+#define LSM303DLHC_ODR_0_75_HZ              ((uint8_t) 0x00)  /*!< Output Data Rate = 0.75 Hz */
+#define LSM303DLHC_ODR_1_5_HZ               ((uint8_t) 0x04)  /*!< Output Data Rate = 1.5 Hz */
+#define LSM303DLHC_ODR_3_0_HZ               ((uint8_t) 0x08)  /*!< Output Data Rate = 3 Hz */
+#define LSM303DLHC_ODR_7_5_HZ               ((uint8_t) 0x0C)  /*!< Output Data Rate = 7.5 Hz */
+#define LSM303DLHC_ODR_15_HZ                ((uint8_t) 0x10)  /*!< Output Data Rate = 15 Hz */
+#define LSM303DLHC_ODR_30_HZ                ((uint8_t) 0x14)  /*!< Output Data Rate = 30 Hz */
+#define LSM303DLHC_ODR_75_HZ                ((uint8_t) 0x18)  /*!< Output Data Rate = 75 Hz */
+#define LSM303DLHC_ODR_220_HZ               ((uint8_t) 0x1C)  /*!< Output Data Rate = 220 Hz */
+/**
+  * @}
+  */
+ 
+/** @defgroup Mag_Full_Scale
+  * @{
+  */ 
+#define  LSM303DLHC_FS_1_3_GA               ((uint8_t) 0x20)  /*!< Full scale = ±1.3 Gauss */
+#define  LSM303DLHC_FS_1_9_GA               ((uint8_t) 0x40)  /*!< Full scale = ±1.9 Gauss */
+#define  LSM303DLHC_FS_2_5_GA               ((uint8_t) 0x60)  /*!< Full scale = ±2.5 Gauss */
+#define  LSM303DLHC_FS_4_0_GA               ((uint8_t) 0x80)  /*!< Full scale = ±4.0 Gauss */
+#define  LSM303DLHC_FS_4_7_GA               ((uint8_t) 0xA0)  /*!< Full scale = ±4.7 Gauss */
+#define  LSM303DLHC_FS_5_6_GA               ((uint8_t) 0xC0)  /*!< Full scale = ±5.6 Gauss */
+#define  LSM303DLHC_FS_8_1_GA               ((uint8_t) 0xE0)  /*!< Full scale = ±8.1 Gauss */
+/**
+  * @}
+  */ 
+ 
+/**
+ * @defgroup Magnetometer_Sensitivity
+ * @{
+ */
+#define LSM303DLHC_M_SENSITIVITY_XY_1_3Ga     1100  /*!< magnetometer X Y axes sensitivity for 1.3 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_1_9Ga     855   /*!< magnetometer X Y axes sensitivity for 1.9 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_2_5Ga     670   /*!< magnetometer X Y axes sensitivity for 2.5 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_4Ga       450   /*!< magnetometer X Y axes sensitivity for 4 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_4_7Ga     400   /*!< magnetometer X Y axes sensitivity for 4.7 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_5_6Ga     330   /*!< magnetometer X Y axes sensitivity for 5.6 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_XY_8_1Ga     230   /*!< magnetometer X Y axes sensitivity for 8.1 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_1_3Ga      980   /*!< magnetometer Z axis sensitivity for 1.3 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_1_9Ga      760   /*!< magnetometer Z axis sensitivity for 1.9 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_2_5Ga      600   /*!< magnetometer Z axis sensitivity for 2.5 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_4Ga        400   /*!< magnetometer Z axis sensitivity for 4 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_4_7Ga      355   /*!< magnetometer Z axis sensitivity for 4.7 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_5_6Ga      295   /*!< magnetometer Z axis sensitivity for 5.6 Ga full scale [LSB/Ga] */
+#define LSM303DLHC_M_SENSITIVITY_Z_8_1Ga      205   /*!< magnetometer Z axis sensitivity for 8.1 Ga full scale [LSB/Ga] */
+/**
+ * @}
+ */
+
+/** @defgroup Mag_Working_Mode
+  * @{
+  */ 
+#define LSM303DLHC_CONTINUOS_CONVERSION      ((uint8_t) 0x00)   /*!< Continuous-Conversion Mode */
+#define LSM303DLHC_SINGLE_CONVERSION         ((uint8_t) 0x01)   /*!< Single-Conversion Mode */
+#define LSM303DLHC_SLEEP                     ((uint8_t) 0x02)   /*!< Sleep Mode */                       
+/**
+  * @}
+  */
+
+/** @defgroup Mag_Temperature_Sensor
+  * @{
+  */ 
+#define LSM303DLHC_TEMPSENSOR_ENABLE         ((uint8_t) 0x80)   /*!< Temp sensor Enable */
+#define LSM303DLHC_TEMPSENSOR_DISABLE        ((uint8_t) 0x00)   /*!< Temp sensor Disable */
+/**
+  * @}
+  */
+  
+/** @defgroup LSM303DLHC_Exported_Functions
+  * @{
+  */
+/* ACC functions */
+void    LSM303DLHC_AccInit(uint16_t InitStruct);
+void    LSM303DLHC_AccDeInit(void);
+uint8_t LSM303DLHC_AccReadID(void);
+void    LSM303DLHC_AccRebootCmd(void);
+void    LSM303DLHC_AccFilterConfig(uint8_t FilterStruct);
+void    LSM303DLHC_AccFilterCmd(uint8_t HighPassFilterState);
+void    LSM303DLHC_AccReadXYZ(int16_t* pData);
+void    LSM303DLHC_AccFilterClickCmd(uint8_t HighPassFilterClickState);
+void    LSM303DLHC_AccIT1Enable(uint8_t LSM303DLHC_IT);
+void    LSM303DLHC_AccIT1Disable(uint8_t LSM303DLHC_IT);
+void    LSM303DLHC_AccIT2Enable(uint8_t LSM303DLHC_IT);
+void    LSM303DLHC_AccIT2Disable(uint8_t LSM303DLHC_IT);
+void    LSM303DLHC_AccINT1InterruptEnable(uint8_t ITCombination, uint8_t ITAxes);
+void    LSM303DLHC_AccINT1InterruptDisable(uint8_t ITCombination, uint8_t ITAxes);
+void    LSM303DLHC_AccINT2InterruptEnable(uint8_t ITCombination, uint8_t ITAxes);
+void    LSM303DLHC_AccINT2InterruptDisable(uint8_t ITCombination, uint8_t ITAxes);
+void    LSM303DLHC_AccClickITEnable(uint8_t ITClick);
+void    LSM303DLHC_AccClickITDisable(uint8_t ITClick);
+void    LSM303DLHC_AccZClickITConfig(void);
+
+/* COMPASS / ACCELERO IO functions */
+void    COMPASSACCELERO_IO_Init(void);
+void    COMPASSACCELERO_IO_ITConfig(void);
+void    COMPASSACCELERO_IO_Write(uint16_t DeviceAddr, uint8_t RegisterAddr, uint8_t Value);
+uint8_t COMPASSACCELERO_IO_Read(uint16_t DeviceAddr, uint8_t RegisterAddr);
+
+/* ACC driver structure */
+extern ACCELERO_DrvTypeDef Lsm303dlhcDrv;
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __LSM303DLHC_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 259 - 0
bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/Release_Notes.html


+ 1584 - 0
bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/mfxstm32l152.c

@@ -0,0 +1,1584 @@
+/** 
+  ******************************************************************************
+  * @file    mfxstm32l152.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file provides a set of functions needed to manage the MFXSTM32L152
+  *          IO Expander devices.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "mfxstm32l152.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */ 
+  
+/** @defgroup MFXSTM32L152
+  * @{
+  */   
+  
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Types_Definitions
+  * @{
+  */ 
+ 
+/* Private define ------------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Defines
+  * @{
+  */ 
+#define MFXSTM32L152_MAX_INSTANCE         3
+
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Macros
+  * @{
+  */ 
+  
+/* Private variables ---------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Variables
+  * @{
+  */ 
+
+/* Touch screen driver structure initialization */  
+TS_DrvTypeDef mfxstm32l152_ts_drv = 
+{
+  mfxstm32l152_Init,
+  mfxstm32l152_ReadID,
+  mfxstm32l152_Reset,
+  
+  mfxstm32l152_TS_Start,
+  mfxstm32l152_TS_DetectTouch,
+  mfxstm32l152_TS_GetXY,
+  
+  mfxstm32l152_TS_EnableIT,
+  mfxstm32l152_TS_ClearIT,
+  mfxstm32l152_TS_ITStatus,
+  mfxstm32l152_TS_DisableIT,
+};
+
+/* IO driver structure initialization */ 
+IO_DrvTypeDef mfxstm32l152_io_drv = 
+{
+  mfxstm32l152_Init,
+  mfxstm32l152_ReadID,
+  mfxstm32l152_Reset,
+  
+  mfxstm32l152_IO_Start,
+  mfxstm32l152_IO_Config,
+  mfxstm32l152_IO_WritePin,
+  mfxstm32l152_IO_ReadPin,
+  
+  mfxstm32l152_IO_EnableIT,
+  mfxstm32l152_IO_DisableIT,
+  mfxstm32l152_IO_ITStatus,
+  mfxstm32l152_IO_ClearIT,
+};
+
+/* IDD driver structure initialization */
+IDD_DrvTypeDef mfxstm32l152_idd_drv =
+{
+  mfxstm32l152_Init,
+  mfxstm32l152_DeInit,
+  mfxstm32l152_ReadID,
+  mfxstm32l152_Reset,
+  mfxstm32l152_LowPower,
+  mfxstm32l152_WakeUp,
+
+  mfxstm32l152_IDD_Start,
+  mfxstm32l152_IDD_Config,
+  mfxstm32l152_IDD_GetValue,
+
+  mfxstm32l152_IDD_EnableIT,
+  mfxstm32l152_IDD_ClearIT,
+  mfxstm32l152_IDD_GetITStatus,
+  mfxstm32l152_IDD_DisableIT,
+
+  mfxstm32l152_Error_EnableIT,
+  mfxstm32l152_Error_ClearIT,
+  mfxstm32l152_Error_GetITStatus,
+  mfxstm32l152_Error_DisableIT,
+  mfxstm32l152_Error_ReadSrc,
+  mfxstm32l152_Error_ReadMsg
+};
+
+
+/* mfxstm32l152 instances by address */
+uint8_t mfxstm32l152[MFXSTM32L152_MAX_INSTANCE] = {0};
+/**
+  * @}
+  */ 
+    
+/* Private function prototypes -----------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Function_Prototypes
+  * @{
+  */
+static uint8_t mfxstm32l152_GetInstance(uint16_t DeviceAddr); 
+static uint8_t  mfxstm32l152_ReleaseInstance(uint16_t DeviceAddr);
+static void mfxstm32l152_reg24_setPinValue(uint16_t DeviceAddr, uint8_t RegisterAddr, uint32_t PinPosition, uint8_t PinValue );
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Initialize the mfxstm32l152 and configure the needed hardware resources
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void mfxstm32l152_Init(uint16_t DeviceAddr)
+{
+  uint8_t instance;
+  uint8_t empty;
+  
+  /* Check if device instance already exists */
+  instance = mfxstm32l152_GetInstance(DeviceAddr);
+  
+  /* To prevent double initialization */
+  if(instance == 0xFF)
+  {
+    /* Look for empty instance */
+    empty = mfxstm32l152_GetInstance(0);
+    
+    if(empty < MFXSTM32L152_MAX_INSTANCE)
+    {
+      /* Register the current device instance */
+      mfxstm32l152[empty] = DeviceAddr;
+      
+      /* Initialize IO BUS layer */
+      MFX_IO_Init();
+    }
+  }
+  
+  mfxstm32l152_SetIrqOutPinPolarity(DeviceAddr, MFXSTM32L152_OUT_PIN_POLARITY_HIGH);
+  mfxstm32l152_SetIrqOutPinType(DeviceAddr, MFXSTM32L152_OUT_PIN_TYPE_PUSHPULL);
+}
+
+/**
+  * @brief  DeInitialize the mfxstm32l152 and unconfigure the needed hardware resources
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void mfxstm32l152_DeInit(uint16_t DeviceAddr)
+{
+  uint8_t instance;
+  
+  /* release existing instance */
+  instance = mfxstm32l152_ReleaseInstance(DeviceAddr);
+  
+  /* De-Init only if instance was previously registered */
+  if(instance != 0xFF)
+  {
+    /* De-Initialize IO BUS layer */
+    MFX_IO_DeInit();
+  }
+}
+
+/**
+  * @brief  Reset the mfxstm32l152 by Software.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void mfxstm32l152_Reset(uint16_t DeviceAddr)
+{
+  /* Soft Reset */  
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, MFXSTM32L152_SWRST);
+
+  /* Wait for a delay to ensure registers erasing */
+  MFX_IO_Delay(10);
+}
+
+/**
+  * @brief  Put mfxstm32l152 Device in Low Power standby mode
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void  mfxstm32l152_LowPower(uint16_t DeviceAddr)
+{
+  /* Enter standby mode */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, MFXSTM32L152_STANDBY);
+
+  /* enable wakeup pin */
+  MFX_IO_EnableWakeupPin();
+}
+
+/**
+  * @brief  WakeUp mfxstm32l152 from standby mode
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void  mfxstm32l152_WakeUp(uint16_t DeviceAddr)
+{
+  uint8_t instance;
+  
+  /* Check if device instance already exists */
+  instance = mfxstm32l152_GetInstance(DeviceAddr);
+  
+  /* if instance does not exist, first initialize pins*/
+  if(instance == 0xFF)
+  {
+    /* enable wakeup pin */
+    MFX_IO_EnableWakeupPin();
+  }
+
+  /* toggle wakeup pin */
+  MFX_IO_Wakeup();
+}
+
+/**
+  * @brief  Read the MFXSTM32L152 IO Expander device ID.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval The Device ID (two bytes).
+  */
+uint16_t mfxstm32l152_ReadID(uint16_t DeviceAddr)
+{
+  uint8_t id;
+  
+  /* Wait for a delay to ensure the state of registers */
+  MFX_IO_Delay(1);
+
+  /* Initialize IO BUS layer */
+  MFX_IO_Init();
+  
+  id = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_ID);
+  
+  /* Return the device ID value */
+  return (id);
+}
+
+/**
+  * @brief  Read the MFXSTM32L152 device firmware version.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval The Device FW version (two bytes).
+  */
+uint16_t mfxstm32l152_ReadFwVersion(uint16_t DeviceAddr)
+{
+  uint8_t  data[2];
+
+  MFX_IO_ReadMultiple((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_FW_VERSION_MSB, data, sizeof(data)) ;
+
+  /* Recompose MFX firmware value */
+  return ((data[0] << 8) | data[1]);
+}
+
+/**
+  * @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  MFXSTM32L152_IRQ_GPIO: IO interrupt 
+  *   @arg  MFXSTM32L152_IRQ_IDD : IDD interrupt    
+  *   @arg  MFXSTM32L152_IRQ_ERROR : Error interrupt    
+  *   @arg  MFXSTM32L152_IRQ_TS_DET : Touch Screen Controller Touch Detected interrupt  
+  *   @arg  MFXSTM32L152_IRQ_TS_NE : Touch Screen FIFO Not Empty  
+  *   @arg  MFXSTM32L152_IRQ_TS_TH : Touch Screen FIFO threshold triggered  
+  *   @arg  MFXSTM32L152_IRQ_TS_FULL : Touch Screen FIFO Full  
+  *   @arg  MFXSTM32L152_IRQ_TS_OVF : Touch Screen FIFO Overflow  
+  * @retval None
+  */  
+void mfxstm32l152_EnableITSource(uint16_t DeviceAddr, uint8_t Source)
+{
+  uint8_t tmp = 0;
+  
+  /* Get the current value of the INT_EN register */
+  tmp = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_SRC_EN);
+
+  /* Set the interrupts to be Enabled */    
+  tmp |= Source; 
+  
+  /* Set the register */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_SRC_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  MFXSTM32L152_IRQ_GPIO: IO interrupt 
+  *   @arg  MFXSTM32L152_IRQ_IDD : IDD interrupt    
+  *   @arg  MFXSTM32L152_IRQ_ERROR : Error interrupt    
+  *   @arg  MFXSTM32L152_IRQ_TS_DET : Touch Screen Controller Touch Detected interrupt  
+  *   @arg  MFXSTM32L152_IRQ_TS_NE : Touch Screen FIFO Not Empty  
+  *   @arg  MFXSTM32L152_IRQ_TS_TH : Touch Screen FIFO threshold triggered  
+  *   @arg  MFXSTM32L152_IRQ_TS_FULL : Touch Screen FIFO Full  
+  *   @arg  MFXSTM32L152_IRQ_TS_OVF : Touch Screen FIFO Overflow  
+  * @retval None
+  */
+void mfxstm32l152_DisableITSource(uint16_t DeviceAddr, uint8_t Source)
+{
+  uint8_t tmp = 0;
+  
+  /* Get the current value of the INT_EN register */
+  tmp = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_SRC_EN);
+
+  /* Set the interrupts to be Enabled */    
+  tmp &= ~Source; 
+  
+  /* Set the register */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_SRC_EN, tmp);
+}
+
+
+/**
+  * @brief  Returns the selected Global interrupt source pending bit value
+  * @param  DeviceAddr: Device address on communication Bus. 
+  * @param  Source: the Global interrupt source to be checked, could be:
+  *   @arg  MFXSTM32L152_IRQ_GPIO: IO interrupt 
+  *   @arg  MFXSTM32L152_IRQ_IDD : IDD interrupt    
+  *   @arg  MFXSTM32L152_IRQ_ERROR : Error interrupt    
+  *   @arg  MFXSTM32L152_IRQ_TS_DET : Touch Screen Controller Touch Detected interrupt  
+  *   @arg  MFXSTM32L152_IRQ_TS_NE : Touch Screen FIFO Not Empty  
+  *   @arg  MFXSTM32L152_IRQ_TS_TH : Touch Screen FIFO threshold triggered  
+  *   @arg  MFXSTM32L152_IRQ_TS_FULL : Touch Screen FIFO Full  
+  *   @arg  MFXSTM32L152_IRQ_TS_OVF : Touch Screen FIFO Overflow  
+  * @retval The value of the checked Global interrupt source status.
+  */
+uint8_t mfxstm32l152_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source)
+{
+  /* Return the global IT source status (pending or not)*/
+  return((MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_PENDING) & 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 below values. The acknowledge signal for MFXSTM32L152_GPIOs configured in input 
+  *         with interrupt is not on this register but in IRQ_GPI_ACK1, IRQ_GPI_ACK2 registers.          
+  *   @arg  MFXSTM32L152_IRQ_IDD : IDD interrupt    
+  *   @arg  MFXSTM32L152_IRQ_ERROR : Error interrupt    
+  *   @arg  MFXSTM32L152_IRQ_TS_DET : Touch Screen Controller Touch Detected interrupt  
+  *   @arg  MFXSTM32L152_IRQ_TS_NE : Touch Screen FIFO Not Empty  
+  *   @arg  MFXSTM32L152_IRQ_TS_TH : Touch Screen FIFO threshold triggered  
+  *   @arg  MFXSTM32L152_IRQ_TS_FULL : Touch Screen FIFO Full  
+  *   @arg  MFXSTM32L152_IRQ_TS_OVF : Touch Screen FIFO Overflow  
+  *  /\/\ IMPORTANT NOTE /\/\ must not use MFXSTM32L152_IRQ_GPIO as argument, see IRQ_GPI_ACK1 and IRQ_GPI_ACK2 registers 
+  * @retval None
+  */
+void mfxstm32l152_ClearGlobalIT(uint16_t DeviceAddr, uint8_t Source)
+{
+  /* Write 1 to the bits that have to be cleared */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_ACK, Source);
+}
+
+/**
+  * @brief  Set the global interrupt Polarity of IRQ_OUT_PIN.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  Polarity: the IT mode polarity, could be one of the following values:
+  *   @arg  MFXSTM32L152_OUT_PIN_POLARITY_LOW: Interrupt output line is active Low edge      
+  *   @arg  MFXSTM32L152_OUT_PIN_POLARITY_HIGH: Interrupt line output is active High edge              
+  * @retval None
+  */
+void mfxstm32l152_SetIrqOutPinPolarity(uint16_t DeviceAddr, uint8_t Polarity)
+{
+  uint8_t tmp = 0;
+  
+  /* Get the current register value */ 
+  tmp = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_MFX_IRQ_OUT);
+  
+  /* Mask the polarity bits */
+  tmp &= ~(uint8_t)0x02;
+    
+  /* Modify the Interrupt Output line configuration */
+  tmp |= Polarity;
+  
+  /* Set the new register value */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_MFX_IRQ_OUT, tmp);
+
+  /* Wait for 1 ms for MFX to change IRQ_out pin config, before activate it */
+  MFX_IO_Delay(1);
+  
+}
+
+/**
+  * @brief  Set the global interrupt Type of IRQ_OUT_PIN. 
+  * @param  DeviceAddr: Device address on communication Bus.      
+  * @param  Type: Interrupt line activity type, could be one of the following values:
+  *   @arg  MFXSTM32L152_OUT_PIN_TYPE_OPENDRAIN: Open Drain output Interrupt line          
+  *   @arg  MFXSTM32L152_OUT_PIN_TYPE_PUSHPULL: Push Pull output Interrupt line            
+  * @retval None
+  */
+void mfxstm32l152_SetIrqOutPinType(uint16_t DeviceAddr, uint8_t Type)
+{
+  uint8_t tmp = 0;
+  
+  /* Get the current register value */ 
+  tmp = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_MFX_IRQ_OUT);
+  
+  /* Mask the type bits */
+  tmp &= ~(uint8_t)0x01;
+    
+  /* Modify the Interrupt Output line configuration */
+  tmp |= Type;
+  
+  /* Set the new register value */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_MFX_IRQ_OUT, tmp);
+
+  /* Wait for 1 ms for MFX to change IRQ_out pin config, before activate it */
+  MFX_IO_Delay(1);
+  
+}
+
+
+/* ------------------------------------------------------------------ */
+/* ----------------------- GPIO ------------------------------------- */
+/* ------------------------------------------------------------------ */
+
+
+/**
+  * @brief  Start the IO functionality used and enable the AF for selected IO pin(s).
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  AF_en: 0 to disable, else enabled. 
+  * @retval None
+  */
+void mfxstm32l152_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t mode;
+  
+  /* Get the current register value */
+  mode = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL);
+  
+  /* Set the IO Functionalities to be Enabled */    
+  mode |= MFXSTM32L152_GPIO_EN;  
+  
+  /* Enable ALTERNATE functions */
+  /* AGPIO[0..3] can be either IDD or GPIO */ 
+  /* AGPIO[4..7] can be either TS or GPIO */ 
+  /* if IDD or TS are enabled no matter the value this bit GPIO are not available for those pins */
+  /*  however the MFX will waste some cycles to to handle these potential GPIO (pooling, etc) */ 
+  /* so if IDD and TS are both active it is better to let ALTERNATE off (0) */
+  /* if however IDD or TS are not connected then set it on gives more GPIOs availability */
+  /* remind that AGPIO are less efficient then normal GPIO (They use pooling rather then EXTI */
+  if (IO_Pin > 0xFFFF)
+  {
+    mode |= MFXSTM32L152_ALTERNATE_GPIO_EN;  
+  }
+  else
+  {
+    mode &= ~MFXSTM32L152_ALTERNATE_GPIO_EN;  
+  }  
+
+  /* Write the new register value */  
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode);
+  
+  /* Wait for 1 ms for MFX to change IRQ_out pin config, before activate it */
+  MFX_IO_Delay(1);
+}
+
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23.
+  * @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            
+  *   @arg  IO_MODE_INPUT_PU,
+  *   @arg  IO_MODE_INPUT_PD,
+  *   @arg  IO_MODE_OUTPUT_OD_PU,
+  *   @arg  IO_MODE_OUTPUT_OD_PD,
+  *   @arg  IO_MODE_OUTPUT_PP_PU,
+  *   @arg  IO_MODE_OUTPUT_PP_PD,
+  *   @arg  IO_MODE_IT_RISING_EDGE_PU
+  *   @arg  IO_MODE_IT_FALLING_EDGE_PU
+  *   @arg  IO_MODE_IT_LOW_LEVEL_PU
+  *   @arg  IO_MODE_IT_HIGH_LEVEL_PU
+  *   @arg  IO_MODE_IT_RISING_EDGE_PD
+  *   @arg  IO_MODE_IT_FALLING_EDGE_PD
+  *   @arg  IO_MODE_IT_LOW_LEVEL_PD
+  *   @arg  IO_MODE_IT_HIGH_LEVEL_PD
+  * @retval None
+  */
+uint8_t mfxstm32l152_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_OFF: /* Off or analog mode */
+  case IO_MODE_ANALOG: /* Off or analog mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    break;
+
+  case IO_MODE_INPUT: /* Input mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    break;
+    
+  case IO_MODE_INPUT_PU: /* Input mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    break;
+    
+  case IO_MODE_INPUT_PD: /* Input mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    break;
+
+  case IO_MODE_OUTPUT: /* Output mode */
+  case IO_MODE_OUTPUT_PP_PD: /* Output mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_OUT);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPO_PUSH_PULL);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    break;
+
+  case IO_MODE_OUTPUT_PP_PU: /* Output mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_OUT);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPO_PUSH_PULL);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    break;
+
+  case IO_MODE_OUTPUT_OD_PD: /* Output mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_OUT);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPO_OPEN_DRAIN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    break;
+
+  case IO_MODE_OUTPUT_OD_PU: /* Output mode */
+    mfxstm32l152_IO_DisablePinIT(DeviceAddr, IO_Pin); /* first disable IT */
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_OUT);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPO_OPEN_DRAIN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    break;
+
+  case IO_MODE_IT_RISING_EDGE: /* Interrupt rising edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN); 
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin); /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_RISING_EDGE_PU: /* Interrupt rising edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_RISING_EDGE_PD: /* Interrupt rising edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);      
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE); 
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_FALLING_EDGE: /* Interrupt falling edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_FALLING_EDGE_PU: /* Interrupt falling edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_FALLING_EDGE_PD: /* Interrupt falling edge mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN); 
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_EDGE);    
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE); 
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_LOW_LEVEL: /* Low level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN); 
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_LOW_LEVEL_PU: /* Low level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_LOW_LEVEL_PD: /* Low level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_LLFE);      
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+    
+  case IO_MODE_IT_HIGH_LEVEL: /* High level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN); 
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_HIGH_LEVEL_PU: /* High level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_UP);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE);
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    break;
+
+  case IO_MODE_IT_HIGH_LEVEL_PD: /* High level interrupt mode */
+    mfxstm32l152_IO_EnableIT(DeviceAddr);
+    mfxstm32l152_IO_InitPin(DeviceAddr, IO_Pin, MFXSTM32L152_GPIO_DIR_IN);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_TYPE1, IO_Pin, MFXSTM32L152_GPI_WITH_PULL_RESISTOR);
+    mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_PUPD1, IO_Pin, MFXSTM32L152_GPIO_PULL_DOWN);
+    mfxstm32l152_IO_SetIrqEvtMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_EVT_LEVEL);
+    mfxstm32l152_IO_SetIrqTypeMode(DeviceAddr, IO_Pin, MFXSTM32L152_IRQ_GPI_TYPE_HLRE);  
+    mfxstm32l152_IO_EnablePinIT(DeviceAddr, IO_Pin);  /* last to do: enable IT */
+    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  MFXSTM32L152_GPIO_PIN_x: Where x can be from 0 to 23.   
+  * @param  Direction: could be MFXSTM32L152_GPIO_DIR_IN or MFXSTM32L152_GPIO_DIR_OUT.      
+  * @retval None
+  */
+void mfxstm32l152_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction)
+{
+  mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_DIR1, IO_Pin, Direction);
+}
+
+/**
+  * @brief  Set the global interrupt Type. 
+  * @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  MFXSTM32L152_GPIO_PIN_x: Where x can be from 0 to 23.   
+  * @param  Evt: Interrupt line activity type, could be one of the following values:
+  *   @arg  MFXSTM32L152_IRQ_GPI_EVT_LEVEL: Interrupt line is active in level model         
+  *   @arg  MFXSTM32L152_IRQ_GPI_EVT_EDGE: Interrupt line is active in edge model           
+  * @retval None
+  */
+void mfxstm32l152_IO_SetIrqEvtMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Evt)
+{
+  mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_EVT1, IO_Pin, Evt);
+  MFX_IO_Delay(1);
+}
+
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x: Where x can be from 0 to 23.  
+  * @param  Evt: Interrupt line activity type, could be one of the following values:
+  *   @arg  MFXSTM32L152_IRQ_GPI_TYPE_LLFE: Interrupt line is active in Low Level or Falling Edge         
+  *   @arg  MFXSTM32L152_IRQ_GPI_TYPE_HLRE: Interrupt line is active in High Level or Rising Edge           
+  * @retval None
+  */
+void mfxstm32l152_IO_SetIrqTypeMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Type)
+{
+  mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE1, IO_Pin, Type);
+  MFX_IO_Delay(1);
+}
+
+/**
+  * @brief  When GPIO is in output mode, puts the corresponding GPO in High (1) or Low (0) level.
+  * @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  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23. 
+  * @param PinState: The new IO pin state.
+  * @retval None
+  */
+void mfxstm32l152_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 SET register */
+	mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPO_SET1, IO_Pin, 1);
+  }
+  else
+  {
+    /* Set the CLEAR register */
+	mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPO_CLR1, IO_Pin, 1);
+  } 
+}
+
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23. 
+  * @retval IO pin(s) state.
+  */
+uint32_t mfxstm32l152_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmp1;
+  uint16_t tmp2;
+  uint32_t tmp3;
+  
+  tmp1 = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_STATE1);
+  tmp2 = (uint16_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_STATE2);
+  tmp3 = (uint32_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_GPIO_STATE3);
+  tmp3 = tmp1 + (tmp2 << 8) + (tmp3 << 16);
+  
+  return(tmp3 & IO_Pin);
+}
+
+/**
+  * @brief  Enable the global IO interrupt source.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void mfxstm32l152_IO_EnableIT(uint16_t DeviceAddr)
+{ 
+  MFX_IO_ITConfig();
+    
+  /* Enable global IO IT source */
+  mfxstm32l152_EnableITSource(DeviceAddr, MFXSTM32L152_IRQ_GPIO);
+}
+
+/**
+  * @brief  Disable the global IO interrupt source.
+  * @param  DeviceAddr: Device address on communication Bus.   
+  * @retval None
+  */
+void mfxstm32l152_IO_DisableIT(uint16_t DeviceAddr)
+{
+  /* Disable global IO IT source */
+  mfxstm32l152_DisableITSource(DeviceAddr, MFXSTM32L152_IRQ_GPIO);    
+}
+  
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23.
+  * @retval None
+  */
+void mfxstm32l152_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1, IO_Pin, 1);
+}
+
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23.
+  * @retval None
+  */
+void mfxstm32l152_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1, IO_Pin, 0);
+}
+
+
+/**
+  * @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  MFXSTM32L152_GPIO_PIN_x Where x can be from 0 to 23.             
+  * @retval Status of the checked IO pin(s).
+  */
+uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  /* Get the Interrupt status */
+  uint8_t tmp1;
+  uint16_t tmp2;
+  uint32_t tmp3;
+
+  tmp1 = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING1);
+  tmp2 = (uint16_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING2);
+  tmp3 = (uint32_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING3);
+  tmp3 = tmp1 + (tmp2 << 8) + (tmp3 << 16);
+  
+  return(tmp3 & IO_Pin);
+}
+
+/**
+  * @brief  Clear the selected IO interrupt pending bit(s). It clear automatically also the general MFXSTM32L152_REG_ADR_IRQ_PENDING
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  IO_Pin: the IO interrupt to be cleared, could be:
+  *   @arg  MFXSTM32L152_GPIO_PIN_x: Where x can be from 0 to 23.            
+  * @retval None
+  */
+void mfxstm32l152_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  /* Clear the IO IT pending bit(s) by acknowledging */
+  /* it cleans automatically also the Global IRQ_GPIO */
+  /* normally this function is called under interrupt */
+  uint8_t pin_0_7, pin_8_15, pin_16_23;
+
+  pin_0_7   = IO_Pin & 0x0000ff;
+  pin_8_15  = IO_Pin >> 8;
+  pin_8_15   = pin_8_15 & 0x00ff;
+  pin_16_23 = IO_Pin >> 16;
+
+  if (pin_0_7)
+  {
+    MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_ACK1, pin_0_7);
+  }
+  if (pin_8_15)
+  {
+    MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_ACK2, pin_8_15);
+  }
+  if (pin_16_23)
+  {
+    MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_ACK3, pin_16_23);
+  }
+}
+
+
+/**
+  * @brief  Enable the AF for aGPIO.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void mfxstm32l152_IO_EnableAF(uint16_t DeviceAddr)
+{
+  uint8_t mode;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL);
+  
+  /* Enable ALTERNATE functions */
+  /* AGPIO[0..3] can be either IDD or GPIO */ 
+  /* AGPIO[4..7] can be either TS or GPIO */ 
+  /* if IDD or TS are enabled no matter the value this bit GPIO are not available for those pins */
+  /*  however the MFX will waste some cycles to to handle these potential GPIO (pooling, etc) */ 
+  /* so if IDD and TS are both active it is better to let ALTERNATE disabled (0) */
+  /* if however IDD or TS are not connected then set it on gives more GPIOs availability */
+  /* remind that AGPIO are less efficient then normal GPIO (they use pooling rather then EXTI) */
+  mode |= MFXSTM32L152_ALTERNATE_GPIO_EN;  
+ 
+  /* Write the new register value */  
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode);
+}
+
+/**
+  * @brief  Disable the AF for aGPIO.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+ void mfxstm32l152_IO_DisableAF(uint16_t DeviceAddr)
+{
+  uint8_t mode;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL);
+  
+  /* Enable ALTERNATE functions */
+  /* AGPIO[0..3] can be either IDD or GPIO */ 
+  /* AGPIO[4..7] can be either TS or GPIO */ 
+  /* if IDD or TS are enabled no matter the value this bit GPIO are not available for those pins */
+  /*  however the MFX will waste some cycles to to handle these potential GPIO (pooling, etc) */ 
+  /* so if IDD and TS are both active it is better to let ALTERNATE disabled (0) */
+  /* if however IDD or TS are not connected then set it on gives more GPIOs availability */
+  /* remind that AGPIO are less efficient then normal GPIO (they use pooling rather then EXTI) */
+  mode &= ~MFXSTM32L152_ALTERNATE_GPIO_EN;  
+ 
+  /* Write the new register value */  
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode);
+  
+}
+
+
+/* ------------------------------------------------------------------ */
+/* --------------------- TOUCH SCREEN ------------------------------- */
+/* ------------------------------------------------------------------ */
+
+/**
+  * @brief  Configures the touch Screen Controller (Single point detection)
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void mfxstm32l152_TS_Start(uint16_t DeviceAddr)
+{
+  uint8_t mode;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL);
+  
+  /* Set the Functionalities to be Enabled */    
+  mode |= MFXSTM32L152_TS_EN;  
+  
+  /* Set the new register value */  
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode);
+     
+  /* Wait for 2 ms */
+  MFX_IO_Delay(2); 
+  
+  /* Select 2 nF filter capacitor */
+  /* Configuration: 
+     - Touch average control    : 4 samples
+     - Touch delay time         : 500 uS
+     - Panel driver setting time: 500 uS 
+  */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_SETTLING, 0x32);
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_TOUCH_DET_DELAY, 0x5);
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_AVE, 0x04);
+  
+  /* Configure the Touch FIFO threshold: single point reading */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_FIFO_TH, 0x01);
+  
+  /* Clear the FIFO memory content. */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_FIFO_TH, MFXSTM32L152_TS_CLEAR_FIFO);
+
+  /* Touch screen control configuration :
+     - No window tracking index
+   */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_TRACK, 0x00);
+  
+ 
+  /*  Clear all the IT status pending bits if any */
+  mfxstm32l152_IO_ClearIT(DeviceAddr, 0xFFFFFF);
+
+  /* Wait for 1 ms delay */
+  MFX_IO_Delay(1);
+}
+
+/**
+  * @brief  Return if there is touch detected or not.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Touch detected state.
+  */
+uint8_t mfxstm32l152_TS_DetectTouch(uint16_t DeviceAddr)
+{
+  uint8_t state;
+  uint8_t ret = 0;
+ 
+  state = MFX_IO_Read(DeviceAddr, MFXSTM32L152_TS_FIFO_STA);
+  state = ((state & (uint8_t)MFXSTM32L152_TS_CTRL_STATUS) == (uint8_t)MFXSTM32L152_TS_CTRL_STATUS);
+  
+  if(state > 0)
+  {
+    if(MFX_IO_Read(DeviceAddr, MFXSTM32L152_TS_FIFO_LEVEL) > 0)
+    {
+      ret = 1;
+    }
+  }
+  
+  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 mfxstm32l152_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
+{
+  uint8_t  data_xy[3];
+
+  MFX_IO_ReadMultiple(DeviceAddr, MFXSTM32L152_TS_XY_DATA, data_xy, sizeof(data_xy)) ;
+  
+  /* Calculate positions values */
+  *X = (data_xy[1]<<4) + (data_xy[0]>>4); 
+  *Y = (data_xy[2]<<4) + (data_xy[0]&4); 
+
+  /* Reset the FIFO memory content. */
+  MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_FIFO_TH, MFXSTM32L152_TS_CLEAR_FIFO);
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void mfxstm32l152_TS_EnableIT(uint16_t DeviceAddr)
+{
+  MFX_IO_ITConfig();
+  
+  /* Enable global TS IT source */
+  mfxstm32l152_EnableITSource(DeviceAddr, MFXSTM32L152_IRQ_TS_DET);
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @retval None
+  */
+void mfxstm32l152_TS_DisableIT(uint16_t DeviceAddr)
+{
+  /* Disable global TS IT source */
+  mfxstm32l152_DisableITSource(DeviceAddr, MFXSTM32L152_IRQ_TS_DET);    
+}
+
+/**
+  * @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 mfxstm32l152_TS_ITStatus(uint16_t DeviceAddr)
+{
+  /* Return TS interrupts status */
+  return(mfxstm32l152_GlobalITStatus(DeviceAddr, MFXSTM32L152_IRQ_TS));
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void mfxstm32l152_TS_ClearIT(uint16_t DeviceAddr)
+{
+  /* Clear the global TS IT source */
+  mfxstm32l152_ClearGlobalIT(DeviceAddr, MFXSTM32L152_IRQ_TS);
+}
+
+/* ------------------------------------------------------------------ */
+/* --------------------- IDD MEASUREMENT ---------------------------- */
+/* ------------------------------------------------------------------ */
+
+/**
+  * @brief  Launch IDD current measurement
+  * @param  DeviceAddr: Device address on communication Bus
+  * @retval None.
+  */
+void mfxstm32l152_IDD_Start(uint16_t DeviceAddr)
+{
+  uint8_t mode = 0;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_CTRL);
+
+  /* Set the Functionalities to be enabled */
+  mode |= MFXSTM32L152_IDD_CTRL_REQ;
+
+  /* Start measurement campaign */
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_CTRL, mode);
+}
+
+/**
+  * @brief  Configures the IDD current measurement
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  MfxIddConfig: Parameters depending on hardware config.
+  * @retval None
+  */
+void mfxstm32l152_IDD_Config(uint16_t DeviceAddr, IDD_ConfigTypeDef MfxIddConfig)
+{
+  uint8_t value = 0;
+  uint8_t mode = 0;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL);
+
+  if((mode & MFXSTM32L152_IDD_EN) != MFXSTM32L152_IDD_EN)
+  {
+    /* Set the Functionalities to be enabled */
+    mode |= MFXSTM32L152_IDD_EN;
+
+    /* Set the new register value */
+    MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode);
+  }
+
+  /* Control register setting: number of shunts */
+  value =  ((MfxIddConfig.ShuntNbUsed << 1) & MFXSTM32L152_IDD_CTRL_SHUNT_NB);
+  value |= (MfxIddConfig.VrefMeasurement & MFXSTM32L152_IDD_CTRL_VREF_DIS);
+  value |= (MfxIddConfig.Calibration & MFXSTM32L152_IDD_CTRL_CAL_DIS);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_CTRL, value);
+
+  /* Idd pre delay configuration: unit and value*/
+  value = (MfxIddConfig.PreDelayUnit & MFXSTM32L152_IDD_PREDELAY_UNIT) |
+          (MfxIddConfig.PreDelayValue & MFXSTM32L152_IDD_PREDELAY_VALUE);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_PRE_DELAY, value);
+
+  /* Shunt 0 register value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.Shunt0Value >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT0_MSB, value);
+  value = (uint8_t) (MfxIddConfig.Shunt0Value);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT0_LSB, value);
+
+  /* Shunt 1 register value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.Shunt1Value >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT1_MSB, value);
+  value = (uint8_t) (MfxIddConfig.Shunt1Value);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT1_LSB, value);
+
+  /* Shunt 2 register value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.Shunt2Value >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT2_MSB, value);
+  value = (uint8_t) (MfxIddConfig.Shunt2Value);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT2_LSB, value);
+
+  /* Shunt 3 register value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.Shunt3Value >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT3_MSB, value);
+  value = (uint8_t) (MfxIddConfig.Shunt3Value);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT3_LSB, value);
+
+  /* Shunt 4 register value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.Shunt4Value >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT4_MSB, value);
+  value = (uint8_t) (MfxIddConfig.Shunt4Value);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT4_LSB, value);
+
+  /* Shunt 0 stabilization delay */
+  value = MfxIddConfig.Shunt0StabDelay;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SH0_STABILIZATION, value);
+
+  /* Shunt 1 stabilization delay */
+  value = MfxIddConfig.Shunt1StabDelay;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SH1_STABILIZATION, value);
+
+  /* Shunt 2 stabilization delay */
+  value = MfxIddConfig.Shunt2StabDelay;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SH2_STABILIZATION, value);
+
+  /* Shunt 3 stabilization delay */
+  value = MfxIddConfig.Shunt3StabDelay;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SH3_STABILIZATION, value);
+
+  /* Shunt 4 stabilization delay */
+  value = MfxIddConfig.Shunt4StabDelay;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SH4_STABILIZATION, value);
+
+  /* Idd ampli gain value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.AmpliGain >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_GAIN_MSB, value);
+  value = (uint8_t) (MfxIddConfig.AmpliGain);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_GAIN_LSB, value);
+
+  /* Idd VDD min value: MSB then LSB */
+  value = (uint8_t) (MfxIddConfig.VddMin >> 8);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_VDD_MIN_MSB, value);
+  value = (uint8_t) (MfxIddConfig.VddMin);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_VDD_MIN_LSB, value);
+
+  /* Idd number of measurements */
+  value = MfxIddConfig.MeasureNb;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_NBR_OF_MEAS, value);
+
+  /* Idd delta delay configuration: unit and value */
+  value = (MfxIddConfig.DeltaDelayUnit & MFXSTM32L152_IDD_DELTADELAY_UNIT) |
+          (MfxIddConfig.DeltaDelayValue & MFXSTM32L152_IDD_DELTADELAY_VALUE);
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_MEAS_DELTA_DELAY, value);
+
+  /* Idd number of shut on board */
+  value = MfxIddConfig.ShuntNbOnBoard;
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNTS_ON_BOARD, value);
+}
+
+/**
+  * @brief  This function allows to modify number of shunt used for a measurement
+  * @param  DeviceAddr: Device address on communication Bus
+  * @retval None.
+  */
+void mfxstm32l152_IDD_ConfigShuntNbLimit(uint16_t DeviceAddr, uint8_t ShuntNbLimit)
+{
+  uint8_t mode = 0;
+
+  /* Get the current register value */
+  mode = MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_CTRL);
+
+  /* Clear number of shunt limit */
+  mode &= ~(MFXSTM32L152_IDD_CTRL_SHUNT_NB);
+
+  /* Clear number of shunt limit */
+  mode |= ((ShuntNbLimit << 1) & MFXSTM32L152_IDD_CTRL_SHUNT_NB);
+
+  /* Write noewx desired limit */
+  MFX_IO_Write((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_CTRL, mode);
+}
+
+/**
+  * @brief  Get Idd current value
+  * @param  DeviceAddr: Device address on communication Bus
+  * @param  ReadValue: Pointer on value to be read
+  * @retval Idd value in 10 nA.
+  */
+void mfxstm32l152_IDD_GetValue(uint16_t DeviceAddr, uint32_t *ReadValue)
+{
+  uint8_t  data[3];
+
+  MFX_IO_ReadMultiple((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_VALUE_MSB, data, sizeof(data)) ;
+
+  /* Recompose Idd current value */
+  *ReadValue = (data[0] << 16) | (data[1] << 8) | data[2];
+
+}
+
+/**
+  * @brief  Get Last shunt used for measurement
+  * @param  DeviceAddr: Device address on communication Bus
+  * @retval Last shunt used 
+  */
+uint8_t  mfxstm32l152_IDD_GetShuntUsed(uint16_t DeviceAddr)
+{
+  return(MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_IDD_SHUNT_USED));
+}
+
+/**
+  * @brief  Configure mfx to enable Idd interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void mfxstm32l152_IDD_EnableIT(uint16_t DeviceAddr)
+{
+  MFX_IO_ITConfig();
+
+  /* Enable global IDD interrupt source */
+  mfxstm32l152_EnableITSource(DeviceAddr, MFXSTM32L152_IRQ_IDD);
+}
+
+/**
+  * @brief  Clear Idd global interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void mfxstm32l152_IDD_ClearIT(uint16_t DeviceAddr)
+{
+  /* Clear the global IDD interrupt source */
+  mfxstm32l152_ClearGlobalIT(DeviceAddr, MFXSTM32L152_IRQ_IDD);
+}
+
+/**
+  * @brief  get Idd interrupt status
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval IDD interrupts status
+  */
+uint8_t mfxstm32l152_IDD_GetITStatus(uint16_t DeviceAddr)
+{
+  /* Return IDD interrupt status */
+  return(mfxstm32l152_GlobalITStatus(DeviceAddr, MFXSTM32L152_IRQ_IDD));
+}
+
+/**
+  * @brief  disable Idd interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void mfxstm32l152_IDD_DisableIT(uint16_t DeviceAddr)
+{
+  /* Disable global IDD interrupt source */
+  mfxstm32l152_DisableITSource(DeviceAddr, MFXSTM32L152_IRQ_IDD);
+}
+
+
+/* ------------------------------------------------------------------ */
+/* --------------------- ERROR MANAGEMENT --------------------------- */
+/* ------------------------------------------------------------------ */
+
+/**
+  * @brief  Read Error Source.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Error message code with error source
+  */
+uint8_t mfxstm32l152_Error_ReadSrc(uint16_t DeviceAddr)
+{
+  /* Get the current source register value */
+  return(MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_ERROR_SRC));
+}
+
+/**
+  * @brief  Read Error Message
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Error message code with error source
+  */
+uint8_t mfxstm32l152_Error_ReadMsg(uint16_t DeviceAddr)
+{
+  /* Get the current message register value */
+  return(MFX_IO_Read((uint8_t) DeviceAddr, MFXSTM32L152_REG_ADR_ERROR_MSG));
+}
+
+/**
+  * @brief  Enable Error global interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+
+void mfxstm32l152_Error_EnableIT(uint16_t DeviceAddr)
+{
+  MFX_IO_ITConfig();
+
+  /* Enable global Error interrupt source */
+  mfxstm32l152_EnableITSource(DeviceAddr, MFXSTM32L152_IRQ_ERROR);
+}
+
+/**
+  * @brief  Clear Error global interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void mfxstm32l152_Error_ClearIT(uint16_t DeviceAddr)
+{
+  /* Clear the global Error interrupt source */
+  mfxstm32l152_ClearGlobalIT(DeviceAddr, MFXSTM32L152_IRQ_ERROR);
+}
+
+/**
+  * @brief  get Error interrupt status
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Error interrupts status
+  */
+uint8_t mfxstm32l152_Error_GetITStatus(uint16_t DeviceAddr)
+{
+  /* Return Error interrupt status */
+  return(mfxstm32l152_GlobalITStatus(DeviceAddr, MFXSTM32L152_IRQ_ERROR));
+}
+
+/**
+  * @brief  disable Error interrupt
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void mfxstm32l152_Error_DisableIT(uint16_t DeviceAddr)
+{
+  /* Disable global Error interrupt source */
+  mfxstm32l152_DisableITSource(DeviceAddr, MFXSTM32L152_IRQ_ERROR);
+}
+
+/**
+  * @brief  FOR DEBUG ONLY
+  */
+uint8_t mfxstm32l152_ReadReg(uint16_t DeviceAddr, uint8_t RegAddr)
+{
+  /* Get the current register value */ 
+  return(MFX_IO_Read((uint8_t) DeviceAddr, RegAddr));
+}
+
+void mfxstm32l152_WriteReg(uint16_t DeviceAddr, uint8_t RegAddr, uint8_t Value)
+{
+  /* set the current register value */ 
+  MFX_IO_Write((uint8_t) DeviceAddr, RegAddr, Value);
+}
+
+/* ------------------------------------------------------------------ */
+/* ----------------------- Private functions ------------------------ */
+/* ------------------------------------------------------------------ */
+/**
+  * @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 mfxstm32l152_GetInstance(uint16_t DeviceAddr)
+{
+  uint8_t idx = 0;
+  
+  /* Check all the registered instances */
+  for(idx = 0; idx < MFXSTM32L152_MAX_INSTANCE ; idx ++)
+  {
+    if(mfxstm32l152[idx] == DeviceAddr)
+    {
+      return idx; 
+    }
+  }
+  
+  return 0xFF;
+}
+
+/**
+  * @brief  Release registered device instance
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Index of released device instance, 0xFF if not.
+  */
+static uint8_t mfxstm32l152_ReleaseInstance(uint16_t DeviceAddr)
+{
+  uint8_t idx = 0;
+  
+  /* Check for all the registered instances */
+  for(idx = 0; idx < MFXSTM32L152_MAX_INSTANCE ; idx ++)
+  {
+    if(mfxstm32l152[idx] == DeviceAddr)
+    {
+      mfxstm32l152[idx] = 0;
+      return idx;
+    }
+  }
+  return 0xFF;
+}
+
+/**
+  * @brief  Internal routine
+  * @param  DeviceAddr: Device address on communication Bus. 
+  * @param  RegisterAddr: Register Address
+  * @param  PinPosition: Pin [0:23]
+  * @param  PinValue: 0/1
+  * @retval None
+  */
+void mfxstm32l152_reg24_setPinValue(uint16_t DeviceAddr, uint8_t RegisterAddr, uint32_t PinPosition, uint8_t PinValue )
+{
+  uint8_t tmp = 0;
+  uint8_t pin_0_7, pin_8_15, pin_16_23;
+
+  pin_0_7   = PinPosition & 0x0000ff;
+  pin_8_15  = PinPosition >> 8;
+  pin_8_15   = pin_8_15 & 0x00ff;
+  pin_16_23 = PinPosition >> 16;
+  
+  if (pin_0_7)
+  {  
+    /* Get the current register value */ 
+    tmp = MFX_IO_Read(DeviceAddr, RegisterAddr);
+  
+    /* Set the selected pin direction */
+    if (PinValue != 0)
+    {
+      tmp |= (uint8_t)pin_0_7;
+    }  
+    else 
+    {
+      tmp &= ~(uint8_t)pin_0_7;
+    }
+  
+    /* Set the new register value */
+    MFX_IO_Write(DeviceAddr, RegisterAddr, tmp);
+  }
+
+  if (pin_8_15)
+  {
+    /* Get the current register value */ 
+    tmp = MFX_IO_Read(DeviceAddr, RegisterAddr+1);
+  
+    /* Set the selected pin direction */
+    if (PinValue != 0)
+    {
+      tmp |= (uint8_t)pin_8_15;
+    }  
+    else 
+    {
+      tmp &= ~(uint8_t)pin_8_15;
+    }
+  
+    /* Set the new register value */
+    MFX_IO_Write(DeviceAddr, RegisterAddr+1, tmp);
+  }  
+
+  if (pin_16_23)
+  {
+    /* Get the current register value */ 
+    tmp = MFX_IO_Read(DeviceAddr, RegisterAddr+2);
+  
+    /* Set the selected pin direction */
+    if (PinValue != 0)
+    {
+      tmp |= (uint8_t)pin_16_23;
+    }  
+    else 
+    {
+      tmp &= ~(uint8_t)pin_16_23;
+    }
+  
+    /* Set the new register value */
+    MFX_IO_Write(DeviceAddr, RegisterAddr+2, tmp);
+  } 
+}
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */      
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 668 - 0
bsp/stm32f411RE/Libraries/BSP/Components/mfxstm32l152/mfxstm32l152.h

@@ -0,0 +1,668 @@
+/**
+  ******************************************************************************
+  * @file    mfxstm32l152.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file contains all the functions prototypes for the
+  *          mfxstm32l152.c IO expander driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __MFXSTM32L152_H
+#define __MFXSTM32L152_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif   
+   
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/ts.h"
+#include "../Common/io.h"
+#include "../Common/idd.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Component
+  * @{
+  */
+    
+/** @defgroup MFXSTM32L152
+  * @{
+  */    
+
+/* Exported types ------------------------------------------------------------*/
+
+/** @defgroup MFXSTM32L152_Exported_Types
+  * @{
+  */ 
+typedef struct
+{
+  uint8_t SYS_CTRL;
+  uint8_t ERROR_SRC;
+  uint8_t ERROR_MSG;
+  uint8_t IRQ_OUT;
+  uint8_t IRQ_SRC_EN;
+  uint8_t IRQ_PENDING;
+  uint8_t IDD_CTRL;
+  uint8_t IDD_PRE_DELAY;
+  uint8_t IDD_SHUNT0_MSB;
+  uint8_t IDD_SHUNT0_LSB;
+  uint8_t IDD_SHUNT1_MSB;
+  uint8_t IDD_SHUNT1_LSB;
+  uint8_t IDD_SHUNT2_MSB;
+  uint8_t IDD_SHUNT2_LSB;
+  uint8_t IDD_SHUNT3_MSB;
+  uint8_t IDD_SHUNT3_LSB;
+  uint8_t IDD_SHUNT4_MSB;
+  uint8_t IDD_SHUNT4_LSB;
+  uint8_t IDD_GAIN_MSB;
+  uint8_t IDD_GAIN_LSB;
+  uint8_t IDD_VDD_MIN_MSB;
+  uint8_t IDD_VDD_MIN_LSB;
+  uint8_t IDD_VALUE_MSB;
+  uint8_t IDD_VALUE_MID;
+  uint8_t IDD_VALUE_LSB;
+  uint8_t IDD_CAL_OFFSET_MSB;
+  uint8_t IDD_CAL_OFFSET_LSB;
+  uint8_t IDD_SHUNT_USED;
+}IDD_dbgTypeDef;
+
+/**
+  * @}
+  */
+
+/* Exported constants --------------------------------------------------------*/
+  
+/** @defgroup MFXSTM32L152_Exported_Constants
+  * @{
+  */ 
+
+ /**
+  * @brief  MFX COMMON defines
+  */
+   
+ /**
+  * @brief  Register address: chip IDs (R)
+  */
+#define MFXSTM32L152_REG_ADR_ID                 ((uint8_t)0x00)
+ /**
+  * @brief  Register address: chip FW_VERSION  (R)
+  */
+#define MFXSTM32L152_REG_ADR_FW_VERSION_MSB     ((uint8_t)0x01)
+#define MFXSTM32L152_REG_ADR_FW_VERSION_LSB     ((uint8_t)0x00)
+ /**
+  * @brief  Register address: System Control Register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_SYS_CTRL           ((uint8_t)0x40)
+ /**
+  * @brief  Register address: Vdd monitoring (R)
+  */
+#define MFXSTM32L152_REG_ADR_VDD_REF_MSB        ((uint8_t)0x06)
+#define MFXSTM32L152_REG_ADR_VDD_REF_LSB        ((uint8_t)0x07)
+ /**
+  * @brief  Register address: Error source
+  */
+#define MFXSTM32L152_REG_ADR_ERROR_SRC          ((uint8_t)0x03)
+ /**
+  * @brief  Register address: Error Message
+  */
+#define MFXSTM32L152_REG_ADR_ERROR_MSG          ((uint8_t)0x04)
+
+ /**
+  * @brief  Reg Addr IRQs: to config the pin that informs Main MCU that MFX events appear
+  */
+#define MFXSTM32L152_REG_ADR_MFX_IRQ_OUT        ((uint8_t)0x41)
+ /**
+  * @brief  Reg Addr IRQs: to select the events which activate the MFXSTM32L152_IRQ_OUT signal
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_SRC_EN         ((uint8_t)0x42)
+ /**
+  * @brief  Reg Addr IRQs: the Main MCU must read the IRQ_PENDING register to know the interrupt reason
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_PENDING        ((uint8_t)0x08)
+ /**
+  * @brief  Reg Addr IRQs: the Main MCU must acknowledge it thanks to a writing access to the IRQ_ACK register
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_ACK            ((uint8_t)0x44)
+   
+  /**
+  * @brief  MFXSTM32L152_REG_ADR_ID choices
+  */
+#define MFXSTM32L152_ID_1                    ((uint8_t)0x7B)
+#define MFXSTM32L152_ID_2                    ((uint8_t)0x79)
+   
+  /**
+  * @brief  MFXSTM32L152_REG_ADR_SYS_CTRL choices
+  */
+#define MFXSTM32L152_SWRST                    ((uint8_t)0x80)
+#define MFXSTM32L152_STANDBY                  ((uint8_t)0x40)
+#define MFXSTM32L152_ALTERNATE_GPIO_EN        ((uint8_t)0x08) /* by the way if IDD and TS are enabled they take automatically the AF pins*/
+#define MFXSTM32L152_IDD_EN                   ((uint8_t)0x04)
+#define MFXSTM32L152_TS_EN                    ((uint8_t)0x02)
+#define MFXSTM32L152_GPIO_EN                  ((uint8_t)0x01)
+
+  /**
+  * @brief  MFXSTM32L152_REG_ADR_ERROR_SRC choices
+  */
+#define MFXSTM32L152_IDD_ERROR_SRC             ((uint8_t)0x04)  /* Error raised by Idd */
+#define MFXSTM32L152_TS_ERROR_SRC              ((uint8_t)0x02)  /* Error raised by Touch Screen */
+#define MFXSTM32L152_GPIO_ERROR_SRC            ((uint8_t)0x01)  /* Error raised by Gpio */
+
+ /**
+  * @brief  MFXSTM32L152_REG_ADR_MFX_IRQ_OUT choices
+  */
+#define MFXSTM32L152_OUT_PIN_TYPE_OPENDRAIN   ((uint8_t)0x00)
+#define MFXSTM32L152_OUT_PIN_TYPE_PUSHPULL    ((uint8_t)0x01)
+#define MFXSTM32L152_OUT_PIN_POLARITY_LOW     ((uint8_t)0x00)
+#define MFXSTM32L152_OUT_PIN_POLARITY_HIGH    ((uint8_t)0x02)
+
+ /**
+   * @brief  REG_ADR_IRQ_SRC_EN, REG_ADR_IRQ_PENDING & REG_ADR_IRQ_ACK choices
+  */
+#define MFXSTM32L152_IRQ_TS_OVF               ((uint8_t)0x80)  /* TouchScreen FIFO Overflow irq*/
+#define MFXSTM32L152_IRQ_TS_FULL              ((uint8_t)0x40)  /* TouchScreen FIFO Full irq*/
+#define MFXSTM32L152_IRQ_TS_TH                ((uint8_t)0x20)  /* TouchScreen FIFO threshold triggered irq*/
+#define MFXSTM32L152_IRQ_TS_NE                ((uint8_t)0x10)  /* TouchScreen FIFO Not Empty irq*/
+#define MFXSTM32L152_IRQ_TS_DET               ((uint8_t)0x08)  /* TouchScreen Detect irq*/
+#define MFXSTM32L152_IRQ_ERROR                ((uint8_t)0x04)  /* Error message from MFXSTM32L152 firmware irq */
+#define MFXSTM32L152_IRQ_IDD                  ((uint8_t)0x02)  /* IDD function irq */
+#define MFXSTM32L152_IRQ_GPIO                 ((uint8_t)0x01)  /* General GPIO irq (only for SRC_EN and PENDING) */
+#define MFXSTM32L152_IRQ_ALL                  ((uint8_t)0xFF)  /* All global interrupts          */
+#define MFXSTM32L152_IRQ_TS                  (MFXSTM32L152_IRQ_TS_DET | MFXSTM32L152_IRQ_TS_NE |  MFXSTM32L152_IRQ_TS_TH | MFXSTM32L152_IRQ_TS_FULL | MFXSTM32L152_IRQ_TS_OVF ) 
+
+   
+ /**
+  * @brief  GPIO: 24 programmable input/output called MFXSTM32L152_GPIO[23:0] are provided
+  */
+
+ /**
+   * @brief  Reg addr: GPIO DIRECTION (R/W): GPIO pins direction: (0) input, (1) output.
+  */
+#define MFXSTM32L152_REG_ADR_GPIO_DIR1          ((uint8_t)0x60)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPIO_DIR2          ((uint8_t)0x61)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPIO_DIR3          ((uint8_t)0x62)  /* agpio [0:7] */
+ /**
+  * @brief  Reg addr: GPIO TYPE (R/W): If GPIO in output: (0) output push pull, (1) output open drain.
+  *                          If GPIO in input: (0) input without pull resistor, (1) input with pull resistor.
+  */
+#define MFXSTM32L152_REG_ADR_GPIO_TYPE1         ((uint8_t)0x64)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPIO_TYPE2         ((uint8_t)0x65)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPIO_TYPE3         ((uint8_t)0x66)  /* agpio [0:7] */
+ /**
+  * @brief  Reg addr: GPIO PULL_UP_PULL_DOWN (R/W):  discussion open with Jean Claude
+  */
+#define MFXSTM32L152_REG_ADR_GPIO_PUPD1         ((uint8_t)0x68)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPIO_PUPD2         ((uint8_t)0x69)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPIO_PUPD3         ((uint8_t)0x6A)  /* agpio [0:7] */
+ /**
+  * @brief  Reg addr: GPIO SET (W): When GPIO is in output mode, write (1) puts the corresponding GPO in High level.
+  */
+#define MFXSTM32L152_REG_ADR_GPO_SET1           ((uint8_t)0x6C)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPO_SET2           ((uint8_t)0x6D)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPO_SET3           ((uint8_t)0x6E)  /* agpio [0:7] */
+ /**
+  * @brief  Reg addr: GPIO CLEAR (W): When GPIO is in output mode, write (1) puts the corresponding GPO in Low level.
+  */
+#define MFXSTM32L152_REG_ADR_GPO_CLR1           ((uint8_t)0x70)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPO_CLR2           ((uint8_t)0x71)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPO_CLR3           ((uint8_t)0x72)  /* agpio [0:7] */
+ /**
+  * @brief  Reg addr: GPIO STATE (R): Give state of the GPIO pin.
+  */
+#define MFXSTM32L152_REG_ADR_GPIO_STATE1         ((uint8_t)0x10)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_GPIO_STATE2         ((uint8_t)0x11)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_GPIO_STATE3         ((uint8_t)0x12)  /* agpio [0:7] */
+
+  /**
+  * @brief  GPIO IRQ_GPIs
+  */
+/* GPIOs can INDIVIDUALLY generate interruption to the Main MCU thanks to the MFXSTM32L152_IRQ_OUT signal */
+/* the general MFXSTM32L152_IRQ_GPIO_SRC_EN shall be enabled too          */
+  /**
+  * @brief  GPIO IRQ_GPI_SRC1/2/3 (R/W): registers enable or not the feature to generate irq
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1       ((uint8_t)0x48)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC2       ((uint8_t)0x49)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_SRC3       ((uint8_t)0x4A)  /* agpio [0:7] */
+  /**
+  * @brief  GPIO IRQ_GPI_EVT1/2/3 (R/W): Irq generated on level (0) or edge (1).
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT1       ((uint8_t)0x4C)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT2       ((uint8_t)0x4D)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_EVT3       ((uint8_t)0x4E)  /* agpio [0:7] */
+  /**
+  * @brief  GPIO IRQ_GPI_TYPE1/2/3 (R/W): Irq generated on (0) : Low level or Falling edge. (1) : High level or Rising edge.
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE1      ((uint8_t)0x50)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE2      ((uint8_t)0x51)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_TYPE3      ((uint8_t)0x52)  /* agpio [0:7] */
+  /**
+  * @brief  GPIO IRQ_GPI_PENDING1/2/3 (R): irq occurs
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING1   ((uint8_t)0x0C)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING2   ((uint8_t)0x0D)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING3   ((uint8_t)0x0E)  /* agpio [0:7] */
+  /**
+  * @brief  GPIO IRQ_GPI_ACK1/2/3 (W): Write (1) to acknowledge IRQ event
+  */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK1       ((uint8_t)0x54)  /* gpio [0:7] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK2       ((uint8_t)0x55)  /* gpio [8:15] */
+#define MFXSTM32L152_REG_ADR_IRQ_GPI_ACK3       ((uint8_t)0x56)  /* agpio [0:7] */
+
+   
+ /**
+  * @brief  GPIO: IO Pins definition
+  */
+#define MFXSTM32L152_GPIO_PIN_0                  ((uint32_t)0x0001)
+#define MFXSTM32L152_GPIO_PIN_1                  ((uint32_t)0x0002)
+#define MFXSTM32L152_GPIO_PIN_2                  ((uint32_t)0x0004)
+#define MFXSTM32L152_GPIO_PIN_3                  ((uint32_t)0x0008)
+#define MFXSTM32L152_GPIO_PIN_4                  ((uint32_t)0x0010)
+#define MFXSTM32L152_GPIO_PIN_5                  ((uint32_t)0x0020)
+#define MFXSTM32L152_GPIO_PIN_6                  ((uint32_t)0x0040)
+#define MFXSTM32L152_GPIO_PIN_7                  ((uint32_t)0x0080)
+
+#define MFXSTM32L152_GPIO_PIN_8                  ((uint32_t)0x0100) 
+#define MFXSTM32L152_GPIO_PIN_9                  ((uint32_t)0x0200) 
+#define MFXSTM32L152_GPIO_PIN_10                 ((uint32_t)0x0400) 
+#define MFXSTM32L152_GPIO_PIN_11                 ((uint32_t)0x0800)
+#define MFXSTM32L152_GPIO_PIN_12                 ((uint32_t)0x1000) 
+#define MFXSTM32L152_GPIO_PIN_13                 ((uint32_t)0x2000) 
+#define MFXSTM32L152_GPIO_PIN_14                 ((uint32_t)0x4000) 
+#define MFXSTM32L152_GPIO_PIN_15                 ((uint32_t)0x8000) 
+
+#define MFXSTM32L152_GPIO_PIN_16               ((uint32_t)0x010000)
+#define MFXSTM32L152_GPIO_PIN_17               ((uint32_t)0x020000)
+#define MFXSTM32L152_GPIO_PIN_18               ((uint32_t)0x040000)
+#define MFXSTM32L152_GPIO_PIN_19               ((uint32_t)0x080000)
+#define MFXSTM32L152_GPIO_PIN_20               ((uint32_t)0x100000)
+#define MFXSTM32L152_GPIO_PIN_21               ((uint32_t)0x200000)
+#define MFXSTM32L152_GPIO_PIN_22               ((uint32_t)0x400000)
+#define MFXSTM32L152_GPIO_PIN_23               ((uint32_t)0x800000)
+
+#define MFXSTM32L152_AGPIO_PIN_0               MFXSTM32L152_GPIO_PIN_16
+#define MFXSTM32L152_AGPIO_PIN_1               MFXSTM32L152_GPIO_PIN_17
+#define MFXSTM32L152_AGPIO_PIN_2               MFXSTM32L152_GPIO_PIN_18
+#define MFXSTM32L152_AGPIO_PIN_3               MFXSTM32L152_GPIO_PIN_19
+#define MFXSTM32L152_AGPIO_PIN_4               MFXSTM32L152_GPIO_PIN_20
+#define MFXSTM32L152_AGPIO_PIN_5               MFXSTM32L152_GPIO_PIN_21
+#define MFXSTM32L152_AGPIO_PIN_6               MFXSTM32L152_GPIO_PIN_22
+#define MFXSTM32L152_AGPIO_PIN_7               MFXSTM32L152_GPIO_PIN_23
+
+#define MFXSTM32L152_GPIO_PINS_ALL             ((uint32_t)0xFFFFFF)
+
+ /**
+  * @brief  GPIO: constant
+  */
+#define MFXSTM32L152_GPIO_DIR_IN                ((uint8_t)0x0)  
+#define MFXSTM32L152_GPIO_DIR_OUT               ((uint8_t)0x1)  
+#define MFXSTM32L152_IRQ_GPI_EVT_LEVEL          ((uint8_t)0x0)  
+#define MFXSTM32L152_IRQ_GPI_EVT_EDGE           ((uint8_t)0x1)  
+#define MFXSTM32L152_IRQ_GPI_TYPE_LLFE          ((uint8_t)0x0)  /* Low Level Falling Edge */
+#define MFXSTM32L152_IRQ_GPI_TYPE_HLRE          ((uint8_t)0x1)  /*High Level Raising Edge */
+#define MFXSTM32L152_GPI_WITHOUT_PULL_RESISTOR  ((uint8_t)0x0)  
+#define MFXSTM32L152_GPI_WITH_PULL_RESISTOR     ((uint8_t)0x1)  
+#define MFXSTM32L152_GPO_PUSH_PULL              ((uint8_t)0x0)  
+#define MFXSTM32L152_GPO_OPEN_DRAIN             ((uint8_t)0x1)  
+#define MFXSTM32L152_GPIO_PULL_DOWN             ((uint8_t)0x0)  
+#define MFXSTM32L152_GPIO_PULL_UP               ((uint8_t)0x1)   
+   
+   
+  /**
+  * @brief  TOUCH SCREEN Registers
+  */
+
+  /**
+  * @brief  Touch Screen Registers
+  */
+#define MFXSTM32L152_TS_SETTLING            ((uint8_t)0xA0)
+#define MFXSTM32L152_TS_TOUCH_DET_DELAY     ((uint8_t)0xA1)
+#define MFXSTM32L152_TS_AVE                 ((uint8_t)0xA2)
+#define MFXSTM32L152_TS_TRACK               ((uint8_t)0xA3)
+#define MFXSTM32L152_TS_FIFO_TH             ((uint8_t)0xA4)
+#define MFXSTM32L152_TS_FIFO_STA            ((uint8_t)0x20)
+#define MFXSTM32L152_TS_FIFO_LEVEL          ((uint8_t)0x21)
+#define MFXSTM32L152_TS_XY_DATA             ((uint8_t)0x24)
+
+  /**
+  * @brief TS registers masks
+  */
+#define MFXSTM32L152_TS_CTRL_STATUS         ((uint8_t)0x08)
+#define MFXSTM32L152_TS_CLEAR_FIFO          ((uint8_t)0x80)
+
+
+/**
+  * @brief  Register address: Idd control register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_CTRL           ((uint8_t)0x80)
+
+/**
+  * @brief  Register address: Idd pre delay  register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_PRE_DELAY      ((uint8_t)0x81)
+
+/**
+  * @brief  Register address: Idd Shunt registers (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT0_MSB     ((uint8_t)0x82)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT0_LSB     ((uint8_t)0x83)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT1_MSB     ((uint8_t)0x84)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT1_LSB     ((uint8_t)0x85)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT2_MSB     ((uint8_t)0x86)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT2_LSB     ((uint8_t)0x87)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT3_MSB     ((uint8_t)0x88)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT3_LSB     ((uint8_t)0x89)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT4_MSB     ((uint8_t)0x8A)
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT4_LSB     ((uint8_t)0x8B)
+
+/**
+  * @brief  Register address: Idd ampli gain register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_GAIN_MSB       ((uint8_t)0x8C)
+#define MFXSTM32L152_REG_ADR_IDD_GAIN_LSB       ((uint8_t)0x8D)
+
+/**
+  * @brief  Register address: Idd VDD min register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_VDD_MIN_MSB    ((uint8_t)0x8E)
+#define MFXSTM32L152_REG_ADR_IDD_VDD_MIN_LSB    ((uint8_t)0x8F)
+
+/**
+  * @brief  Register address: Idd value register (R)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_VALUE_MSB      ((uint8_t)0x14)
+#define MFXSTM32L152_REG_ADR_IDD_VALUE_MID      ((uint8_t)0x15)
+#define MFXSTM32L152_REG_ADR_IDD_VALUE_LSB      ((uint8_t)0x16)
+
+/**
+  * @brief  Register address: Idd calibration offset register (R)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_CAL_OFFSET_MSB ((uint8_t)0x18)
+#define MFXSTM32L152_REG_ADR_IDD_CAL_OFFSET_LSB ((uint8_t)0x19)
+
+/**
+  * @brief  Register address: Idd shunt used offset register (R)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_SHUNT_USED     ((uint8_t)0x1A)
+
+/**
+  * @brief  Register address: shunt stabilisation delay registers (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_SH0_STABILIZATION  ((uint8_t)0x90)
+#define MFXSTM32L152_REG_ADR_IDD_SH1_STABILIZATION  ((uint8_t)0x91)
+#define MFXSTM32L152_REG_ADR_IDD_SH2_STABILIZATION  ((uint8_t)0x92)
+#define MFXSTM32L152_REG_ADR_IDD_SH3_STABILIZATION  ((uint8_t)0x93)
+#define MFXSTM32L152_REG_ADR_IDD_SH4_STABILIZATION  ((uint8_t)0x94)
+
+/**
+  * @brief  Register address: Idd number of measurements register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_NBR_OF_MEAS    ((uint8_t)0x96)
+
+/**
+  * @brief  Register address: Idd delta delay between 2 measurements register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_MEAS_DELTA_DELAY  ((uint8_t)0x97)
+
+/**
+  * @brief  Register address: Idd number of shunt on board register (R/W)
+  */
+#define MFXSTM32L152_REG_ADR_IDD_SHUNTS_ON_BOARD  ((uint8_t)0x98)
+
+ 
+
+/** @defgroup IDD_Control_Register_Defines  IDD Control Register Defines
+  * @{
+  */
+/**
+  * @brief  IDD control register masks
+  */
+#define MFXSTM32L152_IDD_CTRL_REQ                       ((uint8_t)0x01)
+#define MFXSTM32L152_IDD_CTRL_SHUNT_NB                  ((uint8_t)0x0E)
+#define MFXSTM32L152_IDD_CTRL_VREF_DIS                  ((uint8_t)0x40)
+#define MFXSTM32L152_IDD_CTRL_CAL_DIS                   ((uint8_t)0x80)
+
+/**
+  * @brief  IDD Shunt Number
+  */
+#define MFXSTM32L152_IDD_SHUNT_NB_1                     ((uint8_t) 0x01)
+#define MFXSTM32L152_IDD_SHUNT_NB_2                     ((uint8_t) 0x02)
+#define MFXSTM32L152_IDD_SHUNT_NB_3                     ((uint8_t) 0x03)
+#define MFXSTM32L152_IDD_SHUNT_NB_4                     ((uint8_t) 0x04)
+#define MFXSTM32L152_IDD_SHUNT_NB_5                     ((uint8_t) 0x05)
+
+/**
+  * @brief  Vref Measurement
+  */
+#define MFXSTM32L152_IDD_VREF_AUTO_MEASUREMENT_ENABLE   ((uint8_t) 0x00)
+#define MFXSTM32L152_IDD_VREF_AUTO_MEASUREMENT_DISABLE  ((uint8_t) 0x70)
+
+/**
+  * @brief  IDD Calibration
+  */
+#define MFXSTM32L152_IDD_AUTO_CALIBRATION_ENABLE        ((uint8_t) 0x00)
+#define MFXSTM32L152_IDD_AUTO_CALIBRATION_DISABLE       ((uint8_t) 0x80)
+/**
+  * @}
+  */
+
+/** @defgroup IDD_PreDelay_Defines  IDD PreDelay Defines
+  * @{
+  */
+/**
+  * @brief  IDD PreDelay masks
+  */
+#define MFXSTM32L152_IDD_PREDELAY_UNIT                  ((uint8_t) 0x80)
+#define MFXSTM32L152_IDD_PREDELAY_VALUE                 ((uint8_t) 0x7F)
+
+
+/**
+  * @brief  IDD PreDelay unit
+  */
+#define MFXSTM32L152_IDD_PREDELAY_0_5_MS                ((uint8_t) 0x00)
+#define MFXSTM32L152_IDD_PREDELAY_20_MS                 ((uint8_t) 0x80)
+/**
+  * @}
+  */
+
+/** @defgroup IDD_DeltaDelay_Defines  IDD Delta DElay Defines
+  * @{
+  */
+/**
+  * @brief  IDD Delta Delay masks
+  */
+#define MFXSTM32L152_IDD_DELTADELAY_UNIT                ((uint8_t) 0x80)
+#define MFXSTM32L152_IDD_DELTADELAY_VALUE               ((uint8_t) 0x7F)
+
+
+/**
+  * @brief  IDD Delta Delay unit
+  */
+#define MFXSTM32L152_IDD_DELTADELAY_0_5_MS              ((uint8_t) 0x00)
+#define MFXSTM32L152_IDD_DELTADELAY_20_MS               ((uint8_t) 0x80)
+
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+ 
+/* Exported macro ------------------------------------------------------------*/
+   
+/** @defgroup MFXSTM32L152_Exported_Macros
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/* Exported functions --------------------------------------------------------*/
+  
+/** @defgroup MFXSTM32L152_Exported_Functions
+  * @{
+  */
+
+/** 
+  * @brief MFXSTM32L152 Control functions
+  */
+void     mfxstm32l152_Init(uint16_t DeviceAddr);
+void     mfxstm32l152_DeInit(uint16_t DeviceAddr);
+void     mfxstm32l152_Reset(uint16_t DeviceAddr);
+uint16_t mfxstm32l152_ReadID(uint16_t DeviceAddr);
+uint16_t mfxstm32l152_ReadFwVersion(uint16_t DeviceAddr);
+void     mfxstm32l152_LowPower(uint16_t DeviceAddr);
+void     mfxstm32l152_WakeUp(uint16_t DeviceAddr);
+
+void     mfxstm32l152_EnableITSource(uint16_t DeviceAddr, uint8_t Source);
+void     mfxstm32l152_DisableITSource(uint16_t DeviceAddr, uint8_t Source);
+uint8_t  mfxstm32l152_GlobalITStatus(uint16_t DeviceAddr, uint8_t Source);
+void     mfxstm32l152_ClearGlobalIT(uint16_t DeviceAddr, uint8_t Source);
+
+void     mfxstm32l152_SetIrqOutPinPolarity(uint16_t DeviceAddr, uint8_t Polarity);
+void     mfxstm32l152_SetIrqOutPinType(uint16_t DeviceAddr, uint8_t Type);
+
+
+/** 
+  * @brief MFXSTM32L152 IO functionalities functions
+  */
+void     mfxstm32l152_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin);
+uint8_t  mfxstm32l152_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
+void     mfxstm32l152_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState);
+uint32_t mfxstm32l152_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     mfxstm32l152_IO_EnableIT(uint16_t DeviceAddr);
+void     mfxstm32l152_IO_DisableIT(uint16_t DeviceAddr);
+uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     mfxstm32l152_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+
+void     mfxstm32l152_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction);
+void     mfxstm32l152_IO_EnableAF(uint16_t DeviceAddr);
+void     mfxstm32l152_IO_DisableAF(uint16_t DeviceAddr);
+void     mfxstm32l152_IO_SetIrqTypeMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Type);
+void     mfxstm32l152_IO_SetIrqEvtMode(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Evt);
+void     mfxstm32l152_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     mfxstm32l152_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+
+/** 
+  * @brief MFXSTM32L152 Touch screen functionalities functions
+  */
+void     mfxstm32l152_TS_Start(uint16_t DeviceAddr);
+uint8_t  mfxstm32l152_TS_DetectTouch(uint16_t DeviceAddr);
+void     mfxstm32l152_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
+void     mfxstm32l152_TS_EnableIT(uint16_t DeviceAddr);
+void     mfxstm32l152_TS_DisableIT(uint16_t DeviceAddr);
+uint8_t  mfxstm32l152_TS_ITStatus (uint16_t DeviceAddr);
+void     mfxstm32l152_TS_ClearIT (uint16_t DeviceAddr);
+
+/**
+  * @brief MFXSTM32L152 IDD current measurement functionalities functions
+  */
+void     mfxstm32l152_IDD_Start(uint16_t DeviceAddr);
+void     mfxstm32l152_IDD_Config(uint16_t DeviceAddr, IDD_ConfigTypeDef MfxIddConfig);
+void     mfxstm32l152_IDD_ConfigShuntNbLimit(uint16_t DeviceAddr, uint8_t ShuntNbLimit);
+void     mfxstm32l152_IDD_GetValue(uint16_t DeviceAddr, uint32_t *ReadValue);
+uint8_t  mfxstm32l152_IDD_GetShuntUsed(uint16_t DeviceAddr);
+void     mfxstm32l152_IDD_EnableIT(uint16_t DeviceAddr);
+void     mfxstm32l152_IDD_ClearIT(uint16_t DeviceAddr);
+uint8_t  mfxstm32l152_IDD_GetITStatus(uint16_t DeviceAddr);
+void     mfxstm32l152_IDD_DisableIT(uint16_t DeviceAddr);
+
+/**
+  * @brief MFXSTM32L152 Error management functions
+  */
+uint8_t  mfxstm32l152_Error_ReadSrc(uint16_t DeviceAddr);
+uint8_t  mfxstm32l152_Error_ReadMsg(uint16_t DeviceAddr);
+void     mfxstm32l152_Error_EnableIT(uint16_t DeviceAddr);
+void     mfxstm32l152_Error_ClearIT(uint16_t DeviceAddr);
+uint8_t  mfxstm32l152_Error_GetITStatus(uint16_t DeviceAddr);
+void     mfxstm32l152_Error_DisableIT(uint16_t DeviceAddr);
+
+uint8_t  mfxstm32l152_ReadReg(uint16_t DeviceAddr, uint8_t RegAddr);
+void     mfxstm32l152_WriteReg(uint16_t DeviceAddr, uint8_t RegAddr, uint8_t Value);
+
+
+
+/** 
+  * @brief iobus prototypes (they should be defined in common/stm32_iobus.h)
+  */
+void     MFX_IO_Init(void);
+void     MFX_IO_DeInit(void);
+void     MFX_IO_ITConfig (void);
+void     MFX_IO_EnableWakeupPin(void);
+void     MFX_IO_Wakeup(void);
+void     MFX_IO_Delay(uint32_t delay);
+void     MFX_IO_Write(uint16_t addr, uint8_t reg, uint8_t value);
+uint8_t  MFX_IO_Read(uint16_t addr, uint8_t reg);
+uint16_t MFX_IO_ReadMultiple(uint16_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
+
+/**
+  * @}
+  */ 
+
+/* Touch screen driver structure */
+extern TS_DrvTypeDef mfxstm32l152_ts_drv;
+
+/* IO driver structure */
+extern IO_DrvTypeDef mfxstm32l152_io_drv;
+
+/* IDD driver structure */
+extern IDD_DrvTypeDef mfxstm32l152_idd_drv;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __MFXSTM32L152_H */
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */       
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 157 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q128a/Release_Notes.html

@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for N25Q128A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><br><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 29-May-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-size: 10pt; font-family: Verdana;"> of </span><span style="font-size: 10pt; font-family: Verdana;">N25Q128A QuadSPI Flash&nbsp;Component</span><span style="font-size: 10pt; font-family: Verdana;"> driver</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"></td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 219 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q128a/n25q128a.h

@@ -0,0 +1,219 @@
+/**
+  ******************************************************************************
+  * @file    n25q128a.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    29-May-2015
+  * @brief   This file contains all the description of the N25Q128A QSPI memory.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __N25Q128A_H
+#define __N25Q128A_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup n25q128a
+  * @{
+  */
+
+/** @defgroup N25Q128A_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup N25Q128A_Exported_Constants
+  * @{
+  */
+   
+/** 
+  * @brief  N25Q128A Configuration  
+  */  
+#define N25Q128A_FLASH_SIZE                  0x1000000 /* 128 MBits => 16MBytes */
+#define N25Q128A_SECTOR_SIZE                 0x10000   /* 256 sectors of 64KBytes */
+#define N25Q128A_SUBSECTOR_SIZE              0x1000    /* 4096 subsectors of 4kBytes */
+#define N25Q128A_PAGE_SIZE                   0x100     /* 65536 pages of 256 bytes */
+
+#define N25Q128A_DUMMY_CYCLES_READ           8
+#define N25Q128A_DUMMY_CYCLES_READ_QUAD      10
+
+#define N25Q128A_BULK_ERASE_MAX_TIME         250000
+#define N25Q128A_SECTOR_ERASE_MAX_TIME       3000
+#define N25Q128A_SUBSECTOR_ERASE_MAX_TIME    800
+
+/** 
+  * @brief  N25Q128A Commands  
+  */  
+/* Reset Operations */
+#define RESET_ENABLE_CMD                     0x66
+#define RESET_MEMORY_CMD                     0x99
+
+/* Identification Operations */
+#define READ_ID_CMD                          0x9E
+#define READ_ID_CMD2                         0x9F
+#define MULTIPLE_IO_READ_ID_CMD              0xAF
+#define READ_SERIAL_FLASH_DISCO_PARAM_CMD    0x5A
+
+/* Read Operations */
+#define READ_CMD                             0x03
+#define FAST_READ_CMD                        0x0B
+#define DUAL_OUT_FAST_READ_CMD               0x3B
+#define DUAL_INOUT_FAST_READ_CMD             0xBB
+#define QUAD_OUT_FAST_READ_CMD               0x6B
+#define QUAD_INOUT_FAST_READ_CMD             0xEB
+
+/* Write Operations */
+#define WRITE_ENABLE_CMD                     0x06
+#define WRITE_DISABLE_CMD                    0x04
+
+/* Register Operations */
+#define READ_STATUS_REG_CMD                  0x05
+#define WRITE_STATUS_REG_CMD                 0x01
+
+#define READ_LOCK_REG_CMD                    0xE8
+#define WRITE_LOCK_REG_CMD                   0xE5
+
+#define READ_FLAG_STATUS_REG_CMD             0x70
+#define CLEAR_FLAG_STATUS_REG_CMD            0x50
+
+#define READ_NONVOL_CFG_REG_CMD              0xB5
+#define WRITE_NONVOL_CFG_REG_CMD             0xB1
+
+#define READ_VOL_CFG_REG_CMD                 0x85
+#define WRITE_VOL_CFG_REG_CMD                0x81
+
+#define READ_ENHANCED_VOL_CFG_REG_CMD        0x65
+#define WRITE_ENHANCED_VOL_CFG_REG_CMD       0x61
+
+/* Program Operations */
+#define PAGE_PROG_CMD                        0x02
+#define DUAL_IN_FAST_PROG_CMD                0xA2
+#define EXT_DUAL_IN_FAST_PROG_CMD            0xD2
+#define QUAD_IN_FAST_PROG_CMD                0x32
+#define EXT_QUAD_IN_FAST_PROG_CMD            0x12
+
+/* Erase Operations */
+#define SUBSECTOR_ERASE_CMD                  0x20
+#define SECTOR_ERASE_CMD                     0xD8
+#define BULK_ERASE_CMD                       0xC7
+
+#define PROG_ERASE_RESUME_CMD                0x7A
+#define PROG_ERASE_SUSPEND_CMD               0x75
+
+/* One-Time Programmable Operations */
+#define READ_OTP_ARRAY_CMD                   0x4B
+#define PROG_OTP_ARRAY_CMD                   0x42
+
+/** 
+  * @brief  N25Q128A Registers  
+  */ 
+/* Status Register */
+#define N25Q128A_SR_WIP                      ((uint8_t)0x01)    /*!< Write in progress */
+#define N25Q128A_SR_WREN                     ((uint8_t)0x02)    /*!< Write enable latch */
+#define N25Q128A_SR_BLOCKPR                  ((uint8_t)0x5C)    /*!< Block protected against program and erase operations */
+#define N25Q128A_SR_PRBOTTOM                 ((uint8_t)0x20)    /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
+#define N25Q128A_SR_SRWREN                   ((uint8_t)0x80)    /*!< Status register write enable/disable */
+
+/* Nonvolatile Configuration Register */
+#define N25Q128A_NVCR_LOCK                   ((uint16_t)0x0001) /*!< Lock nonvolatile configuration register */
+#define N25Q128A_NVCR_DUAL                   ((uint16_t)0x0004) /*!< Dual I/O protocol */
+#define N25Q128A_NVCR_QUAB                   ((uint16_t)0x0008) /*!< Quad I/O protocol */
+#define N25Q128A_NVCR_RH                     ((uint16_t)0x0010) /*!< Reset/hold */
+#define N25Q128A_NVCR_ODS                    ((uint16_t)0x01C0) /*!< Output driver strength */
+#define N25Q128A_NVCR_XIP                    ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */
+#define N25Q128A_NVCR_NB_DUMMY               ((uint16_t)0xF000) /*!< Number of dummy clock cycles */
+
+/* Volatile Configuration Register */
+#define N25Q128A_VCR_WRAP                    ((uint8_t)0x03)    /*!< Wrap */
+#define N25Q128A_VCR_XIP                     ((uint8_t)0x08)    /*!< XIP */
+#define N25Q128A_VCR_NB_DUMMY                ((uint8_t)0xF0)    /*!< Number of dummy clock cycles */
+
+/* Enhanced Volatile Configuration Register */
+#define N25Q128A_EVCR_ODS                    ((uint8_t)0x07)    /*!< Output driver strength */
+#define N25Q128A_EVCR_VPPA                   ((uint8_t)0x08)    /*!< Vpp accelerator */
+#define N25Q128A_EVCR_RH                     ((uint8_t)0x10)    /*!< Reset/hold */
+#define N25Q128A_EVCR_DUAL                   ((uint8_t)0x40)    /*!< Dual I/O protocol */
+#define N25Q128A_EVCR_QUAD                   ((uint8_t)0x80)    /*!< Quad I/O protocol */
+
+/* Flag Status Register */
+#define N25Q128A_FSR_PRERR                   ((uint8_t)0x02)    /*!< Protection error */
+#define N25Q128A_FSR_PGSUS                   ((uint8_t)0x04)    /*!< Program operation suspended */
+#define N25Q128A_FSR_VPPERR                  ((uint8_t)0x08)    /*!< Invalid voltage during program or erase */
+#define N25Q128A_FSR_PGERR                   ((uint8_t)0x10)    /*!< Program error */
+#define N25Q128A_FSR_ERERR                   ((uint8_t)0x20)    /*!< Erase error */
+#define N25Q128A_FSR_ERSUS                   ((uint8_t)0x40)    /*!< Erase operation suspended */
+#define N25Q128A_FSR_READY                   ((uint8_t)0x80)    /*!< Ready or command in progress */
+
+/**
+  * @}
+  */
+  
+/** @defgroup N25Q128A_Exported_Functions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+      
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __N25Q128A_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 157 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q256a/Release_Notes.html

@@ -0,0 +1,157 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP N25Q256A Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for N25Q256A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 02-March-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-family: Verdana; font-size: 10pt;"></span> </li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"></td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 261 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q256a/n25q256a.h

@@ -0,0 +1,261 @@
+/**
+  ******************************************************************************
+  * @file    n25q256a.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    02-March-2015
+  * @brief   This file contains all the description of the N25Q256A QSPI memory.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __N25Q256A_H
+#define __N25Q256A_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup n25q256a
+  * @{
+  */
+
+/** @defgroup N25Q256A_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup N25Q256A_Exported_Constants
+  * @{
+  */
+   
+/** 
+  * @brief  N25Q256A Configuration  
+  */  
+#define N25Q256A_FLASH_SIZE                  0x2000000 /* 256 MBits => 32MBytes */
+#define N25Q256A_SECTOR_SIZE                 0x10000   /* 512 sectors of 64KBytes */
+#define N25Q256A_SUBSECTOR_SIZE              0x1000    /* 8192 subsectors of 4kBytes */
+#define N25Q256A_PAGE_SIZE                   0x100     /* 131072 pages of 256 bytes */
+
+#define N25Q256A_DUMMY_CYCLES_READ           8
+#define N25Q256A_DUMMY_CYCLES_READ_QUAD      10
+#define N25Q256A_DUMMY_CYCLES_READ_DTR       6
+#define N25Q256A_DUMMY_CYCLES_READ_QUAD_DTR  8
+
+#define N25Q256A_BULK_ERASE_MAX_TIME         480000
+#define N25Q256A_SECTOR_ERASE_MAX_TIME       3000
+#define N25Q256A_SUBSECTOR_ERASE_MAX_TIME    800
+
+/** 
+  * @brief  N25Q256A Commands  
+  */  
+/* Reset Operations */
+#define RESET_ENABLE_CMD                     0x66
+#define RESET_MEMORY_CMD                     0x99
+
+/* Identification Operations */
+#define READ_ID_CMD                          0x9E
+#define READ_ID_CMD2                         0x9F
+#define MULTIPLE_IO_READ_ID_CMD              0xAF
+#define READ_SERIAL_FLASH_DISCO_PARAM_CMD    0x5A
+
+/* Read Operations */
+#define READ_CMD                             0x03
+#define READ_4_BYTE_ADDR_CMD                 0x13
+
+#define FAST_READ_CMD                        0x0B
+#define FAST_READ_DTR_CMD                    0x0D
+#define FAST_READ_4_BYTE_ADDR_CMD            0x0C
+
+#define DUAL_OUT_FAST_READ_CMD               0x3B
+#define DUAL_OUT_FAST_READ_DTR_CMD           0x3D
+#define DUAL_OUT_FAST_READ_4_BYTE_ADDR_CMD   0x3C
+
+#define DUAL_INOUT_FAST_READ_CMD             0xBB
+#define DUAL_INOUT_FAST_READ_DTR_CMD         0xBD
+#define DUAL_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xBC
+
+#define QUAD_OUT_FAST_READ_CMD               0x6B
+#define QUAD_OUT_FAST_READ_DTR_CMD           0x6D
+#define QUAD_OUT_FAST_READ_4_BYTE_ADDR_CMD   0x6C
+
+#define QUAD_INOUT_FAST_READ_CMD             0xEB
+#define QUAD_INOUT_FAST_READ_DTR_CMD         0xED
+#define QUAD_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xEC
+
+/* Write Operations */
+#define WRITE_ENABLE_CMD                     0x06
+#define WRITE_DISABLE_CMD                    0x04
+
+/* Register Operations */
+#define READ_STATUS_REG_CMD                  0x05
+#define WRITE_STATUS_REG_CMD                 0x01
+
+#define READ_LOCK_REG_CMD                    0xE8
+#define WRITE_LOCK_REG_CMD                   0xE5
+
+#define READ_FLAG_STATUS_REG_CMD             0x70
+#define CLEAR_FLAG_STATUS_REG_CMD            0x50
+
+#define READ_NONVOL_CFG_REG_CMD              0xB5
+#define WRITE_NONVOL_CFG_REG_CMD             0xB1
+
+#define READ_VOL_CFG_REG_CMD                 0x85
+#define WRITE_VOL_CFG_REG_CMD                0x81
+
+#define READ_ENHANCED_VOL_CFG_REG_CMD        0x65
+#define WRITE_ENHANCED_VOL_CFG_REG_CMD       0x61
+
+#define READ_EXT_ADDR_REG_CMD                0xC8
+#define WRITE_EXT_ADDR_REG_CMD               0xC5
+
+/* Program Operations */
+#define PAGE_PROG_CMD                        0x02
+#define PAGE_PROG_4_BYTE_ADDR_CMD            0x12
+
+#define DUAL_IN_FAST_PROG_CMD                0xA2
+#define EXT_DUAL_IN_FAST_PROG_CMD            0xD2
+
+#define QUAD_IN_FAST_PROG_CMD                0x32
+#define EXT_QUAD_IN_FAST_PROG_CMD            0x12 /*0x38*/
+#define QUAD_IN_FAST_PROG_4_BYTE_ADDR_CMD    0x34
+
+/* Erase Operations */
+#define SUBSECTOR_ERASE_CMD                  0x20
+#define SUBSECTOR_ERASE_4_BYTE_ADDR_CMD      0x21
+
+#define SECTOR_ERASE_CMD                     0xD8
+#define SECTOR_ERASE_4_BYTE_ADDR_CMD         0xDC
+
+#define BULK_ERASE_CMD                       0xC7
+
+#define PROG_ERASE_RESUME_CMD                0x7A
+#define PROG_ERASE_SUSPEND_CMD               0x75
+
+/* One-Time Programmable Operations */
+#define READ_OTP_ARRAY_CMD                   0x4B
+#define PROG_OTP_ARRAY_CMD                   0x42
+
+/* 4-byte Address Mode Operations */
+#define ENTER_4_BYTE_ADDR_MODE_CMD           0xB7
+#define EXIT_4_BYTE_ADDR_MODE_CMD            0xE9
+
+/* Quad Operations */
+#define ENTER_QUAD_CMD                       0x35
+#define EXIT_QUAD_CMD                        0xF5
+   
+/** 
+  * @brief  N25Q256A Registers  
+  */ 
+/* Status Register */
+#define N25Q256A_SR_WIP                      ((uint8_t)0x01)    /*!< Write in progress */
+#define N25Q256A_SR_WREN                     ((uint8_t)0x02)    /*!< Write enable latch */
+#define N25Q256A_SR_BLOCKPR                  ((uint8_t)0x5C)    /*!< Block protected against program and erase operations */
+#define N25Q256A_SR_PRBOTTOM                 ((uint8_t)0x20)    /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
+#define N25Q256A_SR_SRWREN                   ((uint8_t)0x80)    /*!< Status register write enable/disable */
+
+/* Nonvolatile Configuration Register */
+#define N25Q256A_NVCR_NBADDR                 ((uint16_t)0x0001) /*!< 3-bytes or 4-bytes addressing */
+#define N25Q256A_NVCR_SEGMENT                ((uint16_t)0x0002) /*!< Upper or lower 128Mb segment selected by default */
+#define N25Q256A_NVCR_DUAL                   ((uint16_t)0x0004) /*!< Dual I/O protocol */
+#define N25Q256A_NVCR_QUAB                   ((uint16_t)0x0008) /*!< Quad I/O protocol */
+#define N25Q256A_NVCR_RH                     ((uint16_t)0x0010) /*!< Reset/hold */
+#define N25Q256A_NVCR_ODS                    ((uint16_t)0x01C0) /*!< Output driver strength */
+#define N25Q256A_NVCR_XIP                    ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */
+#define N25Q256A_NVCR_NB_DUMMY               ((uint16_t)0xF000) /*!< Number of dummy clock cycles */
+
+/* Volatile Configuration Register */
+#define N25Q256A_VCR_WRAP                    ((uint8_t)0x03)    /*!< Wrap */
+#define N25Q256A_VCR_XIP                     ((uint8_t)0x08)    /*!< XIP */
+#define N25Q256A_VCR_NB_DUMMY                ((uint8_t)0xF0)    /*!< Number of dummy clock cycles */
+
+/* Extended Address Register */
+#define N25Q256A_EAR_A24                     ((uint8_t)0x01)    /*!< Select the lower or upper 128Mb segment */
+
+/* Enhanced Volatile Configuration Register */
+#define N25Q256A_EVCR_ODS                    ((uint8_t)0x07)    /*!< Output driver strength */
+#define N25Q256A_EVCR_VPPA                   ((uint8_t)0x08)    /*!< Vpp accelerator */
+#define N25Q256A_EVCR_RH                     ((uint8_t)0x10)    /*!< Reset/hold */
+#define N25Q256A_EVCR_DUAL                   ((uint8_t)0x40)    /*!< Dual I/O protocol */
+#define N25Q256A_EVCR_QUAD                   ((uint8_t)0x80)    /*!< Quad I/O protocol */
+
+/* Flag Status Register */
+#define N25Q256A_FSR_NBADDR                  ((uint8_t)0x01)    /*!< 3-bytes or 4-bytes addressing */
+#define N25Q256A_FSR_PRERR                   ((uint8_t)0x02)    /*!< Protection error */
+#define N25Q256A_FSR_PGSUS                   ((uint8_t)0x04)    /*!< Program operation suspended */
+#define N25Q256A_FSR_VPPERR                  ((uint8_t)0x08)    /*!< Invalid voltage during program or erase */
+#define N25Q256A_FSR_PGERR                   ((uint8_t)0x10)    /*!< Program error */
+#define N25Q256A_FSR_ERERR                   ((uint8_t)0x20)    /*!< Erase error */
+#define N25Q256A_FSR_ERSUS                   ((uint8_t)0x40)    /*!< Erase operation suspended */
+#define N25Q256A_FSR_READY                   ((uint8_t)0x80)    /*!< Ready or command in progress */
+
+/**
+  * @}
+  */
+  
+/** @defgroup N25Q256A_Exported_Functions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+      
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __N25Q256A_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 158 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q512a/Release_Notes.html

@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for N25Q512A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 28-April-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-family: Verdana; font-size: 10pt;"></span> </li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"><br>
+</td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 261 - 0
bsp/stm32f411RE/Libraries/BSP/Components/n25q512a/n25q512a.h

@@ -0,0 +1,261 @@
+/**
+  ******************************************************************************
+  * @file    n25q512a.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    28-April-2015
+  * @brief   This file contains all the description of the N25Q512A QSPI memory.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __N25Q512A_H
+#define __N25Q512A_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup n25q512a
+  * @{
+  */
+
+/** @defgroup N25Q512A_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup N25Q512A_Exported_Constants
+  * @{
+  */
+   
+/** 
+  * @brief  N25Q512A Configuration  
+  */  
+#define N25Q512A_FLASH_SIZE                  0x4000000 /* 512 MBits => 64MBytes */
+#define N25Q512A_SECTOR_SIZE                 0x10000   /* 1024 sectors of 64KBytes */
+#define N25Q512A_SUBSECTOR_SIZE              0x1000    /* 16384 subsectors of 4kBytes */
+#define N25Q512A_PAGE_SIZE                   0x100     /* 262144 pages of 256 bytes */
+
+#define N25Q512A_DUMMY_CYCLES_READ           8
+#define N25Q512A_DUMMY_CYCLES_READ_QUAD      10
+#define N25Q512A_DUMMY_CYCLES_READ_DTR       6
+#define N25Q512A_DUMMY_CYCLES_READ_QUAD_DTR  8
+
+#define N25Q512A_BULK_ERASE_MAX_TIME         480000
+#define N25Q512A_SECTOR_ERASE_MAX_TIME       3000
+#define N25Q512A_SUBSECTOR_ERASE_MAX_TIME    800
+
+/** 
+  * @brief  N25Q512A Commands  
+  */  
+/* Reset Operations */
+#define RESET_ENABLE_CMD                     0x66
+#define RESET_MEMORY_CMD                     0x99
+
+/* Identification Operations */
+#define READ_ID_CMD                          0x9E
+#define READ_ID_CMD2                         0x9F
+#define MULTIPLE_IO_READ_ID_CMD              0xAF
+#define READ_SERIAL_FLASH_DISCO_PARAM_CMD    0x5A
+
+/* Read Operations */
+#define READ_CMD                             0x03
+#define READ_4_BYTE_ADDR_CMD                 0x13
+
+#define FAST_READ_CMD                        0x0B
+#define FAST_READ_DTR_CMD                    0x0D
+#define FAST_READ_4_BYTE_ADDR_CMD            0x0C
+
+#define DUAL_OUT_FAST_READ_CMD               0x3B
+#define DUAL_OUT_FAST_READ_DTR_CMD           0x3D
+#define DUAL_OUT_FAST_READ_4_BYTE_ADDR_CMD   0x3C
+
+#define DUAL_INOUT_FAST_READ_CMD             0xBB
+#define DUAL_INOUT_FAST_READ_DTR_CMD         0xBD
+#define DUAL_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xBC
+
+#define QUAD_OUT_FAST_READ_CMD               0x6B
+#define QUAD_OUT_FAST_READ_DTR_CMD           0x6D
+#define QUAD_OUT_FAST_READ_4_BYTE_ADDR_CMD   0x6C
+
+#define QUAD_INOUT_FAST_READ_CMD             0xEB
+#define QUAD_INOUT_FAST_READ_DTR_CMD         0xED
+#define QUAD_INOUT_FAST_READ_4_BYTE_ADDR_CMD 0xEC
+
+/* Write Operations */
+#define WRITE_ENABLE_CMD                     0x06
+#define WRITE_DISABLE_CMD                    0x04
+
+/* Register Operations */
+#define READ_STATUS_REG_CMD                  0x05
+#define WRITE_STATUS_REG_CMD                 0x01
+
+#define READ_LOCK_REG_CMD                    0xE8
+#define WRITE_LOCK_REG_CMD                   0xE5
+
+#define READ_FLAG_STATUS_REG_CMD             0x70
+#define CLEAR_FLAG_STATUS_REG_CMD            0x50
+
+#define READ_NONVOL_CFG_REG_CMD              0xB5
+#define WRITE_NONVOL_CFG_REG_CMD             0xB1
+
+#define READ_VOL_CFG_REG_CMD                 0x85
+#define WRITE_VOL_CFG_REG_CMD                0x81
+
+#define READ_ENHANCED_VOL_CFG_REG_CMD        0x65
+#define WRITE_ENHANCED_VOL_CFG_REG_CMD       0x61
+
+#define READ_EXT_ADDR_REG_CMD                0xC8
+#define WRITE_EXT_ADDR_REG_CMD               0xC5
+
+/* Program Operations */
+#define PAGE_PROG_CMD                        0x02
+#define PAGE_PROG_4_BYTE_ADDR_CMD            0x12
+
+#define DUAL_IN_FAST_PROG_CMD                0xA2
+#define EXT_DUAL_IN_FAST_PROG_CMD            0xD2
+
+#define QUAD_IN_FAST_PROG_CMD                0x32
+#define EXT_QUAD_IN_FAST_PROG_CMD            0x12 /*0x38*/
+#define QUAD_IN_FAST_PROG_4_BYTE_ADDR_CMD    0x34
+
+/* Erase Operations */
+#define SUBSECTOR_ERASE_CMD                  0x20
+#define SUBSECTOR_ERASE_4_BYTE_ADDR_CMD      0x21
+
+#define SECTOR_ERASE_CMD                     0xD8
+#define SECTOR_ERASE_4_BYTE_ADDR_CMD         0xDC
+
+#define BULK_ERASE_CMD                       0xC7
+
+#define PROG_ERASE_RESUME_CMD                0x7A
+#define PROG_ERASE_SUSPEND_CMD               0x75
+
+/* One-Time Programmable Operations */
+#define READ_OTP_ARRAY_CMD                   0x4B
+#define PROG_OTP_ARRAY_CMD                   0x42
+
+/* 4-byte Address Mode Operations */
+#define ENTER_4_BYTE_ADDR_MODE_CMD           0xB7
+#define EXIT_4_BYTE_ADDR_MODE_CMD            0xE9
+
+/* Quad Operations */
+#define ENTER_QUAD_CMD                       0x35
+#define EXIT_QUAD_CMD                        0xF5
+   
+/** 
+  * @brief  N25Q512A Registers  
+  */ 
+/* Status Register */
+#define N25Q512A_SR_WIP                      ((uint8_t)0x01)    /*!< Write in progress */
+#define N25Q512A_SR_WREN                     ((uint8_t)0x02)    /*!< Write enable latch */
+#define N25Q512A_SR_BLOCKPR                  ((uint8_t)0x5C)    /*!< Block protected against program and erase operations */
+#define N25Q512A_SR_PRBOTTOM                 ((uint8_t)0x20)    /*!< Protected memory area defined by BLOCKPR starts from top or bottom */
+#define N25Q512A_SR_SRWREN                   ((uint8_t)0x80)    /*!< Status register write enable/disable */
+
+/* Non volatile Configuration Register */
+#define N25Q512A_NVCR_NBADDR                 ((uint16_t)0x0001) /*!< 3-bytes or 4-bytes addressing */
+#define N25Q512A_NVCR_SEGMENT                ((uint16_t)0x0002) /*!< Upper or lower 128Mb segment selected by default */
+#define N25Q512A_NVCR_DUAL                   ((uint16_t)0x0004) /*!< Dual I/O protocol */
+#define N25Q512A_NVCR_QUAB                   ((uint16_t)0x0008) /*!< Quad I/O protocol */
+#define N25Q512A_NVCR_RH                     ((uint16_t)0x0010) /*!< Reset/hold */
+#define N25Q512A_NVCR_ODS                    ((uint16_t)0x01C0) /*!< Output driver strength */
+#define N25Q512A_NVCR_XIP                    ((uint16_t)0x0E00) /*!< XIP mode at power-on reset */
+#define N25Q512A_NVCR_NB_DUMMY               ((uint16_t)0xF000) /*!< Number of dummy clock cycles */
+
+/* Volatile Configuration Register */
+#define N25Q512A_VCR_WRAP                    ((uint8_t)0x03)    /*!< Wrap */
+#define N25Q512A_VCR_XIP                     ((uint8_t)0x08)    /*!< XIP */
+#define N25Q512A_VCR_NB_DUMMY                ((uint8_t)0xF0)    /*!< Number of dummy clock cycles */
+
+/* Extended Address Register */
+#define N25Q512A_EAR_A24                     ((uint8_t)0x01)    /*!< Select the lower or upper 128Mb segment */
+
+/* Enhanced Volatile Configuration Register */
+#define N25Q512A_EVCR_ODS                    ((uint8_t)0x07)    /*!< Output driver strength */
+#define N25Q512A_EVCR_VPPA                   ((uint8_t)0x08)    /*!< Vpp accelerator */
+#define N25Q512A_EVCR_RH                     ((uint8_t)0x10)    /*!< Reset/hold */
+#define N25Q512A_EVCR_DUAL                   ((uint8_t)0x40)    /*!< Dual I/O protocol */
+#define N25Q512A_EVCR_QUAD                   ((uint8_t)0x80)    /*!< Quad I/O protocol */
+
+/* Flag Status Register */
+#define N25Q512A_FSR_NBADDR                  ((uint8_t)0x01)    /*!< 3-bytes or 4-bytes addressing */
+#define N25Q512A_FSR_PRERR                   ((uint8_t)0x02)    /*!< Protection error */
+#define N25Q512A_FSR_PGSUS                   ((uint8_t)0x04)    /*!< Program operation suspended */
+#define N25Q512A_FSR_VPPERR                  ((uint8_t)0x08)    /*!< Invalid voltage during program or erase */
+#define N25Q512A_FSR_PGERR                   ((uint8_t)0x10)    /*!< Program error */
+#define N25Q512A_FSR_ERERR                   ((uint8_t)0x20)    /*!< Erase error */
+#define N25Q512A_FSR_ERSUS                   ((uint8_t)0x40)    /*!< Erase operation suspended */
+#define N25Q512A_FSR_READY                   ((uint8_t)0x80)    /*!< Ready or command in progress */
+
+/**
+  * @}
+  */
+  
+/** @defgroup N25Q512A_Exported_Functions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+      
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __N25Q512A_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 156 - 0
bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/Release_Notes.html

@@ -0,0 +1,156 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for OTM8009A BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for OTM8009A Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 03-August-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"></td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 449 - 0
bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/otm8009a.c

@@ -0,0 +1,449 @@
+/**
+  ******************************************************************************
+  * @file    otm8009a.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    03-August-2015
+  * @brief   This file provides the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
+  *          DSI LCD Display OTM8009A.   
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "otm8009a.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+  
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @defgroup OTM8009A OTM8009A
+  * @brief     This file provides a set of functions needed to drive the 
+  *            otm8009a IC display driver.
+  * @{
+  */
+
+/* Private types -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private constants ---------------------------------------------------------*/
+/** @defgroup OTM8009A_Private_Constants OTM8009A Private Constants
+  * @{
+  */
+
+/*
+ * @brief Constant tables of register settings used to transmit DSI
+ * command packets as power up initialization sequence of the KoD LCD (OTM8009A LCD Driver)
+ */
+const uint8_t lcdRegData1[]  = {0x80,0x09,0x01,0xFF};
+const uint8_t lcdRegData2[]  = {0x80,0x09,0xFF};
+const uint8_t lcdRegData3[]  = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE1};
+const uint8_t lcdRegData4[]  = {0x00,0x09,0x0F,0x0E,0x07,0x10,0x0B,0x0A,0x04,0x07,0x0B,0x08,0x0F,0x10,0x0A,0x01,0xE2};
+const uint8_t lcdRegData5[]  = {0x79,0x79,0xD8};
+const uint8_t lcdRegData6[]  = {0x00,0x01,0xB3};
+const uint8_t lcdRegData7[]  = {0x85,0x01,0x00,0x84,0x01,0x00,0xCE};
+const uint8_t lcdRegData8[]  = {0x18,0x04,0x03,0x39,0x00,0x00,0x00,0x18,0x03,0x03,0x3A,0x00,0x00,0x00,0xCE};
+const uint8_t lcdRegData9[]  = {0x18,0x02,0x03,0x3B,0x00,0x00,0x00,0x18,0x01,0x03,0x3C,0x00,0x00,0x00,0xCE};
+const uint8_t lcdRegData10[] = {0x01,0x01,0x20,0x20,0x00,0x00,0x01,0x02,0x00,0x00,0xCF};
+const uint8_t lcdRegData11[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData12[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData13[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData14[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData15[] = {0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData16[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData17[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCB};
+const uint8_t lcdRegData18[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xCB};
+const uint8_t lcdRegData19[] = {0x00,0x26,0x09,0x0B,0x01,0x25,0x00,0x00,0x00,0x00,0xCC};
+const uint8_t lcdRegData20[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x0A,0x0C,0x02,0xCC};
+const uint8_t lcdRegData21[] = {0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
+const uint8_t lcdRegData22[] = {0x00,0x25,0x0C,0x0A,0x02,0x26,0x00,0x00,0x00,0x00,0xCC};
+const uint8_t lcdRegData23[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x0B,0x09,0x01,0xCC};
+const uint8_t lcdRegData24[] = {0x26,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC};
+const uint8_t lcdRegData25[] = {0xFF,0xFF,0xFF,0xFF};    
+/*
+  * CASET value (Column Address Set) : X direction LCD GRAM boundaries
+  * depending on LCD orientation mode and PASET value (Page Address Set) : Y direction
+  * LCD GRAM boundaries depending on LCD orientation mode
+  * XS[15:0] = 0x000 = 0, XE[15:0] = 0x31F = 799 for landscape mode : apply to CASET
+  * YS[15:0] = 0x000 = 0, YE[15:0] = 0x31F = 799 for portrait mode : : apply to PASET
+  */
+const uint8_t lcdRegData27[] = {0x00, 0x00, 0x03, 0x1F, OTM8009A_CMD_CASET};
+/*
+  * XS[15:0] = 0x000 = 0, XE[15:0] = 0x1DF = 479 for portrait mode : apply to CASET
+  * YS[15:0] = 0x000 = 0, YE[15:0] = 0x1DF = 479 for landscape mode : apply to PASET
+ */
+const uint8_t lcdRegData28[] = {0x00, 0x00, 0x01, 0xDF, OTM8009A_CMD_PASET};
+
+
+const uint8_t ShortRegData1[]  = {OTM8009A_CMD_NOP, 0x00};
+const uint8_t ShortRegData2[]  = {OTM8009A_CMD_NOP, 0x80};
+const uint8_t ShortRegData3[]  = {0xC4, 0x30};
+const uint8_t ShortRegData4[]  = {OTM8009A_CMD_NOP, 0x8A};
+const uint8_t ShortRegData5[]  = {0xC4, 0x40};
+const uint8_t ShortRegData6[]  = {OTM8009A_CMD_NOP, 0xB1};
+const uint8_t ShortRegData7[]  = {0xC5, 0xA9};
+const uint8_t ShortRegData8[]  = {OTM8009A_CMD_NOP, 0x91};
+const uint8_t ShortRegData9[]  = {0xC5, 0x34};
+const uint8_t ShortRegData10[] = {OTM8009A_CMD_NOP, 0xB4};
+const uint8_t ShortRegData11[] = {0xC0, 0x50};
+const uint8_t ShortRegData12[] = {0xD9, 0x4E};
+const uint8_t ShortRegData13[] = {OTM8009A_CMD_NOP, 0x81};
+const uint8_t ShortRegData14[] = {0xC1, 0x66};
+const uint8_t ShortRegData15[] = {OTM8009A_CMD_NOP, 0xA1};
+const uint8_t ShortRegData16[] = {0xC1, 0x08};
+const uint8_t ShortRegData17[] = {OTM8009A_CMD_NOP, 0x92};
+const uint8_t ShortRegData18[] = {0xC5, 0x01};
+const uint8_t ShortRegData19[] = {OTM8009A_CMD_NOP, 0x95};
+const uint8_t ShortRegData20[] = {OTM8009A_CMD_NOP, 0x94};
+const uint8_t ShortRegData21[] = {0xC5, 0x33};
+const uint8_t ShortRegData22[] = {OTM8009A_CMD_NOP, 0xA3};
+const uint8_t ShortRegData23[] = {0xC0, 0x1B};
+const uint8_t ShortRegData24[] = {OTM8009A_CMD_NOP, 0x82};
+const uint8_t ShortRegData25[] = {0xC5, 0x83};
+const uint8_t ShortRegData26[] = {0xC4, 0x83};
+const uint8_t ShortRegData27[] = {0xC1, 0x0E};
+const uint8_t ShortRegData28[] = {OTM8009A_CMD_NOP, 0xA6};
+const uint8_t ShortRegData29[] = {OTM8009A_CMD_NOP, 0xA0};
+const uint8_t ShortRegData30[] = {OTM8009A_CMD_NOP, 0xB0};
+const uint8_t ShortRegData31[] = {OTM8009A_CMD_NOP, 0xC0};
+const uint8_t ShortRegData32[] = {OTM8009A_CMD_NOP, 0xD0};
+const uint8_t ShortRegData33[] = {OTM8009A_CMD_NOP, 0x90};
+const uint8_t ShortRegData34[] = {OTM8009A_CMD_NOP, 0xE0};
+const uint8_t ShortRegData35[] = {OTM8009A_CMD_NOP, 0xF0};
+const uint8_t ShortRegData36[] = {OTM8009A_CMD_SLPOUT, 0x00};
+const uint8_t ShortRegData37[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB565};
+const uint8_t ShortRegData38[] = {OTM8009A_CMD_COLMOD, OTM8009A_COLMOD_RGB888};
+const uint8_t ShortRegData39[] = {OTM8009A_CMD_MADCTR, OTM8009A_MADCTR_MODE_LANDSCAPE};
+const uint8_t ShortRegData40[] = {OTM8009A_CMD_WRDISBV, 0x7F};
+const uint8_t ShortRegData41[] = {OTM8009A_CMD_WRCTRLD, 0x2C};
+const uint8_t ShortRegData42[] = {OTM8009A_CMD_WRCABC, 0x02};
+const uint8_t ShortRegData43[] = {OTM8009A_CMD_WRCABCMB, 0xFF};
+const uint8_t ShortRegData44[] = {OTM8009A_CMD_DISPON, 0x00};
+const uint8_t ShortRegData45[] = {OTM8009A_CMD_RAMWR, 0x00};
+const uint8_t ShortRegData46[] = {0xCF, 0x00};
+const uint8_t ShortRegData47[] = {0xC5, 0x66};
+const uint8_t ShortRegData48[] = {OTM8009A_CMD_NOP, 0xB6};
+const uint8_t ShortRegData49[] = {0xF5, 0x06};
+
+/**
+  * @}
+  */
+
+/* Private macros ------------------------------------------------------------*/
+/* Private functions ---------------------------------------------------------*/
+/** @defgroup OTM8009A_Exported_Variables
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/* Exported functions ---------------------------------------------------------*/
+/** @defgroup OTM8009A_Exported_Functions OTM8009A Exported Functions
+  * @{
+  */
+
+/**
+  * @brief  DSI IO write short/long command.
+  * @note : Can be surcharged by application code implementation of the function.
+  */
+__weak void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams)
+{
+  /* NOTE : This function Should not be modified, when it is needed,
+            the DSI_IO_WriteCmd could be implemented in the user file
+   */
+}
+
+/**
+  * @brief  Initializes the LCD KoD display part by communication in DSI mode in Video Mode
+  *         with IC Display Driver OTM8009A (see IC Driver specification for more information).
+  * @param  hdsi_eval : pointer on DSI configuration structure
+  * @param  hdsivideo_handle : pointer on DSI video mode configuration structure
+  * @retval Status
+  */
+uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation)
+{
+  /* Enable CMD2 to access vendor specific commands                               */
+  /* Enter in command 2 mode and set EXTC to enable address shift function (0x00) */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData1);
+
+  /* Enter ORISE Command 2 */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2); /* Shift address to 0x80 */
+  DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData2);
+
+  /////////////////////////////////////////////////////////////////////
+  /* SD_PCH_CTRL - 0xC480h - 129th parameter - Default 0x00          */
+  /* Set SD_PT                                                       */
+  /* -> Source output level during porch and non-display area to GND */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData3);
+  OTM8009A_IO_Delay(10);
+  /* Not documented */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData4);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData5);
+  OTM8009A_IO_Delay(10);
+  /////////////////////////////////////////////////////////////////////
+
+  /* PWR_CTRL4 - 0xC4B0h - 178th parameter - Default 0xA8 */
+  /* Set gvdd_en_test                                     */
+  /* -> enable GVDD test mode !!!                         */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData6);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData7);
+
+  /* PWR_CTRL2 - 0xC590h - 146th parameter - Default 0x79      */
+  /* Set pump 4 vgh voltage                                    */
+  /* -> from 15.0v down to 13.0v                               */
+  /* Set pump 5 vgh voltage                                    */
+  /* -> from -12.0v downto -9.0v                               */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData8);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
+
+  /* P_DRV_M - 0xC0B4h - 181th parameter - Default 0x00 */
+  /* -> Column inversion                                */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData10);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData11);
+
+  /* VCOMDC - 0xD900h - 1st parameter - Default 0x39h */
+  /* VCOM Voltage settings                            */
+  /* -> from -1.0000v downto -1.2625v                 */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData12);
+
+  /* Oscillator adjustment for Idle/Normal mode (LPDT only) set to 65Hz (default is 60Hz) */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData14);
+
+  /* Video mode internal */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData16);
+
+  /* PWR_CTRL2 - 0xC590h - 147h parameter - Default 0x00 */
+  /* Set pump 4&5 x6                                     */
+  /* -> ONLY VALID when PUMP4_EN_ASDM_HV = "0"           */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData17);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData18);
+
+  /* PWR_CTRL2 - 0xC590h - 150th parameter - Default 0x33h */
+  /* Change pump4 clock ratio                              */
+  /* -> from 1 line to 1/2 line                            */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData19);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);
+
+  /* GVDD/NGVDD settings */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData5);
+
+  /* PWR_CTRL2 - 0xC590h - 149th parameter - Default 0x33h */
+  /* Rewrite the default value !                           */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData20);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData21);
+
+  /* Panel display timing Setting 3 */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData22);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData23);
+
+  /* Power control 1 */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData24);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData25);
+
+  /* Source driver precharge */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData26);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData27);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData28);
+  DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData6);
+
+  /* GOAVST */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
+  DSI_IO_WriteCmd( 6, (uint8_t *)lcdRegData7);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
+  DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData8);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
+  DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData9);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData10);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData46);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData11);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData12);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData13);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData14);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData15);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData16);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData34);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData17);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData35);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData18);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData19);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData20);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData21);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
+  DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData22);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData23);
+
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
+  DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData24);
+
+  /////////////////////////////////////////////////////////////////////////////
+  /* PWR_CTRL1 - 0xc580h - 130th parameter - default 0x00 */
+  /* Pump 1 min and max DM                                */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData47);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData48);
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData49);
+  /////////////////////////////////////////////////////////////////////////////
+
+  /* Exit CMD2 mode */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData25);
+
+  /*************************************************************************** */
+  /* Standard DCS Initialization TO KEEP CAN BE DONE IN HSDT                   */
+  /*************************************************************************** */
+
+  /* NOP - goes back to DCS std command ? */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+          
+  /* Gamma correction 2.2+ table (HSDT possible) */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData3);
+  
+  /* Gamma correction 2.2- table (HSDT possible) */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+  DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData4);
+          
+  /* Send Sleep Out command to display : no parameter */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData36);
+  
+  /* Wait for sleep out exit */
+  OTM8009A_IO_Delay(120);
+
+  switch(ColorCoding)
+  {
+  case OTM8009A_FORMAT_RBG565 :
+    /* Set Pixel color format to RGB565 */
+    DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData37);
+    break;
+  case OTM8009A_FORMAT_RGB888 :
+    /* Set Pixel color format to RGB888 */
+    DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData38);
+    break;
+  default :
+    break;
+  }
+
+  /* Send command to configure display in landscape orientation mode. By default
+      the orientation mode is portrait  */
+  if(orientation == OTM8009A_ORIENTATION_LANDSCAPE)
+  {
+    DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData39);
+    DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData27);
+    DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData28);
+  }
+
+  /** CABC : Content Adaptive Backlight Control section start >> */
+  /* Note : defaut is 0 (lowest Brightness), 0xFF is highest Brightness, try 0x7F : intermediate value */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData40);
+
+  /* defaut is 0, try 0x2C - Brightness Control Block, Display Dimming & BackLight on */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData41);
+
+  /* defaut is 0, try 0x02 - image Content based Adaptive Brightness [Still Picture] */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData42);
+
+  /* defaut is 0 (lowest Brightness), 0xFF is highest Brightness */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData43);
+
+  /** CABC : Content Adaptive Backlight Control section end << */
+
+  /* Send Command Display On */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData44);
+
+  /* NOP command */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
+
+  /* Send Command GRAM memory write (no parameters) : this initiates frame write via other DSI commands sent by */
+  /* DSI host from LTDC incoming pixels in video mode */
+  DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData45);
+
+  return 0;
+}
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 224 - 0
bsp/stm32f411RE/Libraries/BSP/Components/otm8009a/otm8009a.h

@@ -0,0 +1,224 @@
+/**
+  ******************************************************************************
+  * @file    otm8009a.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    03-August-2015
+  * @brief   This file contains all the constants parameters for the OTM8009A
+  *          which is the LCD Driver for KoD KM-040TMP-02-0621 (WVGA)
+  *          DSI LCD Display.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __OTM8009A_H
+#define __OTM8009A_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include <stdint.h>
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Components
+  * @{
+  */
+
+/** @addtogroup otm8009a
+  * @{
+  */
+
+/** @addtogroup OTM8009A_Exported_Variables
+  * @{
+  */
+
+#if defined ( __GNUC__ )
+#ifndef __weak
+#define __weak __attribute__((weak))
+#endif /* __weak */
+#endif /* __GNUC__ */
+      
+/**
+ *  @brief LCD_OrientationTypeDef
+ *  Possible values of Display Orientation
+ */
+#define OTM8009A_ORIENTATION_PORTRAIT    ((uint32_t)0x00) /* Portrait orientation choice of LCD screen  */
+#define OTM8009A_ORIENTATION_LANDSCAPE   ((uint32_t)0x01) /* Landscape orientation choice of LCD screen */
+
+/**
+ *  @brief  Possible values of
+ *  pixel data format (ie color coding) transmitted on DSI Data lane in DSI packets
+ */
+#define OTM8009A_FORMAT_RGB888    ((uint32_t)0x00) /* Pixel format chosen is RGB888 : 24 bpp */
+#define OTM8009A_FORMAT_RBG565    ((uint32_t)0x02) /* Pixel format chosen is RGB565 : 16 bpp */
+
+/**
+  * @brief  otm8009a_480x800 Size
+  */
+
+/* Width and Height in Portrait mode */
+#define  OTM8009A_480X800_WIDTH             ((uint16_t)480)     /* LCD PIXEL WIDTH   */
+#define  OTM8009A_480X800_HEIGHT            ((uint16_t)800)     /* LCD PIXEL HEIGHT  */
+
+/* Width and Height in Landscape mode */
+#define  OTM8009A_800X480_WIDTH             ((uint16_t)800)     /* LCD PIXEL WIDTH   */
+#define  OTM8009A_800X480_HEIGHT            ((uint16_t)480)     /* LCD PIXEL HEIGHT  */
+
+/**
+  * @brief  OTM8009A_480X800 Timing parameters for Portrait orientation mode
+  */
+#define  OTM8009A_480X800_HSYNC             ((uint16_t)120)     /* Horizontal synchronization */
+#define  OTM8009A_480X800_HBP               ((uint16_t)120)     /* Horizontal back porch      */
+#define  OTM8009A_480X800_HFP               ((uint16_t)120)     /* Horizontal front porch     */
+#define  OTM8009A_480X800_VSYNC             ((uint16_t)12)      /* Vertical synchronization   */
+#define  OTM8009A_480X800_VBP               ((uint16_t)12)      /* Vertical back porch        */
+#define  OTM8009A_480X800_VFP               ((uint16_t)12)      /* Vertical front porch       */
+
+/**
+  * @brief  OTM8009A_800X480 Timing parameters for Landscape orientation mode
+  *         Same values as for Portrait mode in fact.
+  */
+#define  OTM8009A_800X480_HSYNC             OTM8009A_480X800_HSYNC  /* Horizontal synchronization */
+#define  OTM8009A_800X480_HBP               OTM8009A_480X800_HBP    /* Horizontal back porch      */
+#define  OTM8009A_800X480_HFP               OTM8009A_480X800_HFP    /* Horizontal front porch     */
+#define  OTM8009A_800X480_VSYNC             OTM8009A_480X800_VSYNC  /* Vertical synchronization   */
+#define  OTM8009A_800X480_VBP               OTM8009A_480X800_VBP    /* Vertical back porch        */
+#define  OTM8009A_800X480_VFP               OTM8009A_480X800_VFP    /* Vertical front porch       */
+
+
+/* List of OTM8009A used commands                                  */
+/* Detailed in OTM8009A Data Sheet 'DATA_SHEET_OTM8009A_V0 92.pdf' */
+/* Version of 14 June 2012                                         */
+#define  OTM8009A_CMD_NOP                   0x00  /* NOP command      */
+#define  OTM8009A_CMD_SWRESET               0x01  /* Sw reset command */
+#define  OTM8009A_CMD_RDDMADCTL             0x0B  /* Read Display MADCTR command : read memory display access ctrl */
+#define  OTM8009A_CMD_RDDCOLMOD             0x0C  /* Read Display pixel format */
+#define  OTM8009A_CMD_SLPIN                 0x10  /* Sleep In command */
+#define  OTM8009A_CMD_SLPOUT                0x11  /* Sleep Out command */
+#define  OTM8009A_CMD_PTLON                 0x12  /* Partial mode On command */
+
+#define  OTM8009A_CMD_DISPOFF               0x28  /* Display Off command */
+#define  OTM8009A_CMD_DISPON                0x29  /* Display On command */
+
+#define  OTM8009A_CMD_CASET                 0x2A  /* Column address set command */
+#define  OTM8009A_CMD_PASET                 0x2B  /* Page address set command */
+
+#define  OTM8009A_CMD_RAMWR                 0x2C  /* Memory (GRAM) write command */
+#define  OTM8009A_CMD_RAMRD                 0x2E  /* Memory (GRAM) read command  */
+
+#define  OTM8009A_CMD_PLTAR                 0x30  /* Partial area command (4 parameters) */
+
+#define  OTM8009A_CMD_TEOFF                 0x34  /* Tearing Effect Line Off command : command with no parameter */
+
+#define  OTM8009A_CMD_TEEON                 0x35  /* Tearing Effect Line On command : command with 1 parameter 'TELOM' */
+
+/* Parameter TELOM : Tearing Effect Line Output Mode : possible values */
+#define OTM8009A_TEEON_TELOM_VBLANKING_INFO_ONLY            0x00
+#define OTM8009A_TEEON_TELOM_VBLANKING_AND_HBLANKING_INFO   0x01
+
+#define  OTM8009A_CMD_MADCTR                0x36  /* Memory Access write control command  */
+
+/* Possible used values of MADCTR */
+#define OTM8009A_MADCTR_MODE_PORTRAIT       0x00
+#define OTM8009A_MADCTR_MODE_LANDSCAPE      0x60  /* MY = 0, MX = 1, MV = 1, ML = 0, RGB = 0 */
+
+#define  OTM8009A_CMD_IDMOFF                0x38  /* Idle mode Off command */
+#define  OTM8009A_CMD_IDMON                 0x39  /* Idle mode On command  */
+
+#define  OTM8009A_CMD_COLMOD                0x3A  /* Interface Pixel format command */
+
+/* Possible values of COLMOD parameter corresponding to used pixel formats */
+#define  OTM8009A_COLMOD_RGB565             0x55
+#define  OTM8009A_COLMOD_RGB888             0x77
+
+#define  OTM8009A_CMD_RAMWRC                0x3C  /* Memory write continue command */
+#define  OTM8009A_CMD_RAMRDC                0x3E  /* Memory read continue command  */
+
+#define  OTM8009A_CMD_WRTESCN               0x44  /* Write Tearing Effect Scan line command */
+#define  OTM8009A_CMD_RDSCNL                0x45  /* Read  Tearing Effect Scan line command */
+
+/* CABC Management : ie : Content Adaptive Back light Control in IC OTM8009a */
+#define  OTM8009A_CMD_WRDISBV               0x51  /* Write Display Brightness command          */
+#define  OTM8009A_CMD_WRCTRLD               0x53  /* Write CTRL Display command                */
+#define  OTM8009A_CMD_WRCABC                0x55  /* Write Content Adaptive Brightness command */
+#define  OTM8009A_CMD_WRCABCMB              0x5E  /* Write CABC Minimum Brightness command     */
+
+/**
+  * @brief  OTM8009A_480X800 frequency divider
+  */
+#define OTM8009A_480X800_FREQUENCY_DIVIDER  2   /* LCD Frequency divider      */
+
+/**
+  * @}
+  */
+   
+/* Exported macro ------------------------------------------------------------*/
+   
+/** @defgroup OTM8009A_Exported_Macros OTM8009A Exported Macros
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/* Exported functions --------------------------------------------------------*/
+  
+/** @addtogroup OTM8009A_Exported_Functions
+  * @{
+  */
+void DSI_IO_WriteCmd(uint32_t NbrParams, uint8_t *pParams);
+uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation);
+void OTM8009A_IO_Delay(uint32_t Delay);
+/**
+  * @}
+  */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OTM8009A_480X800_H */
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 426 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ov2640/Release_Notes.html

@@ -0,0 +1,426 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for OV2640 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for OV2640 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">ov2640.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 19-June-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">Align driver
+with the STM32Cube BSP architecture by removing check for
+initialization in ov2640_Init() and&nbsp; ov2640_ReadID() functions</span></li>
+              <li><span style="font-size: 10pt; font-family: Verdana;">Comments clean up and typo corrections</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release </span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 1351 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ov2640/ov2640.c

@@ -0,0 +1,1351 @@
+/**
+  ******************************************************************************
+  * @file    ov2640.c
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file provides the OV2640 camera driver
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 "ov2640.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup OV2640
+  * @brief     This file provides a set of functions needed to drive the 
+  *            OV2640 Camera module.
+  * @{
+  */
+
+/** @defgroup OV2640_Private_TypesDefinitions
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup OV2640_Private_Defines
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup OV2640_Private_Macros
+  * @{
+  */
+     
+/**
+  * @}
+  */  
+  
+/** @defgroup OV2640_Private_FunctionPrototypes
+  * @{
+  */
+static uint32_t ov2640_ConvertValue(uint32_t feature, uint32_t value);
+/**
+  * @}
+  */ 
+  
+/** @defgroup OV2640_Private_Variables
+  * @{
+  */        
+
+CAMERA_DrvTypeDef   ov2640_drv = 
+{
+  ov2640_Init,
+  ov2640_ReadID,  
+  ov2640_Config,
+};
+
+/* Initialization sequence for 480x272 resolution */
+const unsigned char OV2640_480x272[][2]=
+{
+  {0xff, 0x00},  /* Device control register list Table 12 */
+  {0x2c, 0xff},  /* Reserved                              */
+  {0x2e, 0xdf},  /* Reserved                              */
+  {0xff, 0x01},  /* Device control register list Table 13 */
+  {0x3c, 0x32},  /* Reserved                              */
+  {0x11, 0x00},  /* Clock Rate Control                    */
+  {0x09, 0x02},  /* Common control 2                      */
+  {0x04, 0xA8},  /* Mirror                                */
+  {0x13, 0xe5},  /* Common control 8                      */
+  {0x14, 0x48},  /* Common control 9                      */
+  {0x2c, 0x0c},  /* Reserved                              */
+  {0x33, 0x78},  /* Reserved                              */
+  {0x3a, 0x33},  /* Reserved                              */
+  {0x3b, 0xfB},  /* Reserved                              */
+  {0x3e, 0x00},  /* Reserved                              */
+  {0x43, 0x11},  /* Reserved                              */
+  {0x16, 0x10},  /* Reserved                              */
+  {0x4a, 0x81},  /* Reserved                              */
+  {0x21, 0x99},  /* Reserved                              */
+  {0x24, 0x40},  /* Luminance signal High range           */
+  {0x25, 0x38},  /* Luminance signal low range            */
+  {0x26, 0x82},  /*                                       */
+  {0x5c, 0x00},  /* Reserved                              */
+  {0x63, 0x00},  /* Reserved                              */
+  {0x46, 0x3f},  /* Frame length adjustment               */
+  {0x0c, 0x3c},  /* Common control 3                      */
+  {0x61, 0x70},  /* Histogram algo low level              */
+  {0x62, 0x80},  /* Histogram algo high level             */
+  {0x7c, 0x05},  /* Reserved                              */
+  {0x20, 0x80},  /* Reserved                              */
+  {0x28, 0x30},  /* Reserved                              */
+  {0x6c, 0x00},  /* Reserved                              */
+  {0x6d, 0x80},  /* Reserved                              */
+  {0x6e, 0x00},  /* Reserved                              */
+  {0x70, 0x02},  /* Reserved                              */
+  {0x71, 0x94},  /* Reserved                              */
+  {0x73, 0xc1},  /* Reserved                              */
+  {0x3d, 0x34},  /* Reserved                              */
+  {0x5a, 0x57},  /* Reserved                              */
+  {0x12, 0x00},  /* Common control 7                      */
+  {0x11, 0x00},  /* Clock Rate Control                   2*/
+  {0x17, 0x11},  /* Horiz window start MSB 8bits          */
+  {0x18, 0x75},  /* Horiz window end MSB 8bits            */
+  {0x19, 0x01},  /* Vert window line start MSB 8bits      */
+  {0x1a, 0x97},  /* Vert window line end MSB 8bits        */
+  {0x32, 0x36},
+  {0x03, 0x0f},
+  {0x37, 0x40},
+  {0x4f, 0xbb},
+  {0x50, 0x9c},
+  {0x5a, 0x57},
+  {0x6d, 0x80},
+  {0x6d, 0x38},
+  {0x39, 0x02},
+  {0x35, 0x88},
+  {0x22, 0x0a},
+  {0x37, 0x40},
+  {0x23, 0x00},
+  {0x34, 0xa0},
+  {0x36, 0x1a},
+  {0x06, 0x02},
+  {0x07, 0xc0},
+  {0x0d, 0xb7},
+  {0x0e, 0x01},
+  {0x4c, 0x00},
+  {0xff, 0x00},
+  {0xe5, 0x7f},
+  {0xf9, 0xc0},
+  {0x41, 0x24},
+  {0xe0, 0x14},
+  {0x76, 0xff},
+  {0x33, 0xa0},
+  {0x42, 0x20},
+  {0x43, 0x18},
+  {0x4c, 0x00},
+  {0x87, 0xd0},
+  {0x88, 0x3f},
+  {0xd7, 0x03},
+  {0xd9, 0x10},
+  {0xd3, 0x82},
+  {0xc8, 0x08},
+  {0xc9, 0x80},
+  {0x7d, 0x00},
+  {0x7c, 0x03},
+  {0x7d, 0x48},
+  {0x7c, 0x08},
+  {0x7d, 0x20},
+  {0x7d, 0x10},
+  {0x7d, 0x0e},
+  {0x90, 0x00},
+  {0x91, 0x0e},
+  {0x91, 0x1a},
+  {0x91, 0x31},
+  {0x91, 0x5a},
+  {0x91, 0x69},
+  {0x91, 0x75},
+  {0x91, 0x7e},
+  {0x91, 0x88},
+  {0x91, 0x8f},
+  {0x91, 0x96},
+  {0x91, 0xa3},
+  {0x91, 0xaf},
+  {0x91, 0xc4},
+  {0x91, 0xd7},
+  {0x91, 0xe8},
+  {0x91, 0x20},
+  {0x92, 0x00},
+  {0x93, 0x06},
+  {0x93, 0xe3},
+  {0x93, 0x02},
+  {0x93, 0x02},
+  {0x93, 0x00},
+  {0x93, 0x04},
+  {0x93, 0x00},
+  {0x93, 0x03},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x96, 0x00},
+  {0x97, 0x08},
+  {0x97, 0x19},
+  {0x97, 0x02},
+  {0x97, 0x0c},
+  {0x97, 0x24},
+  {0x97, 0x30},
+  {0x97, 0x28},
+  {0x97, 0x26},
+  {0x97, 0x02},
+  {0x97, 0x98},
+  {0x97, 0x80},
+  {0x97, 0x00},
+  {0x97, 0x00},
+  {0xc3, 0xef},
+  {0xff, 0x00},
+  {0xba, 0xdc},
+  {0xbb, 0x08},
+  {0xb6, 0x24},
+  {0xb8, 0x33},
+  {0xb7, 0x20},
+  {0xb9, 0x30},
+  {0xb3, 0xb4},
+  {0xb4, 0xca},
+  {0xb5, 0x43},
+  {0xb0, 0x5c},
+  {0xb1, 0x4f},
+  {0xb2, 0x06},
+  {0xc7, 0x00},
+  {0xc6, 0x51},
+  {0xc5, 0x11},
+  {0xc4, 0x9c},
+  {0xbf, 0x00},
+  {0xbc, 0x64},
+  {0xa6, 0x00},
+  {0xa7, 0x1e},
+  {0xa7, 0x6b},
+  {0xa7, 0x47},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x2e},
+  {0xa7, 0x85},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x1b},
+  {0xa7, 0x74},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x8c, 0x00},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0x7f, 0x00},
+  {0xda, 0x00},
+  {0xe5, 0x1f},
+  {0xe1, 0x67},
+  {0xe0, 0x00},
+  {0xdd, 0x7f},
+  {0x05, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0xe0, 0x00},
+  {0xFF, 0x00},
+  {0x05, 0x00},
+  {0xDA, 0x08},
+  {0xda, 0x09},
+  {0x98, 0x00},
+  {0x99, 0x00},
+  {0x00, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x35},
+  {0x50, 0x80},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0x78},
+  {0x5b, 0x44},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0xe0, 0x00},
+};
+
+/* Initialization sequence for VGA resolution (640x480)*/
+const unsigned char OV2640_VGA[][2]=
+{
+  {0xff, 0x00},  /* Device control register list Table 12 */
+  {0x2c, 0xff},  /* Reserved                              */
+  {0x2e, 0xdf},  /* Reserved                              */
+  {0xff, 0x01},  /* Device control register list Table 13 */
+  {0x3c, 0x32},  /* Reserved                              */
+  {0x11, 0x00},  /* Clock Rate Control                    */
+  {0x09, 0x02},  /* Common control 2                      */
+  {0x04, 0xA8},  /* Mirror                                */
+  {0x13, 0xe5},  /* Common control 8                      */
+  {0x14, 0x48},  /* Common control 9                      */
+  {0x2c, 0x0c},  /* Reserved                              */
+  {0x33, 0x78},  /* Reserved                              */
+  {0x3a, 0x33},  /* Reserved                              */
+  {0x3b, 0xfB},  /* Reserved                              */
+  {0x3e, 0x00},  /* Reserved                              */
+  {0x43, 0x11},  /* Reserved                              */
+  {0x16, 0x10},  /* Reserved                              */
+  {0x4a, 0x81},  /* Reserved                              */
+  {0x21, 0x99},  /* Reserved                              */
+  {0x24, 0x40},  /* Luminance signal High range           */
+  {0x25, 0x38},  /* Luminance signal low range            */
+  {0x26, 0x82},  /*                                       */
+  {0x5c, 0x00},  /* Reserved                              */
+  {0x63, 0x00},  /* Reserved                              */
+  {0x46, 0x3f},  /* Frame length adjustment               */
+  {0x0c, 0x3c},  /* Common control 3                      */
+  {0x61, 0x70},  /* Histogram algo low level              */
+  {0x62, 0x80},  /* Histogram algo high level             */
+  {0x7c, 0x05},  /* Reserved                              */
+  {0x20, 0x80},  /* Reserved                              */
+  {0x28, 0x30},  /* Reserved                              */
+  {0x6c, 0x00},  /* Reserved                              */
+  {0x6d, 0x80},  /* Reserved                              */
+  {0x6e, 0x00},  /* Reserved                              */
+  {0x70, 0x02},  /* Reserved                              */
+  {0x71, 0x94},  /* Reserved                              */
+  {0x73, 0xc1},  /* Reserved                              */
+  {0x3d, 0x34},  /* Reserved                              */
+  {0x5a, 0x57},  /* Reserved                              */
+  {0x12, 0x00},  /* Common control 7                      */
+  {0x11, 0x00},  /* Clock Rate Control                   2*/
+  {0x17, 0x11},  /* Horiz window start MSB 8bits          */
+  {0x18, 0x75},  /* Horiz window end MSB 8bits            */
+  {0x19, 0x01},  /* Vert window line start MSB 8bits      */
+  {0x1a, 0x97},  /* Vert window line end MSB 8bits        */
+  {0x32, 0x36},
+  {0x03, 0x0f},
+  {0x37, 0x40},
+  {0x4f, 0xbb},
+  {0x50, 0x9c},
+  {0x5a, 0x57},
+  {0x6d, 0x80},
+  {0x6d, 0x38},
+  {0x39, 0x02},
+  {0x35, 0x88},
+  {0x22, 0x0a},
+  {0x37, 0x40},
+  {0x23, 0x00},
+  {0x34, 0xa0},
+  {0x36, 0x1a},
+  {0x06, 0x02},
+  {0x07, 0xc0},
+  {0x0d, 0xb7},
+  {0x0e, 0x01},
+  {0x4c, 0x00},
+  {0xff, 0x00},
+  {0xe5, 0x7f},
+  {0xf9, 0xc0},
+  {0x41, 0x24},
+  {0xe0, 0x14},
+  {0x76, 0xff},
+  {0x33, 0xa0},
+  {0x42, 0x20},
+  {0x43, 0x18},
+  {0x4c, 0x00},
+  {0x87, 0xd0},
+  {0x88, 0x3f},
+  {0xd7, 0x03},
+  {0xd9, 0x10},
+  {0xd3, 0x82},
+  {0xc8, 0x08},
+  {0xc9, 0x80},
+  {0x7d, 0x00},
+  {0x7c, 0x03},
+  {0x7d, 0x48},
+  {0x7c, 0x08},
+  {0x7d, 0x20},
+  {0x7d, 0x10},
+  {0x7d, 0x0e},
+  {0x90, 0x00},
+  {0x91, 0x0e},
+  {0x91, 0x1a},
+  {0x91, 0x31},
+  {0x91, 0x5a},
+  {0x91, 0x69},
+  {0x91, 0x75},
+  {0x91, 0x7e},
+  {0x91, 0x88},
+  {0x91, 0x8f},
+  {0x91, 0x96},
+  {0x91, 0xa3},
+  {0x91, 0xaf},
+  {0x91, 0xc4},
+  {0x91, 0xd7},
+  {0x91, 0xe8},
+  {0x91, 0x20},
+  {0x92, 0x00},
+  {0x93, 0x06},
+  {0x93, 0xe3},
+  {0x93, 0x02},
+  {0x93, 0x02},
+  {0x93, 0x00},
+  {0x93, 0x04},
+  {0x93, 0x00},
+  {0x93, 0x03},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x96, 0x00},
+  {0x97, 0x08},
+  {0x97, 0x19},
+  {0x97, 0x02},
+  {0x97, 0x0c},
+  {0x97, 0x24},
+  {0x97, 0x30},
+  {0x97, 0x28},
+  {0x97, 0x26},
+  {0x97, 0x02},
+  {0x97, 0x98},
+  {0x97, 0x80},
+  {0x97, 0x00},
+  {0x97, 0x00},
+  {0xc3, 0xef},
+  {0xff, 0x00},
+  {0xba, 0xdc},
+  {0xbb, 0x08},
+  {0xb6, 0x24},
+  {0xb8, 0x33},
+  {0xb7, 0x20},
+  {0xb9, 0x30},
+  {0xb3, 0xb4},
+  {0xb4, 0xca},
+  {0xb5, 0x43},
+  {0xb0, 0x5c},
+  {0xb1, 0x4f},
+  {0xb2, 0x06},
+  {0xc7, 0x00},
+  {0xc6, 0x51},
+  {0xc5, 0x11},
+  {0xc4, 0x9c},
+  {0xbf, 0x00},
+  {0xbc, 0x64},
+  {0xa6, 0x00},
+  {0xa7, 0x1e},
+  {0xa7, 0x6b},
+  {0xa7, 0x47},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x2e},
+  {0xa7, 0x85},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x1b},
+  {0xa7, 0x74},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x8c, 0x00},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0x7f, 0x00},
+  {0xda, 0x00},
+  {0xe5, 0x1f},
+  {0xe1, 0x67},
+  {0xe0, 0x00},
+  {0xdd, 0x7f},
+  {0x05, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0xe0, 0x00},
+  {0xFF, 0x00},
+  {0x05, 0x00},
+  {0xDA, 0x08},
+  {0xda, 0x09},
+  {0x98, 0x00},
+  {0x99, 0x00},
+  {0x00, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x3d},
+  {0x50, 0x89},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0xA0},
+  {0x5b, 0x78},
+  {0x5c, 0x00},
+  {0xd3, 0x02},
+  {0xe0, 0x00},
+};
+
+/* Initialization sequence for QVGA resolution (320x240) */
+const unsigned char OV2640_QVGA[][2]=
+{
+  {0xff, 0x00},
+  {0x2c, 0xff},
+  {0x2e, 0xdf},
+  {0xff, 0x01},
+  {0x3c, 0x32},
+  {0x11, 0x00},
+  {0x09, 0x02},
+  {0x04, 0xA8},
+  {0x13, 0xe5},
+  {0x14, 0x48},
+  {0x2c, 0x0c},
+  {0x33, 0x78},
+  {0x3a, 0x33},
+  {0x3b, 0xfB},
+  {0x3e, 0x00},
+  {0x43, 0x11},
+  {0x16, 0x10},
+  {0x4a, 0x81},
+  {0x21, 0x99},
+  {0x24, 0x40},
+  {0x25, 0x38},
+  {0x26, 0x82},
+  {0x5c, 0x00},
+  {0x63, 0x00},
+  {0x46, 0x3f},
+  {0x0c, 0x3c},
+  {0x61, 0x70},
+  {0x62, 0x80},
+  {0x7c, 0x05},
+  {0x20, 0x80},
+  {0x28, 0x30},
+  {0x6c, 0x00},
+  {0x6d, 0x80},
+  {0x6e, 0x00},
+  {0x70, 0x02},
+  {0x71, 0x94},
+  {0x73, 0xc1},
+  {0x3d, 0x34},
+  {0x5a, 0x57},
+  {0x12, 0x00},
+  {0x11, 0x00},
+  {0x17, 0x11},
+  {0x18, 0x75},
+  {0x19, 0x01},
+  {0x1a, 0x97},
+  {0x32, 0x36},
+  {0x03, 0x0f},
+  {0x37, 0x40},
+  {0x4f, 0xbb},
+  {0x50, 0x9c},
+  {0x5a, 0x57},
+  {0x6d, 0x80},
+  {0x6d, 0x38},
+  {0x39, 0x02},
+  {0x35, 0x88},
+  {0x22, 0x0a},
+  {0x37, 0x40},
+  {0x23, 0x00},
+  {0x34, 0xa0},
+  {0x36, 0x1a},
+  {0x06, 0x02},
+  {0x07, 0xc0},
+  {0x0d, 0xb7},
+  {0x0e, 0x01},
+  {0x4c, 0x00},
+  {0xff, 0x00},
+  {0xe5, 0x7f},
+  {0xf9, 0xc0},
+  {0x41, 0x24},
+  {0xe0, 0x14},
+  {0x76, 0xff},
+  {0x33, 0xa0},
+  {0x42, 0x20},
+  {0x43, 0x18},
+  {0x4c, 0x00},
+  {0x87, 0xd0},
+  {0x88, 0x3f},
+  {0xd7, 0x03},
+  {0xd9, 0x10},
+  {0xd3, 0x82},
+  {0xc8, 0x08},
+  {0xc9, 0x80},
+  {0x7d, 0x00},
+  {0x7c, 0x03},
+  {0x7d, 0x48},
+  {0x7c, 0x08},
+  {0x7d, 0x20},
+  {0x7d, 0x10},
+  {0x7d, 0x0e},
+  {0x90, 0x00},
+  {0x91, 0x0e},
+  {0x91, 0x1a},
+  {0x91, 0x31},
+  {0x91, 0x5a},
+  {0x91, 0x69},
+  {0x91, 0x75},
+  {0x91, 0x7e},
+  {0x91, 0x88},
+  {0x91, 0x8f},
+  {0x91, 0x96},
+  {0x91, 0xa3},
+  {0x91, 0xaf},
+  {0x91, 0xc4},
+  {0x91, 0xd7},
+  {0x91, 0xe8},
+  {0x91, 0x20},
+  {0x92, 0x00},
+  {0x93, 0x06},
+  {0x93, 0xe3},
+  {0x93, 0x02},
+  {0x93, 0x02},
+  {0x93, 0x00},
+  {0x93, 0x04},
+  {0x93, 0x00},
+  {0x93, 0x03},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x96, 0x00},
+  {0x97, 0x08},
+  {0x97, 0x19},
+  {0x97, 0x02},
+  {0x97, 0x0c},
+  {0x97, 0x24},
+  {0x97, 0x30},
+  {0x97, 0x28},
+  {0x97, 0x26},
+  {0x97, 0x02},
+  {0x97, 0x98},
+  {0x97, 0x80},
+  {0x97, 0x00},
+  {0x97, 0x00},
+  {0xc3, 0xef},
+  {0xff, 0x00},
+  {0xba, 0xdc},
+  {0xbb, 0x08},
+  {0xb6, 0x24},
+  {0xb8, 0x33},
+  {0xb7, 0x20},
+  {0xb9, 0x30},
+  {0xb3, 0xb4},
+  {0xb4, 0xca},
+  {0xb5, 0x43},
+  {0xb0, 0x5c},
+  {0xb1, 0x4f},
+  {0xb2, 0x06},
+  {0xc7, 0x00},
+  {0xc6, 0x51},
+  {0xc5, 0x11},
+  {0xc4, 0x9c},
+  {0xbf, 0x00},
+  {0xbc, 0x64},
+  {0xa6, 0x00},
+  {0xa7, 0x1e},
+  {0xa7, 0x6b},
+  {0xa7, 0x47},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x2e},
+  {0xa7, 0x85},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x1b},
+  {0xa7, 0x74},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x8c, 0x00},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0x7f, 0x00},
+  {0xda, 0x00},
+  {0xe5, 0x1f},
+  {0xe1, 0x67},
+  {0xe0, 0x00},
+  {0xdd, 0x7f},
+  {0x05, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0x50},
+  {0x5b, 0x3C},
+  {0x5c, 0x00},
+  {0xd3, 0x08},
+  {0xe0, 0x00},
+  {0xFF, 0x00},
+  {0x05, 0x00},
+  {0xDA, 0x08},
+  {0xda, 0x09},
+  {0x98, 0x00},
+  {0x99, 0x00},
+  {0x00, 0x00},
+};
+
+/* Initialization sequence for QQVGA resolution (160x120) */
+const char OV2640_QQVGA[][2]=
+{
+  {0xff, 0x00},
+  {0x2c, 0xff},
+  {0x2e, 0xdf},
+  {0xff, 0x01},
+  {0x3c, 0x32},
+  {0x11, 0x00},
+  {0x09, 0x02},
+  {0x04, 0xA8},
+  {0x13, 0xe5},
+  {0x14, 0x48},
+  {0x2c, 0x0c},
+  {0x33, 0x78},
+  {0x3a, 0x33},
+  {0x3b, 0xfB},
+  {0x3e, 0x00},
+  {0x43, 0x11},
+  {0x16, 0x10},
+  {0x4a, 0x81},
+  {0x21, 0x99},
+  {0x24, 0x40},
+  {0x25, 0x38},
+  {0x26, 0x82},
+  {0x5c, 0x00},
+  {0x63, 0x00},
+  {0x46, 0x3f},
+  {0x0c, 0x3c},
+  {0x61, 0x70},
+  {0x62, 0x80},
+  {0x7c, 0x05},
+  {0x20, 0x80},
+  {0x28, 0x30},
+  {0x6c, 0x00},
+  {0x6d, 0x80},
+  {0x6e, 0x00},
+  {0x70, 0x02},
+  {0x71, 0x94},
+  {0x73, 0xc1},
+  {0x3d, 0x34},
+  {0x5a, 0x57},
+  {0x12, 0x00},
+  {0x11, 0x00},
+  {0x17, 0x11},
+  {0x18, 0x75},
+  {0x19, 0x01},
+  {0x1a, 0x97},
+  {0x32, 0x36},
+  {0x03, 0x0f},
+  {0x37, 0x40},
+  {0x4f, 0xbb},
+  {0x50, 0x9c},
+  {0x5a, 0x57},
+  {0x6d, 0x80},
+  {0x6d, 0x38},
+  {0x39, 0x02},
+  {0x35, 0x88},
+  {0x22, 0x0a},
+  {0x37, 0x40},
+  {0x23, 0x00},
+  {0x34, 0xa0},
+  {0x36, 0x1a},
+  {0x06, 0x02},
+  {0x07, 0xc0},
+  {0x0d, 0xb7},
+  {0x0e, 0x01},
+  {0x4c, 0x00},
+  {0xff, 0x00},
+  {0xe5, 0x7f},
+  {0xf9, 0xc0},
+  {0x41, 0x24},
+  {0xe0, 0x14},
+  {0x76, 0xff},
+  {0x33, 0xa0},
+  {0x42, 0x20},
+  {0x43, 0x18},
+  {0x4c, 0x00},
+  {0x87, 0xd0},
+  {0x88, 0x3f},
+  {0xd7, 0x03},
+  {0xd9, 0x10},
+  {0xd3, 0x82},
+  {0xc8, 0x08},
+  {0xc9, 0x80},
+  {0x7d, 0x00},
+  {0x7c, 0x03},
+  {0x7d, 0x48},
+  {0x7c, 0x08},
+  {0x7d, 0x20},
+  {0x7d, 0x10},
+  {0x7d, 0x0e},
+  {0x90, 0x00},
+  {0x91, 0x0e},
+  {0x91, 0x1a},
+  {0x91, 0x31},
+  {0x91, 0x5a},
+  {0x91, 0x69},
+  {0x91, 0x75},
+  {0x91, 0x7e},
+  {0x91, 0x88},
+  {0x91, 0x8f},
+  {0x91, 0x96},
+  {0x91, 0xa3},
+  {0x91, 0xaf},
+  {0x91, 0xc4},
+  {0x91, 0xd7},
+  {0x91, 0xe8},
+  {0x91, 0x20},
+  {0x92, 0x00},
+  {0x93, 0x06},
+  {0x93, 0xe3},
+  {0x93, 0x02},
+  {0x93, 0x02},
+  {0x93, 0x00},
+  {0x93, 0x04},
+  {0x93, 0x00},
+  {0x93, 0x03},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x93, 0x00},
+  {0x96, 0x00},
+  {0x97, 0x08},
+  {0x97, 0x19},
+  {0x97, 0x02},
+  {0x97, 0x0c},
+  {0x97, 0x24},
+  {0x97, 0x30},
+  {0x97, 0x28},
+  {0x97, 0x26},
+  {0x97, 0x02},
+  {0x97, 0x98},
+  {0x97, 0x80},
+  {0x97, 0x00},
+  {0x97, 0x00},
+  {0xc3, 0xef},
+  {0xff, 0x00},
+  {0xba, 0xdc},
+  {0xbb, 0x08},
+  {0xb6, 0x24},
+  {0xb8, 0x33},
+  {0xb7, 0x20},
+  {0xb9, 0x30},
+  {0xb3, 0xb4},
+  {0xb4, 0xca},
+  {0xb5, 0x43},
+  {0xb0, 0x5c},
+  {0xb1, 0x4f},
+  {0xb2, 0x06},
+  {0xc7, 0x00},
+  {0xc6, 0x51},
+  {0xc5, 0x11},
+  {0xc4, 0x9c},
+  {0xbf, 0x00},
+  {0xbc, 0x64},
+  {0xa6, 0x00},
+  {0xa7, 0x1e},
+  {0xa7, 0x6b},
+  {0xa7, 0x47},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x2e},
+  {0xa7, 0x85},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xa7, 0x1b},
+  {0xa7, 0x74},
+  {0xa7, 0x42},
+  {0xa7, 0x33},
+  {0xa7, 0x00},
+  {0xa7, 0x23},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x8c, 0x00},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x5a, 0x50},
+  {0x5b, 0x3c},
+  {0x5c, 0x00},
+  {0xd3, 0x04},
+  {0x7f, 0x00},
+  {0xda, 0x00},
+  {0xe5, 0x1f},
+  {0xe1, 0x67},
+  {0xe0, 0x00},
+  {0xdd, 0x7f},
+  {0x05, 0x00},
+  {0xff, 0x00},
+  {0xe0, 0x04},
+  {0xc0, 0xc8},
+  {0xc1, 0x96},
+  {0x86, 0x3d},
+  {0x50, 0x92},
+  {0x51, 0x90},
+  {0x52, 0x2c},
+  {0x53, 0x00},
+  {0x54, 0x00},
+  {0x55, 0x88},
+  {0x57, 0x00},
+  {0x5a, 0x28}, 
+  {0x5b, 0x1E}, 
+  {0x5c, 0x00},
+  {0xd3, 0x08},
+  {0xe0, 0x00},
+  {0xFF, 0x00},
+  {0x05, 0x00},
+  {0xDA, 0x08},
+  {0xda, 0x09},
+  {0x98, 0x00},
+  {0x99, 0x00},
+  {0x00, 0x00},
+};
+
+/**
+  * @}
+  */
+  
+/** @defgroup OV2640_Private_Functions
+  * @{
+  */ 
+  
+/**
+  * @brief  Initializes the OV2640 CAMERA component.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  resolution: Camera resolution
+  * @retval None
+  */
+void ov2640_Init(uint16_t DeviceAddr, uint32_t resolution)
+{
+  uint32_t index;
+  
+  /* Initialize I2C */
+  CAMERA_IO_Init();    
+  
+  /* Prepare the camera to be configured */
+  CAMERA_IO_Write(DeviceAddr, OV2640_DSP_RA_DLMT, 0x01);
+  CAMERA_IO_Write(DeviceAddr, OV2640_SENSOR_COM7, 0x80);
+  CAMERA_Delay(200);
+  
+  /* Initialize OV2640 */
+  switch (resolution)
+  {
+  case CAMERA_R160x120:
+    {
+      for(index=0; index<(sizeof(OV2640_QQVGA)/2); index++)
+      {
+        CAMERA_IO_Write(DeviceAddr, OV2640_QQVGA[index][0], OV2640_QQVGA[index][1]);
+        CAMERA_Delay(1);
+      } 
+      break;
+    }    
+  case CAMERA_R320x240:
+    {
+      for(index=0; index<(sizeof(OV2640_QVGA)/2); index++)
+      {
+        CAMERA_IO_Write(DeviceAddr, OV2640_QVGA[index][0], OV2640_QVGA[index][1]);
+        CAMERA_Delay(1);
+      } 
+      break;
+    }
+  case CAMERA_R480x272:
+    {
+      for(index=0; index<(sizeof(OV2640_480x272)/2); index++)
+      {
+        CAMERA_IO_Write(DeviceAddr, OV2640_480x272[index][0], OV2640_480x272[index][1]);
+        CAMERA_Delay(2);
+      }
+      break;
+    }
+  case CAMERA_R640x480:
+    {
+      for(index=0; index<(sizeof(OV2640_VGA)/2); index++)
+      {
+        CAMERA_IO_Write(DeviceAddr, OV2640_VGA[index][0], OV2640_VGA[index][1]);
+        CAMERA_Delay(2);
+      }
+      break;
+    }    
+  default:
+    {
+      break;
+    }
+  }
+}
+
+/**
+  * @brief  Configures the OV2640 camera feature.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  feature: Camera feature to be configured
+  * @param  value: Value to be configured
+  * @param  brightness_value: Brightness value to be configured
+  * @retval None
+  */
+void ov2640_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t brightness_value)
+{
+  uint8_t value1, value2;
+  uint32_t value_tmp;
+  uint32_t br_value;
+  
+  /* Convert the input value into ov2640 parameters */
+  value_tmp = ov2640_ConvertValue(feature, value); 
+  br_value = ov2640_ConvertValue(CAMERA_CONTRAST_BRIGHTNESS, brightness_value); 
+    
+  switch(feature)
+  {
+  case CAMERA_BLACK_WHITE:
+    {  
+      CAMERA_IO_Write(DeviceAddr, 0xff, 0x00);
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x00);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, value_tmp);
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x05);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, 0x80);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, 0x80);
+      break;
+    }
+  case CAMERA_CONTRAST_BRIGHTNESS:
+    {
+      value1 = (uint8_t)(value_tmp);
+      value2 = (uint8_t)(value_tmp >> 8);
+      CAMERA_IO_Write(DeviceAddr, 0xff, 0x00);     
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x00);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, 0x04);
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x07);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, br_value);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, value1);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, value2);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, 0x06);
+      break;
+    }
+  case CAMERA_COLOR_EFFECT:
+    {     
+      value1 = (uint8_t)(value_tmp);
+      value2 = (uint8_t)(value_tmp >> 8);
+      CAMERA_IO_Write(DeviceAddr, 0xff, 0x00);
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x00);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, 0x18);
+      CAMERA_IO_Write(DeviceAddr, 0x7c, 0x05);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, value1);
+      CAMERA_IO_Write(DeviceAddr, 0x7d, value2);
+      break;
+    }     
+  default:
+    {
+      break;
+    }
+  }
+}
+
+/**
+  * @brief  Read the OV2640 Camera identity.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval the OV2640 ID
+  */
+uint16_t ov2640_ReadID(uint16_t DeviceAddr)
+{
+  /* Initialize I2C */
+  CAMERA_IO_Init();
+  
+  /* Prepare the sensor to read the Camera ID */
+  CAMERA_IO_Write(DeviceAddr, OV2640_DSP_RA_DLMT, 0x01);
+  
+  /* Get the camera ID */
+  return (CAMERA_IO_Read(DeviceAddr, OV2640_SENSOR_PIDH));
+}
+
+/******************************************************************************
+                            Static Functions
+*******************************************************************************/
+/**
+  * @brief  Convert input values into ov2640 parameters.
+  * @param  feature: Camera feature to be configured
+  * @param  value: Value to be configured
+  * @retval The converted value
+  */
+static uint32_t ov2640_ConvertValue(uint32_t feature, uint32_t value)
+{
+  uint32_t ret = 0;
+  
+  switch(feature)
+  {
+  case CAMERA_BLACK_WHITE:
+    {
+      switch(value)
+      {
+      case CAMERA_BLACK_WHITE_BW:
+        {
+          ret =  OV2640_BLACK_WHITE_BW;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_NEGATIVE:
+        {
+          ret =  OV2640_BLACK_WHITE_NEGATIVE;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_BW_NEGATIVE:
+        {
+          ret =  OV2640_BLACK_WHITE_BW_NEGATIVE;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_NORMAL:
+        {
+          ret =  OV2640_BLACK_WHITE_NORMAL;
+          break;
+        }
+      default:
+        {
+          ret =  OV2640_BLACK_WHITE_NORMAL;
+          break;
+        }
+      }
+      break;
+    }
+  case CAMERA_CONTRAST_BRIGHTNESS:
+    {
+      switch(value)
+      {
+      case CAMERA_BRIGHTNESS_LEVEL0:
+        {
+          ret =  OV2640_BRIGHTNESS_LEVEL0;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL1:
+        {
+          ret =  OV2640_BRIGHTNESS_LEVEL1;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL2:
+        {
+          ret =  OV2640_BRIGHTNESS_LEVEL2;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL3:
+        {
+          ret =  OV2640_BRIGHTNESS_LEVEL3;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL4:
+        {
+          ret =  OV2640_BRIGHTNESS_LEVEL4;
+          break;
+        }        
+      case CAMERA_CONTRAST_LEVEL0:
+        {
+          ret =  OV2640_CONTRAST_LEVEL0;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL1:
+        {
+          ret =  OV2640_CONTRAST_LEVEL1;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL2:
+        {
+          ret =  OV2640_CONTRAST_LEVEL2;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL3:
+        {
+          ret =  OV2640_CONTRAST_LEVEL3;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL4:
+        {
+          ret =  OV2640_CONTRAST_LEVEL4;
+          break;
+        }
+      default:
+        {
+          ret =  OV2640_CONTRAST_LEVEL0;
+          break;
+        }
+      }
+      break;
+    }
+  case CAMERA_COLOR_EFFECT:
+    {
+      switch(value)
+      {
+      case CAMERA_COLOR_EFFECT_ANTIQUE:
+        {
+          ret =  OV2640_COLOR_EFFECT_ANTIQUE;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_BLUE:
+        {
+          ret =  OV2640_COLOR_EFFECT_BLUE;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_GREEN:
+        {
+          ret =  OV2640_COLOR_EFFECT_GREEN;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_RED:
+        {
+          ret =  OV2640_COLOR_EFFECT_RED;
+          break;
+        }
+      default:
+        {
+          ret =  OV2640_COLOR_EFFECT_RED;
+          break;
+        }
+      }
+      break;
+    default:
+      {
+        ret = 0;
+        break;
+      }    
+    }
+  }
+  
+  return ret;
+}
+         
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */  
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 226 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ov2640/ov2640.h

@@ -0,0 +1,226 @@
+/**
+  ******************************************************************************
+  * @file    ov2640.h
+  * @author  MCD Application Team
+  * @version V1.0.2
+  * @date    02-December-2014
+  * @brief   This file contains all the functions prototypes for the ov2640.c
+  *          driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __OV2640_H
+#define __OV2640_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/camera.h"
+   
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup ov2640
+  * @{
+  */
+
+/** @defgroup OV2640_Exported_Types
+  * @{
+  */
+     
+/**
+  * @}
+  */ 
+
+/** @defgroup OV2640_Exported_Constants
+  * @{
+  */
+/** 
+  * @brief  OV2640 ID  
+  */  
+#define  OV2640_ID    0x26
+/** 
+  * @brief  OV2640 Registers  
+  */
+/* OV2640 Registers definition when DSP bank selected (0xFF = 0x00) */
+#define OV2640_DSP_R_BYPASS             0x05
+#define OV2640_DSP_Qs                   0x44
+#define OV2640_DSP_CTRL                 0x50
+#define OV2640_DSP_HSIZE1               0x51
+#define OV2640_DSP_VSIZE1               0x52
+#define OV2640_DSP_XOFFL                0x53
+#define OV2640_DSP_YOFFL                0x54
+#define OV2640_DSP_VHYX                 0x55
+#define OV2640_DSP_DPRP                 0x56
+#define OV2640_DSP_TEST                 0x57
+#define OV2640_DSP_ZMOW                 0x5A
+#define OV2640_DSP_ZMOH                 0x5B
+#define OV2640_DSP_ZMHH                 0x5C
+#define OV2640_DSP_BPADDR               0x7C
+#define OV2640_DSP_BPDATA               0x7D
+#define OV2640_DSP_CTRL2                0x86
+#define OV2640_DSP_CTRL3                0x87
+#define OV2640_DSP_SIZEL                0x8C
+#define OV2640_DSP_HSIZE2               0xC0
+#define OV2640_DSP_VSIZE2               0xC1
+#define OV2640_DSP_CTRL0                0xC2
+#define OV2640_DSP_CTRL1                0xC3
+#define OV2640_DSP_R_DVP_SP             0xD3
+#define OV2640_DSP_IMAGE_MODE           0xDA
+#define OV2640_DSP_RESET                0xE0
+#define OV2640_DSP_MS_SP                0xF0
+#define OV2640_DSP_SS_ID                0x7F
+#define OV2640_DSP_SS_CTRL              0xF8
+#define OV2640_DSP_MC_BIST              0xF9
+#define OV2640_DSP_MC_AL                0xFA
+#define OV2640_DSP_MC_AH                0xFB
+#define OV2640_DSP_MC_D                 0xFC
+#define OV2640_DSP_P_STATUS             0xFE
+#define OV2640_DSP_RA_DLMT              0xFF
+
+/* OV2640 Registers definition when sensor bank selected (0xFF = 0x01) */
+#define OV2640_SENSOR_GAIN              0x00
+#define OV2640_SENSOR_COM1              0x03
+#define OV2640_SENSOR_REG04             0x04
+#define OV2640_SENSOR_REG08             0x08
+#define OV2640_SENSOR_COM2              0x09
+#define OV2640_SENSOR_PIDH              0x0A
+#define OV2640_SENSOR_PIDL              0x0B
+#define OV2640_SENSOR_COM3              0x0C
+#define OV2640_SENSOR_COM4              0x0D
+#define OV2640_SENSOR_AEC               0x10
+#define OV2640_SENSOR_CLKRC             0x11
+#define OV2640_SENSOR_COM7              0x12
+#define OV2640_SENSOR_COM8              0x13
+#define OV2640_SENSOR_COM9              0x14
+#define OV2640_SENSOR_COM10             0x15
+#define OV2640_SENSOR_HREFST            0x17
+#define OV2640_SENSOR_HREFEND           0x18
+#define OV2640_SENSOR_VSTART            0x19
+#define OV2640_SENSOR_VEND              0x1A
+#define OV2640_SENSOR_MIDH              0x1C
+#define OV2640_SENSOR_MIDL              0x1D
+#define OV2640_SENSOR_AEW               0x24
+#define OV2640_SENSOR_AEB               0x25
+#define OV2640_SENSOR_W                 0x26
+#define OV2640_SENSOR_REG2A             0x2A
+#define OV2640_SENSOR_FRARL             0x2B
+#define OV2640_SENSOR_ADDVSL            0x2D
+#define OV2640_SENSOR_ADDVHS            0x2E
+#define OV2640_SENSOR_YAVG              0x2F
+#define OV2640_SENSOR_REG32             0x32
+#define OV2640_SENSOR_ARCOM2            0x34
+#define OV2640_SENSOR_REG45             0x45
+#define OV2640_SENSOR_FLL               0x46
+#define OV2640_SENSOR_FLH               0x47
+#define OV2640_SENSOR_COM19             0x48
+#define OV2640_SENSOR_ZOOMS             0x49
+#define OV2640_SENSOR_COM22             0x4B
+#define OV2640_SENSOR_COM25             0x4E
+#define OV2640_SENSOR_BD50              0x4F
+#define OV2640_SENSOR_BD60              0x50
+#define OV2640_SENSOR_REG5D             0x5D
+#define OV2640_SENSOR_REG5E             0x5E
+#define OV2640_SENSOR_REG5F             0x5F
+#define OV2640_SENSOR_REG60             0x60
+#define OV2640_SENSOR_HISTO_LOW         0x61
+#define OV2640_SENSOR_HISTO_HIGH        0x62 
+
+/** 
+ * @brief  OV2640 Features Parameters  
+ */
+#define OV2640_BRIGHTNESS_LEVEL0        0x40   /* Brightness level -2         */
+#define OV2640_BRIGHTNESS_LEVEL1        0x30   /* Brightness level -1         */
+#define OV2640_BRIGHTNESS_LEVEL2        0x20   /* Brightness level 0          */
+#define OV2640_BRIGHTNESS_LEVEL3        0x10   /* Brightness level +1         */
+#define OV2640_BRIGHTNESS_LEVEL4        0x00   /* Brightness level +2         */
+
+#define OV2640_BLACK_WHITE_BW           0x18   /* Black and white effect      */
+#define OV2640_BLACK_WHITE_NEGATIVE     0x40   /* Negative effect             */
+#define OV2640_BLACK_WHITE_BW_NEGATIVE  0x58   /* BW and Negative effect      */
+#define OV2640_BLACK_WHITE_NORMAL       0x00   /* Normal effect               */
+
+#define OV2640_CONTRAST_LEVEL0          0x3418 /* Contrast level -2           */
+#define OV2640_CONTRAST_LEVEL1          0x2A1C /* Contrast level -2           */
+#define OV2640_CONTRAST_LEVEL2          0x2020 /* Contrast level -2           */
+#define OV2640_CONTRAST_LEVEL3          0x1624 /* Contrast level -2           */
+#define OV2640_CONTRAST_LEVEL4          0x0C28 /* Contrast level -2           */
+
+#define OV2640_COLOR_EFFECT_ANTIQUE     0xA640 /* Antique effect              */
+#define OV2640_COLOR_EFFECT_BLUE        0x40A0 /* Blue effect                 */
+#define OV2640_COLOR_EFFECT_GREEN       0x4040 /* Green effect                */
+#define OV2640_COLOR_EFFECT_RED         0xC040 /* Red effect                  */   
+/**
+  * @}
+  */
+  
+/** @defgroup OV2640_Exported_Functions
+  * @{
+  */ 
+void     ov2640_Init(uint16_t DeviceAddr, uint32_t resolution);
+void     ov2640_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t BR_value);
+uint16_t ov2640_ReadID(uint16_t DeviceAddr);
+
+void     CAMERA_IO_Init(void);
+void     CAMERA_IO_Write(uint8_t addr, uint8_t reg, uint8_t value);
+uint8_t  CAMERA_IO_Read(uint8_t addr, uint8_t reg);
+void     CAMERA_Delay(uint32_t delay);
+
+/* CAMERA driver structure */
+extern CAMERA_DrvTypeDef   ov2640_drv;
+/**
+  * @}
+  */    
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OV2640_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 158 - 0
bsp/stm32f411RE/Libraries/BSP/Components/s25fl512s/Release_Notes.html

@@ -0,0 +1,158 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32 BSP Components Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for S25FL512S Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table style="width: 675pt;" class="MsoNormalTable" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top"><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0
+/ 03-August-2015 <o:p></o:p></span></h3>
+<p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<span style="font-size: 10pt; font-family: Verdana;"></span>
+<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">First official release<span class="Apple-converted-space"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span class="Apple-converted-space"></span></span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2><div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <div style="margin-left: 120px;"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span></div>
+            </td>
+          </tr>
+        <tr><td style="padding: 0cm;" valign="top"><br>
+</td></tr></tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 261 - 0
bsp/stm32f411RE/Libraries/BSP/Components/s25fl512s/s25fl512s.h

@@ -0,0 +1,261 @@
+/**
+  ******************************************************************************
+  * @file    s25fl512s.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    03-August-2015
+  * @brief   This file contains all the description of the S25FL512S QSPI memory.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __S25FL512S_H
+#define __S25FL512S_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup s25fl512s
+  * @brief     This file provides a set of definitions for the Spansion
+  *            S25FL512S memory (configuration, commands, registers).
+  * @{
+  */
+
+/** @defgroup S25FL512S_Exported_Types
+  * @{
+  */
+   
+/**
+  * @}
+  */ 
+
+/** @defgroup S25FL512S_Exported_Constants
+  * @{
+  */
+   
+/* S25FL512SAGMFI01 Spansion Memory */
+/**
+  * @brief  S25FL512S Configuration
+  */
+#define S25FL512S_FLASH_SIZE                            0x4000000 /* 512 MBits => 64MBytes */
+#define S25FL512S_SECTOR_SIZE                           0x40000   /* 256 sectors of 256KBytes */
+#define S25FL512S_PAGE_SIZE                             0x200     /* 131072 pages of 512 bytes */
+
+#define S25FL512S_BULK_ERASE_MAX_TIME                   460000
+#define S25FL512S_SECTOR_ERASE_MAX_TIME                 2600
+
+
+/**
+  * @brief  S25FL512S Commands
+  */
+/* Reset Operations */
+#define S25FL512S_SOFTWARE_RESET_CMD                    0xF0
+#define S25FL512S_MODE_BIT_RESET_CMD                    0xFF
+
+/* Identification Operations */
+#define S25FL512S_READ_ID_CMD                           0x90
+#define S25FL512S_READ_ID_CMD2                          0x9F
+#define S25FL512S_READ_ELECTRONIC_SIGNATURE             0xAB
+#define S25FL512S_READ_SERIAL_FLASH_DISCO_PARAM_CMD     0x5A
+
+/* Register Operations */
+#define S25FL512S_READ_STATUS_REG1_CMD                  0x05
+#define S25FL512S_READ_STATUS_REG2_CMD                  0x07
+#define S25FL512S_READ_CONFIGURATION_REG1_CMD           0x35
+#define S25FL512S_WRITE_STATUS_CMD_REG_CMD              0x01
+#define S25FL512S_WRITE_DISABLE_CMD                     0x04
+#define S25FL512S_WRITE_ENABLE_CMD                      0x06
+#define S25FL512S_CLEAR_STATUS_REG1_CMD                 0x30
+#define S25FL512S_READ_AUTOBOOT_REG_CMD                 0x14
+#define S25FL512S_WRITE_AUTOBOOT_REG_CMD                0x15
+#define S25FL512S_READ_BANK_REG_CMD                     0x16
+#define S25FL512S_WRITE_BANK_REG_CMD                    0x17
+#define S25FL512S_ACCESS_BANK_REG_CMD                   0xB9
+#define S25FL512S_READ_DATA_LEARNING_PATTERN_CMD        0x41
+#define S25FL512S_PGM_NV_DATA_LEARNING_REG_CMD          0x43
+#define S25FL512S_WRITE_VOL_DATA_LEARNING_REG_CMD       0x4A
+
+/* Read Operations */
+#define S25FL512S_READ_CMD                              0x03
+#define S25FL512S_READ_4_BYTE_ADDR_CMD                  0x13
+
+#define S25FL512S_FAST_READ_CMD                         0x0B
+#define S25FL512S_FAST_READ_4_BYTE_ADDR_CMD             0x0C
+#define S25FL512S_FAST_READ_DDR_CMD                     0x0D
+#define S25FL512S_FAST_READ__DDR_4_BYTE_ADDR_CMD        0x0E
+
+#define S25FL512S_DUAL_OUT_FAST_READ_CMD                0x3B
+#define S25FL512S_DUAL_OUT_FAST_READ_4_BYTE_ADDR_CMD    0x3C
+
+#define S25FL512S_QUAD_OUT_FAST_READ_CMD                0x6B
+#define S25FL512S_QUAD_OUT_FAST_READ_4_BYTE_ADDR_CMD    0x6C
+
+#define S25FL512S_DUAL_INOUT_FAST_READ_CMD              0xBB
+#define S25FL512S_DUAL_INOUT_FAST_READ_DTR_CMD          0xBD
+#define S25FL512S_DUAL_INOUT_FAST_READ_4_BYTE_ADDR_CMD  0xBC
+#define S25FL512S_DDR_DUAL_INOUT_READ_4_BYTE_ADDR_CMD   0xBE
+
+#define S25FL512S_QUAD_INOUT_FAST_READ_CMD              0xEB
+#define S25FL512S_QUAD_INOUT_FAST_READ_4_BYTE_ADDR_CMD  0xEC
+#define S25FL512S_QUAD_INOUT_FAST_READ_DDR_CMD          0xED
+#define S25FL512S_QUAD_INOUT_READ_DDR_4_BYTE_ADDR_CMD   0xEE
+
+
+/* Program Operations */
+#define S25FL512S_PAGE_PROG_CMD                         0x02
+#define S25FL512S_PAGE_PROG_4_BYTE_ADDR_CMD             0x12
+
+#define S25FL512S_QUAD_IN_FAST_PROG_CMD                 0x32
+#define S25FL512S_QUAD_IN_FAST_PROG_ALTERNATE_CMD       0x38
+#define S25FL512S_QUAD_IN_FAST_PROG_4_BYTE_ADDR_CMD     0x34
+
+#define S25FL512S_PROGRAM_SUSPEND_CMD                   0x85
+#define S25FL512S_PROGRAM_RESUME_CMD                    0x8A
+
+/* Erase Operations */
+#define S25FL512S_SECTOR_ERASE_CMD                      0xD8
+#define S25FL512S_SECTOR_ERASE_4_BYTE_ADDR_CMD          0xDC
+
+#define S25FL512S_BULK_ERASE_CMD                        0x60
+#define S25FL512S_BULK_ERASE_ALTERNATE_CMD              0xC7
+
+#define S25FL512S_PROG_ERASE_SUSPEND_CMD                0x75
+#define S25FL512S_PROG_ERASE_RESUME_CMD                 0x7A
+
+/* One-Time Programmable Operations */
+#define S25FL512S_PROG_OTP_ARRAY_CMD                    0x42
+#define S25FL512S_READ_OTP_ARRAY_CMD                    0x4B
+
+/* Advanced Sector Protection Operations */
+#define S25FL512S_READ_DYB_CMD                          0xE0
+#define S25FL512S_WRITE_DYB_CMD                         0xE1
+
+#define S25FL512S_READ_PPB_CMD                          0xE2
+#define S25FL512S_PROGRAM_PPB_CMD                       0xE3
+#define S25FL512S_ERASE_PPB_CMD                         0xE4
+
+#define S25FL512S_READ_ASP_CMD                          0x2B
+#define S25FL512S_PROGRAM_ASP_CMD                       0x2F
+
+#define S25FL512S_READ_PPB_LOCKBIT_CMD                  0xA7
+#define S25FL512S_WRITE_PPB_LOCKBIT_CMD                 0xA6
+
+#define S25FL512S_READ_PASSWORD_CMD                     0xE7
+#define S25FL512S_PROGRAM_PASSWORD_CMD                  0xE8
+#define S25FL512S_UNLOCK_PASSWORD_CMD                   0xE9
+
+
+
+/**
+  * @brief  S25FL512S Registers
+  */
+/* Status Register-1 */
+#define S25FL512S_SR1_WIP                               ((uint8_t)0x01)      /*!< Write in progress, device busy */
+#define S25FL512S_SR1_WREN                              ((uint8_t)0x02)      /*!< Write Registers, program or commands are accepted */
+#define S25FL512S_SR1_BP0                               ((uint8_t)0x04)      /*!< Sector0 protected from Program or Erase */
+#define S25FL512S_SR1_BP1                               ((uint8_t)0x08)      /*!< Sector1 protected from Program or Erase */
+#define S25FL512S_SR1_BP2                               ((uint8_t)0x10)      /*!< Sector2 protected from Program or Erase */
+#define S25FL512S_SR1_ERERR                             ((uint8_t)0x20)      /*!< Erase error */
+#define S25FL512S_SR1_PGERR                             ((uint8_t)0x40)      /*!< Program error */
+#define S25FL512S_SR1_SRWD                              ((uint8_t)0x80)      /*!< Status Register Write Disable */
+
+/* Status Register-2 */
+#define S25FL512S_SR2_PS                                ((uint8_t)0x01)      /*!< Program in Suspend mode */
+#define S25FL512S_SR2_ES                                ((uint8_t)0x02)      /*!< Erase Suspend Mode */
+
+/* Configuration Register CR1 */
+#define S25FL512S_CR1_FREEZE                            ((uint8_t)0x01)      /*!< Block protection and OTP locked */
+#define S25FL512S_CR1_QUAD                              ((uint8_t)0x02)      /*!< Quad mode enable */
+#define S25FL512S_CR1_BPNV                              ((uint8_t)0x08)      /*!< BP2-0 bits of Status Reg are volatile */
+#define S25FL512S_CR1_TBPROT                            ((uint8_t)0x20)      /*!< BPstarts at bottom */
+#define S25FL512S_CR1_LC_MASK                           ((uint8_t)0xC0)      /*!< Latency Code mask */
+#define S25FL512S_CR1_LC0                               ((uint8_t)0x00)      /*!< Latency Code = 0 */
+#define S25FL512S_CR1_LC1                               ((uint8_t)0x40)      /*!< Latency Code = 1 */
+#define S25FL512S_CR1_LC2                               ((uint8_t)0x80)      /*!< Latency Code = 2 */
+#define S25FL512S_CR1_LC3                               ((uint8_t)0xC0)      /*!< Latency Code = 3 */
+
+/* AutoBoot Register */
+#define S25FL512S_AB_EN                                 ((uint32_t)0x00000001) /*!< AutoBoot Enabled     */
+#define S25FL512S_AB_SD_MASK                            ((uint32_t)0x000001FE) /*!< AutoBoot Start Delay mask */
+#define S25FL512S_AB_SA_MASK                            ((uint32_t)0xFFFFFE00) /*!< AutoBoot Start Address mask */
+
+/* Bank Address Register */
+#define S25FL512S_BA_BA24                               ((uint8_t)0x01)      /*!< A24 for 512 Mb device */
+#define S25FL512S_BA_BA25                               ((uint8_t)0x02)      /*!< A25 for 512 Mb device */
+#define S25FL512S_BA_EXTADD                             ((uint8_t)0x80)      /*!< 4 bytes addressing required from command */
+
+/* ASP Register */
+#define S25FL512S_ASP_PSTMLB                            ((uint16_t)0x0002)   /*!< Persistent protection mode not permanently enabled */
+#define S25FL512S_ASP_PWSMLB                            ((uint16_t)0x0003)   /*!< Password protection mode not permanently enabled */
+
+/* PPB Lock Register */
+#define S25FL512S_PPBLOCK                               ((uint8_t)0x01)      /*!< PPB array may be programmed or erased */
+
+/**
+  * @}
+  */
+  
+/** @defgroup S25FL512S_Exported_Functions
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+      
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __S25FL512S_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+  
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 1081 - 0
bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/Release_Notes.html

@@ -0,0 +1,1081 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
+<meta name="ProgId" content="Word.Document">
+<meta name="Generator" content="Microsoft Word 15">
+<meta name="Originator" content="Microsoft Word 15">
+<link rel="File-List" href="Release_Notes_files/filelist.xml">
+<link rel="Edit-Time-Data" href="Release_Notes_files/editdata.mso"><!--[if !mso]>
+<style>
+v\:* {behavior:url(#default#VML);}
+o\:* {behavior:url(#default#VML);}
+w\:* {behavior:url(#default#VML);}
+.shape {behavior:url(#default#VML);}
+</style>
+<![endif]--><title>Release Notes for S5K5CAG Component Driver</title><!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+  <o:Author>STMicroelectronics</o:Author>
+  <o:LastAuthor>David LACOMBE</o:LastAuthor>
+  <o:Revision>38</o:Revision>
+  <o:TotalTime>138</o:TotalTime>
+  <o:Created>2009-02-27T19:26:00Z</o:Created>
+  <o:LastSaved>2014-08-11T09:12:00Z</o:LastSaved>
+  <o:Pages>1</o:Pages>
+  <o:Words>291</o:Words>
+  <o:Characters>1663</o:Characters>
+  <o:Company>STMicroelectronics</o:Company>
+  <o:Lines>13</o:Lines>
+  <o:Paragraphs>3</o:Paragraphs>
+  <o:CharactersWithSpaces>1951</o:CharactersWithSpaces>
+  <o:Version>15.00</o:Version>
+ </o:DocumentProperties>
+ <o:OfficeDocumentSettings>
+  <o:AllowPNG/>
+ </o:OfficeDocumentSettings>
+</xml><![endif]-->
+
+
+
+<link rel="dataStoreItem" href="Release_Notes_files/item0001.xml" target="Release_Notes_files/props002.xml">
+<link rel="themeData" href="Release_Notes_files/themedata.thmx">
+<link rel="colorSchemeMapping" href="Release_Notes_files/colorschememapping.xml"><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+  <w:SpellingState>Clean</w:SpellingState>
+  <w:GrammarState>Clean</w:GrammarState>
+  <w:TrackMoves>false</w:TrackMoves>
+  <w:TrackFormatting/>
+  <w:ValidateAgainstSchemas/>
+  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+  <w:DoNotPromoteQF/>
+  <w:LidThemeOther>EN-US</w:LidThemeOther>
+  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
+  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
+  <w:Compatibility>
+   <w:BreakWrappedTables/>
+   <w:SplitPgBreakAndParaMark/>
+  </w:Compatibility>
+  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+  <m:mathPr>
+   <m:mathFont m:val="Cambria Math"/>
+   <m:brkBin m:val="before"/>
+   <m:brkBinSub m:val="&#45;-"/>
+   <m:smallFrac m:val="off"/>
+   <m:dispDef/>
+   <m:lMargin m:val="0"/>
+   <m:rMargin m:val="0"/>
+   <m:defJc m:val="centerGroup"/>
+   <m:wrapIndent m:val="1440"/>
+   <m:intLim m:val="subSup"/>
+   <m:naryLim m:val="undOvr"/>
+  </m:mathPr></w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
+  DefSemiHidden="false" DefQFormat="false" LatentStyleCount="371">
+  <w:LsdException Locked="false" QFormat="true" Name="Normal"/>
+  <w:LsdException Locked="false" QFormat="true" Name="heading 1"/>
+  <w:LsdException Locked="false" QFormat="true" Name="heading 2"/>
+  <w:LsdException Locked="false" QFormat="true" Name="heading 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 6"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 7"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 8"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="heading 9"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 6"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 7"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 8"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index 9"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 6"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 7"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 8"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="toc 9"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Normal Indent"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="footnote text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="annotation text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="header"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="footer"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="index heading"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   QFormat="true" Name="caption"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="table of figures"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="envelope address"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="envelope return"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="footnote reference"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="annotation reference"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="line number"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="page number"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="endnote reference"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="endnote text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="table of authorities"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Bullet 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Bullet 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Bullet 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Bullet 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Number 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Number 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Number 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Number 5"/>
+  <w:LsdException Locked="false" QFormat="true" Name="Title"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Closing"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Signature"/>
+  <w:LsdException Locked="false" Priority="1" SemiHidden="true"
+   UnhideWhenUsed="true" Name="Default Paragraph Font"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text Indent"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Continue"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Continue 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Continue 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Continue 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="List Continue 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Message Header"/>
+  <w:LsdException Locked="false" QFormat="true" Name="Subtitle"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Salutation"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Date"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text First Indent"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text First Indent 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Note Heading"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text Indent 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Body Text Indent 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Block Text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Hyperlink"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="FollowedHyperlink"/>
+  <w:LsdException Locked="false" QFormat="true" Name="Strong"/>
+  <w:LsdException Locked="false" QFormat="true" Name="Emphasis"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Document Map"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Plain Text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="E-mail Signature"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Top of Form"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Bottom of Form"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Normal (Web)"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Acronym"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Address"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Cite"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Code"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Definition"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Keyboard"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Preformatted"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Sample"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Typewriter"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="HTML Variable"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Normal Table"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="annotation subject"/>
+  <w:LsdException Locked="false" Priority="99" SemiHidden="true"
+   UnhideWhenUsed="true" Name="No List"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Outline List 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Outline List 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Outline List 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Simple 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Simple 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Simple 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Classic 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Classic 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Classic 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Classic 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Colorful 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Colorful 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Colorful 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Columns 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Columns 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Columns 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Columns 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Columns 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 6"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 7"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Grid 8"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 4"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 5"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 6"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 7"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table List 8"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table 3D effects 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table 3D effects 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table 3D effects 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Contemporary"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Elegant"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Professional"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Subtle 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Subtle 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Web 1"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Web 2"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Web 3"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Balloon Text"/>
+  <w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
+   Name="Table Theme"/>
+  <w:LsdException Locked="false" Priority="99" SemiHidden="true"
+   Name="Placeholder Text"/>
+  <w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
+  <w:LsdException Locked="false" Priority="99" SemiHidden="true" Name="Revision"/>
+  <w:LsdException Locked="false" Priority="34" QFormat="true"
+   Name="List Paragraph"/>
+  <w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
+  <w:LsdException Locked="false" Priority="30" QFormat="true"
+   Name="Intense Quote"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
+  <w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
+  <w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
+  <w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
+  <w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
+  <w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
+  <w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
+  <w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
+  <w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
+  <w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
+  <w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
+  <w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
+  <w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
+  <w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
+  <w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
+  <w:LsdException Locked="false" Priority="19" QFormat="true"
+   Name="Subtle Emphasis"/>
+  <w:LsdException Locked="false" Priority="21" QFormat="true"
+   Name="Intense Emphasis"/>
+  <w:LsdException Locked="false" Priority="31" QFormat="true"
+   Name="Subtle Reference"/>
+  <w:LsdException Locked="false" Priority="32" QFormat="true"
+   Name="Intense Reference"/>
+  <w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
+  <w:LsdException Locked="false" Priority="37" SemiHidden="true"
+   UnhideWhenUsed="true" Name="Bibliography"/>
+  <w:LsdException Locked="false" Priority="39" SemiHidden="true"
+   UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
+  <w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
+  <w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
+  <w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
+  <w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
+  <w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
+  <w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
+  <w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
+  <w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
+  <w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 1"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 1"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 1"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 2"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 2"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 2"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 3"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 3"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 3"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 4"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 4"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 4"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 5"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 5"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 5"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="Grid Table 1 Light Accent 6"/>
+  <w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
+  <w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
+  <w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
+  <w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="Grid Table 6 Colorful Accent 6"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="Grid Table 7 Colorful Accent 6"/>
+  <w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
+  <w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
+  <w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 1"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 1"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 1"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 2"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 2"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 2"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 3"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 3"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 3"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 4"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 4"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 4"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 5"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 5"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 5"/>
+  <w:LsdException Locked="false" Priority="46"
+   Name="List Table 1 Light Accent 6"/>
+  <w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
+  <w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
+  <w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
+  <w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
+  <w:LsdException Locked="false" Priority="51"
+   Name="List Table 6 Colorful Accent 6"/>
+  <w:LsdException Locked="false" Priority="52"
+   Name="List Table 7 Colorful Accent 6"/>
+ </w:LatentStyles>
+</xml><![endif]-->
+
+<style>
+<!--
+ /* Font Definitions */
+ @font-face
+	{font-family:Wingdings;
+	panose-1:5 0 0 0 0 0 0 0 0 0;
+	mso-font-charset:2;
+	mso-generic-font-family:auto;
+	mso-font-pitch:variable;
+	mso-font-signature:0 268435456 0 0 -2147483648 0;}
+@font-face
+	{font-family:"Cambria Math";
+	panose-1:2 4 5 3 5 4 6 3 2 4;
+	mso-font-charset:1;
+	mso-generic-font-family:roman;
+	mso-font-format:other;
+	mso-font-pitch:variable;
+	mso-font-signature:0 0 0 0 0 0;}
+@font-face
+	{font-family:Verdana;
+	panose-1:2 11 6 4 3 5 4 4 2 4;
+	mso-font-charset:0;
+	mso-generic-font-family:swiss;
+	mso-font-pitch:variable;
+	mso-font-signature:-1593833729 1073750107 16 0 415 0;}
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-parent:"";
+	margin:0cm;
+	margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman","serif";
+	mso-fareast-font-family:"Times New Roman";}
+h1
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-link:"Heading 1 Char";
+	mso-margin-top-alt:auto;
+	margin-right:0cm;
+	mso-margin-bottom-alt:auto;
+	margin-left:0cm;
+	mso-pagination:widow-orphan;
+	mso-outline-level:1;
+	font-size:24.0pt;
+	font-family:"Times New Roman","serif";
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:minor-fareast;
+	font-weight:bold;}
+h2
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-link:"Heading 2 Char";
+	mso-style-next:Normal;
+	margin-top:12.0pt;
+	margin-right:0cm;
+	margin-bottom:3.0pt;
+	margin-left:0cm;
+	mso-pagination:widow-orphan;
+	page-break-after:avoid;
+	mso-outline-level:2;
+	font-size:14.0pt;
+	font-family:"Arial","sans-serif";
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:minor-fareast;
+	font-weight:bold;
+	font-style:italic;}
+h3
+	{mso-style-unhide:no;
+	mso-style-qformat:yes;
+	mso-style-link:"Heading 3 Char";
+	mso-margin-top-alt:auto;
+	margin-right:0cm;
+	mso-margin-bottom-alt:auto;
+	margin-left:0cm;
+	mso-pagination:widow-orphan;
+	mso-outline-level:3;
+	font-size:13.5pt;
+	font-family:"Times New Roman","serif";
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:minor-fareast;
+	font-weight:bold;}
+a:link, span.MsoHyperlink
+	{mso-style-noshow:yes;
+	color:blue;
+	text-decoration:underline;
+	text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+	{mso-style-noshow:yes;
+	color:blue;
+	text-decoration:underline;
+	text-underline:single;}
+p
+	{mso-style-noshow:yes;
+	mso-margin-top-alt:auto;
+	margin-right:0cm;
+	mso-margin-bottom-alt:auto;
+	margin-left:0cm;
+	mso-pagination:widow-orphan;
+	font-size:12.0pt;
+	font-family:"Times New Roman","serif";
+	mso-fareast-font-family:"Times New Roman";}
+span.Heading2Char
+	{mso-style-name:"Heading 2 Char";
+	mso-style-noshow:yes;
+	mso-style-unhide:no;
+	mso-style-locked:yes;
+	mso-style-link:"Heading 2";
+	mso-ansi-font-size:13.0pt;
+	mso-bidi-font-size:13.0pt;
+	font-family:"Calibri Light","sans-serif";
+	mso-ascii-font-family:"Calibri Light";
+	mso-ascii-theme-font:major-latin;
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:major-fareast;
+	mso-hansi-font-family:"Calibri Light";
+	mso-hansi-theme-font:major-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:major-bidi;
+	color:#2E74B5;
+	mso-themecolor:accent1;
+	mso-themeshade:191;}
+span.Heading1Char
+	{mso-style-name:"Heading 1 Char";
+	mso-style-unhide:no;
+	mso-style-locked:yes;
+	mso-style-link:"Heading 1";
+	mso-ansi-font-size:16.0pt;
+	mso-bidi-font-size:16.0pt;
+	font-family:"Calibri Light","sans-serif";
+	mso-ascii-font-family:"Calibri Light";
+	mso-ascii-theme-font:major-latin;
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:major-fareast;
+	mso-hansi-font-family:"Calibri Light";
+	mso-hansi-theme-font:major-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:major-bidi;
+	color:#2E74B5;
+	mso-themecolor:accent1;
+	mso-themeshade:191;}
+span.Heading3Char
+	{mso-style-name:"Heading 3 Char";
+	mso-style-noshow:yes;
+	mso-style-unhide:no;
+	mso-style-locked:yes;
+	mso-style-link:"Heading 3";
+	mso-ansi-font-size:12.0pt;
+	mso-bidi-font-size:12.0pt;
+	font-family:"Calibri Light","sans-serif";
+	mso-ascii-font-family:"Calibri Light";
+	mso-ascii-theme-font:major-latin;
+	mso-fareast-font-family:"Times New Roman";
+	mso-fareast-theme-font:major-fareast;
+	mso-hansi-font-family:"Calibri Light";
+	mso-hansi-theme-font:major-latin;
+	mso-bidi-font-family:"Times New Roman";
+	mso-bidi-theme-font:major-bidi;
+	color:#1F4D78;
+	mso-themecolor:accent1;
+	mso-themeshade:127;}
+span.GramE
+	{mso-style-name:"";
+	mso-gram-e:yes;}
+.MsoChpDefault
+	{mso-style-type:export-only;
+	mso-default-props:yes;
+	font-size:10.0pt;
+	mso-ansi-font-size:10.0pt;
+	mso-bidi-font-size:10.0pt;}
+@page WordSection1
+	{size:612.0pt 792.0pt;
+	margin:72.0pt 90.0pt 72.0pt 90.0pt;
+	mso-header-margin:36.0pt;
+	mso-footer-margin:36.0pt;
+	mso-paper-source:0;}
+div.WordSection1
+	{page:WordSection1;}
+ /* List Definitions */
+ @list l0
+	{mso-list-id:738748693;
+	mso-list-template-ids:1300894520;}
+@list l0:level1
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:36.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level2
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:72.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level3
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:108.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level4
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:144.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level5
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:180.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level6
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:216.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level7
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:252.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level8
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:288.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l0:level9
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:324.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1
+	{mso-list-id:1416249062;
+	mso-list-template-ids:-1878985858;}
+@list l1:level1
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:36.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level2
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:72.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level3
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:108.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level4
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:144.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level5
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:180.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level6
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:216.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level7
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:252.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level8
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:288.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l1:level9
+	{mso-level-number-format:bullet;
+	mso-level-text:\F0A7;
+	mso-level-tab-stop:324.0pt;
+	mso-level-number-position:left;
+	text-indent:-18.0pt;
+	mso-ansi-font-size:10.0pt;
+	font-family:Wingdings;}
+@list l2
+	{mso-list-id:1777752712;
+	mso-list-template-ids:-642105420;}
+ol
+	{margin-bottom:0cm;}
+ul
+	{margin-bottom:0cm;}
+-->
+</style><!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+	{mso-style-name:"Table Normal";
+	mso-tstyle-rowband-size:0;
+	mso-tstyle-colband-size:0;
+	mso-style-noshow:yes;
+	mso-style-priority:99;
+	mso-style-parent:"";
+	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+	mso-para-margin:0cm;
+	mso-para-margin-bottom:.0001pt;
+	mso-pagination:widow-orphan;
+	font-size:10.0pt;
+	font-family:"Times New Roman","serif";}
+</style>
+<![endif]-->
+
+<meta content="MCD Application Team" name="author"><!--[if gte mso 9]><xml>
+ <o:shapedefaults v:ext="edit" spidmax="1026"/>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <o:shapelayout v:ext="edit">
+  <o:idmap v:ext="edit" data="1"/>
+ </o:shapelayout></xml><![endif]--></head>
+<body style="" link="blue" vlink="blue">
+
+<div class="WordSection1">
+
+<p class="MsoNormal"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;;"><o:p>&nbsp;</o:p></span></p>
+
+<div align="center">
+
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+ <tbody><tr style="">
+  <td style="padding: 0cm;" valign="top">
+  <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+   <tbody><tr style="">
+    <td style="padding: 0cm 5.4pt;" valign="top">
+    <p class="MsoNormal"><span style="font-size: 8pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+    </td>
+   </tr>
+   <tr style="">
+    <td style="padding: 1.5pt;">
+    <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: rgb(51, 102, 255);">Release Notes for S5K5CAG Component Driver</span><span style="font-size: 20pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><o:p></o:p></span></h1>
+    <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: black;">Copyright
+    2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+    <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: black;"><img id="_x0000_i1026" src="../../../../_htmresc/st_logo.png" border="0" height="32" width="32"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+    </td>
+   </tr>
+  </tbody></table>
+  <p class="MsoNormal"><span style="font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; display: none;"><o:p>&nbsp;</o:p></span></p>
+  <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+   <tbody><tr style="">
+    <td style="padding: 0cm;" valign="top">
+    <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt;"><span style="font-size: 10pt; font-family: &quot;Arial&quot;,&quot;sans-serif&quot;; color: white;">V1.0.0 / 05-March-2015 <o:p></o:p></span></h3>
+    <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b><u><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;">Main Changes<o:p></o:p></span></u></b></p>
+    
+    <ul type="square">
+     <li><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-family: Verdana; font-size: 10pt;"></span> </li>
+    </ul>
+    <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span></h2>
+    <p class="MsoNormal" style="text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistribution and use in source and
+    binary forms, with or without modification, are permitted provided that the
+    following conditions are met:</span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+    <ol start="1" type="1">
+     <li class="MsoNormal" style="text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+         of source code must retain the above copyright notice, this list of
+         conditions and the following disclaimer.</span><span style="font-size: 10pt;"><o:p></o:p></span></li>
+     <li class="MsoNormal" style="text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">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.</span><span style="font-size: 10pt;"><o:p></o:p></span></li>
+     <li class="MsoNormal" style="text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither
+         the name of STMicroelectronics nor the names of its contributors may
+         be used to endorse or promote products derived </span><span style="font-size: 10pt;"><o:p></o:p></span></li>
+    </ol>
+    <p class="MsoNormal" style="text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="GramE">from</span> this software without specific prior written
+    permission.</span><span style="font-size: 10pt;"><br>
+    <br>
+    </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">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.</span><span style="font-size: 10pt;"> <o:p></o:p></span></p>
+    <p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><o:p>&nbsp;</o:p></span></p>
+    <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+    <hr align="center" size="2" width="100%">
+    </span></div>
+    <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;">For
+    complete documentation on </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">STM32<span style="color: black;">&nbsp;Microcontrollers
+    visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+    </td>
+   </tr>
+  </tbody></table>
+  <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+  </td>
+ </tr>
+</tbody></table>
+
+</div>
+
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+
+</div>
+
+</body></html>

+ 3450 - 0
bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/s5k5cag.c

@@ -0,0 +1,3450 @@
+/**
+  ******************************************************************************
+  * @file    s5k5cag.c
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    05-March-2015
+  * @brief   This file provides the S5K5CAG camera driver
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "s5k5cag.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup S5K5CAG
+  * @brief     This file provides a set of functions needed to drive the 
+  *            S5K5CAG Camera module.
+  * @{
+  */
+
+/** @defgroup S5K5CAG_Private_TypesDefinitions
+  * @{
+  */ 
+
+/**
+  * @}
+  */ 
+
+/** @defgroup S5K5CAG_Private_Defines
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup S5K5CAG_Private_Macros
+  * @{
+  */
+     
+/**
+  * @}
+  */  
+  
+/** @defgroup S5K5CAG_Private_FunctionPrototypes
+  * @{
+  */
+static uint32_t s5k5cag_ConvertValue(uint32_t feature, uint32_t value);
+/**
+  * @}
+  */ 
+  
+/** @defgroup S5K5CAG_Private_Variables
+  * @{
+  */        
+
+CAMERA_DrvTypeDef   s5k5cag_drv =
+{
+  s5k5cag_Init,
+  s5k5cag_ReadID,
+  s5k5cag_Config,
+};
+
+/* Common initialization sequence for all resolutions */
+const uint16_t S5K5CAG_Common[][2]=
+{
+  /* ARM GO */
+  /* Direct mode */
+  {0xFCFC, 0xD000},
+  {0x0010, 0x0001}, /* Reset */
+  {0x1030, 0x0000}, /* Clear host interrupt so main will wait */
+  {0x0014, 0x0001}, /* ARM go */
+  {0xFFFF, 0x0064}, /* Min.10ms delay is required */
+
+  /* Set IO driving current */
+  {0x0028, 0xD000},
+  {0x002A, 0x1082},
+  {0x0F12, 0x0155}, /* [9:8] D4, [7:6] D3, [5:4] D2, [3:2] D1, [1:0] D0 */
+  {0x0F12, 0x0155}, /* [9:8] D9, [7:6] D8, [5:4] D7, [3:2] D6, [1:0] D5 */
+  {0x0F12, 0x1555}, /* [5:4] GPIO3, [3:2] GPIO2, [1:0] GPIO1 */
+  {0x0F12, 0x0555}, /* [11:10] SDA, [9:8] SCA, [7:6] PCLK, [3:2] VSYNC, [1:0] HSYNC */
+
+  /* Start T&P part */
+  {0x0028, 0x7000},
+  {0x002A, 0x2CF8},
+  {0x0F12, 0xB510},
+  {0x0F12, 0x490F},
+  {0x0F12, 0x2000},
+  {0x0F12, 0x8048},
+  {0x0F12, 0x8088},
+  {0x0F12, 0x490E},
+  {0x0F12, 0x480E},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF949},
+  {0x0F12, 0x490E},
+  {0x0F12, 0x480E},
+  {0x0F12, 0x6341},
+  {0x0F12, 0x490E},
+  {0x0F12, 0x38C0},
+  {0x0F12, 0x63C1},
+  {0x0F12, 0x490E},
+  {0x0F12, 0x6301},
+  {0x0F12, 0x490E},
+  {0x0F12, 0x3040},
+  {0x0F12, 0x6181},
+  {0x0F12, 0x490D},
+  {0x0F12, 0x480E},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF93A},
+  {0x0F12, 0x490D},
+  {0x0F12, 0x480E},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF936},
+  {0x0F12, 0xBC10},
+  {0x0F12, 0xBC08},
+  {0x0F12, 0x4718},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x1080},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x2D69},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x89A9},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x2DBB},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x0140},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x2DED},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x2E65},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x2E79},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x2E4D},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x013D},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x2F03},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x5823},
+  {0x0F12, 0x0000},
+  {0x0F12, 0xB570},
+  {0x0F12, 0x6804},
+  {0x0F12, 0x6845},
+  {0x0F12, 0x6881},
+  {0x0F12, 0x6840},
+  {0x0F12, 0x2900},
+  {0x0F12, 0x6880},
+  {0x0F12, 0xD007},
+  {0x0F12, 0x4976},
+  {0x0F12, 0x8949},
+  {0x0F12, 0x084A},
+  {0x0F12, 0x1880},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF914},
+  {0x0F12, 0x80A0},
+  {0x0F12, 0xE000},
+  {0x0F12, 0x80A0},
+  {0x0F12, 0x88A0},
+  {0x0F12, 0x2800},
+  {0x0F12, 0xD010},
+  {0x0F12, 0x68A9},
+  {0x0F12, 0x6828},
+  {0x0F12, 0x084A},
+  {0x0F12, 0x1880},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF908},
+  {0x0F12, 0x8020},
+  {0x0F12, 0x1D2D},
+  {0x0F12, 0xCD03},
+  {0x0F12, 0x084A},
+  {0x0F12, 0x1880},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF901},
+  {0x0F12, 0x8060},
+  {0x0F12, 0xBC70},
+  {0x0F12, 0xBC08},
+  {0x0F12, 0x4718},
+  {0x0F12, 0x2000},
+  {0x0F12, 0x8060},
+  {0x0F12, 0x8020},
+  {0x0F12, 0xE7F8},
+  {0x0F12, 0xB510},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8FC},
+  {0x0F12, 0x4865},
+  {0x0F12, 0x4966},
+  {0x0F12, 0x8800},
+  {0x0F12, 0x4A66},
+  {0x0F12, 0x2805},
+  {0x0F12, 0xD003},
+  {0x0F12, 0x4B65},
+  {0x0F12, 0x795B},
+  {0x0F12, 0x2B00},
+  {0x0F12, 0xD005},
+  {0x0F12, 0x2001},
+  {0x0F12, 0x8008},
+  {0x0F12, 0x8010},
+  {0x0F12, 0xBC10},
+  {0x0F12, 0xBC08},
+  {0x0F12, 0x4718},
+  {0x0F12, 0x2800},
+  {0x0F12, 0xD1FA},
+  {0x0F12, 0x2000},
+  {0x0F12, 0x8008},
+  {0x0F12, 0x8010},
+  {0x0F12, 0xE7F6},
+  {0x0F12, 0xB570},
+  {0x0F12, 0x0004},
+  {0x0F12, 0x485D},
+  {0x0F12, 0x2C00},
+  {0x0F12, 0x8D00},
+  {0x0F12, 0xD001},
+  {0x0F12, 0x2501},
+  {0x0F12, 0xE000},
+  {0x0F12, 0x2500},
+  {0x0F12, 0x4E5B},
+  {0x0F12, 0x4328},
+  {0x0F12, 0x8030},
+  {0x0F12, 0x207D},
+  {0x0F12, 0x00C0},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8DE},
+  {0x0F12, 0x4858},
+  {0x0F12, 0x2C00},
+  {0x0F12, 0x8C40},
+  {0x0F12, 0x0329},
+  {0x0F12, 0x4308},
+  {0x0F12, 0x8130},
+  {0x0F12, 0x4856},
+  {0x0F12, 0x2C00},
+  {0x0F12, 0x8A40},
+  {0x0F12, 0x01A9},
+  {0x0F12, 0x4308},
+  {0x0F12, 0x80B0},
+  {0x0F12, 0x2C00},
+  {0x0F12, 0xD00B},
+  {0x0F12, 0x4853},
+  {0x0F12, 0x8A01},
+  {0x0F12, 0x4853},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8BD},
+  {0x0F12, 0x4953},
+  {0x0F12, 0x8809},
+  {0x0F12, 0x4348},
+  {0x0F12, 0x0400},
+  {0x0F12, 0x0C00},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8C4},
+  {0x0F12, 0x0020},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8C9},
+  {0x0F12, 0x484F},
+  {0x0F12, 0x7004},
+  {0x0F12, 0xE7AF},
+  {0x0F12, 0xB510},
+  {0x0F12, 0x0004},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8CA},
+  {0x0F12, 0x6020},
+  {0x0F12, 0x494C},
+  {0x0F12, 0x8B49},
+  {0x0F12, 0x0789},
+  {0x0F12, 0xD0BD},
+  {0x0F12, 0x0040},
+  {0x0F12, 0x6020},
+  {0x0F12, 0xE7BA},
+  {0x0F12, 0xB510},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8C7},
+  {0x0F12, 0x4848},
+  {0x0F12, 0x8880},
+  {0x0F12, 0x0601},
+  {0x0F12, 0x4840},
+  {0x0F12, 0x1609},
+  {0x0F12, 0x8281},
+  {0x0F12, 0xE7B0},
+  {0x0F12, 0xB5F8},
+  {0x0F12, 0x000F},
+  {0x0F12, 0x4C3A},
+  {0x0F12, 0x3420},
+  {0x0F12, 0x2500},
+  {0x0F12, 0x5765},
+  {0x0F12, 0x0039},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF8BF},
+  {0x0F12, 0x9000},
+  {0x0F12, 0x2600},
+  {0x0F12, 0x57A6},
+  {0x0F12, 0x4C38},
+  {0x0F12, 0x42AE},
+  {0x0F12, 0xD01B},
+  {0x0F12, 0x4D3D},
+  {0x0F12, 0x8AE8},
+  {0x0F12, 0x2800},
+  {0x0F12, 0xD013},
+  {0x0F12, 0x4832},
+  {0x0F12, 0x8A01},
+  {0x0F12, 0x8B80},
+  {0x0F12, 0x4378},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF881},
+  {0x0F12, 0x89A9},
+  {0x0F12, 0x1A41},
+  {0x0F12, 0x4837},
+  {0x0F12, 0x3820},
+  {0x0F12, 0x8AC0},
+  {0x0F12, 0x4348},
+  {0x0F12, 0x17C1},
+  {0x0F12, 0x0D89},
+  {0x0F12, 0x1808},
+  {0x0F12, 0x1280},
+  {0x0F12, 0x8AA1},
+  {0x0F12, 0x1A08},
+  {0x0F12, 0x82A0},
+  {0x0F12, 0xE003},
+  {0x0F12, 0x88A8},
+  {0x0F12, 0x0600},
+  {0x0F12, 0x1600},
+  {0x0F12, 0x82A0},
+  {0x0F12, 0x2014},
+  {0x0F12, 0x5E20},
+  {0x0F12, 0x42B0},
+  {0x0F12, 0xD011},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF89F},
+  {0x0F12, 0x1D40},
+  {0x0F12, 0x00C3},
+  {0x0F12, 0x1A18},
+  {0x0F12, 0x214B},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF863},
+  {0x0F12, 0x211F},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF89E},
+  {0x0F12, 0x2114},
+  {0x0F12, 0x5E61},
+  {0x0F12, 0x0FC9},
+  {0x0F12, 0x0149},
+  {0x0F12, 0x4301},
+  {0x0F12, 0x4826},
+  {0x0F12, 0x81C1},
+  {0x0F12, 0x9800},
+  {0x0F12, 0xBCF8},
+  {0x0F12, 0xBC08},
+  {0x0F12, 0x4718},
+  {0x0F12, 0xB5F1},
+  {0x0F12, 0xB082},
+  {0x0F12, 0x2500},
+  {0x0F12, 0x4822},
+  {0x0F12, 0x9001},
+  {0x0F12, 0x2400},
+  {0x0F12, 0x2028},
+  {0x0F12, 0x4368},
+  {0x0F12, 0x4A21},
+  {0x0F12, 0x4917},
+  {0x0F12, 0x1882},
+  {0x0F12, 0x39E0},
+  {0x0F12, 0x1847},
+  {0x0F12, 0x9200},
+  {0x0F12, 0x0066},
+  {0x0F12, 0x19B8},
+  {0x0F12, 0x9A01},
+  {0x0F12, 0x3060},
+  {0x0F12, 0x8B01},
+  {0x0F12, 0x5BB8},
+  {0x0F12, 0x8812},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF884},
+  {0x0F12, 0x9900},
+  {0x0F12, 0x5388},
+  {0x0F12, 0x1C64},
+  {0x0F12, 0x2C14},
+  {0x0F12, 0xDBF1},
+  {0x0F12, 0x1C6D},
+  {0x0F12, 0x2D03},
+  {0x0F12, 0xDBE5},
+  {0x0F12, 0x9802},
+  {0x0F12, 0x6800},
+  {0x0F12, 0x0600},
+  {0x0F12, 0x0E00},
+  {0x0F12, 0xF000},
+  {0x0F12, 0xF87E},
+  {0x0F12, 0xBCFE},
+  {0x0F12, 0xBC08},
+  {0x0F12, 0x4718},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0C3C},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x26E8},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x6100},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x6500},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x1A7C},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x2C2C},
+  {0x0F12, 0x7000},
+  {0x0F12, 0xF400},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x167C},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x3368},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x1D6C},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x40A0},
+  {0x0F12, 0x00DD},
+  {0x0F12, 0xF520},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x2C29},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x1A54},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x1564},
+  {0x0F12, 0x7000},
+  {0x0F12, 0xF2A0},
+  {0x0F12, 0xD000},
+  {0x0F12, 0x2440},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x05A0},
+  {0x0F12, 0x7000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x1A3F},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xF004},
+  {0x0F12, 0xE51F},
+  {0x0F12, 0x1F48},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x24BD},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0xF53F},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0xF5D9},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x013D},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0xF5C9},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0xFAA9},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x36DD},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x36ED},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x3723},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x4778},
+  {0x0F12, 0x46C0},
+  {0x0F12, 0xC000},
+  {0x0F12, 0xE59F},
+  {0x0F12, 0xFF1C},
+  {0x0F12, 0xE12F},
+  {0x0F12, 0x5823},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x7D3E},
+  {0x0F12, 0x0000},
+  /* End T&P part */
+
+  /* CIS/APS/Analog setting- 400LSBSYSCLK 45M */
+  {0x0028, 0x7000},
+  {0x002A, 0x157A},
+  {0x0F12, 0x0001},
+  {0x002A, 0x1578},
+  {0x0F12, 0x0001},
+  {0x002A, 0x1576},
+  {0x0F12, 0x0020},
+  {0x002A, 0x1574},
+  {0x0F12, 0x0006},
+  {0x002A, 0x156E},
+  {0x0F12, 0x0001}, /* Slope calibration tolerance in units of 1/256 */
+  {0x002A, 0x1568},
+  {0x0F12, 0x00FC},
+
+  /* ADC control */
+  {0x002A, 0x155A},
+  {0x0F12, 0x01CC}, /* ADC SAT of 450mV for 10bit default in EVT1 */
+  {0x002A, 0x157E},
+  {0x0F12, 0x0C80}, /* 3200 Max. Reset ramp DCLK counts (default 2048 0x800) */
+  {0x0F12, 0x0578}, /* 1400 Max. Reset ramp DCLK counts for x3.5 */
+  {0x002A, 0x157C},
+  {0x0F12, 0x0190}, /* 400 Reset ramp for x1 in DCLK counts */
+  {0x002A, 0x1570},
+  {0x0F12, 0x00A0}, /* 224 LSB */
+  {0x0F12, 0x0010}, /* reset threshold */
+  {0x002A, 0x12C4},
+  {0x0F12, 0x006A}, /* 106 additional timing columns */
+  {0x002A, 0x12C8},
+  {0x0F12, 0x08AC}, /* 2220 ADC columns in normal mode including Hold & Latch */
+  {0x0F12, 0x0050}, /* 80 addition of ADC columns in Y-ave mode (default 244 0x74) */
+
+  {0x002A, 0x1696},
+  {0x0F12, 0x0000}, /* based on APS guidelines */
+  {0x0F12, 0x0000}, /* based on APS guidelines */
+  {0x0F12, 0x00C6}, /* default. 1492 used for ADC dark characteristics */
+  {0x0F12, 0x00C6}, /* default. 1492 used for ADC dark characteristics */
+  {0x002A, 0x1690},
+  {0x0F12, 0x0001}, /* when set double sampling is activated - requires different set of pointers */
+  {0x002A, 0x12B0},
+  {0x0F12, 0x0055}, /* comp and pixel bias control 0xF40E - default for EVT1 */
+  {0x0F12, 0x005A}, /* comp and pixel bias control 0xF40E for binning mode */
+  {0x002A, 0x337A},
+  {0x0F12, 0x0006}, /* [7] - is used for rest-only mode (EVT0 value is 0xD and HW 0x6) */
+  {0x002A, 0x169E}, /* [3:0]- specifies the target (default 7)- DCLK = 64MHz instead of 116MHz */
+  {0x0F12, 0x000A},
+  {0x0028, 0xD000},
+  {0x002A, 0xF406},
+  {0x0F12, 0x1000}, /* [11]: Enable DBLR Regulation */
+  {0x002A, 0xF40A},
+  {0x0F12, 0x6998}, /* [3:0]: VPIX ~2.8V */
+  {0x002A, 0xF418},
+  {0x0F12, 0x0078}, /* [0]: Static RC-filter */
+  {0x0F12, 0x04FE}, /* [7:4]: Full RC-filter */
+  {0x002A, 0xF52C},
+  {0x0F12, 0x8800}, /* [11]: Add load to CDS block */
+
+  {0x002A, 0x3274},
+  {0x0F12, 0x0155},
+  {0x0F12, 0x0155},
+  {0x0F12, 0x1555},
+  {0x0F12, 0x0555},
+
+  /* Asserting CDS pointers - Long exposure MS Normal */
+  /* Conditions: 10bit, ADC_SAT = 450mV ; ramp_del = 22 ; ramp_start = 34 */
+  {0x0028, 0x7000},
+  {0x002A, 0x12D2},
+  {0x0F12, 0x0003}, /* #senHal_pContSenModesRegsArray[0][0]2 700012D2   */
+  {0x0F12, 0x0003}, /* #senHal_pContSenModesRegsArray[0][1]2 700012D4   */
+  {0x0F12, 0x0003}, /* #senHal_pContSenModesRegsArray[0][2]2 700012D6   */
+  {0x0F12, 0x0003}, /* #senHal_pContSenModesRegsArray[0][3]2 700012D8   */
+  {0x0F12, 0x0884}, /* #senHal_pContSenModesRegsArray[1][0]2 700012DA   */
+  {0x0F12, 0x08CF}, /* #senHal_pContSenModesRegsArray[1][1]2 700012DC   */
+  {0x0F12, 0x0500}, /* #senHal_pContSenModesRegsArray[1][2]2 700012DE   */
+  {0x0F12, 0x054B}, /* #senHal_pContSenModesRegsArray[1][3]2 700012E0   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[2][0]2 700012E2   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[2][1]2 700012E4   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[2][2]2 700012E6   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[2][3]2 700012E8   */
+  {0x0F12, 0x0885}, /* #senHal_pContSenModesRegsArray[3][0]2 700012EA   */
+  {0x0F12, 0x0467}, /* #senHal_pContSenModesRegsArray[3][1]2 700012EC   */
+  {0x0F12, 0x0501}, /* #senHal_pContSenModesRegsArray[3][2]2 700012EE   */
+  {0x0F12, 0x02A5}, /* #senHal_pContSenModesRegsArray[3][3]2 700012F0   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[4][0]2 700012F2   */
+  {0x0F12, 0x046A}, /* #senHal_pContSenModesRegsArray[4][1]2 700012F4   */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[4][2]2 700012F6   */
+  {0x0F12, 0x02A8}, /* #senHal_pContSenModesRegsArray[4][3]2 700012F8   */
+  {0x0F12, 0x0885}, /* #senHal_pContSenModesRegsArray[5][0]2 700012FA   */
+  {0x0F12, 0x08D0}, /* #senHal_pContSenModesRegsArray[5][1]2 700012FC   */
+  {0x0F12, 0x0501}, /* #senHal_pContSenModesRegsArray[5][2]2 700012FE   */
+  {0x0F12, 0x054C}, /* #senHal_pContSenModesRegsArray[5][3]2 70001300   */
+  {0x0F12, 0x0006}, /* #senHal_pContSenModesRegsArray[6][0]2 70001302   */
+  {0x0F12, 0x0020}, /* #senHal_pContSenModesRegsArray[6][1]2 70001304   */
+  {0x0F12, 0x0006}, /* #senHal_pContSenModesRegsArray[6][2]2 70001306   */
+  {0x0F12, 0x0020}, /* #senHal_pContSenModesRegsArray[6][3]2 70001308   */
+  {0x0F12, 0x0881}, /* #senHal_pContSenModesRegsArray[7][0]2 7000130A   */
+  {0x0F12, 0x0463}, /* #senHal_pContSenModesRegsArray[7][1]2 7000130C   */
+  {0x0F12, 0x04FD}, /* #senHal_pContSenModesRegsArray[7][2]2 7000130E   */
+  {0x0F12, 0x02A1}, /* #senHal_pContSenModesRegsArray[7][3]2 70001310   */
+  {0x0F12, 0x0006}, /* #senHal_pContSenModesRegsArray[8][0]2 70001312   */
+  {0x0F12, 0x0489}, /* #senHal_pContSenModesRegsArray[8][1]2 70001314   */
+  {0x0F12, 0x0006}, /* #senHal_pContSenModesRegsArray[8][2]2 70001316   */
+  {0x0F12, 0x02C7}, /* #senHal_pContSenModesRegsArray[8][3]2 70001318   */
+  {0x0F12, 0x0881}, /* #senHal_pContSenModesRegsArray[9][0]2 7000131A   */
+  {0x0F12, 0x08CC}, /* #senHal_pContSenModesRegsArray[9][1]2 7000131C   */
+  {0x0F12, 0x04FD}, /* #senHal_pContSenModesRegsArray[9][2]2 7000131E   */
+  {0x0F12, 0x0548}, /* #senHal_pContSenModesRegsArray[9][3]2 70001320   */
+  {0x0F12, 0x03A2}, /* #senHal_pContSenModesRegsArray[10][0] 2 70001322 */
+  {0x0F12, 0x01D3}, /* #senHal_pContSenModesRegsArray[10][1] 2 70001324 */
+  {0x0F12, 0x01E0}, /* #senHal_pContSenModesRegsArray[10][2] 2 70001326 */
+  {0x0F12, 0x00F2}, /* #senHal_pContSenModesRegsArray[10][3] 2 70001328 */
+  {0x0F12, 0x03F2}, /* #senHal_pContSenModesRegsArray[11][0] 2 7000132A */
+  {0x0F12, 0x0223}, /* #senHal_pContSenModesRegsArray[11][1] 2 7000132C */
+  {0x0F12, 0x0230}, /* #senHal_pContSenModesRegsArray[11][2] 2 7000132E */
+  {0x0F12, 0x0142}, /* #senHal_pContSenModesRegsArray[11][3] 2 70001330 */
+  {0x0F12, 0x03A2}, /* #senHal_pContSenModesRegsArray[12][0] 2 70001332 */
+  {0x0F12, 0x063C}, /* #senHal_pContSenModesRegsArray[12][1] 2 70001334 */
+  {0x0F12, 0x01E0}, /* #senHal_pContSenModesRegsArray[12][2] 2 70001336 */
+  {0x0F12, 0x0399}, /* #senHal_pContSenModesRegsArray[12][3] 2 70001338 */
+  {0x0F12, 0x03F2}, /* #senHal_pContSenModesRegsArray[13][0] 2 7000133A */
+  {0x0F12, 0x068C}, /* #senHal_pContSenModesRegsArray[13][1] 2 7000133C */
+  {0x0F12, 0x0230}, /* #senHal_pContSenModesRegsArray[13][2] 2 7000133E */
+  {0x0F12, 0x03E9}, /* #senHal_pContSenModesRegsArray[13][3] 2 70001340 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[14][0] 2 70001342 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[14][1] 2 70001344 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[14][2] 2 70001346 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[14][3] 2 70001348 */
+  {0x0F12, 0x003C}, /* #senHal_pContSenModesRegsArray[15][0] 2 7000134A */
+  {0x0F12, 0x003C}, /* #senHal_pContSenModesRegsArray[15][1] 2 7000134C */
+  {0x0F12, 0x003C}, /* #senHal_pContSenModesRegsArray[15][2] 2 7000134E */
+  {0x0F12, 0x003C}, /* #senHal_pContSenModesRegsArray[15][3] 2 70001350 */
+  {0x0F12, 0x01D3}, /* #senHal_pContSenModesRegsArray[16][0] 2 70001352 */
+  {0x0F12, 0x01D3}, /* #senHal_pContSenModesRegsArray[16][1] 2 70001354 */
+  {0x0F12, 0x00F2}, /* #senHal_pContSenModesRegsArray[16][2] 2 70001356 */
+  {0x0F12, 0x00F2}, /* #senHal_pContSenModesRegsArray[16][3] 2 70001358 */
+  {0x0F12, 0x020B}, /* #senHal_pContSenModesRegsArray[17][0] 2 7000135A */
+  {0x0F12, 0x024A}, /* #senHal_pContSenModesRegsArray[17][1] 2 7000135C */
+  {0x0F12, 0x012A}, /* #senHal_pContSenModesRegsArray[17][2] 2 7000135E */
+  {0x0F12, 0x0169}, /* #senHal_pContSenModesRegsArray[17][3] 2 70001360 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[18][0] 2 70001362 */
+  {0x0F12, 0x046B}, /* #senHal_pContSenModesRegsArray[18][1] 2 70001364 */
+  {0x0F12, 0x0002}, /* #senHal_pContSenModesRegsArray[18][2] 2 70001366 */
+  {0x0F12, 0x02A9}, /* #senHal_pContSenModesRegsArray[18][3] 2 70001368 */
+  {0x0F12, 0x0419}, /* #senHal_pContSenModesRegsArray[19][0] 2 7000136A */
+  {0x0F12, 0x04A5}, /* #senHal_pContSenModesRegsArray[19][1] 2 7000136C */
+  {0x0F12, 0x0257}, /* #senHal_pContSenModesRegsArray[19][2] 2 7000136E */
+  {0x0F12, 0x02E3}, /* #senHal_pContSenModesRegsArray[19][3] 2 70001370 */
+  {0x0F12, 0x0630}, /* #senHal_pContSenModesRegsArray[20][0] 2 70001372 */
+  {0x0F12, 0x063C}, /* #senHal_pContSenModesRegsArray[20][1] 2 70001374 */
+  {0x0F12, 0x038D}, /* #senHal_pContSenModesRegsArray[20][2] 2 70001376 */
+  {0x0F12, 0x0399}, /* #senHal_pContSenModesRegsArray[20][3] 2 70001378 */
+  {0x0F12, 0x0668}, /* #senHal_pContSenModesRegsArray[21][0] 2 7000137A */
+  {0x0F12, 0x06B3}, /* #senHal_pContSenModesRegsArray[21][1] 2 7000137C */
+  {0x0F12, 0x03C5}, /* #senHal_pContSenModesRegsArray[21][2] 2 7000137E */
+  {0x0F12, 0x0410}, /* #senHal_pContSenModesRegsArray[21][3] 2 70001380 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[22][0] 2 70001382 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[22][1] 2 70001384 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[22][2] 2 70001386 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[22][3] 2 70001388 */
+  {0x0F12, 0x03A2}, /* #senHal_pContSenModesRegsArray[23][0] 2 7000138A */
+  {0x0F12, 0x01D3}, /* #senHal_pContSenModesRegsArray[23][1] 2 7000138C */
+  {0x0F12, 0x01E0}, /* #senHal_pContSenModesRegsArray[23][2] 2 7000138E */
+  {0x0F12, 0x00F2}, /* #senHal_pContSenModesRegsArray[23][3] 2 70001390 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[24][0] 2 70001392 */
+  {0x0F12, 0x0461}, /* #senHal_pContSenModesRegsArray[24][1] 2 70001394 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[24][2] 2 70001396 */
+  {0x0F12, 0x029F}, /* #senHal_pContSenModesRegsArray[24][3] 2 70001398 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[25][0] 2 7000139A */
+  {0x0F12, 0x063C}, /* #senHal_pContSenModesRegsArray[25][1] 2 7000139C */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[25][2] 2 7000139E */
+  {0x0F12, 0x0399}, /* #senHal_pContSenModesRegsArray[25][3] 2 700013A0 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[26][0] 2 700013A2 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[26][1] 2 700013A4 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[26][2] 2 700013A6 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[26][3] 2 700013A8 */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[27][0] 2 700013AA */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[27][1] 2 700013AC */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[27][2] 2 700013AE */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[27][3] 2 700013B0 */
+  {0x0F12, 0x020C}, /* #senHal_pContSenModesRegsArray[28][0] 2 700013B2 */
+  {0x0F12, 0x024B}, /* #senHal_pContSenModesRegsArray[28][1] 2 700013B4 */
+  {0x0F12, 0x012B}, /* #senHal_pContSenModesRegsArray[28][2] 2 700013B6 */
+  {0x0F12, 0x016A}, /* #senHal_pContSenModesRegsArray[28][3] 2 700013B8 */
+  {0x0F12, 0x039F}, /* #senHal_pContSenModesRegsArray[29][0] 2 700013BA */
+  {0x0F12, 0x045E}, /* #senHal_pContSenModesRegsArray[29][1] 2 700013BC */
+  {0x0F12, 0x01DD}, /* #senHal_pContSenModesRegsArray[29][2] 2 700013BE */
+  {0x0F12, 0x029C}, /* #senHal_pContSenModesRegsArray[29][3] 2 700013C0 */
+  {0x0F12, 0x041A}, /* #senHal_pContSenModesRegsArray[30][0] 2 700013C2 */
+  {0x0F12, 0x04A6}, /* #senHal_pContSenModesRegsArray[30][1] 2 700013C4 */
+  {0x0F12, 0x0258}, /* #senHal_pContSenModesRegsArray[30][2] 2 700013C6 */
+  {0x0F12, 0x02E4}, /* #senHal_pContSenModesRegsArray[30][3] 2 700013C8 */
+  {0x0F12, 0x062D}, /* #senHal_pContSenModesRegsArray[31][0] 2 700013CA */
+  {0x0F12, 0x0639}, /* #senHal_pContSenModesRegsArray[31][1] 2 700013CC */
+  {0x0F12, 0x038A}, /* #senHal_pContSenModesRegsArray[31][2] 2 700013CE */
+  {0x0F12, 0x0396}, /* #senHal_pContSenModesRegsArray[31][3] 2 700013D0 */
+  {0x0F12, 0x0669}, /* #senHal_pContSenModesRegsArray[32][0] 2 700013D2 */
+  {0x0F12, 0x06B4}, /* #senHal_pContSenModesRegsArray[32][1] 2 700013D4 */
+  {0x0F12, 0x03C6}, /* #senHal_pContSenModesRegsArray[32][2] 2 700013D6 */
+  {0x0F12, 0x0411}, /* #senHal_pContSenModesRegsArray[32][3] 2 700013D8 */
+  {0x0F12, 0x087C}, /* #senHal_pContSenModesRegsArray[33][0] 2 700013DA */
+  {0x0F12, 0x08C7}, /* #senHal_pContSenModesRegsArray[33][1] 2 700013DC */
+  {0x0F12, 0x04F8}, /* #senHal_pContSenModesRegsArray[33][2] 2 700013DE */
+  {0x0F12, 0x0543}, /* #senHal_pContSenModesRegsArray[33][3] 2 700013E0 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[34][0] 2 700013E2 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[34][1] 2 700013E4 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[34][2] 2 700013E6 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[34][3] 2 700013E8 */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[35][0] 2 700013EA */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[35][1] 2 700013EC */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[35][2] 2 700013EE */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[35][3] 2 700013F0 */
+  {0x0F12, 0x020F}, /* #senHal_pContSenModesRegsArray[36][0] 2 700013F2 */
+  {0x0F12, 0x024E}, /* #senHal_pContSenModesRegsArray[36][1] 2 700013F4 */
+  {0x0F12, 0x012E}, /* #senHal_pContSenModesRegsArray[36][2] 2 700013F6 */
+  {0x0F12, 0x016D}, /* #senHal_pContSenModesRegsArray[36][3] 2 700013F8 */
+  {0x0F12, 0x039F}, /* #senHal_pContSenModesRegsArray[37][0] 2 700013FA */
+  {0x0F12, 0x045E}, /* #senHal_pContSenModesRegsArray[37][1] 2 700013FC */
+  {0x0F12, 0x01DD}, /* #senHal_pContSenModesRegsArray[37][2] 2 700013FE */
+  {0x0F12, 0x029C}, /* #senHal_pContSenModesRegsArray[37][3] 2 70001400 */
+  {0x0F12, 0x041D}, /* #senHal_pContSenModesRegsArray[38][0] 2 70001402 */
+  {0x0F12, 0x04A9}, /* #senHal_pContSenModesRegsArray[38][1] 2 70001404 */
+  {0x0F12, 0x025B}, /* #senHal_pContSenModesRegsArray[38][2] 2 70001406 */
+  {0x0F12, 0x02E7}, /* #senHal_pContSenModesRegsArray[38][3] 2 70001408 */
+  {0x0F12, 0x062D}, /* #senHal_pContSenModesRegsArray[39][0] 2 7000140A */
+  {0x0F12, 0x0639}, /* #senHal_pContSenModesRegsArray[39][1] 2 7000140C */
+  {0x0F12, 0x038A}, /* #senHal_pContSenModesRegsArray[39][2] 2 7000140E */
+  {0x0F12, 0x0396}, /* #senHal_pContSenModesRegsArray[39][3] 2 70001410 */
+  {0x0F12, 0x066C}, /* #senHal_pContSenModesRegsArray[40][0] 2 70001412 */
+  {0x0F12, 0x06B7}, /* #senHal_pContSenModesRegsArray[40][1] 2 70001414 */
+  {0x0F12, 0x03C9}, /* #senHal_pContSenModesRegsArray[40][2] 2 70001416 */
+  {0x0F12, 0x0414}, /* #senHal_pContSenModesRegsArray[40][3] 2 70001418 */
+  {0x0F12, 0x087C}, /* #senHal_pContSenModesRegsArray[41][0] 2 7000141A */
+  {0x0F12, 0x08C7}, /* #senHal_pContSenModesRegsArray[41][1] 2 7000141C */
+  {0x0F12, 0x04F8}, /* #senHal_pContSenModesRegsArray[41][2] 2 7000141E */
+  {0x0F12, 0x0543}, /* #senHal_pContSenModesRegsArray[41][3] 2 70001420 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[42][0] 2 70001422 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[42][1] 2 70001424 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[42][2] 2 70001426 */
+  {0x0F12, 0x0040}, /* #senHal_pContSenModesRegsArray[42][3] 2 70001428 */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[43][0] 2 7000142A */
+  {0x0F12, 0x01D0}, /* #senHal_pContSenModesRegsArray[43][1] 2 7000142C */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[43][2] 2 7000142E */
+  {0x0F12, 0x00EF}, /* #senHal_pContSenModesRegsArray[43][3] 2 70001430 */
+  {0x0F12, 0x020F}, /* #senHal_pContSenModesRegsArray[44][0] 2 70001432 */
+  {0x0F12, 0x024E}, /* #senHal_pContSenModesRegsArray[44][1] 2 70001434 */
+  {0x0F12, 0x012E}, /* #senHal_pContSenModesRegsArray[44][2] 2 70001436 */
+  {0x0F12, 0x016D}, /* #senHal_pContSenModesRegsArray[44][3] 2 70001438 */
+  {0x0F12, 0x039F}, /* #senHal_pContSenModesRegsArray[45][0] 2 7000143A */
+  {0x0F12, 0x045E}, /* #senHal_pContSenModesRegsArray[45][1] 2 7000143C */
+  {0x0F12, 0x01DD}, /* #senHal_pContSenModesRegsArray[45][2] 2 7000143E */
+  {0x0F12, 0x029C}, /* #senHal_pContSenModesRegsArray[45][3] 2 70001440 */
+  {0x0F12, 0x041D}, /* #senHal_pContSenModesRegsArray[46][0] 2 70001442 */
+  {0x0F12, 0x04A9}, /* #senHal_pContSenModesRegsArray[46][1] 2 70001444 */
+  {0x0F12, 0x025B}, /* #senHal_pContSenModesRegsArray[46][2] 2 70001446 */
+  {0x0F12, 0x02E7}, /* #senHal_pContSenModesRegsArray[46][3] 2 70001448 */
+  {0x0F12, 0x062D}, /* #senHal_pContSenModesRegsArray[47][0] 2 7000144A */
+  {0x0F12, 0x0639}, /* #senHal_pContSenModesRegsArray[47][1] 2 7000144C */
+  {0x0F12, 0x038A}, /* #senHal_pContSenModesRegsArray[47][2] 2 7000144E */
+  {0x0F12, 0x0396}, /* #senHal_pContSenModesRegsArray[47][3] 2 70001450 */
+  {0x0F12, 0x066C}, /* #senHal_pContSenModesRegsArray[48][0] 2 70001452 */
+  {0x0F12, 0x06B7}, /* #senHal_pContSenModesRegsArray[48][1] 2 70001454 */
+  {0x0F12, 0x03C9}, /* #senHal_pContSenModesRegsArray[48][2] 2 70001456 */
+  {0x0F12, 0x0414}, /* #senHal_pContSenModesRegsArray[48][3] 2 70001458 */
+  {0x0F12, 0x087C}, /* #senHal_pContSenModesRegsArray[49][0] 2 7000145A */
+  {0x0F12, 0x08C7}, /* #senHal_pContSenModesRegsArray[49][1] 2 7000145C */
+  {0x0F12, 0x04F8}, /* #senHal_pContSenModesRegsArray[49][2] 2 7000145E */
+  {0x0F12, 0x0543}, /* #senHal_pContSenModesRegsArray[49][3] 2 70001460 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[50][0] 2 70001462 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[50][1] 2 70001464 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[50][2] 2 70001466 */
+  {0x0F12, 0x003D}, /* #senHal_pContSenModesRegsArray[50][3] 2 70001468 */
+  {0x0F12, 0x01D2}, /* #senHal_pContSenModesRegsArray[51][0] 2 7000146A */
+  {0x0F12, 0x01D2}, /* #senHal_pContSenModesRegsArray[51][1] 2 7000146C */
+  {0x0F12, 0x00F1}, /* #senHal_pContSenModesRegsArray[51][2] 2 7000146E */
+  {0x0F12, 0x00F1}, /* #senHal_pContSenModesRegsArray[51][3] 2 70001470 */
+  {0x0F12, 0x020C}, /* #senHal_pContSenModesRegsArray[52][0] 2 70001472 */
+  {0x0F12, 0x024B}, /* #senHal_pContSenModesRegsArray[52][1] 2 70001474 */
+  {0x0F12, 0x012B}, /* #senHal_pContSenModesRegsArray[52][2] 2 70001476 */
+  {0x0F12, 0x016A}, /* #senHal_pContSenModesRegsArray[52][3] 2 70001478 */
+  {0x0F12, 0x03A1}, /* #senHal_pContSenModesRegsArray[53][0] 2 7000147A */
+  {0x0F12, 0x0460}, /* #senHal_pContSenModesRegsArray[53][1] 2 7000147C */
+  {0x0F12, 0x01DF}, /* #senHal_pContSenModesRegsArray[53][2] 2 7000147E */
+  {0x0F12, 0x029E}, /* #senHal_pContSenModesRegsArray[53][3] 2 70001480 */
+  {0x0F12, 0x041A}, /* #senHal_pContSenModesRegsArray[54][0] 2 70001482 */
+  {0x0F12, 0x04A6}, /* #senHal_pContSenModesRegsArray[54][1] 2 70001484 */
+  {0x0F12, 0x0258}, /* #senHal_pContSenModesRegsArray[54][2] 2 70001486 */
+  {0x0F12, 0x02E4}, /* #senHal_pContSenModesRegsArray[54][3] 2 70001488 */
+  {0x0F12, 0x062F}, /* #senHal_pContSenModesRegsArray[55][0] 2 7000148A */
+  {0x0F12, 0x063B}, /* #senHal_pContSenModesRegsArray[55][1] 2 7000148C */
+  {0x0F12, 0x038C}, /* #senHal_pContSenModesRegsArray[55][2] 2 7000148E */
+  {0x0F12, 0x0398}, /* #senHal_pContSenModesRegsArray[55][3] 2 70001490 */
+  {0x0F12, 0x0669}, /* #senHal_pContSenModesRegsArray[56][0] 2 70001492 */
+  {0x0F12, 0x06B4}, /* #senHal_pContSenModesRegsArray[56][1] 2 70001494 */
+  {0x0F12, 0x03C6}, /* #senHal_pContSenModesRegsArray[56][2] 2 70001496 */
+  {0x0F12, 0x0411}, /* #senHal_pContSenModesRegsArray[56][3] 2 70001498 */
+  {0x0F12, 0x087E}, /* #senHal_pContSenModesRegsArray[57][0] 2 7000149A */
+  {0x0F12, 0x08C9}, /* #senHal_pContSenModesRegsArray[57][1] 2 7000149C */
+  {0x0F12, 0x04FA}, /* #senHal_pContSenModesRegsArray[57][2] 2 7000149E */
+  {0x0F12, 0x0545}, /* #senHal_pContSenModesRegsArray[57][3] 2 700014A0 */
+  {0x0F12, 0x03A2}, /* #senHal_pContSenModesRegsArray[58][0] 2 700014A2 */
+  {0x0F12, 0x01D3}, /* #senHal_pContSenModesRegsArray[58][1] 2 700014A4 */
+  {0x0F12, 0x01E0}, /* #senHal_pContSenModesRegsArray[58][2] 2 700014A6 */
+  {0x0F12, 0x00F2}, /* #senHal_pContSenModesRegsArray[58][3] 2 700014A8 */
+  {0x0F12, 0x03AF}, /* #senHal_pContSenModesRegsArray[59][0] 2 700014AA */
+  {0x0F12, 0x01E0}, /* #senHal_pContSenModesRegsArray[59][1] 2 700014AC */
+  {0x0F12, 0x01ED}, /* #senHal_pContSenModesRegsArray[59][2] 2 700014AE */
+  {0x0F12, 0x00FF}, /* #senHal_pContSenModesRegsArray[59][3] 2 700014B0 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[60][0] 2 700014B2 */
+  {0x0F12, 0x0461}, /* #senHal_pContSenModesRegsArray[60][1] 2 700014B4 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[60][2] 2 700014B6 */
+  {0x0F12, 0x029F}, /* #senHal_pContSenModesRegsArray[60][3] 2 700014B8 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[61][0] 2 700014BA */
+  {0x0F12, 0x046E}, /* #senHal_pContSenModesRegsArray[61][1] 2 700014BC */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[61][2] 2 700014BE */
+  {0x0F12, 0x02AC}, /* #senHal_pContSenModesRegsArray[61][3] 2 700014C0 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[62][0] 2 700014C2 */
+  {0x0F12, 0x063C}, /* #senHal_pContSenModesRegsArray[62][1] 2 700014C4 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[62][2] 2 700014C6 */
+  {0x0F12, 0x0399}, /* #senHal_pContSenModesRegsArray[62][3] 2 700014C8 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[63][0] 2 700014CA */
+  {0x0F12, 0x0649}, /* #senHal_pContSenModesRegsArray[63][1] 2 700014CC */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[63][2] 2 700014CE */
+  {0x0F12, 0x03A6}, /* #senHal_pContSenModesRegsArray[63][3] 2 700014D0 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[64][0] 2 700014D2 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[64][1] 2 700014D4 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[64][2] 2 700014D6 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[64][3] 2 700014D8 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[65][0] 2 700014DA */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[65][1] 2 700014DC */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[65][2] 2 700014DE */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[65][3] 2 700014E0 */
+  {0x0F12, 0x03AA}, /* #senHal_pContSenModesRegsArray[66][0] 2 700014E2 */
+  {0x0F12, 0x01DB}, /* #senHal_pContSenModesRegsArray[66][1] 2 700014E4 */
+  {0x0F12, 0x01E8}, /* #senHal_pContSenModesRegsArray[66][2] 2 700014E6 */
+  {0x0F12, 0x00FA}, /* #senHal_pContSenModesRegsArray[66][3] 2 700014E8 */
+  {0x0F12, 0x03B7}, /* #senHal_pContSenModesRegsArray[67][0] 2 700014EA */
+  {0x0F12, 0x01E8}, /* #senHal_pContSenModesRegsArray[67][1] 2 700014EC */
+  {0x0F12, 0x01F5}, /* #senHal_pContSenModesRegsArray[67][2] 2 700014EE */
+  {0x0F12, 0x0107}, /* #senHal_pContSenModesRegsArray[67][3] 2 700014F0 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[68][0] 2 700014F2 */
+  {0x0F12, 0x0469}, /* #senHal_pContSenModesRegsArray[68][1] 2 700014F4 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[68][2] 2 700014F6 */
+  {0x0F12, 0x02A7}, /* #senHal_pContSenModesRegsArray[68][3] 2 700014F8 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[69][0] 2 700014FA */
+  {0x0F12, 0x0476}, /* #senHal_pContSenModesRegsArray[69][1] 2 700014FC */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[69][2] 2 700014FE */
+  {0x0F12, 0x02B4}, /* #senHal_pContSenModesRegsArray[69][3] 2 70001500 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[70][0] 2 70001502 */
+  {0x0F12, 0x0644}, /* #senHal_pContSenModesRegsArray[70][1] 2 70001504 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[70][2] 2 70001506 */
+  {0x0F12, 0x03A1}, /* #senHal_pContSenModesRegsArray[70][3] 2 70001508 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[71][0] 2 7000150A */
+  {0x0F12, 0x0651}, /* #senHal_pContSenModesRegsArray[71][1] 2 7000150C */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[71][2] 2 7000150E */
+  {0x0F12, 0x03AE}, /* #senHal_pContSenModesRegsArray[71][3] 2 70001510 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[72][0] 2 70001512 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[72][1] 2 70001514 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[72][2] 2 70001516 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[72][3] 2 70001518 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[73][0] 2 7000151A */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[73][1] 2 7000151C */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[73][2] 2 7000151E */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[73][3] 2 70001520 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[74][0] 2 70001522 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[74][1] 2 70001524 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[74][2] 2 70001526 */
+  {0x0F12, 0x0001}, /* #senHal_pContSenModesRegsArray[74][3] 2 70001528 */
+  {0x0F12, 0x000F}, /* #senHal_pContSenModesRegsArray[75][0] 2 7000152A */
+  {0x0F12, 0x000F}, /* #senHal_pContSenModesRegsArray[75][1] 2 7000152C */
+  {0x0F12, 0x000F}, /* #senHal_pContSenModesRegsArray[75][2] 2 7000152E */
+  {0x0F12, 0x000F}, /* #senHal_pContSenModesRegsArray[75][3] 2 70001530 */
+  {0x0F12, 0x05AD}, /* #senHal_pContSenModesRegsArray[76][0] 2 70001532 */
+  {0x0F12, 0x03DE}, /* #senHal_pContSenModesRegsArray[76][1] 2 70001534 */
+  {0x0F12, 0x030A}, /* #senHal_pContSenModesRegsArray[76][2] 2 70001536 */
+  {0x0F12, 0x021C}, /* #senHal_pContSenModesRegsArray[76][3] 2 70001538 */
+  {0x0F12, 0x062F}, /* #senHal_pContSenModesRegsArray[77][0] 2 7000153A */
+  {0x0F12, 0x0460}, /* #senHal_pContSenModesRegsArray[77][1] 2 7000153C */
+  {0x0F12, 0x038C}, /* #senHal_pContSenModesRegsArray[77][2] 2 7000153E */
+  {0x0F12, 0x029E}, /* #senHal_pContSenModesRegsArray[77][3] 2 70001540 */
+  {0x0F12, 0x07FC}, /* #senHal_pContSenModesRegsArray[78][0] 2 70001542 */
+  {0x0F12, 0x0847}, /* #senHal_pContSenModesRegsArray[78][1] 2 70001544 */
+  {0x0F12, 0x0478}, /* #senHal_pContSenModesRegsArray[78][2] 2 70001546 */
+  {0x0F12, 0x04C3}, /* #senHal_pContSenModesRegsArray[78][3] 2 70001548 */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[79][0] 2 7000154A */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[79][1] 2 7000154C */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[79][2] 2 7000154E */
+  {0x0F12, 0x0000}, /* #senHal_pContSenModesRegsArray[79][3] 2 70001550 */
+  /* Analog Setting END */
+
+  /* ISP-FE Setting */
+  {0x002A, 0x158A},
+  {0x0F12, 0xEAF0},
+  {0x002A, 0x15C6},
+  {0x0F12, 0x0020},
+  {0x0F12, 0x0060},
+  {0x002A, 0x15BC},
+  {0x0F12, 0x0200},
+  /* Analog Offset for MSM */
+  {0x002A, 0x1608},
+  {0x0F12, 0x0100}, /* #gisp_msm_sAnalogOffset[0] */
+  {0x0F12, 0x0100}, /* #gisp_msm_sAnalogOffset[1] */
+  {0x0F12, 0x0100}, /* #gisp_msm_sAnalogOffset[2] */
+  {0x0F12, 0x0100}, /* #gisp_msm_sAnalogOffset[3] */
+  /* ISP-FE Setting END */
+
+  /* ===== Frame rate setting =====                       */
+  /* How to set                                           */
+  /* 1. Exposure value                                    */
+  /* dec2hex((1 / (frame rate you want(ms))) * 100d * 4d) */
+  /* 2. Analog Digital gain                               */
+  /* dec2hex((Analog gain you want) * 256d)               */
+
+  /* Set preview exposure time */
+  {0x002A, 0x0530},
+  {0x0F12, 0x3415}, /* #lt_uMaxExp1 */
+  {0x0F12, 0x0000},
+  {0x0F12, 0x6720}, /* #lt_uMaxExp2 */
+  {0x0F12, 0x0000},
+  {0x002A, 0x167C},
+  {0x0F12, 0x9AB0}, /* #evt1_lt_uMaxExp3 */
+  {0x0F12, 0x0000},
+  {0x0F12, 0xD055}, /* #evt1_lt_uMaxExp4 */
+  {0x0F12, 0x0000},
+
+  /* Set capture exposure time */
+  {0x002A, 0x0538},
+  {0x0F12, 0x9C40}, /* #lt_uCapMaxExp1 */
+  {0x0F12, 0x0000},
+  {0x0F12, 0xD055}, /* #lt_uCapMaxExp2 */
+  {0x0F12, 0x0000},
+  {0x002A, 0x1684},
+  {0x0F12, 0x0360}, /* #evt1_lt_uCapMaxExp3 */
+  {0x0F12, 0x0001},
+  {0x0F12, 0x3880}, /* #evt1_lt_uCapMaxExp4 */
+  {0x0F12, 0x0001},
+
+  /* Set gain */
+  {0x002A, 0x0540},
+  {0x0F12, 0x0150}, /* #lt_uMaxAnGain1 */
+  {0x0F12, 0x0280}, /* #lt_uMaxAnGain2 */
+  {0x002A, 0x168C},
+  {0x0F12, 0x02A0}, /* #evt1_lt_uMaxAnGain3 */
+  {0x0F12, 0x0700}, /* #evt1_lt_uMaxAnGain4 */
+  {0x002A, 0x0544},
+  {0x0F12, 0x0100}, /* #lt_uMaxDigGain */
+  {0x0F12, 0x1000}, /* #lt_uMaxTotGain */
+  {0x002A, 0x1694},
+  {0x0F12, 0x0001}, /* #evt1_senHal_bExpandForbid */
+  {0x002A, 0x051A},
+  {0x0F12, 0x0111}, /* #lt_uLimitHigh */
+  {0x0F12, 0x00F0}, /* #lt_uLimitLow */
+  {0x002A, 0x0562},
+  {0x0F12, 0x0001},
+
+  /* Set Auto Exposure */
+  /* AE target */
+  {0x002A, 0x0F70},
+  {0x0F12, 0x003A}, /* #TVAR_ae_BrAve */
+  /* AE mode */
+  {0x002A, 0x0F76}, /* Disable illumination & contrast  #ae_StatMode */
+  {0x0F12, 0x000F},
+  /* AE weight */
+  {0x002A, 0x0F7E},
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_0_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_1_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_2_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_3_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_4_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_5_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_6_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_7_ */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_8_ */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_9_ */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_10 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_11 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_12 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_13 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_14 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_15 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_16 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_17 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_18 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_19 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_20 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_21 */
+  {0x0F12, 0x0303}, /* #ae_WeightTbl_16_22 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_23 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_24 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_25 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_26 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_27 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_28 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_29 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_30 */
+  {0x0F12, 0x0101}, /* #ae_WeightTbl_16_31 */
+
+  /* Set Flicker */
+  {0x002A, 0x04D2},
+  {0x0F12, 0x065F}, /* Anti-flicker disabled */
+  {0x002A, 0x04BA},
+  {0x0F12, 0x0002},
+  {0x002A, 0x0C04},
+  {0x0F12, 0xFFFF},
+
+  /* Set GAS */
+  /* GAS alpha */
+  /* R, Gr, Gb, B per light source */
+  {0x002A, 0x06CE},
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[0]  Horizon */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[1]  */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[2]  */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[3]  */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[4]  IncandA */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[5]  */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[6]  */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[7]  */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[8]  WW */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[9]  */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[10] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[11] */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[12] CWF */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[13] */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[14] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[15] */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[16] D50 */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[17] */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[18] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[19] */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[20] D65 */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[21] */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[22] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[23] */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASAlpha[24] D75 */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[25] */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASAlpha[26] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASAlpha[27] */
+  {0x0F12, 0x00ED}, /* #TVAR_ash_GASOutdoorAlpha[0] Outdoor*/
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASOutdoorAlpha[1] */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_GASOutdoorAlpha[2] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_GASOutdoorAlpha[3] */
+
+  /* GAS beta */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[0]  Horizon */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[1]  */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[2]  */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[3]  */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[4]  IncandA */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[5]  */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[6]  */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[7]  */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[8]  WW */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[9]  */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[10] */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[11] */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[12] CWF */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[13] */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[14] */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[15] */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[16] D50 */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[17] */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[18] */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[19] */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[20] D65 */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[21] */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[22] */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[23] */
+  {0x0F12, 0x002D}, /* #ash_GASBeta[24] D75 */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[25] */
+  {0x0F12, 0x0016}, /* #ash_GASBeta[26] */
+  {0x0F12, 0x0000}, /* #ash_GASBeta[27] */
+  {0x0F12, 0x002D}, /* #ash_GASOutdoorBeta[0] Outdoor */
+  {0x0F12, 0x0016}, /* #ash_GASOutdoorBeta[1] */
+  {0x0F12, 0x0016}, /* #ash_GASOutdoorBeta[2] */
+  {0x0F12, 0x0000}, /* #ash_GASOutdoorBeta[3] */
+
+  {0x002A, 0x06B4},
+  {0x0F12, 0x0001}, /* #wbt_bUseOutdoorASH ON:1 OFF:0 */
+
+  /* Parabolic function */
+  {0x002A, 0x075A},
+  {0x0F12, 0x0000}, /* #ash_bParabolicEstimation */
+  {0x0F12, 0x0400}, /* #ash_uParabolicCenterX    */
+  {0x0F12, 0x0300}, /* #ash_uParabolicCenterY    */
+  {0x0F12, 0x0010}, /* #ash_uParabolicScalingA   */
+  {0x0F12, 0x0011}, /* #ash_uParabolicScalingB   */
+  {0x002A, 0x06C6},
+  {0x0F12, 0x00ED}, /* ash_CGrasAlphas_0_ */
+  {0x0F12, 0x00EB}, /* ash_CGrasAlphas_1_ */
+  {0x0F12, 0x00EB}, /* ash_CGrasAlphas_2_ */
+  {0x0F12, 0x00E9}, /* ash_CGrasAlphas_3_ */
+  {0x002A, 0x0E3C},
+  {0x0F12, 0x00C0}, /* #awbb_Alpha_Comp_Mode */
+  {0x002A, 0x074E},
+  {0x0F12, 0x0000}, /* #ash_bLumaMode - use Beta : 0001 not use Beta : 0000 */
+  /* GAS LUT start address 7000_347C */
+  {0x002A, 0x0754},
+  {0x0F12, 0x347C},
+  {0x0F12, 0x7000},
+
+  /* GAS LUT - param_start TVAR_ash_pGAS  (Change the shading setting) */
+  {0x002A, 0x347C},
+  {0x0F12, 0x019D}, /* #TVAR_ash_pGAS[0]   */
+  {0x0F12, 0x0163}, /* #TVAR_ash_pGAS[1]   */
+  {0x0F12, 0x0137}, /* #TVAR_ash_pGAS[2]   */
+  {0x0F12, 0x010B}, /* #TVAR_ash_pGAS[3]   */
+  {0x0F12, 0x00EB}, /* #TVAR_ash_pGAS[4]   */
+  {0x0F12, 0x00D7}, /* #TVAR_ash_pGAS[5]   */
+  {0x0F12, 0x00D0}, /* #TVAR_ash_pGAS[6]   */
+  {0x0F12, 0x00D6}, /* #TVAR_ash_pGAS[7]   */
+  {0x0F12, 0x00EC}, /* #TVAR_ash_pGAS[8]   */
+  {0x0F12, 0x0119}, /* #TVAR_ash_pGAS[9]   */
+  {0x0F12, 0x014C}, /* #TVAR_ash_pGAS[10]  */
+  {0x0F12, 0x0181}, /* #TVAR_ash_pGAS[11]  */
+  {0x0F12, 0x01CE}, /* #TVAR_ash_pGAS[12]  */
+  {0x0F12, 0x017E}, /* #TVAR_ash_pGAS[13]  */
+  {0x0F12, 0x0149}, /* #TVAR_ash_pGAS[14]  */
+  {0x0F12, 0x010E}, /* #TVAR_ash_pGAS[15]  */
+  {0x0F12, 0x00DC}, /* #TVAR_ash_pGAS[16]  */
+  {0x0F12, 0x00B7}, /* #TVAR_ash_pGAS[17]  */
+  {0x0F12, 0x00A4}, /* #TVAR_ash_pGAS[18]  */
+  {0x0F12, 0x009E}, /* #TVAR_ash_pGAS[19]  */
+  {0x0F12, 0x00A3}, /* #TVAR_ash_pGAS[20]  */
+  {0x0F12, 0x00BD}, /* #TVAR_ash_pGAS[21]  */
+  {0x0F12, 0x00E6}, /* #TVAR_ash_pGAS[22]  */
+  {0x0F12, 0x0125}, /* #TVAR_ash_pGAS[23]  */
+  {0x0F12, 0x0169}, /* #TVAR_ash_pGAS[24]  */
+  {0x0F12, 0x019C}, /* #TVAR_ash_pGAS[25]  */
+  {0x0F12, 0x014F}, /* #TVAR_ash_pGAS[26]  */
+  {0x0F12, 0x010E}, /* #TVAR_ash_pGAS[27]  */
+  {0x0F12, 0x00CD}, /* #TVAR_ash_pGAS[28]  */
+  {0x0F12, 0x009B}, /* #TVAR_ash_pGAS[29]  */
+  {0x0F12, 0x0076}, /* #TVAR_ash_pGAS[30]  */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[31]  */
+  {0x0F12, 0x0058}, /* #TVAR_ash_pGAS[32]  */
+  {0x0F12, 0x0063}, /* #TVAR_ash_pGAS[33]  */
+  {0x0F12, 0x007E}, /* #TVAR_ash_pGAS[34]  */
+  {0x0F12, 0x00A9}, /* #TVAR_ash_pGAS[35]  */
+  {0x0F12, 0x00E7}, /* #TVAR_ash_pGAS[36]  */
+  {0x0F12, 0x0136}, /* #TVAR_ash_pGAS[37]  */
+  {0x0F12, 0x017E}, /* #TVAR_ash_pGAS[38]  */
+  {0x0F12, 0x0129}, /* #TVAR_ash_pGAS[39]  */
+  {0x0F12, 0x00E1}, /* #TVAR_ash_pGAS[40]  */
+  {0x0F12, 0x009F}, /* #TVAR_ash_pGAS[41]  */
+  {0x0F12, 0x006B}, /* #TVAR_ash_pGAS[42]  */
+  {0x0F12, 0x0046}, /* #TVAR_ash_pGAS[43]  */
+  {0x0F12, 0x0030}, /* #TVAR_ash_pGAS[44]  */
+  {0x0F12, 0x0029}, /* #TVAR_ash_pGAS[45]  */
+  {0x0F12, 0x0033}, /* #TVAR_ash_pGAS[46]  */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[47]  */
+  {0x0F12, 0x007F}, /* #TVAR_ash_pGAS[48]  */
+  {0x0F12, 0x00BD}, /* #TVAR_ash_pGAS[49]  */
+  {0x0F12, 0x0111}, /* #TVAR_ash_pGAS[50]  */
+  {0x0F12, 0x015D}, /* #TVAR_ash_pGAS[51]  */
+  {0x0F12, 0x0110}, /* #TVAR_ash_pGAS[52]  */
+  {0x0F12, 0x00C6}, /* #TVAR_ash_pGAS[53]  */
+  {0x0F12, 0x0082}, /* #TVAR_ash_pGAS[54]  */
+  {0x0F12, 0x004B}, /* #TVAR_ash_pGAS[55]  */
+  {0x0F12, 0x0026}, /* #TVAR_ash_pGAS[56]  */
+  {0x0F12, 0x0011}, /* #TVAR_ash_pGAS[57]  */
+  {0x0F12, 0x000C}, /* #TVAR_ash_pGAS[58]  */
+  {0x0F12, 0x0016}, /* #TVAR_ash_pGAS[59]  */
+  {0x0F12, 0x0032}, /* #TVAR_ash_pGAS[60]  */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[61]  */
+  {0x0F12, 0x00A1}, /* #TVAR_ash_pGAS[62]  */
+  {0x0F12, 0x00F4}, /* #TVAR_ash_pGAS[63]  */
+  {0x0F12, 0x014C}, /* #TVAR_ash_pGAS[64]  */
+  {0x0F12, 0x0102}, /* #TVAR_ash_pGAS[65]  */
+  {0x0F12, 0x00BB}, /* #TVAR_ash_pGAS[66]  */
+  {0x0F12, 0x0075}, /* #TVAR_ash_pGAS[67]  */
+  {0x0F12, 0x003F}, /* #TVAR_ash_pGAS[68]  */
+  {0x0F12, 0x0019}, /* #TVAR_ash_pGAS[69]  */
+  {0x0F12, 0x0005}, /* #TVAR_ash_pGAS[70]  */
+  {0x0F12, 0x0000}, /* #TVAR_ash_pGAS[71]  */
+  {0x0F12, 0x000A}, /* #TVAR_ash_pGAS[72]  */
+  {0x0F12, 0x0025}, /* #TVAR_ash_pGAS[73]  */
+  {0x0F12, 0x0055}, /* #TVAR_ash_pGAS[74]  */
+  {0x0F12, 0x0098}, /* #TVAR_ash_pGAS[75]  */
+  {0x0F12, 0x00EA}, /* #TVAR_ash_pGAS[76]  */
+  {0x0F12, 0x0143}, /* #TVAR_ash_pGAS[77]  */
+  {0x0F12, 0x0106}, /* #TVAR_ash_pGAS[78]  */
+  {0x0F12, 0x00BF}, /* #TVAR_ash_pGAS[79]  */
+  {0x0F12, 0x007B}, /* #TVAR_ash_pGAS[80]  */
+  {0x0F12, 0x0043}, /* #TVAR_ash_pGAS[81]  */
+  {0x0F12, 0x001F}, /* #TVAR_ash_pGAS[82]  */
+  {0x0F12, 0x000D}, /* #TVAR_ash_pGAS[83]  */
+  {0x0F12, 0x0006}, /* #TVAR_ash_pGAS[84]  */
+  {0x0F12, 0x0010}, /* #TVAR_ash_pGAS[85]  */
+  {0x0F12, 0x002C}, /* #TVAR_ash_pGAS[86]  */
+  {0x0F12, 0x005D}, /* #TVAR_ash_pGAS[87]  */
+  {0x0F12, 0x009D}, /* #TVAR_ash_pGAS[88]  */
+  {0x0F12, 0x00F2}, /* #TVAR_ash_pGAS[89]  */
+  {0x0F12, 0x0147}, /* #TVAR_ash_pGAS[90]  */
+  {0x0F12, 0x0115}, /* #TVAR_ash_pGAS[91]  */
+  {0x0F12, 0x00D2}, /* #TVAR_ash_pGAS[92]  */
+  {0x0F12, 0x008C}, /* #TVAR_ash_pGAS[93]  */
+  {0x0F12, 0x0059}, /* #TVAR_ash_pGAS[94]  */
+  {0x0F12, 0x0034}, /* #TVAR_ash_pGAS[95]  */
+  {0x0F12, 0x0022}, /* #TVAR_ash_pGAS[96]  */
+  {0x0F12, 0x001B}, /* #TVAR_ash_pGAS[97]  */
+  {0x0F12, 0x0027}, /* #TVAR_ash_pGAS[98]  */
+  {0x0F12, 0x0047}, /* #TVAR_ash_pGAS[99]  */
+  {0x0F12, 0x0077}, /* #TVAR_ash_pGAS[100] */
+  {0x0F12, 0x00B6}, /* #TVAR_ash_pGAS[101] */
+  {0x0F12, 0x0108}, /* #TVAR_ash_pGAS[102] */
+  {0x0F12, 0x015F}, /* #TVAR_ash_pGAS[103] */
+  {0x0F12, 0x0136}, /* #TVAR_ash_pGAS[104] */
+  {0x0F12, 0x00F1}, /* #TVAR_ash_pGAS[105] */
+  {0x0F12, 0x00AE}, /* #TVAR_ash_pGAS[106] */
+  {0x0F12, 0x007C}, /* #TVAR_ash_pGAS[107] */
+  {0x0F12, 0x0058}, /* #TVAR_ash_pGAS[108] */
+  {0x0F12, 0x0046}, /* #TVAR_ash_pGAS[109] */
+  {0x0F12, 0x0040}, /* #TVAR_ash_pGAS[110] */
+  {0x0F12, 0x004E}, /* #TVAR_ash_pGAS[111] */
+  {0x0F12, 0x006C}, /* #TVAR_ash_pGAS[112] */
+  {0x0F12, 0x009C}, /* #TVAR_ash_pGAS[113] */
+  {0x0F12, 0x00DB}, /* #TVAR_ash_pGAS[114] */
+  {0x0F12, 0x012F}, /* #TVAR_ash_pGAS[115] */
+  {0x0F12, 0x017C}, /* #TVAR_ash_pGAS[116] */
+  {0x0F12, 0x015C}, /* #TVAR_ash_pGAS[117] */
+  {0x0F12, 0x0120}, /* #TVAR_ash_pGAS[118] */
+  {0x0F12, 0x00DF}, /* #TVAR_ash_pGAS[119] */
+  {0x0F12, 0x00AF}, /* #TVAR_ash_pGAS[120] */
+  {0x0F12, 0x008F}, /* #TVAR_ash_pGAS[121] */
+  {0x0F12, 0x007D}, /* #TVAR_ash_pGAS[122] */
+  {0x0F12, 0x0079}, /* #TVAR_ash_pGAS[123] */
+  {0x0F12, 0x0084}, /* #TVAR_ash_pGAS[124] */
+  {0x0F12, 0x00A3}, /* #TVAR_ash_pGAS[125] */
+  {0x0F12, 0x00D1}, /* #TVAR_ash_pGAS[126] */
+  {0x0F12, 0x0110}, /* #TVAR_ash_pGAS[127] */
+  {0x0F12, 0x015E}, /* #TVAR_ash_pGAS[128] */
+  {0x0F12, 0x019A}, /* #TVAR_ash_pGAS[129] */
+  {0x0F12, 0x0178}, /* #TVAR_ash_pGAS[130] */
+  {0x0F12, 0x0144}, /* #TVAR_ash_pGAS[131] */
+  {0x0F12, 0x010C}, /* #TVAR_ash_pGAS[132] */
+  {0x0F12, 0x00DF}, /* #TVAR_ash_pGAS[133] */
+  {0x0F12, 0x00C1}, /* #TVAR_ash_pGAS[134] */
+  {0x0F12, 0x00B3}, /* #TVAR_ash_pGAS[135] */
+  {0x0F12, 0x00B0}, /* #TVAR_ash_pGAS[136] */
+  {0x0F12, 0x00BC}, /* #TVAR_ash_pGAS[137] */
+  {0x0F12, 0x00D6}, /* #TVAR_ash_pGAS[138] */
+  {0x0F12, 0x0103}, /* #TVAR_ash_pGAS[139] */
+  {0x0F12, 0x0144}, /* #TVAR_ash_pGAS[140] */
+  {0x0F12, 0x0187}, /* #TVAR_ash_pGAS[141] */
+  {0x0F12, 0x01C2}, /* #TVAR_ash_pGAS[142] */
+  {0x0F12, 0x0167}, /* #TVAR_ash_pGAS[143] */
+  {0x0F12, 0x013A}, /* #TVAR_ash_pGAS[144] */
+  {0x0F12, 0x010D}, /* #TVAR_ash_pGAS[145] */
+  {0x0F12, 0x00E5}, /* #TVAR_ash_pGAS[146] */
+  {0x0F12, 0x00C6}, /* #TVAR_ash_pGAS[147] */
+  {0x0F12, 0x00B7}, /* #TVAR_ash_pGAS[148] */
+  {0x0F12, 0x00B0}, /* #TVAR_ash_pGAS[149] */
+  {0x0F12, 0x00B6}, /* #TVAR_ash_pGAS[150] */
+  {0x0F12, 0x00C9}, /* #TVAR_ash_pGAS[151] */
+  {0x0F12, 0x00EC}, /* #TVAR_ash_pGAS[152] */
+  {0x0F12, 0x011C}, /* #TVAR_ash_pGAS[153] */
+  {0x0F12, 0x014B}, /* #TVAR_ash_pGAS[154] */
+  {0x0F12, 0x0192}, /* #TVAR_ash_pGAS[155] */
+  {0x0F12, 0x0155}, /* #TVAR_ash_pGAS[156] */
+  {0x0F12, 0x0125}, /* #TVAR_ash_pGAS[157] */
+  {0x0F12, 0x00EE}, /* #TVAR_ash_pGAS[158] */
+  {0x0F12, 0x00BF}, /* #TVAR_ash_pGAS[159] */
+  {0x0F12, 0x00A2}, /* #TVAR_ash_pGAS[160] */
+  {0x0F12, 0x008D}, /* #TVAR_ash_pGAS[161] */
+  {0x0F12, 0x0087}, /* #TVAR_ash_pGAS[162] */
+  {0x0F12, 0x008F}, /* #TVAR_ash_pGAS[163] */
+  {0x0F12, 0x00A1}, /* #TVAR_ash_pGAS[164] */
+  {0x0F12, 0x00C5}, /* #TVAR_ash_pGAS[165] */
+  {0x0F12, 0x00F8}, /* #TVAR_ash_pGAS[166] */
+  {0x0F12, 0x0135}, /* #TVAR_ash_pGAS[167] */
+  {0x0F12, 0x0166}, /* #TVAR_ash_pGAS[168] */
+  {0x0F12, 0x012F}, /* #TVAR_ash_pGAS[169] */
+  {0x0F12, 0x00F2}, /* #TVAR_ash_pGAS[170] */
+  {0x0F12, 0x00B6}, /* #TVAR_ash_pGAS[171] */
+  {0x0F12, 0x0089}, /* #TVAR_ash_pGAS[172] */
+  {0x0F12, 0x0068}, /* #TVAR_ash_pGAS[173] */
+  {0x0F12, 0x0055}, /* #TVAR_ash_pGAS[174] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[175] */
+  {0x0F12, 0x0058}, /* #TVAR_ash_pGAS[176] */
+  {0x0F12, 0x006E}, /* #TVAR_ash_pGAS[177] */
+  {0x0F12, 0x0092}, /* #TVAR_ash_pGAS[178] */
+  {0x0F12, 0x00C5}, /* #TVAR_ash_pGAS[179] */
+  {0x0F12, 0x0109}, /* #TVAR_ash_pGAS[180] */
+  {0x0F12, 0x0147}, /* #TVAR_ash_pGAS[181] */
+  {0x0F12, 0x010D}, /* #TVAR_ash_pGAS[182] */
+  {0x0F12, 0x00C9}, /* #TVAR_ash_pGAS[183] */
+  {0x0F12, 0x008E}, /* #TVAR_ash_pGAS[184] */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[185] */
+  {0x0F12, 0x003E}, /* #TVAR_ash_pGAS[186] */
+  {0x0F12, 0x002A}, /* #TVAR_ash_pGAS[187] */
+  {0x0F12, 0x0025}, /* #TVAR_ash_pGAS[188] */
+  {0x0F12, 0x002F}, /* #TVAR_ash_pGAS[189] */
+  {0x0F12, 0x0047}, /* #TVAR_ash_pGAS[190] */
+  {0x0F12, 0x006F}, /* #TVAR_ash_pGAS[191] */
+  {0x0F12, 0x00A2}, /* #TVAR_ash_pGAS[192] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_pGAS[193] */
+  {0x0F12, 0x0130}, /* #TVAR_ash_pGAS[194] */
+  {0x0F12, 0x00F3}, /* #TVAR_ash_pGAS[195] */
+  {0x0F12, 0x00B1}, /* #TVAR_ash_pGAS[196] */
+  {0x0F12, 0x0076}, /* #TVAR_ash_pGAS[197] */
+  {0x0F12, 0x0045}, /* #TVAR_ash_pGAS[198] */
+  {0x0F12, 0x0022}, /* #TVAR_ash_pGAS[199] */
+  {0x0F12, 0x000F}, /* #TVAR_ash_pGAS[200] */
+  {0x0F12, 0x000A}, /* #TVAR_ash_pGAS[201] */
+  {0x0F12, 0x0015}, /* #TVAR_ash_pGAS[202] */
+  {0x0F12, 0x002E}, /* #TVAR_ash_pGAS[203] */
+  {0x0F12, 0x0058}, /* #TVAR_ash_pGAS[204] */
+  {0x0F12, 0x008D}, /* #TVAR_ash_pGAS[205] */
+  {0x0F12, 0x00D4}, /* #TVAR_ash_pGAS[206] */
+  {0x0F12, 0x011A}, /* #TVAR_ash_pGAS[207] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_pGAS[208] */
+  {0x0F12, 0x00A7}, /* #TVAR_ash_pGAS[209] */
+  {0x0F12, 0x0068}, /* #TVAR_ash_pGAS[210] */
+  {0x0F12, 0x0038}, /* #TVAR_ash_pGAS[211] */
+  {0x0F12, 0x0017}, /* #TVAR_ash_pGAS[212] */
+  {0x0F12, 0x0004}, /* #TVAR_ash_pGAS[213] */
+  {0x0F12, 0x0000}, /* #TVAR_ash_pGAS[214] */
+  {0x0F12, 0x000B}, /* #TVAR_ash_pGAS[215] */
+  {0x0F12, 0x0025}, /* #TVAR_ash_pGAS[216] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[217] */
+  {0x0F12, 0x0084}, /* #TVAR_ash_pGAS[218] */
+  {0x0F12, 0x00CB}, /* #TVAR_ash_pGAS[219] */
+  {0x0F12, 0x0117}, /* #TVAR_ash_pGAS[220] */
+  {0x0F12, 0x00EA}, /* #TVAR_ash_pGAS[221] */
+  {0x0F12, 0x00A8}, /* #TVAR_ash_pGAS[222] */
+  {0x0F12, 0x006E}, /* #TVAR_ash_pGAS[223] */
+  {0x0F12, 0x003D}, /* #TVAR_ash_pGAS[224] */
+  {0x0F12, 0x001B}, /* #TVAR_ash_pGAS[225] */
+  {0x0F12, 0x0009}, /* #TVAR_ash_pGAS[226] */
+  {0x0F12, 0x0006}, /* #TVAR_ash_pGAS[227] */
+  {0x0F12, 0x0010}, /* #TVAR_ash_pGAS[228] */
+  {0x0F12, 0x002B}, /* #TVAR_ash_pGAS[229] */
+  {0x0F12, 0x0056}, /* #TVAR_ash_pGAS[230] */
+  {0x0F12, 0x008B}, /* #TVAR_ash_pGAS[231] */
+  {0x0F12, 0x00D1}, /* #TVAR_ash_pGAS[232] */
+  {0x0F12, 0x011B}, /* #TVAR_ash_pGAS[233] */
+  {0x0F12, 0x00F9}, /* #TVAR_ash_pGAS[234] */
+  {0x0F12, 0x00B6}, /* #TVAR_ash_pGAS[235] */
+  {0x0F12, 0x007D}, /* #TVAR_ash_pGAS[236] */
+  {0x0F12, 0x004E}, /* #TVAR_ash_pGAS[237] */
+  {0x0F12, 0x002D}, /* #TVAR_ash_pGAS[238] */
+  {0x0F12, 0x001C}, /* #TVAR_ash_pGAS[239] */
+  {0x0F12, 0x0019}, /* #TVAR_ash_pGAS[240] */
+  {0x0F12, 0x0025}, /* #TVAR_ash_pGAS[241] */
+  {0x0F12, 0x0042}, /* #TVAR_ash_pGAS[242] */
+  {0x0F12, 0x006C}, /* #TVAR_ash_pGAS[243] */
+  {0x0F12, 0x00A0}, /* #TVAR_ash_pGAS[244] */
+  {0x0F12, 0x00E6}, /* #TVAR_ash_pGAS[245] */
+  {0x0F12, 0x0130}, /* #TVAR_ash_pGAS[246] */
+  {0x0F12, 0x0114}, /* #TVAR_ash_pGAS[247] */
+  {0x0F12, 0x00D5}, /* #TVAR_ash_pGAS[248] */
+  {0x0F12, 0x0099}, /* #TVAR_ash_pGAS[249] */
+  {0x0F12, 0x006D}, /* #TVAR_ash_pGAS[250] */
+  {0x0F12, 0x004E}, /* #TVAR_ash_pGAS[251] */
+  {0x0F12, 0x003E}, /* #TVAR_ash_pGAS[252] */
+  {0x0F12, 0x003C}, /* #TVAR_ash_pGAS[253] */
+  {0x0F12, 0x0049}, /* #TVAR_ash_pGAS[254] */
+  {0x0F12, 0x0065}, /* #TVAR_ash_pGAS[255] */
+  {0x0F12, 0x008D}, /* #TVAR_ash_pGAS[256] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[257] */
+  {0x0F12, 0x0109}, /* #TVAR_ash_pGAS[258] */
+  {0x0F12, 0x014C}, /* #TVAR_ash_pGAS[259] */
+  {0x0F12, 0x0135}, /* #TVAR_ash_pGAS[260] */
+  {0x0F12, 0x00FC}, /* #TVAR_ash_pGAS[261] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[262] */
+  {0x0F12, 0x0099}, /* #TVAR_ash_pGAS[263] */
+  {0x0F12, 0x007D}, /* #TVAR_ash_pGAS[264] */
+  {0x0F12, 0x006F}, /* #TVAR_ash_pGAS[265] */
+  {0x0F12, 0x006D}, /* #TVAR_ash_pGAS[266] */
+  {0x0F12, 0x007C}, /* #TVAR_ash_pGAS[267] */
+  {0x0F12, 0x0095}, /* #TVAR_ash_pGAS[268] */
+  {0x0F12, 0x00BC}, /* #TVAR_ash_pGAS[269] */
+  {0x0F12, 0x00F1}, /* #TVAR_ash_pGAS[270] */
+  {0x0F12, 0x0135}, /* #TVAR_ash_pGAS[271] */
+  {0x0F12, 0x016E}, /* #TVAR_ash_pGAS[272] */
+  {0x0F12, 0x0154}, /* #TVAR_ash_pGAS[273] */
+  {0x0F12, 0x011D}, /* #TVAR_ash_pGAS[274] */
+  {0x0F12, 0x00E9}, /* #TVAR_ash_pGAS[275] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[276] */
+  {0x0F12, 0x00A7}, /* #TVAR_ash_pGAS[277] */
+  {0x0F12, 0x009C}, /* #TVAR_ash_pGAS[278] */
+  {0x0F12, 0x009B}, /* #TVAR_ash_pGAS[279] */
+  {0x0F12, 0x00A8}, /* #TVAR_ash_pGAS[280] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[281] */
+  {0x0F12, 0x00E8}, /* #TVAR_ash_pGAS[282] */
+  {0x0F12, 0x011C}, /* #TVAR_ash_pGAS[283] */
+  {0x0F12, 0x015C}, /* #TVAR_ash_pGAS[284] */
+  {0x0F12, 0x018F}, /* #TVAR_ash_pGAS[285] */
+  {0x0F12, 0x0158}, /* #TVAR_ash_pGAS[286] */
+  {0x0F12, 0x012B}, /* #TVAR_ash_pGAS[287] */
+  {0x0F12, 0x0100}, /* #TVAR_ash_pGAS[288] */
+  {0x0F12, 0x00DA}, /* #TVAR_ash_pGAS[289] */
+  {0x0F12, 0x00BF}, /* #TVAR_ash_pGAS[290] */
+  {0x0F12, 0x00AE}, /* #TVAR_ash_pGAS[291] */
+  {0x0F12, 0x00AD}, /* #TVAR_ash_pGAS[292] */
+  {0x0F12, 0x00B8}, /* #TVAR_ash_pGAS[293] */
+  {0x0F12, 0x00D2}, /* #TVAR_ash_pGAS[294] */
+  {0x0F12, 0x00FB}, /* #TVAR_ash_pGAS[295] */
+  {0x0F12, 0x012C}, /* #TVAR_ash_pGAS[296] */
+  {0x0F12, 0x015B}, /* #TVAR_ash_pGAS[297] */
+  {0x0F12, 0x01A0}, /* #TVAR_ash_pGAS[298] */
+  {0x0F12, 0x0150}, /* #TVAR_ash_pGAS[299] */
+  {0x0F12, 0x011F}, /* #TVAR_ash_pGAS[300] */
+  {0x0F12, 0x00E7}, /* #TVAR_ash_pGAS[301] */
+  {0x0F12, 0x00BA}, /* #TVAR_ash_pGAS[302] */
+  {0x0F12, 0x009D}, /* #TVAR_ash_pGAS[303] */
+  {0x0F12, 0x008C}, /* #TVAR_ash_pGAS[304] */
+  {0x0F12, 0x008B}, /* #TVAR_ash_pGAS[305] */
+  {0x0F12, 0x0095}, /* #TVAR_ash_pGAS[306] */
+  {0x0F12, 0x00AF}, /* #TVAR_ash_pGAS[307] */
+  {0x0F12, 0x00D6}, /* #TVAR_ash_pGAS[308] */
+  {0x0F12, 0x010E}, /* #TVAR_ash_pGAS[309] */
+  {0x0F12, 0x014C}, /* #TVAR_ash_pGAS[310] */
+  {0x0F12, 0x017C}, /* #TVAR_ash_pGAS[311] */
+  {0x0F12, 0x012E}, /* #TVAR_ash_pGAS[312] */
+  {0x0F12, 0x00EE}, /* #TVAR_ash_pGAS[313] */
+  {0x0F12, 0x00B4}, /* #TVAR_ash_pGAS[314] */
+  {0x0F12, 0x0088}, /* #TVAR_ash_pGAS[315] */
+  {0x0F12, 0x0068}, /* #TVAR_ash_pGAS[316] */
+  {0x0F12, 0x0055}, /* #TVAR_ash_pGAS[317] */
+  {0x0F12, 0x0050}, /* #TVAR_ash_pGAS[318] */
+  {0x0F12, 0x005E}, /* #TVAR_ash_pGAS[319] */
+  {0x0F12, 0x007A}, /* #TVAR_ash_pGAS[320] */
+  {0x0F12, 0x00A4}, /* #TVAR_ash_pGAS[321] */
+  {0x0F12, 0x00DA}, /* #TVAR_ash_pGAS[322] */
+  {0x0F12, 0x0121}, /* #TVAR_ash_pGAS[323] */
+  {0x0F12, 0x0161}, /* #TVAR_ash_pGAS[324] */
+  {0x0F12, 0x010B}, /* #TVAR_ash_pGAS[325] */
+  {0x0F12, 0x00C9}, /* #TVAR_ash_pGAS[326] */
+  {0x0F12, 0x008E}, /* #TVAR_ash_pGAS[327] */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[328] */
+  {0x0F12, 0x003F}, /* #TVAR_ash_pGAS[329] */
+  {0x0F12, 0x002B}, /* #TVAR_ash_pGAS[330] */
+  {0x0F12, 0x0028}, /* #TVAR_ash_pGAS[331] */
+  {0x0F12, 0x0034}, /* #TVAR_ash_pGAS[332] */
+  {0x0F12, 0x0052}, /* #TVAR_ash_pGAS[333] */
+  {0x0F12, 0x007D}, /* #TVAR_ash_pGAS[334] */
+  {0x0F12, 0x00B4}, /* #TVAR_ash_pGAS[335] */
+  {0x0F12, 0x00F9}, /* #TVAR_ash_pGAS[336] */
+  {0x0F12, 0x0141}, /* #TVAR_ash_pGAS[337] */
+  {0x0F12, 0x00F9}, /* #TVAR_ash_pGAS[338] */
+  {0x0F12, 0x00B3}, /* #TVAR_ash_pGAS[339] */
+  {0x0F12, 0x0079}, /* #TVAR_ash_pGAS[340] */
+  {0x0F12, 0x0048}, /* #TVAR_ash_pGAS[341] */
+  {0x0F12, 0x0024}, /* #TVAR_ash_pGAS[342] */
+  {0x0F12, 0x0010}, /* #TVAR_ash_pGAS[343] */
+  {0x0F12, 0x000C}, /* #TVAR_ash_pGAS[344] */
+  {0x0F12, 0x0018}, /* #TVAR_ash_pGAS[345] */
+  {0x0F12, 0x0035}, /* #TVAR_ash_pGAS[346] */
+  {0x0F12, 0x0062}, /* #TVAR_ash_pGAS[347] */
+  {0x0F12, 0x009A}, /* #TVAR_ash_pGAS[348] */
+  {0x0F12, 0x00DF}, /* #TVAR_ash_pGAS[349] */
+  {0x0F12, 0x0128}, /* #TVAR_ash_pGAS[350] */
+  {0x0F12, 0x00F2}, /* #TVAR_ash_pGAS[351] */
+  {0x0F12, 0x00AE}, /* #TVAR_ash_pGAS[352] */
+  {0x0F12, 0x0071}, /* #TVAR_ash_pGAS[353] */
+  {0x0F12, 0x003E}, /* #TVAR_ash_pGAS[354] */
+  {0x0F12, 0x001B}, /* #TVAR_ash_pGAS[355] */
+  {0x0F12, 0x0005}, /* #TVAR_ash_pGAS[356] */
+  {0x0F12, 0x0000}, /* #TVAR_ash_pGAS[357] */
+  {0x0F12, 0x000C}, /* #TVAR_ash_pGAS[358] */
+  {0x0F12, 0x0029}, /* #TVAR_ash_pGAS[359] */
+  {0x0F12, 0x0053}, /* #TVAR_ash_pGAS[360] */
+  {0x0F12, 0x008A}, /* #TVAR_ash_pGAS[361] */
+  {0x0F12, 0x00D1}, /* #TVAR_ash_pGAS[362] */
+  {0x0F12, 0x0118}, /* #TVAR_ash_pGAS[363] */
+  {0x0F12, 0x00F4}, /* #TVAR_ash_pGAS[364] */
+  {0x0F12, 0x00B2}, /* #TVAR_ash_pGAS[365] */
+  {0x0F12, 0x0076}, /* #TVAR_ash_pGAS[366] */
+  {0x0F12, 0x0044}, /* #TVAR_ash_pGAS[367] */
+  {0x0F12, 0x0020}, /* #TVAR_ash_pGAS[368] */
+  {0x0F12, 0x000B}, /* #TVAR_ash_pGAS[369] */
+  {0x0F12, 0x0005}, /* #TVAR_ash_pGAS[370] */
+  {0x0F12, 0x000F}, /* #TVAR_ash_pGAS[371] */
+  {0x0F12, 0x002C}, /* #TVAR_ash_pGAS[372] */
+  {0x0F12, 0x0055}, /* #TVAR_ash_pGAS[373] */
+  {0x0F12, 0x008A}, /* #TVAR_ash_pGAS[374] */
+  {0x0F12, 0x00CF}, /* #TVAR_ash_pGAS[375] */
+  {0x0F12, 0x0117}, /* #TVAR_ash_pGAS[376] */
+  {0x0F12, 0x0106}, /* #TVAR_ash_pGAS[377] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[378] */
+  {0x0F12, 0x0088}, /* #TVAR_ash_pGAS[379] */
+  {0x0F12, 0x0057}, /* #TVAR_ash_pGAS[380] */
+  {0x0F12, 0x0033}, /* #TVAR_ash_pGAS[381] */
+  {0x0F12, 0x001F}, /* #TVAR_ash_pGAS[382] */
+  {0x0F12, 0x0017}, /* #TVAR_ash_pGAS[383] */
+  {0x0F12, 0x0021}, /* #TVAR_ash_pGAS[384] */
+  {0x0F12, 0x003C}, /* #TVAR_ash_pGAS[385] */
+  {0x0F12, 0x0065}, /* #TVAR_ash_pGAS[386] */
+  {0x0F12, 0x0099}, /* #TVAR_ash_pGAS[387] */
+  {0x0F12, 0x00DC}, /* #TVAR_ash_pGAS[388] */
+  {0x0F12, 0x0125}, /* #TVAR_ash_pGAS[389] */
+  {0x0F12, 0x0125}, /* #TVAR_ash_pGAS[390] */
+  {0x0F12, 0x00E2}, /* #TVAR_ash_pGAS[391] */
+  {0x0F12, 0x00A4}, /* #TVAR_ash_pGAS[392] */
+  {0x0F12, 0x0077}, /* #TVAR_ash_pGAS[393] */
+  {0x0F12, 0x0053}, /* #TVAR_ash_pGAS[394] */
+  {0x0F12, 0x003F}, /* #TVAR_ash_pGAS[395] */
+  {0x0F12, 0x0038}, /* #TVAR_ash_pGAS[396] */
+  {0x0F12, 0x0042}, /* #TVAR_ash_pGAS[397] */
+  {0x0F12, 0x005B}, /* #TVAR_ash_pGAS[398] */
+  {0x0F12, 0x0081}, /* #TVAR_ash_pGAS[399] */
+  {0x0F12, 0x00B3}, /* #TVAR_ash_pGAS[400] */
+  {0x0F12, 0x00F8}, /* #TVAR_ash_pGAS[401] */
+  {0x0F12, 0x013D}, /* #TVAR_ash_pGAS[402] */
+  {0x0F12, 0x0148}, /* #TVAR_ash_pGAS[403] */
+  {0x0F12, 0x010C}, /* #TVAR_ash_pGAS[404] */
+  {0x0F12, 0x00D2}, /* #TVAR_ash_pGAS[405] */
+  {0x0F12, 0x00A4}, /* #TVAR_ash_pGAS[406] */
+  {0x0F12, 0x0084}, /* #TVAR_ash_pGAS[407] */
+  {0x0F12, 0x0071}, /* #TVAR_ash_pGAS[408] */
+  {0x0F12, 0x006A}, /* #TVAR_ash_pGAS[409] */
+  {0x0F12, 0x0072}, /* #TVAR_ash_pGAS[410] */
+  {0x0F12, 0x0089}, /* #TVAR_ash_pGAS[411] */
+  {0x0F12, 0x00AC}, /* #TVAR_ash_pGAS[412] */
+  {0x0F12, 0x00DE}, /* #TVAR_ash_pGAS[413] */
+  {0x0F12, 0x011E}, /* #TVAR_ash_pGAS[414] */
+  {0x0F12, 0x015A}, /* #TVAR_ash_pGAS[415] */
+  {0x0F12, 0x0167}, /* #TVAR_ash_pGAS[416] */
+  {0x0F12, 0x0130}, /* #TVAR_ash_pGAS[417] */
+  {0x0F12, 0x00FC}, /* #TVAR_ash_pGAS[418] */
+  {0x0F12, 0x00D1}, /* #TVAR_ash_pGAS[419] */
+  {0x0F12, 0x00B5}, /* #TVAR_ash_pGAS[420] */
+  {0x0F12, 0x00A2}, /* #TVAR_ash_pGAS[421] */
+  {0x0F12, 0x009D}, /* #TVAR_ash_pGAS[422] */
+  {0x0F12, 0x00A2}, /* #TVAR_ash_pGAS[423] */
+  {0x0F12, 0x00B8}, /* #TVAR_ash_pGAS[424] */
+  {0x0F12, 0x00D9}, /* #TVAR_ash_pGAS[425] */
+  {0x0F12, 0x0106}, /* #TVAR_ash_pGAS[426] */
+  {0x0F12, 0x0140}, /* #TVAR_ash_pGAS[427] */
+  {0x0F12, 0x0174}, /* #TVAR_ash_pGAS[428] */
+  {0x0F12, 0x0139}, /* #TVAR_ash_pGAS[429] */
+  {0x0F12, 0x0111}, /* #TVAR_ash_pGAS[430] */
+  {0x0F12, 0x00EC}, /* #TVAR_ash_pGAS[431] */
+  {0x0F12, 0x00C6}, /* #TVAR_ash_pGAS[432] */
+  {0x0F12, 0x00AF}, /* #TVAR_ash_pGAS[433] */
+  {0x0F12, 0x00A4}, /* #TVAR_ash_pGAS[434] */
+  {0x0F12, 0x00A2}, /* #TVAR_ash_pGAS[435] */
+  {0x0F12, 0x00AD}, /* #TVAR_ash_pGAS[436] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[437] */
+  {0x0F12, 0x00E6}, /* #TVAR_ash_pGAS[438] */
+  {0x0F12, 0x0111}, /* #TVAR_ash_pGAS[439] */
+  {0x0F12, 0x0141}, /* #TVAR_ash_pGAS[440] */
+  {0x0F12, 0x017D}, /* #TVAR_ash_pGAS[441] */
+  {0x0F12, 0x012B}, /* #TVAR_ash_pGAS[442] */
+  {0x0F12, 0x00FF}, /* #TVAR_ash_pGAS[443] */
+  {0x0F12, 0x00CD}, /* #TVAR_ash_pGAS[444] */
+  {0x0F12, 0x00A5}, /* #TVAR_ash_pGAS[445] */
+  {0x0F12, 0x008F}, /* #TVAR_ash_pGAS[446] */
+  {0x0F12, 0x0082}, /* #TVAR_ash_pGAS[447] */
+  {0x0F12, 0x0082}, /* #TVAR_ash_pGAS[448] */
+  {0x0F12, 0x0089}, /* #TVAR_ash_pGAS[449] */
+  {0x0F12, 0x00A0}, /* #TVAR_ash_pGAS[450] */
+  {0x0F12, 0x00C2}, /* #TVAR_ash_pGAS[451] */
+  {0x0F12, 0x00F2}, /* #TVAR_ash_pGAS[452] */
+  {0x0F12, 0x012C}, /* #TVAR_ash_pGAS[453] */
+  {0x0F12, 0x0156}, /* #TVAR_ash_pGAS[454] */
+  {0x0F12, 0x0102}, /* #TVAR_ash_pGAS[455] */
+  {0x0F12, 0x00CB}, /* #TVAR_ash_pGAS[456] */
+  {0x0F12, 0x009B}, /* #TVAR_ash_pGAS[457] */
+  {0x0F12, 0x0075}, /* #TVAR_ash_pGAS[458] */
+  {0x0F12, 0x005D}, /* #TVAR_ash_pGAS[459] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[460] */
+  {0x0F12, 0x004E}, /* #TVAR_ash_pGAS[461] */
+  {0x0F12, 0x0059}, /* #TVAR_ash_pGAS[462] */
+  {0x0F12, 0x006F}, /* #TVAR_ash_pGAS[463] */
+  {0x0F12, 0x0091}, /* #TVAR_ash_pGAS[464] */
+  {0x0F12, 0x00BE}, /* #TVAR_ash_pGAS[465] */
+  {0x0F12, 0x00FD}, /* #TVAR_ash_pGAS[466] */
+  {0x0F12, 0x0134}, /* #TVAR_ash_pGAS[467] */
+  {0x0F12, 0x00E1}, /* #TVAR_ash_pGAS[468] */
+  {0x0F12, 0x00A5}, /* #TVAR_ash_pGAS[469] */
+  {0x0F12, 0x0075}, /* #TVAR_ash_pGAS[470] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[471] */
+  {0x0F12, 0x0035}, /* #TVAR_ash_pGAS[472] */
+  {0x0F12, 0x0028}, /* #TVAR_ash_pGAS[473] */
+  {0x0F12, 0x0025}, /* #TVAR_ash_pGAS[474] */
+  {0x0F12, 0x0030}, /* #TVAR_ash_pGAS[475] */
+  {0x0F12, 0x0048}, /* #TVAR_ash_pGAS[476] */
+  {0x0F12, 0x006C}, /* #TVAR_ash_pGAS[477] */
+  {0x0F12, 0x009A}, /* #TVAR_ash_pGAS[478] */
+  {0x0F12, 0x00D6}, /* #TVAR_ash_pGAS[479] */
+  {0x0F12, 0x0119}, /* #TVAR_ash_pGAS[480] */
+  {0x0F12, 0x00CA}, /* #TVAR_ash_pGAS[481] */
+  {0x0F12, 0x0090}, /* #TVAR_ash_pGAS[482] */
+  {0x0F12, 0x005C}, /* #TVAR_ash_pGAS[483] */
+  {0x0F12, 0x0036}, /* #TVAR_ash_pGAS[484] */
+  {0x0F12, 0x001B}, /* #TVAR_ash_pGAS[485] */
+  {0x0F12, 0x000D}, /* #TVAR_ash_pGAS[486] */
+  {0x0F12, 0x000B}, /* #TVAR_ash_pGAS[487] */
+  {0x0F12, 0x0015}, /* #TVAR_ash_pGAS[488] */
+  {0x0F12, 0x002A}, /* #TVAR_ash_pGAS[489] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[490] */
+  {0x0F12, 0x007C}, /* #TVAR_ash_pGAS[491] */
+  {0x0F12, 0x00B9}, /* #TVAR_ash_pGAS[492] */
+  {0x0F12, 0x00FA}, /* #TVAR_ash_pGAS[493] */
+  {0x0F12, 0x00BF}, /* #TVAR_ash_pGAS[494] */
+  {0x0F12, 0x0086}, /* #TVAR_ash_pGAS[495] */
+  {0x0F12, 0x0053}, /* #TVAR_ash_pGAS[496] */
+  {0x0F12, 0x002C}, /* #TVAR_ash_pGAS[497] */
+  {0x0F12, 0x0010}, /* #TVAR_ash_pGAS[498] */
+  {0x0F12, 0x0002}, /* #TVAR_ash_pGAS[499] */
+  {0x0F12, 0x0000}, /* #TVAR_ash_pGAS[500] */
+  {0x0F12, 0x0007}, /* #TVAR_ash_pGAS[501] */
+  {0x0F12, 0x001D}, /* #TVAR_ash_pGAS[502] */
+  {0x0F12, 0x0040}, /* #TVAR_ash_pGAS[503] */
+  {0x0F12, 0x006B}, /* #TVAR_ash_pGAS[504] */
+  {0x0F12, 0x00A8}, /* #TVAR_ash_pGAS[505] */
+  {0x0F12, 0x00EC}, /* #TVAR_ash_pGAS[506] */
+  {0x0F12, 0x00C4}, /* #TVAR_ash_pGAS[507] */
+  {0x0F12, 0x0089}, /* #TVAR_ash_pGAS[508] */
+  {0x0F12, 0x0057}, /* #TVAR_ash_pGAS[509] */
+  {0x0F12, 0x002F}, /* #TVAR_ash_pGAS[510] */
+  {0x0F12, 0x0015}, /* #TVAR_ash_pGAS[511] */
+  {0x0F12, 0x0008}, /* #TVAR_ash_pGAS[512] */
+  {0x0F12, 0x0003}, /* #TVAR_ash_pGAS[513] */
+  {0x0F12, 0x000B}, /* #TVAR_ash_pGAS[514] */
+  {0x0F12, 0x001E}, /* #TVAR_ash_pGAS[515] */
+  {0x0F12, 0x003F}, /* #TVAR_ash_pGAS[516] */
+  {0x0F12, 0x006B}, /* #TVAR_ash_pGAS[517] */
+  {0x0F12, 0x00A6}, /* #TVAR_ash_pGAS[518] */
+  {0x0F12, 0x00E5}, /* #TVAR_ash_pGAS[519] */
+  {0x0F12, 0x00D2}, /* #TVAR_ash_pGAS[520] */
+  {0x0F12, 0x0097}, /* #TVAR_ash_pGAS[521] */
+  {0x0F12, 0x0065}, /* #TVAR_ash_pGAS[522] */
+  {0x0F12, 0x0041}, /* #TVAR_ash_pGAS[523] */
+  {0x0F12, 0x0027}, /* #TVAR_ash_pGAS[524] */
+  {0x0F12, 0x0018}, /* #TVAR_ash_pGAS[525] */
+  {0x0F12, 0x0014}, /* #TVAR_ash_pGAS[526] */
+  {0x0F12, 0x001A}, /* #TVAR_ash_pGAS[527] */
+  {0x0F12, 0x002E}, /* #TVAR_ash_pGAS[528] */
+  {0x0F12, 0x004F}, /* #TVAR_ash_pGAS[529] */
+  {0x0F12, 0x0076}, /* #TVAR_ash_pGAS[530] */
+  {0x0F12, 0x00B3}, /* #TVAR_ash_pGAS[531] */
+  {0x0F12, 0x00F1}, /* #TVAR_ash_pGAS[532] */
+  {0x0F12, 0x00EE}, /* #TVAR_ash_pGAS[533] */
+  {0x0F12, 0x00B3}, /* #TVAR_ash_pGAS[534] */
+  {0x0F12, 0x0082}, /* #TVAR_ash_pGAS[535] */
+  {0x0F12, 0x005D}, /* #TVAR_ash_pGAS[536] */
+  {0x0F12, 0x0043}, /* #TVAR_ash_pGAS[537] */
+  {0x0F12, 0x0036}, /* #TVAR_ash_pGAS[538] */
+  {0x0F12, 0x0031}, /* #TVAR_ash_pGAS[539] */
+  {0x0F12, 0x0037}, /* #TVAR_ash_pGAS[540] */
+  {0x0F12, 0x004B}, /* #TVAR_ash_pGAS[541] */
+  {0x0F12, 0x0067}, /* #TVAR_ash_pGAS[542] */
+  {0x0F12, 0x0092}, /* #TVAR_ash_pGAS[543] */
+  {0x0F12, 0x00CD}, /* #TVAR_ash_pGAS[544] */
+  {0x0F12, 0x0107}, /* #TVAR_ash_pGAS[545] */
+  {0x0F12, 0x0110}, /* #TVAR_ash_pGAS[546] */
+  {0x0F12, 0x00DA}, /* #TVAR_ash_pGAS[547] */
+  {0x0F12, 0x00AA}, /* #TVAR_ash_pGAS[548] */
+  {0x0F12, 0x0086}, /* #TVAR_ash_pGAS[549] */
+  {0x0F12, 0x006F}, /* #TVAR_ash_pGAS[550] */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[551] */
+  {0x0F12, 0x005B}, /* #TVAR_ash_pGAS[552] */
+  {0x0F12, 0x0061}, /* #TVAR_ash_pGAS[553] */
+  {0x0F12, 0x0072}, /* #TVAR_ash_pGAS[554] */
+  {0x0F12, 0x008D}, /* #TVAR_ash_pGAS[555] */
+  {0x0F12, 0x00B6}, /* #TVAR_ash_pGAS[556] */
+  {0x0F12, 0x00F1}, /* #TVAR_ash_pGAS[557] */
+  {0x0F12, 0x0129}, /* #TVAR_ash_pGAS[558] */
+  {0x0F12, 0x0134}, /* #TVAR_ash_pGAS[559] */
+  {0x0F12, 0x0102}, /* #TVAR_ash_pGAS[560] */
+  {0x0F12, 0x00D2}, /* #TVAR_ash_pGAS[561] */
+  {0x0F12, 0x00B0}, /* #TVAR_ash_pGAS[562] */
+  {0x0F12, 0x009A}, /* #TVAR_ash_pGAS[563] */
+  {0x0F12, 0x008D}, /* #TVAR_ash_pGAS[564] */
+  {0x0F12, 0x0089}, /* #TVAR_ash_pGAS[565] */
+  {0x0F12, 0x008C}, /* #TVAR_ash_pGAS[566] */
+  {0x0F12, 0x0099}, /* #TVAR_ash_pGAS[567] */
+  {0x0F12, 0x00B2}, /* #TVAR_ash_pGAS[568] */
+  {0x0F12, 0x00D9}, /* #TVAR_ash_pGAS[569] */
+  {0x0F12, 0x010E}, /* #TVAR_ash_pGAS[570] */
+  {0x0F12, 0x0142}, /* #TVAR_ash_pGAS[571] */
+
+  {0x002A, 0x0D30},
+  {0x0F12, 0x02A7}, /* #awbb_GLocusR */
+  {0x0F12, 0x0343}, /* #awbb_GLocusB */
+  {0x002A, 0x06B8},
+  {0x0F12, 0x00C7}, /* #TVAR_ash_AwbAshCord_0_ */
+  {0x0F12, 0x00d9}, /* #TVAR_ash_AwbAshCord_1_ */
+  {0x0F12, 0x0110}, /* #TVAR_ash_AwbAshCord_2_ */
+  {0x0F12, 0x0129}, /* #TVAR_ash_AwbAshCord_3_ */
+  {0x0F12, 0x0159}, /* #TVAR_ash_AwbAshCord_4_ */
+  {0x0F12, 0x0179}, /* #TVAR_ash_AwbAshCord_5_ */
+  {0x0F12, 0x018c}, /* #TVAR_ash_AwbAshCord_6_ */
+
+  /* Set CCM */
+  /* CCM start address 7000_33A4 */
+  {0x002A, 0x0698},
+  {0x0F12, 0x33A4},
+  {0x0F12, 0x7000},
+  {0x002A, 0x33A4},
+  {0x0F12, 0x0172}, /* #TVAR_wbt_pBaseCcms[0]  Horizon */
+  {0x0F12, 0xFF64}, /* #TVAR_wbt_pBaseCcms[1] */
+  {0x0F12, 0xFFA0}, /* #TVAR_wbt_pBaseCcms[2] */
+  {0x0F12, 0xFF4D}, /* #TVAR_wbt_pBaseCcms[3] */
+  {0x0F12, 0x01FA}, /* #TVAR_wbt_pBaseCcms[4] */
+  {0x0F12, 0xFEF4}, /* #TVAR_wbt_pBaseCcms[5] */
+  {0x0F12, 0xFFD9}, /* #TVAR_wbt_pBaseCcms[6] */
+  {0x0F12, 0x0025}, /* #TVAR_wbt_pBaseCcms[7] */
+  {0x0F12, 0x026F}, /* #TVAR_wbt_pBaseCcms[8] */
+  {0x0F12, 0x0299}, /* #TVAR_wbt_pBaseCcms[9] */
+  {0x0F12, 0x012F}, /* #TVAR_wbt_pBaseCcms[10] */
+  {0x0F12, 0xFE21}, /* #TVAR_wbt_pBaseCcms[11] */
+  {0x0F12, 0x0143}, /* #TVAR_wbt_pBaseCcms[12] */
+  {0x0F12, 0xFF4E}, /* #TVAR_wbt_pBaseCcms[13] */
+  {0x0F12, 0x0183}, /* #TVAR_wbt_pBaseCcms[14] */
+  {0x0F12, 0xFEBA}, /* #TVAR_wbt_pBaseCcms[15] */
+  {0x0F12, 0x0191}, /* #TVAR_wbt_pBaseCcms[16] */
+  {0x0F12, 0x013D}, /* #TVAR_wbt_pBaseCcms[17] */
+  {0x0F12, 0x0172}, /* #TVAR_wbt_pBaseCcms[18]  Inca */
+  {0x0F12, 0xFF64}, /* #TVAR_wbt_pBaseCcms[19] */
+  {0x0F12, 0xFFA0}, /* #TVAR_wbt_pBaseCcms[20] */
+  {0x0F12, 0xFF4D}, /* #TVAR_wbt_pBaseCcms[21] */
+  {0x0F12, 0x01FA}, /* #TVAR_wbt_pBaseCcms[22] */
+  {0x0F12, 0xFEF4}, /* #TVAR_wbt_pBaseCcms[23] */
+  {0x0F12, 0xFFD9}, /* #TVAR_wbt_pBaseCcms[24] */
+  {0x0F12, 0x0025}, /* #TVAR_wbt_pBaseCcms[25] */
+  {0x0F12, 0x026F}, /* #TVAR_wbt_pBaseCcms[26] */
+  {0x0F12, 0x0299}, /* #TVAR_wbt_pBaseCcms[27] */
+  {0x0F12, 0x012F}, /* #TVAR_wbt_pBaseCcms[28] */
+  {0x0F12, 0xFE21}, /* #TVAR_wbt_pBaseCcms[29] */
+  {0x0F12, 0x0143}, /* #TVAR_wbt_pBaseCcms[30] */
+  {0x0F12, 0xFF4E}, /* #TVAR_wbt_pBaseCcms[31] */
+  {0x0F12, 0x0183}, /* #TVAR_wbt_pBaseCcms[32] */
+  {0x0F12, 0xFEBA}, /* #TVAR_wbt_pBaseCcms[33] */
+  {0x0F12, 0x0191}, /* #TVAR_wbt_pBaseCcms[34] */
+  {0x0F12, 0x013D}, /* #TVAR_wbt_pBaseCcms[35] */
+  {0x0F12, 0x01C8}, /* #TVAR_wbt_pBaseCcms[36]  WW */
+  {0x0F12, 0xFF57}, /* #TVAR_wbt_pBaseCcms[37] */
+  {0x0F12, 0xFFC3}, /* #TVAR_wbt_pBaseCcms[38] */
+  {0x0F12, 0xFF67}, /* #TVAR_wbt_pBaseCcms[39] */
+  {0x0F12, 0x01AD}, /* #TVAR_wbt_pBaseCcms[40] */
+  {0x0F12, 0xFF39}, /* #TVAR_wbt_pBaseCcms[41] */
+  {0x0F12, 0xFFE6}, /* #TVAR_wbt_pBaseCcms[42] */
+  {0x0F12, 0xFFF0}, /* #TVAR_wbt_pBaseCcms[43] */
+  {0x0F12, 0x01B0}, /* #TVAR_wbt_pBaseCcms[44] */
+  {0x0F12, 0x00EF}, /* #TVAR_wbt_pBaseCcms[45] */
+  {0x0F12, 0x00EE}, /* #TVAR_wbt_pBaseCcms[46] */
+  {0x0F12, 0xFF1D}, /* #TVAR_wbt_pBaseCcms[47] */
+  {0x0F12, 0x01A4}, /* #TVAR_wbt_pBaseCcms[48] */
+  {0x0F12, 0xFF70}, /* #TVAR_wbt_pBaseCcms[49] */
+  {0x0F12, 0x01D0}, /* #TVAR_wbt_pBaseCcms[50] */
+  {0x0F12, 0xFF3B}, /* #TVAR_wbt_pBaseCcms[51] */
+  {0x0F12, 0x016F}, /* #TVAR_wbt_pBaseCcms[52] */
+  {0x0F12, 0x012C}, /* #TVAR_wbt_pBaseCcms[53] */
+  {0x0F12, 0x01C8}, /* #TVAR_wbt_pBaseCcms[54]  CWF */
+  {0x0F12, 0xFF57}, /* #TVAR_wbt_pBaseCcms[55] */
+  {0x0F12, 0xFFC3}, /* #TVAR_wbt_pBaseCcms[56] */
+  {0x0F12, 0xFF67}, /* #TVAR_wbt_pBaseCcms[57] */
+  {0x0F12, 0x01AD}, /* #TVAR_wbt_pBaseCcms[58] */
+  {0x0F12, 0xFF39}, /* #TVAR_wbt_pBaseCcms[59] */
+  {0x0F12, 0xFFE6}, /* #TVAR_wbt_pBaseCcms[60] */
+  {0x0F12, 0xFFF0}, /* #TVAR_wbt_pBaseCcms[61] */
+  {0x0F12, 0x01B0}, /* #TVAR_wbt_pBaseCcms[62] */
+  {0x0F12, 0x00EF}, /* #TVAR_wbt_pBaseCcms[63] */
+  {0x0F12, 0x00EE}, /* #TVAR_wbt_pBaseCcms[64] */
+  {0x0F12, 0xFF1D}, /* #TVAR_wbt_pBaseCcms[65] */
+  {0x0F12, 0x01A4}, /* #TVAR_wbt_pBaseCcms[66] */
+  {0x0F12, 0xFF70}, /* #TVAR_wbt_pBaseCcms[67] */
+  {0x0F12, 0x01D0}, /* #TVAR_wbt_pBaseCcms[68] */
+  {0x0F12, 0xFF3B}, /* #TVAR_wbt_pBaseCcms[69] */
+  {0x0F12, 0x016F}, /* #TVAR_wbt_pBaseCcms[70] */
+  {0x0F12, 0x012C}, /* #TVAR_wbt_pBaseCcms[71] */
+  {0x0F12, 0x0184}, /* #TVAR_wbt_pBaseCcms[72]  D50 */
+  {0x0F12, 0xFFA0}, /* #TVAR_wbt_pBaseCcms[73] */
+  {0x0F12, 0xFFF4}, /* #TVAR_wbt_pBaseCcms[74] */
+  {0x0F12, 0xFF71}, /* #TVAR_wbt_pBaseCcms[75] */
+  {0x0F12, 0x019E}, /* #TVAR_wbt_pBaseCcms[76] */
+  {0x0F12, 0xFF45}, /* #TVAR_wbt_pBaseCcms[77] */
+  {0x0F12, 0xFFFE}, /* #TVAR_wbt_pBaseCcms[78] */
+  {0x0F12, 0x0006}, /* #TVAR_wbt_pBaseCcms[79] */
+  {0x0F12, 0x018A}, /* #TVAR_wbt_pBaseCcms[80] */
+  {0x0F12, 0x0110}, /* #TVAR_wbt_pBaseCcms[81] */
+  {0x0F12, 0x010F}, /* #TVAR_wbt_pBaseCcms[82] */
+  {0x0F12, 0xFF52}, /* #TVAR_wbt_pBaseCcms[83] */
+  {0x0F12, 0x01D7}, /* #TVAR_wbt_pBaseCcms[84] */
+  {0x0F12, 0xFF9D}, /* #TVAR_wbt_pBaseCcms[85] */
+  {0x0F12, 0x0203}, /* #TVAR_wbt_pBaseCcms[86] */
+  {0x0F12, 0xFF55}, /* #TVAR_wbt_pBaseCcms[87] */
+  {0x0F12, 0x0163}, /* #TVAR_wbt_pBaseCcms[88] */
+  {0x0F12, 0x0126}, /* #TVAR_wbt_pBaseCcms[89] */
+  {0x0F12, 0x0199}, /* #TVAR_wbt_pBaseCcms[90]  D65*/
+  {0x0F12, 0xFFA5}, /* #TVAR_wbt_pBaseCcms[91] */
+  {0x0F12, 0xFFFC}, /* #TVAR_wbt_pBaseCcms[92] */
+  {0x0F12, 0xFF6F}, /* #TVAR_wbt_pBaseCcms[93] */
+  {0x0F12, 0x019F}, /* #TVAR_wbt_pBaseCcms[94] */
+  {0x0F12, 0xFF43}, /* #TVAR_wbt_pBaseCcms[95] */
+  {0x0F12, 0xFFFB}, /* #TVAR_wbt_pBaseCcms[96] */
+  {0x0F12, 0x0003}, /* #TVAR_wbt_pBaseCcms[97] */
+  {0x0F12, 0x018E}, /* #TVAR_wbt_pBaseCcms[98] */
+  {0x0F12, 0x010C}, /* #TVAR_wbt_pBaseCcms[99] */
+  {0x0F12, 0x010B}, /* #TVAR_wbt_pBaseCcms[100] */
+  {0x0F12, 0xFF4B}, /* #TVAR_wbt_pBaseCcms[101] */
+  {0x0F12, 0x01F6}, /* #TVAR_wbt_pBaseCcms[102] */
+  {0x0F12, 0xFFBC}, /* #TVAR_wbt_pBaseCcms[103] */
+  {0x0F12, 0x0222}, /* #TVAR_wbt_pBaseCcms[104] */
+  {0x0F12, 0xFF4F}, /* #TVAR_wbt_pBaseCcms[105] */
+  {0x0F12, 0x0162}, /* #TVAR_wbt_pBaseCcms[106] */
+  {0x0F12, 0x0124}, /* #TVAR_wbt_pBaseCcms[107] */
+  {0x002A, 0x06A0}, /* Outdoor CCM address 7000_3380 */
+  {0x0F12, 0x3380},
+  {0x0F12, 0x7000},
+  {0x002A, 0x3380}, /* Outdoor CCM */
+  {0x0F12, 0x01E0}, /* #TVAR_wbt_pOutdoorCcm[0]  */
+  {0x0F12, 0xFF80}, /* #TVAR_wbt_pOutdoorCcm[1]  */
+  {0x0F12, 0xFFD0}, /* #TVAR_wbt_pOutdoorCcm[2]  */
+  {0x0F12, 0xFF61}, /* #TVAR_wbt_pOutdoorCcm[3]  */
+  {0x0F12, 0x01BD}, /* #TVAR_wbt_pOutdoorCcm[4]  */
+  {0x0F12, 0xFF34}, /* #TVAR_wbt_pOutdoorCcm[5]  */
+  {0x0F12, 0xFFFE}, /* #TVAR_wbt_pOutdoorCcm[6]  */
+  {0x0F12, 0xFFF6}, /* #TVAR_wbt_pOutdoorCcm[7]  */
+  {0x0F12, 0x019D}, /* #TVAR_wbt_pOutdoorCcm[8]  */
+  {0x0F12, 0x0107}, /* #TVAR_wbt_pOutdoorCcm[9]  */
+  {0x0F12, 0x010F}, /* #TVAR_wbt_pOutdoorCcm[10] */
+  {0x0F12, 0xFF67}, /* #TVAR_wbt_pOutdoorCcm[11] */
+  {0x0F12, 0x016C}, /* #TVAR_wbt_pOutdoorCcm[12] */
+  {0x0F12, 0xFF54}, /* #TVAR_wbt_pOutdoorCcm[13] */
+  {0x0F12, 0x01FC}, /* #TVAR_wbt_pOutdoorCcm[14] */
+  {0x0F12, 0xFF82}, /* #TVAR_wbt_pOutdoorCcm[15] */
+  {0x0F12, 0x015D}, /* #TVAR_wbt_pOutdoorCcm[16] */
+  {0x0F12, 0x00FD}, /* #TVAR_wbt_pOutdoorCcm[17] */
+
+  /* White balance */
+  {0x002A, 0x0C48},
+  {0x0F12, 0x03C8}, /* awbb_IndoorGrZones_m_BGrid[0]  */
+  {0x0F12, 0x03E2}, /* awbb_IndoorGrZones_m_BGrid[1]  */
+  {0x0F12, 0x038A}, /* awbb_IndoorGrZones_m_BGrid[2]  */
+  {0x0F12, 0x03F4}, /* awbb_IndoorGrZones_m_BGrid[3]  */
+  {0x0F12, 0x034E}, /* awbb_IndoorGrZones_m_BGrid[4]  */
+  {0x0F12, 0x03E2}, /* awbb_IndoorGrZones_m_BGrid[5]  */
+  {0x0F12, 0x030A}, /* awbb_IndoorGrZones_m_BGrid[6]  */
+  {0x0F12, 0x03B8}, /* awbb_IndoorGrZones_m_BGrid[7]  */
+  {0x0F12, 0x02C8}, /* awbb_IndoorGrZones_m_BGrid[8]  */
+  {0x0F12, 0x038A}, /* awbb_IndoorGrZones_m_BGrid[9]  */
+  {0x0F12, 0x029C}, /* awbb_IndoorGrZones_m_BGrid[10] */
+  {0x0F12, 0x0356}, /* awbb_IndoorGrZones_m_BGrid[11] */
+  {0x0F12, 0x0286}, /* awbb_IndoorGrZones_m_BGrid[12] */
+  {0x0F12, 0x0322}, /* awbb_IndoorGrZones_m_BGrid[13] */
+  {0x0F12, 0x026C}, /* awbb_IndoorGrZones_m_BGrid[14] */
+  {0x0F12, 0x02F6}, /* awbb_IndoorGrZones_m_BGrid[15] */
+  {0x0F12, 0x0254}, /* awbb_IndoorGrZones_m_BGrid[16] */
+  {0x0F12, 0x02CA}, /* awbb_IndoorGrZones_m_BGrid[17] */
+  {0x0F12, 0x023E}, /* awbb_IndoorGrZones_m_BGrid[18] */
+  {0x0F12, 0x02B8}, /* awbb_IndoorGrZones_m_BGrid[19] */
+  {0x0F12, 0x022E}, /* awbb_IndoorGrZones_m_BGrid[20] */
+  {0x0F12, 0x02A4}, /* awbb_IndoorGrZones_m_BGrid[21] */
+  {0x0F12, 0x0226}, /* awbb_IndoorGrZones_m_BGrid[22] */
+  {0x0F12, 0x0294}, /* awbb_IndoorGrZones_m_BGrid[23] */
+  {0x0F12, 0x0220}, /* awbb_IndoorGrZones_m_BGrid[24] */
+  {0x0F12, 0x027E}, /* awbb_IndoorGrZones_m_BGrid[25] */
+  {0x0F12, 0x022A}, /* awbb_IndoorGrZones_m_BGrid[26] */
+  {0x0F12, 0x025E}, /* awbb_IndoorGrZones_m_BGrid[27] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[28] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[29] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[30] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[31] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[32] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[33] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[34] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[35] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[36] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[37] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[38] */
+  {0x0F12, 0x0000}, /* awbb_IndoorGrZones_m_BGrid[39] */
+  {0x0F12, 0x0005}, /* awbb_IndoorGrZones_m_GridStep */
+  {0x002A, 0x0C9C},
+  {0x0F12, 0x000E},
+  {0x002A, 0x0CA0}, /* awbb_IndoorGrZones_m_Boffs */
+  {0x0F12, 0x00FE},
+  {0x002A, 0x0CA4},
+  {0x0F12, 0x027E}, /* awbb_OutdoorGrZones_m_BGrid[0]  */
+  {0x0F12, 0x02AE}, /* awbb_OutdoorGrZones_m_BGrid[1]  */
+  {0x0F12, 0x025C}, /* awbb_OutdoorGrZones_m_BGrid[2]  */
+  {0x0F12, 0x02B2}, /* awbb_OutdoorGrZones_m_BGrid[3]  */
+  {0x0F12, 0x0244}, /* awbb_OutdoorGrZones_m_BGrid[4]  */
+  {0x0F12, 0x02A0}, /* awbb_OutdoorGrZones_m_BGrid[5]  */
+  {0x0F12, 0x0236}, /* awbb_OutdoorGrZones_m_BGrid[6]  */
+  {0x0F12, 0x0290}, /* awbb_OutdoorGrZones_m_BGrid[7]  */
+  {0x0F12, 0x0230}, /* awbb_OutdoorGrZones_m_BGrid[8]  */
+  {0x0F12, 0x027A}, /* awbb_OutdoorGrZones_m_BGrid[9]  */
+  {0x0F12, 0x0236}, /* awbb_OutdoorGrZones_m_BGrid[10] */
+  {0x0F12, 0x025E}, /* awbb_OutdoorGrZones_m_BGrid[11] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[12] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[13] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[14] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[15] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[16] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[17] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[18] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[19] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[20] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[21] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[22] */
+  {0x0F12, 0x0000}, /* awbb_OutdoorGrZones_m_BGrid[23] */
+  {0x0F12, 0x0005},
+  {0x002A, 0x0CD8}, /* awbb_OutdoorGrZones_m_GridStep */
+  {0x0F12, 0x0006},
+  {0x002A, 0x0CDC}, /* awbb_OutdoorGrZones_m_Boffs */
+  {0x0F12, 0x01EE},
+
+  {0x002A, 0x0D88},
+  {0x0F12, 0xFFAD}, /* awbb_OutdoorDetectionZone_m_BGrid[0]          */
+  {0x0F12, 0x005D}, /* awbb_OutdoorDetectionZone_m_BGrid[1]          */
+  {0x0F12, 0xFF6B}, /* awbb_OutdoorDetectionZone_m_BGrid[2]          */
+  {0x0F12, 0x00A0}, /* awbb_OutdoorDetectionZone_m_BGrid[3]          */
+  {0x0F12, 0xFEFE}, /* awbb_OutdoorDetectionZone_m_BGrid[4]          */
+  {0x0F12, 0x010D}, /* awbb_OutdoorDetectionZone_m_BGrid[5]          */
+  {0x0F12, 0xFE99}, /* awbb_OutdoorDetectionZone_m_BGrid[6]          */
+  {0x0F12, 0x0172}, /* awbb_OutdoorDetectionZone_m_BGrid[7]          */
+  {0x0F12, 0xFE6A}, /* awbb_OutdoorDetectionZone_m_BGrid[8]          */
+  {0x0F12, 0x01A8}, /* awbb_OutdoorDetectionZone_m_BGrid[9]          */
+  {0x0F12, 0x1388}, /* awbb_OutdoorDetectionZone_ZInfo_m_AbsGridStep */
+  {0x0F12, 0x0000}, /* awbb_OutdoorDetectionZone_ZInfo_m_MaxNB       */
+  {0x0F12, 0x0005}, /* awbb_OutdoorDetectionZone_ZInfo_m_NBoffs      */
+  {0x0F12, 0x0000},
+  {0x0F12, 0x1387},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x1388},
+  {0x0F12, 0x0000},
+
+  {0x002A, 0x0DA8},
+  {0x0F12, 0x0913},
+  {0x002A, 0x0DA4},
+  {0x0F12, 0x0008},
+
+  {0x002A, 0x0CE0},
+  {0x0F12, 0x03EA}, /* awbb_LowBrGrZones_m_BGrid[0]      */
+  {0x0F12, 0x044E}, /* awbb_LowBrGrZones_m_BGrid[1]      */
+  {0x0F12, 0x035E}, /* awbb_LowBrGrZones_m_BGrid[2]      */
+  {0x0F12, 0x044C}, /* awbb_LowBrGrZones_m_BGrid[3]      */
+  {0x0F12, 0x02FA}, /* awbb_LowBrGrZones_m_BGrid[4]      */
+  {0x0F12, 0x0434}, /* awbb_LowBrGrZones_m_BGrid[5]      */
+  {0x0F12, 0x02AA}, /* awbb_LowBrGrZones_m_BGrid[6]      */
+  {0x0F12, 0x03F2}, /* awbb_LowBrGrZones_m_BGrid[7]      */
+  {0x0F12, 0x0266}, /* awbb_LowBrGrZones_m_BGrid[8]      */
+  {0x0F12, 0x03AE}, /* awbb_LowBrGrZones_m_BGrid[9]      */
+  {0x0F12, 0x022C}, /* awbb_L0CA4owBrGrZones_m_BGrid[10] */
+  {0x0F12, 0x035A}, /* awbb_LowBrGrZones_m_BGrid[11]     */
+  {0x0F12, 0x020E}, /* awbb_LowBrGrZones_m_BGrid[12]     */
+  {0x0F12, 0x0314}, /* awbb_LowBrGrZones_m_BGrid[13]     */
+  {0x0F12, 0x01F4}, /* awbb_LowBrGrZones_m_BGrid[14]     */
+  {0x0F12, 0x02E0}, /* awbb_LowBrGrZones_m_BGrid[15]     */
+  {0x0F12, 0x01E2}, /* awbb_LowBrGrZones_m_BGrid[16]     */
+  {0x0F12, 0x02AA}, /* awbb_LowBrGrZones_m_BGrid[17]     */
+  {0x0F12, 0x01E6}, /* awbb_LowBrGrZones_m_BGrid[18]     */
+  {0x0F12, 0x0264}, /* awbb_LowBrGrZones_m_BGrid[19]     */
+  {0x0F12, 0x0000}, /* awbb_LowBrGrZones_m_BGrid[20]     */
+  {0x0F12, 0x0000}, /* awbb_LowBrGrZones_m_BGrid[21]     */
+  {0x0F12, 0x0000}, /* awbb_LowBrGrZones_m_BGrid[22]     */
+  {0x0F12, 0x0000}, /* awbb_LowBrGrZones_m_BGrid[23]     */
+  {0x0F12, 0x0006}, /* awbb_LowBrGrZones_m_GridStep */
+  {0x002A, 0x0D14},
+  {0x0F12, 0x000A},
+  {0x002A, 0x0D18}, /* awbb_LowBrGrZones_m_Boffs */
+  {0x0F12, 0x009A},
+  {0x002A, 0x0D1C},
+  {0x0F12, 0x036C}, /* awbb_CrclLowT_R_c */
+  {0x002A, 0x0D20},
+  {0x0F12, 0x011C}, /* awbb_CrclLowT_B_c */
+  {0x002A, 0x0D24},
+  {0x0F12, 0x6184}, /* awbb_CrclLowT_Rad_c */
+  {0x002A, 0x0D2C},
+  {0x0F12, 0x0135}, /* awbb_IntcR */
+  {0x0F12, 0x012B}, /* awbb_IntcB */
+  {0x002A, 0x0D28},
+  {0x0F12, 0x024E},
+  {0x0F12, 0x027B},
+  {0x002A, 0x0E4C},
+  {0x0F12, 0x0000},
+  {0x002A, 0x0D4C},
+  {0x0F12, 0x0653},
+  {0x0F12, 0x02EB},
+  {0x0F12, 0x002C},
+  {0x0F12, 0x000B},
+  {0x002A, 0x0D5C}, /* awbb_LowTempRB */
+  {0x0F12, 0x7FFF},
+  {0x0F12, 0x0050},
+  {0x002A, 0x0D46},
+  {0x0F12, 0x053A}, /* awbb_MvEq_RBthresh */
+  {0x002A, 0x0D4A},
+  {0x0F12, 0x000A},
+  {0x002A, 0x0DD4},
+  {0x0F12, 0xFFFE},
+  {0x0F12, 0xFFEC},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0xFFFD},
+  {0x0F12, 0xFFEC},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0xFFFC},
+  {0x0F12, 0xFFEC},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0028},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0028},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0028},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  {0x0F12, 0x02F0},
+  {0x0F12, 0x0358},
+  {0x0F12, 0x03A5},
+  {0x0F12, 0x0F9C},
+  {0x0F12, 0x0FFA},
+  {0x0F12, 0x10B5},
+  {0x0F12, 0x1126},
+  {0x0F12, 0x1176},
+  {0x0F12, 0x1220},
+  {0x0F12, 0x00B2},
+  {0x0F12, 0x00B8},
+  {0x0F12, 0x00B7},
+  {0x0F12, 0x00B3},
+  {0x002A, 0x0E3E},
+  {0x0F12, 0x0000},
+  {0x002A, 0x22DE},
+  {0x0F12, 0x0004},
+  {0x002A, 0x337C},
+  {0x0F12, 0x00B3},
+  {0x0F12, 0x0040},
+  {0x002A, 0x0E44},
+  {0x0F12, 0x053C},
+  {0x0F12, 0x0400},
+  {0x0F12, 0x055C},
+  {0x002A, 0x0E36},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  {0x002A, 0x0E4A}, /* Grid offset enable */
+  {0x0F12, 0x0001},
+
+  /* Set GAMMA */
+  {0x002A, 0x3288},
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBIndoor_0__0_ 0x70003288  */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBIndoor_0__1_ 0x7000328A  */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBIndoor_0__2_ 0x7000328C  */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBIndoor_0__3_ 0x7000328E  */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBIndoor_0__4_ 0x70003290  */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBIndoor_0__5_ 0x70003292  */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBIndoor_0__6_ 0x70003294  */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBIndoor_0__7_ 0x70003296  */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBIndoor_0__8_ 0x70003298  */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBIndoor_0__9_ 0x7000329A  */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBIndoor_0__10_ 0x7000329C */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBIndoor_0__11_ 0x7000329E */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBIndoor_0__12_ 0x700032A0 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBIndoor_0__13_ 0x700032A2 */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBIndoor_0__14_ 0x700032A4 */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBIndoor_0__15_ 0x700032A6 */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBIndoor_0__16_ 0x700032A8 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBIndoor_0__17_ 0x700032AA */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBIndoor_0__18_ 0x700032AC */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBIndoor_0__19_ 0x700032AE */
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBIndoor_1__0_ 0x700032B0  */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBIndoor_1__1_ 0x700032B2  */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBIndoor_1__2_ 0x700032B4  */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBIndoor_1__3_ 0x700032B6  */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBIndoor_1__4_ 0x700032B8  */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBIndoor_1__5_ 0x700032BA  */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBIndoor_1__6_ 0x700032BC  */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBIndoor_1__7_ 0x700032BE  */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBIndoor_1__8_ 0x700032C0  */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBIndoor_1__9_ 0x700032C2  */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBIndoor_1__10_ 0x700032C4 */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBIndoor_1__11_ 0x700032C6 */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBIndoor_1__12_ 0x700032C8 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBIndoor_1__13_ 0x700032CA */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBIndoor_1__14_ 0x700032CC */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBIndoor_1__15_ 0x700032CE */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBIndoor_1__16_ 0x700032D0 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBIndoor_1__17_ 0x700032D2 */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBIndoor_1__18_ 0x700032D4 */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBIndoor_1__19_ 0x700032D6 */
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBIndoor_2__0_ 0x700032D8  */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBIndoor_2__1_ 0x700032DA  */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBIndoor_2__2_ 0x700032DC  */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBIndoor_2__3_ 0x700032DE  */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBIndoor_2__4_ 0x700032E0  */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBIndoor_2__5_ 0x700032E2  */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBIndoor_2__6_ 0x700032E4  */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBIndoor_2__7_ 0x700032E6  */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBIndoor_2__8_ 0x700032E8  */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBIndoor_2__9_ 0x700032EA  */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBIndoor_2__10_ 0x700032EC */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBIndoor_2__11_ 0x700032EE */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBIndoor_2__12_ 0x700032F0 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBIndoor_2__13_ 0x700032F2 */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBIndoor_2__14_ 0x700032F4 */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBIndoor_2__15_ 0x700032F6 */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBIndoor_2__16_ 0x700032F8 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBIndoor_2__17_ 0x700032FA */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBIndoor_2__18_ 0x700032FC */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBIndoor_2__19_ 0x700032FE */
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBOutdoor_0__0_ 0x70003300 */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBOutdoor_0__1_ 0x70003302 */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBOutdoor_0__2_ 0x70003304 */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBOutdoor_0__3_ 0x70003306 */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBOutdoor_0__4_ 0x70003308 */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBOutdoor_0__5_ 0x7000330A */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBOutdoor_0__6_ 0x7000330C */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBOutdoor_0__7_ 0x7000330E */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBOutdoor_0__8_ 0x70003310 */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBOutdoor_0__9_ 0x70003312 */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBOutdoor_0__10_0x70003314 */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBOutdoor_0__11_0x70003316 */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBOutdoor_0__12_0x70003318 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBOutdoor_0__13_0x7000331A */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBOutdoor_0__14_0x7000331C */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBOutdoor_0__15_0x7000331E */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBOutdoor_0__16_0x70003320 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBOutdoor_0__17_0x70003322 */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBOutdoor_0__18_0x70003324 */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBOutdoor_0__19_0x70003326 */
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBOutdoor_1__0_ 0x70003328 */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBOutdoor_1__1_ 0x7000332A */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBOutdoor_1__2_ 0x7000332C */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBOutdoor_1__3_ 0x7000332E */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBOutdoor_1__4_ 0x70003330 */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBOutdoor_1__5_ 0x70003332 */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBOutdoor_1__6_ 0x70003334 */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBOutdoor_1__7_ 0x70003336 */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBOutdoor_1__8_ 0x70003338 */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBOutdoor_1__9_ 0x7000333A */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBOutdoor_1__10_0x7000333C */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBOutdoor_1__11_0x7000333E */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBOutdoor_1__12_0x70003340 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBOutdoor_1__13_0x70003342 */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBOutdoor_1__14_0x70003344 */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBOutdoor_1__15_0x70003346 */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBOutdoor_1__16_0x70003348 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBOutdoor_1__17_0x7000334A */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBOutdoor_1__18_0x7000334C */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBOutdoor_1__19_0x7000334E */
+  {0x0F12, 0x0000}, /* #SARR_usDualGammaLutRGBOutdoor_2__0_ 0x70003350 */
+  {0x0F12, 0x0004}, /* #SARR_usDualGammaLutRGBOutdoor_2__1_ 0x70003352 */
+  {0x0F12, 0x0010}, /* #SARR_usDualGammaLutRGBOutdoor_2__2_ 0x70003354 */
+  {0x0F12, 0x002A}, /* #SARR_usDualGammaLutRGBOutdoor_2__3_ 0x70003356 */
+  {0x0F12, 0x0062}, /* #SARR_usDualGammaLutRGBOutdoor_2__4_ 0x70003358 */
+  {0x0F12, 0x00D5}, /* #SARR_usDualGammaLutRGBOutdoor_2__5_ 0x7000335A */
+  {0x0F12, 0x0138}, /* #SARR_usDualGammaLutRGBOutdoor_2__6_ 0x7000335C */
+  {0x0F12, 0x0161}, /* #SARR_usDualGammaLutRGBOutdoor_2__7_ 0x7000335E */
+  {0x0F12, 0x0186}, /* #SARR_usDualGammaLutRGBOutdoor_2__8_ 0x70003360 */
+  {0x0F12, 0x01BC}, /* #SARR_usDualGammaLutRGBOutdoor_2__9_ 0x70003362 */
+  {0x0F12, 0x01E8}, /* #SARR_usDualGammaLutRGBOutdoor_2__10_0x70003364 */
+  {0x0F12, 0x020F}, /* #SARR_usDualGammaLutRGBOutdoor_2__11_0x70003366 */
+  {0x0F12, 0x0232}, /* #SARR_usDualGammaLutRGBOutdoor_2__12_0x70003368 */
+  {0x0F12, 0x0273}, /* #SARR_usDualGammaLutRGBOutdoor_2__13_0x7000336A */
+  {0x0F12, 0x02AF}, /* #SARR_usDualGammaLutRGBOutdoor_2__14_0x7000336C */
+  {0x0F12, 0x0309}, /* #SARR_usDualGammaLutRGBOutdoor_2__15_0x7000336E */
+  {0x0F12, 0x0355}, /* #SARR_usDualGammaLutRGBOutdoor_2__16_0x70003370 */
+  {0x0F12, 0x0394}, /* #SARR_usDualGammaLutRGBOutdoor_2__17_0x70003372 */
+  {0x0F12, 0x03CE}, /* #SARR_usDualGammaLutRGBOutdoor_2__18_0x70003374 */
+  {0x0F12, 0x03FF}, /* #SARR_usDualGammaLutRGBOutdoor_2__19_0x70003376 */
+
+  {0x002A, 0x06A6},
+  {0x0F12, 0x00CA}, /* #SARR_AwbCcmCord_0_ */
+  {0x0F12, 0x00EA}, /* #SARR_AwbCcmCord_1_ */
+  {0x0F12, 0x0110}, /* #SARR_AwbCcmCord_2_ */
+  {0x0F12, 0x0124}, /* #SARR_AwbCcmCord_3_ */
+  {0x0F12, 0x0160}, /* #SARR_AwbCcmCord_4_ */
+  {0x0F12, 0x0180}, /* #SARR_AwbCcmCord_5_ */
+
+  /* Set AFIT */
+  /* Noise index */
+  {0x002A, 0x0764},
+  {0x0F12, 0x0041}, /* #afit_uNoiseIndInDoor[0] */
+  {0x0F12, 0x0063}, /* #afit_uNoiseIndInDoor[1] */
+  {0x0F12, 0x00BB}, /* #afit_uNoiseIndInDoor[2] */
+  {0x0F12, 0x0193}, /* #afit_uNoiseIndInDoor[3] */
+  {0x0F12, 0x02BC}, /* #afit_uNoiseIndInDoor[4] */
+
+  /* AFIT table start address 7000_07C4 */
+  {0x002A, 0x0770},
+  {0x0F12, 0x07C4},
+  {0x0F12, 0x7000},
+
+  /* AFIT table (Variables) */
+  {0x002A, 0x07C4},
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[0]   */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[1]   */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[2]   */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[3]   */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[4]   */
+  {0x0F12, 0x00C4}, /* #TVAR_afit_pBaseVals[5]   */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[6]   */
+  {0x0F12, 0x009C}, /* #TVAR_afit_pBaseVals[7]   */
+  {0x0F12, 0x017C}, /* #TVAR_afit_pBaseVals[8]   */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[9]   */
+  {0x0F12, 0x000C}, /* #TVAR_afit_pBaseVals[10]  */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[11]  */
+  {0x0F12, 0x0104}, /* #TVAR_afit_pBaseVals[12]  */
+  {0x0F12, 0x03E8}, /* #TVAR_afit_pBaseVals[13]  */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[14]  */
+  {0x0F12, 0x012C}, /* #TVAR_afit_pBaseVals[15]  */
+  {0x0F12, 0x0070}, /* #TVAR_afit_pBaseVals[16]  */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[17]  */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[18]  */
+  {0x0F12, 0x01AA}, /* #TVAR_afit_pBaseVals[19]  */
+  {0x0F12, 0x0064}, /* #TVAR_afit_pBaseVals[20]  */
+  {0x0F12, 0x0064}, /* #TVAR_afit_pBaseVals[21]  */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[22]  */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[23]  */
+  {0x0F12, 0x003C}, /* #TVAR_afit_pBaseVals[24]  */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[25]  */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[26]  */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[27]  */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[28]  */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[29]  */
+  {0x0F12, 0x0A24}, /* #TVAR_afit_pBaseVals[30]  */
+  {0x0F12, 0x1701}, /* #TVAR_afit_pBaseVals[31]  */
+  {0x0F12, 0x0229}, /* #TVAR_afit_pBaseVals[32]  */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[33]  */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[34]  */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[35]  */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[36]  */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[37]  */
+  {0x0F12, 0x043B}, /* #TVAR_afit_pBaseVals[38]  */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[39]  */
+  {0x0F12, 0x0301}, /* #TVAR_afit_pBaseVals[40]  */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[41]  */
+  {0x0F12, 0x051E}, /* #TVAR_afit_pBaseVals[42]  */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[43]  */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[44]  */
+  {0x0F12, 0x0A05}, /* #TVAR_afit_pBaseVals[45]  */
+  {0x0F12, 0x0A3C}, /* #TVAR_afit_pBaseVals[46]  */
+  {0x0F12, 0x0A28}, /* #TVAR_afit_pBaseVals[47]  */
+  {0x0F12, 0x0002}, /* #TVAR_afit_pBaseVals[48]  */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[49]  */
+  {0x0F12, 0x1002}, /* #TVAR_afit_pBaseVals[50]  */
+  {0x0F12, 0x001D}, /* #TVAR_afit_pBaseVals[51]  */
+  {0x0F12, 0x0900}, /* #TVAR_afit_pBaseVals[52]  */
+  {0x0F12, 0x0600}, /* #TVAR_afit_pBaseVals[53]  */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[54]  */
+  {0x0F12, 0x0305}, /* #TVAR_afit_pBaseVals[55]  */
+  {0x0F12, 0x5003}, /* #TVAR_afit_pBaseVals[56]  */
+  {0x0F12, 0x006E}, /* #TVAR_afit_pBaseVals[57]  */
+  {0x0F12, 0x0078}, /* #TVAR_afit_pBaseVals[58]  */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[59]  */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[60]  */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[61]  */
+  {0x0F12, 0x5002}, /* #TVAR_afit_pBaseVals[62]  */
+  {0x0F12, 0x7850}, /* #TVAR_afit_pBaseVals[63]  */
+  {0x0F12, 0x2878}, /* #TVAR_afit_pBaseVals[64]  */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[65]  */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[66]  */
+  {0x0F12, 0x1E0C}, /* #TVAR_afit_pBaseVals[67]  */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[68]  */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[69]  */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[70]  */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[71]  */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[72]  */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[73]  */
+  {0x0F12, 0x1E03}, /* #TVAR_afit_pBaseVals[74]  */
+  {0x0F12, 0x011E}, /* #TVAR_afit_pBaseVals[75]  */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[76]  */
+  {0x0F12, 0x5050}, /* #TVAR_afit_pBaseVals[77]  */
+  {0x0F12, 0x7878}, /* #TVAR_afit_pBaseVals[78]  */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[79]  */
+  {0x0F12, 0x030A}, /* #TVAR_afit_pBaseVals[80]  */
+  {0x0F12, 0x0714}, /* #TVAR_afit_pBaseVals[81]  */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[82]  */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[83]  */
+  {0x0F12, 0x0432}, /* #TVAR_afit_pBaseVals[84]  */
+  {0x0F12, 0x4050}, /* #TVAR_afit_pBaseVals[85]  */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[86]  */
+  {0x0F12, 0x0440}, /* #TVAR_afit_pBaseVals[87]  */
+  {0x0F12, 0x0302}, /* #TVAR_afit_pBaseVals[88]  */
+  {0x0F12, 0x1E1E}, /* #TVAR_afit_pBaseVals[89]  */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[90]  */
+  {0x0F12, 0x5001}, /* #TVAR_afit_pBaseVals[91]  */
+  {0x0F12, 0x7850}, /* #TVAR_afit_pBaseVals[92]  */
+  {0x0F12, 0x2878}, /* #TVAR_afit_pBaseVals[93]  */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[94]  */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[95]  */
+  {0x0F12, 0x1E07}, /* #TVAR_afit_pBaseVals[96]  */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[97]  */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[98]  */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[99]  */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[100] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[101] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[102] */
+  {0x0F12, 0x0003}, /* #TVAR_afit_pBaseVals[103] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[104] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[105] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[106] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[107] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[108] */
+  {0x0F12, 0x00C4}, /* #TVAR_afit_pBaseVals[109] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[110] */
+  {0x0F12, 0x009C}, /* #TVAR_afit_pBaseVals[111] */
+  {0x0F12, 0x017C}, /* #TVAR_afit_pBaseVals[112] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[113] */
+  {0x0F12, 0x000C}, /* #TVAR_afit_pBaseVals[114] */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[115] */
+  {0x0F12, 0x0104}, /* #TVAR_afit_pBaseVals[116] */
+  {0x0F12, 0x03E8}, /* #TVAR_afit_pBaseVals[117] */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[118] */
+  {0x0F12, 0x012C}, /* #TVAR_afit_pBaseVals[119] */
+  {0x0F12, 0x0070}, /* #TVAR_afit_pBaseVals[120] */
+  {0x0F12, 0x0008}, /* #TVAR_afit_pBaseVals[121] */
+  {0x0F12, 0x0008}, /* #TVAR_afit_pBaseVals[122] */
+  {0x0F12, 0x01AA}, /* #TVAR_afit_pBaseVals[123] */
+  {0x0F12, 0x003C}, /* #TVAR_afit_pBaseVals[124] */
+  {0x0F12, 0x003C}, /* #TVAR_afit_pBaseVals[125] */
+  {0x0F12, 0x0005}, /* #TVAR_afit_pBaseVals[126] */
+  {0x0F12, 0x0005}, /* #TVAR_afit_pBaseVals[127] */
+  {0x0F12, 0x0050}, /* #TVAR_afit_pBaseVals[128] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[129] */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[130] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[131] */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[132] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[133] */
+  {0x0F12, 0x0A24}, /* #TVAR_afit_pBaseVals[134] */
+  {0x0F12, 0x1701}, /* #TVAR_afit_pBaseVals[135] */
+  {0x0F12, 0x0229}, /* #TVAR_afit_pBaseVals[136] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[137] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[138] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[139] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[140] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[141] */
+  {0x0F12, 0x043B}, /* #TVAR_afit_pBaseVals[142] */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[143] */
+  {0x0F12, 0x0301}, /* #TVAR_afit_pBaseVals[144] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[145] */
+  {0x0F12, 0x051E}, /* #TVAR_afit_pBaseVals[146] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[147] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[148] */
+  {0x0F12, 0x0A03}, /* #TVAR_afit_pBaseVals[149] */
+  {0x0F12, 0x0A3C}, /* #TVAR_afit_pBaseVals[150] */
+  {0x0F12, 0x0A28}, /* #TVAR_afit_pBaseVals[151] */
+  {0x0F12, 0x0002}, /* #TVAR_afit_pBaseVals[152] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[153] */
+  {0x0F12, 0x1102}, /* #TVAR_afit_pBaseVals[154] */
+  {0x0F12, 0x001D}, /* #TVAR_afit_pBaseVals[155] */
+  {0x0F12, 0x0900}, /* #TVAR_afit_pBaseVals[156] */
+  {0x0F12, 0x0600}, /* #TVAR_afit_pBaseVals[157] */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[158] */
+  {0x0F12, 0x0305}, /* #TVAR_afit_pBaseVals[159] */
+  {0x0F12, 0x6403}, /* #TVAR_afit_pBaseVals[160] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[161] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[162] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[163] */
+  {0x0F12, 0x1919}, /* #TVAR_afit_pBaseVals[164] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[165] */
+  {0x0F12, 0x3C02}, /* #TVAR_afit_pBaseVals[166] */
+  {0x0F12, 0x553C}, /* #TVAR_afit_pBaseVals[167] */
+  {0x0F12, 0x2855}, /* #TVAR_afit_pBaseVals[168] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[169] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[170] */
+  {0x0F12, 0x1E0C}, /* #TVAR_afit_pBaseVals[171] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[172] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[173] */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[174] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[175] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[176] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[177] */
+  {0x0F12, 0x1E03}, /* #TVAR_afit_pBaseVals[178] */
+  {0x0F12, 0x011E}, /* #TVAR_afit_pBaseVals[179] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[180] */
+  {0x0F12, 0x3232}, /* #TVAR_afit_pBaseVals[181] */
+  {0x0F12, 0x3C3C}, /* #TVAR_afit_pBaseVals[182] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[183] */
+  {0x0F12, 0x030A}, /* #TVAR_afit_pBaseVals[184] */
+  {0x0F12, 0x0714}, /* #TVAR_afit_pBaseVals[185] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[186] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[187] */
+  {0x0F12, 0x0432}, /* #TVAR_afit_pBaseVals[188] */
+  {0x0F12, 0x4050}, /* #TVAR_afit_pBaseVals[189] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[190] */
+  {0x0F12, 0x0440}, /* #TVAR_afit_pBaseVals[191] */
+  {0x0F12, 0x0302}, /* #TVAR_afit_pBaseVals[192] */
+  {0x0F12, 0x1E1E}, /* #TVAR_afit_pBaseVals[193] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[194] */
+  {0x0F12, 0x3201}, /* #TVAR_afit_pBaseVals[195] */
+  {0x0F12, 0x3C32}, /* #TVAR_afit_pBaseVals[196] */
+  {0x0F12, 0x283C}, /* #TVAR_afit_pBaseVals[197] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[198] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[199] */
+  {0x0F12, 0x1E07}, /* #TVAR_afit_pBaseVals[200] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[201] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[202] */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[203] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[204] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[205] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[206] */
+  {0x0F12, 0x0003}, /* #TVAR_afit_pBaseVals[207] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[208] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[209] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[210] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[211] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[212] */
+  {0x0F12, 0x00C4}, /* #TVAR_afit_pBaseVals[213] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[214] */
+  {0x0F12, 0x009C}, /* #TVAR_afit_pBaseVals[215] */
+  {0x0F12, 0x017C}, /* #TVAR_afit_pBaseVals[216] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[217] */
+  {0x0F12, 0x000C}, /* #TVAR_afit_pBaseVals[218] */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[219] */
+  {0x0F12, 0x0104}, /* #TVAR_afit_pBaseVals[220] */
+  {0x0F12, 0x03E8}, /* #TVAR_afit_pBaseVals[221] */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[222] */
+  {0x0F12, 0x012C}, /* #TVAR_afit_pBaseVals[223] */
+  {0x0F12, 0x0070}, /* #TVAR_afit_pBaseVals[224] */
+  {0x0F12, 0x0004}, /* #TVAR_afit_pBaseVals[225] */
+  {0x0F12, 0x0004}, /* #TVAR_afit_pBaseVals[226] */
+  {0x0F12, 0x01AA}, /* #TVAR_afit_pBaseVals[227] */
+  {0x0F12, 0x001E}, /* #TVAR_afit_pBaseVals[228] */
+  {0x0F12, 0x001E}, /* #TVAR_afit_pBaseVals[229] */
+  {0x0F12, 0x0005}, /* #TVAR_afit_pBaseVals[230] */
+  {0x0F12, 0x0005}, /* #TVAR_afit_pBaseVals[231] */
+  {0x0F12, 0x0064}, /* #TVAR_afit_pBaseVals[232] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[233] */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[234] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[235] */
+  {0x0F12, 0x002A}, /* #TVAR_afit_pBaseVals[236] */
+  {0x0F12, 0x0024}, /* #TVAR_afit_pBaseVals[237] */
+  {0x0F12, 0x0A24}, /* #TVAR_afit_pBaseVals[238] */
+  {0x0F12, 0x1701}, /* #TVAR_afit_pBaseVals[239] */
+  {0x0F12, 0x0229}, /* #TVAR_afit_pBaseVals[240] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[241] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[242] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[243] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[244] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[245] */
+  {0x0F12, 0x043B}, /* #TVAR_afit_pBaseVals[246] */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[247] */
+  {0x0F12, 0x0301}, /* #TVAR_afit_pBaseVals[248] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[249] */
+  {0x0F12, 0x051E}, /* #TVAR_afit_pBaseVals[250] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[251] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[252] */
+  {0x0F12, 0x0A04}, /* #TVAR_afit_pBaseVals[253] */
+  {0x0F12, 0x0A3C}, /* #TVAR_afit_pBaseVals[254] */
+  {0x0F12, 0x0528}, /* #TVAR_afit_pBaseVals[255] */
+  {0x0F12, 0x0002}, /* #TVAR_afit_pBaseVals[256] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[257] */
+  {0x0F12, 0x1002}, /* #TVAR_afit_pBaseVals[258] */
+  {0x0F12, 0x001D}, /* #TVAR_afit_pBaseVals[259] */
+  {0x0F12, 0x0900}, /* #TVAR_afit_pBaseVals[260] */
+  {0x0F12, 0x0600}, /* #TVAR_afit_pBaseVals[261] */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[262] */
+  {0x0F12, 0x0305}, /* #TVAR_afit_pBaseVals[263] */
+  {0x0F12, 0x7803}, /* #TVAR_afit_pBaseVals[264] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[265] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[266] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[267] */
+  {0x0F12, 0x2323}, /* #TVAR_afit_pBaseVals[268] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[269] */
+  {0x0F12, 0x2A02}, /* #TVAR_afit_pBaseVals[270] */
+  {0x0F12, 0x462A}, /* #TVAR_afit_pBaseVals[271] */
+  {0x0F12, 0x2846}, /* #TVAR_afit_pBaseVals[272] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[273] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[274] */
+  {0x0F12, 0x1E0C}, /* #TVAR_afit_pBaseVals[275] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[276] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[277] */
+  {0x0F12, 0x5A04}, /* #TVAR_afit_pBaseVals[278] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[279] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[280] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[281] */
+  {0x0F12, 0x2303}, /* #TVAR_afit_pBaseVals[282] */
+  {0x0F12, 0x0123}, /* #TVAR_afit_pBaseVals[283] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[284] */
+  {0x0F12, 0x262A}, /* #TVAR_afit_pBaseVals[285] */
+  {0x0F12, 0x2C2C}, /* #TVAR_afit_pBaseVals[286] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[287] */
+  {0x0F12, 0x030A}, /* #TVAR_afit_pBaseVals[288] */
+  {0x0F12, 0x0714}, /* #TVAR_afit_pBaseVals[289] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[290] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[291] */
+  {0x0F12, 0x0432}, /* #TVAR_afit_pBaseVals[292] */
+  {0x0F12, 0x4050}, /* #TVAR_afit_pBaseVals[293] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[294] */
+  {0x0F12, 0x0440}, /* #TVAR_afit_pBaseVals[295] */
+  {0x0F12, 0x0302}, /* #TVAR_afit_pBaseVals[296] */
+  {0x0F12, 0x2323}, /* #TVAR_afit_pBaseVals[297] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[298] */
+  {0x0F12, 0x2A01}, /* #TVAR_afit_pBaseVals[299] */
+  {0x0F12, 0x2C26}, /* #TVAR_afit_pBaseVals[300] */
+  {0x0F12, 0x282C}, /* #TVAR_afit_pBaseVals[301] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[302] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[303] */
+  {0x0F12, 0x1E07}, /* #TVAR_afit_pBaseVals[304] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[305] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[306] */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[307] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[308] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[309] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[310] */
+  {0x0F12, 0x0003}, /* #TVAR_afit_pBaseVals[311] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[312] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[313] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[314] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[315] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[316] */
+  {0x0F12, 0x00C4}, /* #TVAR_afit_pBaseVals[317] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[318] */
+  {0x0F12, 0x009C}, /* #TVAR_afit_pBaseVals[319] */
+  {0x0F12, 0x017C}, /* #TVAR_afit_pBaseVals[320] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[321] */
+  {0x0F12, 0x000C}, /* #TVAR_afit_pBaseVals[322] */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[323] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[324] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[325] */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[326] */
+  {0x0F12, 0x012C}, /* #TVAR_afit_pBaseVals[327] */
+  {0x0F12, 0x0070}, /* #TVAR_afit_pBaseVals[328] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[329] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[330] */
+  {0x0F12, 0x01AA}, /* #TVAR_afit_pBaseVals[331] */
+  {0x0F12, 0x001E}, /* #TVAR_afit_pBaseVals[332] */
+  {0x0F12, 0x001E}, /* #TVAR_afit_pBaseVals[333] */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[334] */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[335] */
+  {0x0F12, 0x00E6}, /* #TVAR_afit_pBaseVals[336] */
+  {0x0F12, 0x0032}, /* #TVAR_afit_pBaseVals[337] */
+  {0x0F12, 0x0032}, /* #TVAR_afit_pBaseVals[338] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[339] */
+  {0x0F12, 0x0032}, /* #TVAR_afit_pBaseVals[340] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[341] */
+  {0x0F12, 0x0A24}, /* #TVAR_afit_pBaseVals[342] */
+  {0x0F12, 0x1701}, /* #TVAR_afit_pBaseVals[343] */
+  {0x0F12, 0x0229}, /* #TVAR_afit_pBaseVals[344] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[345] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[346] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[347] */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[348] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[349] */
+  {0x0F12, 0x043B}, /* #TVAR_afit_pBaseVals[350] */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[351] */
+  {0x0F12, 0x0301}, /* #TVAR_afit_pBaseVals[352] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[353] */
+  {0x0F12, 0x051E}, /* #TVAR_afit_pBaseVals[354] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[355] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[356] */
+  {0x0F12, 0x0A04}, /* #TVAR_afit_pBaseVals[357] */
+  {0x0F12, 0x0A3C}, /* #TVAR_afit_pBaseVals[358] */
+  {0x0F12, 0x0532}, /* #TVAR_afit_pBaseVals[359] */
+  {0x0F12, 0x0002}, /* #TVAR_afit_pBaseVals[360] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[361] */
+  {0x0F12, 0x1002}, /* #TVAR_afit_pBaseVals[362] */
+  {0x0F12, 0x001D}, /* #TVAR_afit_pBaseVals[363] */
+  {0x0F12, 0x0900}, /* #TVAR_afit_pBaseVals[364] */
+  {0x0F12, 0x0600}, /* #TVAR_afit_pBaseVals[365] */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[366] */
+  {0x0F12, 0x0305}, /* #TVAR_afit_pBaseVals[367] */
+  {0x0F12, 0x7802}, /* #TVAR_afit_pBaseVals[368] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[369] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[370] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[371] */
+  {0x0F12, 0x2328}, /* #TVAR_afit_pBaseVals[372] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[373] */
+  {0x0F12, 0x2A02}, /* #TVAR_afit_pBaseVals[374] */
+  {0x0F12, 0x2628}, /* #TVAR_afit_pBaseVals[375] */
+  {0x0F12, 0x2826}, /* #TVAR_afit_pBaseVals[376] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[377] */
+  {0x0F12, 0x1903}, /* #TVAR_afit_pBaseVals[378] */
+  {0x0F12, 0x1E0F}, /* #TVAR_afit_pBaseVals[379] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[380] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[381] */
+  {0x0F12, 0x7804}, /* #TVAR_afit_pBaseVals[382] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[383] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[384] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[385] */
+  {0x0F12, 0x2803}, /* #TVAR_afit_pBaseVals[386] */
+  {0x0F12, 0x0123}, /* #TVAR_afit_pBaseVals[387] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[388] */
+  {0x0F12, 0x2024}, /* #TVAR_afit_pBaseVals[389] */
+  {0x0F12, 0x1C1C}, /* #TVAR_afit_pBaseVals[390] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[391] */
+  {0x0F12, 0x030A}, /* #TVAR_afit_pBaseVals[392] */
+  {0x0F12, 0x0A0A}, /* #TVAR_afit_pBaseVals[393] */
+  {0x0F12, 0x0A2D}, /* #TVAR_afit_pBaseVals[394] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[395] */
+  {0x0F12, 0x0432}, /* #TVAR_afit_pBaseVals[396] */
+  {0x0F12, 0x4050}, /* #TVAR_afit_pBaseVals[397] */
+  {0x0F12, 0x0F0F}, /* #TVAR_afit_pBaseVals[398] */
+  {0x0F12, 0x0440}, /* #TVAR_afit_pBaseVals[399] */
+  {0x0F12, 0x0302}, /* #TVAR_afit_pBaseVals[400] */
+  {0x0F12, 0x2328}, /* #TVAR_afit_pBaseVals[401] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[402] */
+  {0x0F12, 0x3C01}, /* #TVAR_afit_pBaseVals[403] */
+  {0x0F12, 0x1C3C}, /* #TVAR_afit_pBaseVals[404] */
+  {0x0F12, 0x281C}, /* #TVAR_afit_pBaseVals[405] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[406] */
+  {0x0F12, 0x0A03}, /* #TVAR_afit_pBaseVals[407] */
+  {0x0F12, 0x2D0A}, /* #TVAR_afit_pBaseVals[408] */
+  {0x0F12, 0x070A}, /* #TVAR_afit_pBaseVals[409] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[410] */
+  {0x0F12, 0x5004}, /* #TVAR_afit_pBaseVals[411] */
+  {0x0F12, 0x0F40}, /* #TVAR_afit_pBaseVals[412] */
+  {0x0F12, 0x400F}, /* #TVAR_afit_pBaseVals[413] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[414] */
+  {0x0F12, 0x0003}, /* #TVAR_afit_pBaseVals[415] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[416] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[417] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[418] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[419] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[420] */
+  {0x0F12, 0x00C4}, /* #TVAR_afit_pBaseVals[421] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[422] */
+  {0x0F12, 0x009C}, /* #TVAR_afit_pBaseVals[423] */
+  {0x0F12, 0x017C}, /* #TVAR_afit_pBaseVals[424] */
+  {0x0F12, 0x03FF}, /* #TVAR_afit_pBaseVals[425] */
+  {0x0F12, 0x000C}, /* #TVAR_afit_pBaseVals[426] */
+  {0x0F12, 0x0010}, /* #TVAR_afit_pBaseVals[427] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[428] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[429] */
+  {0x0F12, 0x003C}, /* #TVAR_afit_pBaseVals[430] */
+  {0x0F12, 0x006F}, /* #TVAR_afit_pBaseVals[431] */
+  {0x0F12, 0x0070}, /* #TVAR_afit_pBaseVals[432] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[433] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[434] */
+  {0x0F12, 0x01AA}, /* #TVAR_afit_pBaseVals[435] */
+  {0x0F12, 0x0014}, /* #TVAR_afit_pBaseVals[436] */
+  {0x0F12, 0x0014}, /* #TVAR_afit_pBaseVals[437] */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[438] */
+  {0x0F12, 0x000A}, /* #TVAR_afit_pBaseVals[439] */
+  {0x0F12, 0x0122}, /* #TVAR_afit_pBaseVals[440] */
+  {0x0F12, 0x003C}, /* #TVAR_afit_pBaseVals[441] */
+  {0x0F12, 0x0032}, /* #TVAR_afit_pBaseVals[442] */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[443] */
+  {0x0F12, 0x0023}, /* #TVAR_afit_pBaseVals[444] */
+  {0x0F12, 0x0032}, /* #TVAR_afit_pBaseVals[445] */
+  {0x0F12, 0x0A24}, /* #TVAR_afit_pBaseVals[446] */
+  {0x0F12, 0x1701}, /* #TVAR_afit_pBaseVals[447] */
+  {0x0F12, 0x0229}, /* #TVAR_afit_pBaseVals[448] */
+  {0x0F12, 0x1403}, /* #TVAR_afit_pBaseVals[449] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[450] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[451] */
+  {0x0F12, 0x0505}, /* #TVAR_afit_pBaseVals[452] */
+  {0x0F12, 0x00FF}, /* #TVAR_afit_pBaseVals[453] */
+  {0x0F12, 0x043B}, /* #TVAR_afit_pBaseVals[454] */
+  {0x0F12, 0x1414}, /* #TVAR_afit_pBaseVals[455] */
+  {0x0F12, 0x0301}, /* #TVAR_afit_pBaseVals[456] */
+  {0x0F12, 0xFF07}, /* #TVAR_afit_pBaseVals[457] */
+  {0x0F12, 0x051E}, /* #TVAR_afit_pBaseVals[458] */
+  {0x0F12, 0x0A1E}, /* #TVAR_afit_pBaseVals[459] */
+  {0x0F12, 0x0000}, /* #TVAR_afit_pBaseVals[460] */
+  {0x0F12, 0x0A04}, /* #TVAR_afit_pBaseVals[461] */
+  {0x0F12, 0x0A3C}, /* #TVAR_afit_pBaseVals[462] */
+  {0x0F12, 0x0532}, /* #TVAR_afit_pBaseVals[463] */
+  {0x0F12, 0x0002}, /* #TVAR_afit_pBaseVals[464] */
+  {0x0F12, 0x0096}, /* #TVAR_afit_pBaseVals[465] */
+  {0x0F12, 0x1002}, /* #TVAR_afit_pBaseVals[466] */
+  {0x0F12, 0x001E}, /* #TVAR_afit_pBaseVals[467] */
+  {0x0F12, 0x0900}, /* #TVAR_afit_pBaseVals[468] */
+  {0x0F12, 0x0600}, /* #TVAR_afit_pBaseVals[469] */
+  {0x0F12, 0x0504}, /* #TVAR_afit_pBaseVals[470] */
+  {0x0F12, 0x0305}, /* #TVAR_afit_pBaseVals[471] */
+  {0x0F12, 0x7D02}, /* #TVAR_afit_pBaseVals[472] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[473] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[474] */
+  {0x0F12, 0x0080}, /* #TVAR_afit_pBaseVals[475] */
+  {0x0F12, 0x5050}, /* #TVAR_afit_pBaseVals[476] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[477] */
+  {0x0F12, 0x1C02}, /* #TVAR_afit_pBaseVals[478] */
+  {0x0F12, 0x191C}, /* #TVAR_afit_pBaseVals[479] */
+  {0x0F12, 0x2819}, /* #TVAR_afit_pBaseVals[480] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[481] */
+  {0x0F12, 0x1E03}, /* #TVAR_afit_pBaseVals[482] */
+  {0x0F12, 0x1E0F}, /* #TVAR_afit_pBaseVals[483] */
+  {0x0F12, 0x0508}, /* #TVAR_afit_pBaseVals[484] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[485] */
+  {0x0F12, 0x8204}, /* #TVAR_afit_pBaseVals[486] */
+  {0x0F12, 0x1448}, /* #TVAR_afit_pBaseVals[487] */
+  {0x0F12, 0x4015}, /* #TVAR_afit_pBaseVals[488] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[489] */
+  {0x0F12, 0x5003}, /* #TVAR_afit_pBaseVals[490] */
+  {0x0F12, 0x0150}, /* #TVAR_afit_pBaseVals[491] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[492] */
+  {0x0F12, 0x1E1E}, /* #TVAR_afit_pBaseVals[493] */
+  {0x0F12, 0x1212}, /* #TVAR_afit_pBaseVals[494] */
+  {0x0F12, 0x0028}, /* #TVAR_afit_pBaseVals[495] */
+  {0x0F12, 0x030A}, /* #TVAR_afit_pBaseVals[496] */
+  {0x0F12, 0x0A10}, /* #TVAR_afit_pBaseVals[497] */
+  {0x0F12, 0x0819}, /* #TVAR_afit_pBaseVals[498] */
+  {0x0F12, 0xFF05}, /* #TVAR_afit_pBaseVals[499] */
+  {0x0F12, 0x0432}, /* #TVAR_afit_pBaseVals[500] */
+  {0x0F12, 0x4052}, /* #TVAR_afit_pBaseVals[501] */
+  {0x0F12, 0x1514}, /* #TVAR_afit_pBaseVals[502] */
+  {0x0F12, 0x0440}, /* #TVAR_afit_pBaseVals[503] */
+  {0x0F12, 0x0302}, /* #TVAR_afit_pBaseVals[504] */
+  {0x0F12, 0x5050}, /* #TVAR_afit_pBaseVals[505] */
+  {0x0F12, 0x0101}, /* #TVAR_afit_pBaseVals[506] */
+  {0x0F12, 0x1E01}, /* #TVAR_afit_pBaseVals[507] */
+  {0x0F12, 0x121E}, /* #TVAR_afit_pBaseVals[508] */
+  {0x0F12, 0x2812}, /* #TVAR_afit_pBaseVals[509] */
+  {0x0F12, 0x0A00}, /* #TVAR_afit_pBaseVals[510] */
+  {0x0F12, 0x1003}, /* #TVAR_afit_pBaseVals[511] */
+  {0x0F12, 0x190A}, /* #TVAR_afit_pBaseVals[512] */
+  {0x0F12, 0x0508}, /* #TVAR_afit_pBaseVals[513] */
+  {0x0F12, 0x32FF}, /* #TVAR_afit_pBaseVals[514] */
+  {0x0F12, 0x5204}, /* #TVAR_afit_pBaseVals[515] */
+  {0x0F12, 0x1440}, /* #TVAR_afit_pBaseVals[516] */
+  {0x0F12, 0x4015}, /* #TVAR_afit_pBaseVals[517] */
+  {0x0F12, 0x0204}, /* #TVAR_afit_pBaseVals[518] */
+  {0x0F12, 0x0003}, /* #TVAR_afit_pBaseVals[519] */
+
+  /* Update Changed Registers */
+  {0x002A, 0x0664},
+  {0x0F12, 0x013E}, /* seti_uContrastCenter */
+
+  /* ====== SET PLL =====            */
+  /* How to set                      */
+  /* 1. MCLK                         */
+  /* hex(CLK you want) * 1000)       */
+  /* 2.System CLK                    */
+  /* hex((CLK you want) * 1000 / 4)  */
+  /* 3.PCLK                          */
+  /* hex((CLK you want) * 1000 / 4)  */
+
+  /* Set input CLK */
+  {0x002A, 0x01CC},
+  {0x0F12, 0x5DC0}, /* #REG_TC_IPRM_InClockLSBs */
+  {0x0F12, 0x0000},
+  {0x002A, 0x01EE},
+  {0x0F12, 0x0003}, /* #REG_TC_IPRM_UseNPviClocks - Number of PLL setting */
+  /* Set system CLK - 32MHz(0x1F40), 58MHz(0x38a4), can be 24MHz lowest */
+  {0x002A, 0x01F6},
+  /*{0x0F12, 0x38a4}, */ /* @0x700001F6 First system clock frequency in KHz divided by 4 - 58.000MHz */
+  {0x0F12, 0x2EE0}, /* 48MHz 1st SYS_CLK                                   */
+  {0x0F12, 0x1770}, /* 24MHz REG_TC_IPRM_MinOutRate4KHz_0                  */
+  {0x0F12, 0x1780}, /* 24.064MHz REG_TC_IPRM_MaxOutRate4KHz_0              */
+  {0x0F12, 0x2710}, /* 40MHz 2nd SYS_CLK, for capture                      */
+  {0x0F12, 0x2700}, /* 39.936MHz REG_TC_IPRM_MinOutRate4KHz_1, for capture */
+  {0x0F12, 0x2720}, /* 40.064MHz REG_TC_IPRM_MaxOutRate4KHz_1              */
+  {0x0F12, 0x38a4},
+  {0x0F12, 0x2310},
+  {0x0F12, 0x2340},
+  /* Update PLL */
+  {0x002A, 0x0208},
+  {0x0F12, 0x0001}, /* #REG_TC_IPRM_InitParamsUpdated */
+};
+
+
+/* Initialization sequence for 480x272 resolution */
+const uint16_t S5K5CAG_480x272[][2]=
+{
+  /*  SET PREVIEW CONFIGURATION_0, Camera Normal 10~30fps */
+  /*# Size: 480x272                                       */
+  {0x0028, 0x7000}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x002A, 0x026C}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x0F12, 0x01e0}, /* #REG_0TC_PCFG_usWidth  - 480 */
+  {0x0F12, 0x0110}, /* #REG_0TC_PCFG_usHeight - 272 */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_Format */
+  {0x0F12, 0x1780}, /* #REG_0TC_PCFG_usMaxOut4KHzRate - 24.064MHz */
+  {0x0F12, 0x1760}, /* #REG_0TC_PCFG_usMinOut4KHzRate - 23.936MHz */
+  {0x0F12, 0x0100}, /* #REG_0TC_PCFG_OutClkPerPix88 */
+  {0x0F12, 0x0800}, /* #REG_0TC_PCFG_uMaxBpp88      */
+  /* #REG_0TC_PCFG_PVIMask           */
+  /* bit0: swap RGB high/low byte    */
+  /* bit2: VSYNC data blanking level */
+  /* bit3: HSYNC data blanking level */
+  /*{0x0F12, 0x0052}, */ /* #REG_0TC_PCFG_PVIMask - s0050 = FALSE in MSM6290 : s0052 = TRUE in MSM6800 - reg 027A */
+  {0x0F12, 0x005F}, /* #REG_0TC_PCFG_PVIMask - bit0: swap RGB high/low byte */
+  {0x0F12, 0x4000}, /* #REG_0TC_PCFG_OIFMask                                */
+  {0x0F12, 0x0400}, /* #REG_0TC_PCFG_usJpegPacketSize                       */
+  {0x0F12, 0x0258}, /* #REG_0TC_PCFG_usJpegTotalPackets                     */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_uClockInd                              */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_usFrTimeType                           */
+  {0x0F12, 0x0002}, /* #REG_0TC_PCFG_FrRateQualityType 01:Always achieve the best frame rate. 02:Always achieve the best possible image quality (no-binning mode) */
+  /*=================S5K5CAGX_CAM_NOM_MAX_FR_TIME,S5K5CAGX_CAM_NOM_MIN_FR_TIME 30fps~15fps (Arima Use)==================*/
+  {0x0F12, 0x03E8}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 10fps */
+  {0x0F12, 0x029A}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 15fps */
+  /*{0x0F12, 0x014D},*/ /* #REG_0TC_PCFG_usMinFrTimeMsecMult10 - 30fps */
+  /*==========================================================================================*/
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  /* New Configuration FW Sync Preview */
+  {0x002A, 0x023C},
+  {0x0F12, 0x0000},
+  {0x002A, 0x0240},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0230},
+  {0x0F12, 0x0001},
+  {0x002A, 0x023E},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0220},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x0001},
+
+  {0x0028, 0xD000},
+  {0x002A, 0x1000},
+  {0x0F12, 0x0001},
+};
+
+/* Initialization sequence for VGA resolution (640x480)*/
+const uint16_t S5K5CAG_VGA[][2]=
+{
+  /*  SET PREVIEW CONFIGURATION_0, Camera Normal 10~30fps */
+  /*# Size: VGA 640x480                                   */
+  {0x0028, 0x7000}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x002A, 0x026C}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x0F12, 0x0280}, /* #REG_0TC_PCFG_usWidth  - 640 */
+  {0x0F12, 0x01E0}, /* #REG_0TC_PCFG_usHeight - 480 */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_Format */
+  {0x0F12, 0x1780}, /* #REG_0TC_PCFG_usMaxOut4KHzRate - 24.064MHz */
+  {0x0F12, 0x1760}, /* #REG_0TC_PCFG_usMinOut4KHzRate - 23.936MHz */
+  {0x0F12, 0x0100}, /* #REG_0TC_PCFG_OutClkPerPix88 */
+  {0x0F12, 0x0800}, /* #REG_0TC_PCFG_uMaxBpp88      */
+  /* #REG_0TC_PCFG_PVIMask           */
+  /* bit0: swap RGB high/low byte    */
+  /* bit2: VSYNC data blanking level */
+  /* bit3: HSYNC data blanking level */
+  /*{0x0F12, 0x0052}, */ /* #REG_0TC_PCFG_PVIMask - s0050 = FALSE in MSM6290 : s0052 = TRUE in MSM6800 - reg 027A */
+  {0x0F12, 0x005F}, /* #REG_0TC_PCFG_PVIMask - bit0: swap RGB high/low byte */
+  {0x0F12, 0x4000}, /* #REG_0TC_PCFG_OIFMask                                */
+  {0x0F12, 0x0400}, /* #REG_0TC_PCFG_usJpegPacketSize                       */
+  {0x0F12, 0x0258}, /* #REG_0TC_PCFG_usJpegTotalPackets                     */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_uClockInd                              */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_usFrTimeType                           */
+  {0x0F12, 0x0002}, /* #REG_0TC_PCFG_FrRateQualityType 01:Always achieve the best frame rate. 02:Always achieve the best possible image quality (no-binning mode) */
+  /*=================S5K5CAGX_CAM_NOM_MAX_FR_TIME,S5K5CAGX_CAM_NOM_MIN_FR_TIME 30fps~15fps (Arima Use)==================*/
+  {0x0F12, 0x03E8}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 10fps */
+  {0x0F12, 0x029A}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 15fps */
+  /*0x0F12, 0x014D,*/ /* #REG_0TC_PCFG_usMinFrTimeMsecMult10 - 30fps */
+  /*==========================================================================================*/
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  /* New Configuration FW Sync Preview */
+  {0x002A, 0x023C},
+  {0x0F12, 0x0000},
+  {0x002A, 0x0240},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0230},
+  {0x0F12, 0x0001},
+  {0x002A, 0x023E},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0220},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x0001},
+
+  {0x0028, 0xD000},
+  {0x002A, 0x1000},
+  {0x0F12, 0x0001},
+};
+
+/* Initialization sequence for QVGA resolution (320x240) */
+const uint16_t S5K5CAG_QVGA[][2]=
+{
+  /*  SET PREVIEW CONFIGURATION_0, Camera Normal 10~30fps */
+  /*# Size: QVGA 320x240                                  */
+  {0x0028, 0x7000}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x002A, 0x026C}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x0F12, 0x0140}, /* #REG_0TC_PCFG_usWidth  - 320 */
+  {0x0F12, 0x00F0}, /* #REG_0TC_PCFG_usHeight - 240 */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_Format */
+  {0x0F12, 0x1780}, /* #REG_0TC_PCFG_usMaxOut4KHzRate - 24.064MHz */
+  {0x0F12, 0x1760}, /* #REG_0TC_PCFG_usMinOut4KHzRate - 23.936MHz */
+  {0x0F12, 0x0100}, /* #REG_0TC_PCFG_OutClkPerPix88 */
+  {0x0F12, 0x0800}, /* #REG_0TC_PCFG_uMaxBpp88      */
+  /* #REG_0TC_PCFG_PVIMask           */
+  /* bit0: swap RGB high/low byte    */
+  /* bit2: VSYNC data blanking level */
+  /* bit3: HSYNC data blanking level */
+  /*{0x0F12, 0x0052}, */ /* #REG_0TC_PCFG_PVIMask - s0050 = FALSE in MSM6290 : s0052 = TRUE in MSM6800 - reg 027A */
+  {0x0F12, 0x005F}, /* #REG_0TC_PCFG_PVIMask - bit0: swap RGB high/low byte */
+  {0x0F12, 0x4000}, /* #REG_0TC_PCFG_OIFMask                                */
+  {0x0F12, 0x0400}, /* #REG_0TC_PCFG_usJpegPacketSize                       */
+  {0x0F12, 0x0258}, /* #REG_0TC_PCFG_usJpegTotalPackets                     */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_uClockInd                              */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_usFrTimeType                           */
+  {0x0F12, 0x0002}, /* #REG_0TC_PCFG_FrRateQualityType 01:Always achieve the best frame rate. 02:Always achieve the best possible image quality (no-binning mode) */
+  /*=================S5K5CAGX_CAM_NOM_MAX_FR_TIME,S5K5CAGX_CAM_NOM_MIN_FR_TIME 30fps~15fps (Arima Use)==================*/
+  {0x0F12, 0x03E8}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 10fps */
+  {0x0F12, 0x029A}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 15fps */
+  /*{0x0F12, 0x014D},*/ /* #REG_0TC_PCFG_usMinFrTimeMsecMult10 - 30fps */
+  /*==========================================================================================*/
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  /* New Configuration FW Sync Preview */
+  {0x002A, 0x023C},
+  {0x0F12, 0x0000},
+  {0x002A, 0x0240},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0230},
+  {0x0F12, 0x0001},
+  {0x002A, 0x023E},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0220},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x0001},
+
+  {0x0028, 0xD000},
+  {0x002A, 0x1000},
+  {0x0F12, 0x0001},
+};
+
+/* Initialization sequence for QQVGA resolution (160x120) */
+const uint16_t S5K5CAG_QQVGA[][2]=
+{
+  /*  SET PREVIEW CONFIGURATION_0, Camera Normal 10~30fps */
+  /*# Size: QQVGA 160x120                                 */
+  {0x0028, 0x7000}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x002A, 0x026C}, /* SET PREVIEW CONFIGURATION_0  */
+  {0x0F12, 0x00A0}, /* #REG_0TC_PCFG_usWidth  - 160 */
+  {0x0F12, 0x0078}, /* #REG_0TC_PCFG_usHeight - 120 */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_Format */
+  {0x0F12, 0x1780}, /* #REG_0TC_PCFG_usMaxOut4KHzRate - 24.064MHz */
+  {0x0F12, 0x1760}, /* #REG_0TC_PCFG_usMinOut4KHzRate - 23.936MHz */
+  {0x0F12, 0x0100}, /* #REG_0TC_PCFG_OutClkPerPix88 */
+  {0x0F12, 0x0800}, /* #REG_0TC_PCFG_uMaxBpp88      */
+  /* #REG_0TC_PCFG_PVIMask           */
+  /* bit0: swap RGB high/low byte    */
+  /* bit2: VSYNC data blanking level */
+  /* bit3: HSYNC data blanking level */
+  /*{0x0F12, 0x0052}, */ /* #REG_0TC_PCFG_PVIMask - s0050 = FALSE in MSM6290 : s0052 = TRUE in MSM6800 - reg 027A */
+  {0x0F12, 0x005F}, /* #REG_0TC_PCFG_PVIMask - bit0: swap RGB high/low byte */
+  {0x0F12, 0x4000}, /* #REG_0TC_PCFG_OIFMask                                */
+  {0x0F12, 0x0400}, /* #REG_0TC_PCFG_usJpegPacketSize                       */
+  {0x0F12, 0x0258}, /* #REG_0TC_PCFG_usJpegTotalPackets                     */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_uClockInd                              */
+  {0x0F12, 0x0000}, /* #REG_0TC_PCFG_usFrTimeType                           */
+  {0x0F12, 0x0002}, /* #REG_0TC_PCFG_FrRateQualityType 01:Always achieve the best frame rate. 02:Always achieve the best possible image quality (no-binning mode) */
+  /*=================S5K5CAGX_CAM_NOM_MAX_FR_TIME,S5K5CAGX_CAM_NOM_MIN_FR_TIME 30fps~15fps (Arima Use)==================*/
+  {0x0F12, 0x03E8}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 10fps */
+  {0x0F12, 0x029A}, /* #REG_0TC_PCFG_usMaxFrTimeMsecMult10 - 15fps */
+  /*{0x0F12, 0x014D},*/ /* #REG_0TC_PCFG_usMinFrTimeMsecMult10 - 30fps */
+  /*==========================================================================================*/
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+  {0x0F12, 0x0000},
+
+  /* New Configuration FW Sync Preview */
+  {0x002A, 0x023C},
+  {0x0F12, 0x0000},
+  {0x002A, 0x0240},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0230},
+  {0x0F12, 0x0001},
+  {0x002A, 0x023E},
+  {0x0F12, 0x0001},
+  {0x002A, 0x0220},
+  {0x0F12, 0x0001},
+  {0x0F12, 0x0001},
+
+  {0x0028, 0xD000},
+  {0x002A, 0x1000},
+  {0x0F12, 0x0001},
+};
+
+/**
+  * @}
+  */
+  
+/** @defgroup S5K5CAG_Private_Functions
+  * @{
+  */ 
+  
+/**
+  * @brief  Initializes the S5K5CAG CAMERA component.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  resolution: Camera resolution
+  * @retval None
+  */
+void s5k5cag_Init(uint16_t DeviceAddr, uint32_t resolution)
+{
+  uint32_t index;
+  
+  /* Initialize I2C */
+  CAMERA_IO_Init();
+
+  if ((resolution == CAMERA_R160x120) ||    /* Check if resolution is supported */
+      (resolution == CAMERA_R320x240) ||
+      (resolution == CAMERA_R480x272) ||
+      (resolution == CAMERA_R640x480))
+  {
+    /* Set common parameters for all resolutions */
+    for(index=0; index<(sizeof(S5K5CAG_Common)/4); index++)
+    {
+      if(0xFFFF == S5K5CAG_Common[index][0])
+      {
+        CAMERA_Delay(S5K5CAG_Common[index][1]);
+      }
+      else
+      {
+        CAMERA_IO_Write(DeviceAddr, S5K5CAG_Common[index][0], S5K5CAG_Common[index][1]);
+        CAMERA_Delay(1);
+      }
+    }
+
+    /* Set specific parameters for each resolution */
+    switch (resolution)
+    {
+    case CAMERA_R160x120:
+      {
+        for(index=0; index<(sizeof(S5K5CAG_QQVGA)/4); index++)
+        {
+          CAMERA_IO_Write(DeviceAddr, S5K5CAG_QQVGA[index][0], S5K5CAG_QQVGA[index][1]);
+          CAMERA_Delay(1);
+        }
+        break;
+      }
+    case CAMERA_R320x240:
+      {
+        for(index=0; index<(sizeof(S5K5CAG_QVGA)/4); index++)
+        {
+          CAMERA_IO_Write(DeviceAddr, S5K5CAG_QVGA[index][0], S5K5CAG_QVGA[index][1]);
+          CAMERA_Delay(1);
+        }
+        break;
+      }
+    case CAMERA_R480x272:
+      {
+        for(index=0; index<(sizeof(S5K5CAG_480x272)/4); index++)
+        {
+          CAMERA_IO_Write(DeviceAddr, S5K5CAG_480x272[index][0], S5K5CAG_480x272[index][1]);
+          CAMERA_Delay(1);
+        }
+        break;
+      }
+    case CAMERA_R640x480:
+      {
+        for(index=0; index<(sizeof(S5K5CAG_VGA)/4); index++)
+        {
+          CAMERA_IO_Write(DeviceAddr, S5K5CAG_VGA[index][0], S5K5CAG_VGA[index][1]);
+          CAMERA_Delay(1);
+        }
+        break;
+      }
+    default:
+      {
+        break;
+      }
+    }
+  }
+}
+
+/**
+  * @brief  Configures the S5K5CAG camera feature.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @param  feature: Camera feature to be configured
+  * @param  value: Value to be configured
+  * @param  brightness_value: Brightness value to be configured
+  * @retval None
+  */
+void s5k5cag_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t brightness_value)
+{
+  uint32_t value_tmp;
+  uint32_t br_value;
+  uint32_t r_gain = 0xA0;
+  uint32_t g_gain = 0xA0;
+  uint32_t b_gain = 0xA0;
+  
+  /* Convert the input value into s5k5cag parameters */
+  value_tmp = s5k5cag_ConvertValue(feature, value);
+  br_value = s5k5cag_ConvertValue(CAMERA_CONTRAST_BRIGHTNESS, brightness_value);
+    
+  switch(feature)
+  {
+  case CAMERA_BLACK_WHITE:
+    {
+      CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000);  /* Reset previous color effect settings */
+      CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04D6);
+      CAMERA_IO_Write(DeviceAddr, 0x0F12, 0x0001);
+      CAMERA_Delay(100); /* Wait for 100ms */
+
+      CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_TC_GP_SpecialEffects register (0x70000021E) */
+      CAMERA_IO_Write(DeviceAddr, 0x002A, 0x021E); /* REG_TC_GP_SpecialEffects register */
+      CAMERA_IO_Write(DeviceAddr, 0x0F12, value_tmp);
+      break;
+    }
+  case CAMERA_CONTRAST_BRIGHTNESS:
+    {
+      /* Set brightness */
+      CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_TC_UserBrightness register (0x70000020C) */
+      CAMERA_IO_Write(DeviceAddr, 0x002A, 0x020C); /* REG_TC_UserBrightness register */
+      CAMERA_IO_Write(DeviceAddr, 0x0F12, br_value);
+
+      /* Set contrast */
+      CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_TC_UserContrast register (0x70000020E) */
+      CAMERA_IO_Write(DeviceAddr, 0x002A, 0x020E); /* REG_TC_UserContrast register */
+      CAMERA_IO_Write(DeviceAddr, 0x0F12, value_tmp);
+      break;
+    }
+  case CAMERA_COLOR_EFFECT:
+    {     
+      /* Reset previous color effect settings */
+      CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000);  /* REG_TC_DBG_ReInitCmd register (0x700004D6) */
+      CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04D6);  /* REG_TC_DBG_ReInitCmd register */
+      CAMERA_IO_Write(DeviceAddr, 0x0F12, 0x0001);
+      CAMERA_Delay(100); /* Wait for 100ms */
+
+      if (value_tmp == S5K5CAG_COLOR_EFFECT_ANTIQUE)
+      {
+        /* Sepia color effect */
+        CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_TC_GP_SpecialEffects register (0x70000021E) */
+        CAMERA_IO_Write(DeviceAddr, 0x002A, 0x021E); /* REG_TC_GP_SpecialEffects register */
+        CAMERA_IO_Write(DeviceAddr, 0x0F12, value_tmp);
+      }
+      else
+      {
+        /* Reset previous special effect view, restore normal view */
+        CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_TC_GP_SpecialEffects register (0x70000021E) */
+        CAMERA_IO_Write(DeviceAddr, 0x002A, 0x021E); /* REG_TC_GP_SpecialEffects register */
+        CAMERA_IO_Write(DeviceAddr, 0x0F12, S5K5CAG_BLACK_WHITE_NORMAL);
+
+        switch(value_tmp)
+        {
+          case S5K5CAG_COLOR_EFFECT_RED :     /* Red color effect */
+            r_gain = 0xA0;  /* Red gain set to a high level */
+            g_gain = 0x40;  /* Green gain set to a low level */
+            b_gain = 0x50;  /* Blue gain set to a low level */
+            break;
+
+          case S5K5CAG_COLOR_EFFECT_GREEN :   /* Green color effect */
+            r_gain = 0x60;  /* Red gain set to a low level */
+            g_gain = 0xA0;  /* Green gain set to a high level */
+            b_gain = 0x60;  /* Blue gain set to a low level */
+            break;
+
+          case S5K5CAG_COLOR_EFFECT_BLUE :    /* Blue color effect : */
+            r_gain = 0x30;  /* Red gain set to a low level */
+            g_gain = 0x30;  /* Green gain set to a low level */
+            b_gain = 0xA0;  /* Blue gain set to a high level */
+            break;
+          default :                           /* No color effect applied */
+            value_tmp = S5K5CAG_COLOR_EFFECT_NONE;
+            break;
+        }
+
+        if (value_tmp != S5K5CAG_COLOR_EFFECT_NONE)
+        {
+          /* Set red gain */
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_Rgain register (0x700004A0) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04A0); /* REG_SF_USER_Rgain register */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, r_gain);
+
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_RgainChanged register (0x700004A2) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04A2); /* REG_SF_USER_RgainChanged */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, 0x1);
+
+          /* Set green gain */
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_Ggain register (0x700004A4) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04A4); /* REG_SF_USER_Ggain register */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, g_gain);
+
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_GgainChanged register (0x700004A6) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04A6); /* REG_SF_USER_GgainChanged */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, 0x1);
+
+          /* Set blue gain */
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_Bgain register (0x700004A8) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04A8); /* REG_SF_USER_Bgain register */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, b_gain);
+
+          CAMERA_IO_Write(DeviceAddr, 0x0028, 0x7000); /* REG_SF_USER_BgainChanged register (0x700004AA) */
+          CAMERA_IO_Write(DeviceAddr, 0x002A, 0x04AA); /* REG_SF_USER_BgainChanged */
+          CAMERA_IO_Write(DeviceAddr, 0x0F12, 0x1);
+        }
+      }
+      break;
+    }     
+  default:
+    {
+      break;
+    }
+  }
+}
+
+/**
+  * @brief  Read the S5K5CAG Camera identity.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval the S5K5CAG ID
+  */
+uint16_t s5k5cag_ReadID(uint16_t DeviceAddr)
+{
+  /* Initialize I2C */
+  CAMERA_IO_Init();
+  
+  /* Prepare the sensor to read the Camera ID */
+  CAMERA_IO_Write(DeviceAddr, 0xFCFC, 0x0000);  /* page 0x0000 */
+
+  /* Get the camera ID */
+  /* INFO_chipId1 @ 0x00000040 */
+  return (CAMERA_IO_Read(DeviceAddr, S5K5CAG_INFO_CHIPID1));
+}
+
+/******************************************************************************
+                            Static Functions
+*******************************************************************************/
+/**
+  * @brief  Convert input values into s5k5cag parameters.
+  * @param  feature: Camera feature to be configured
+  * @param  value: Value to be configured
+  * @retval The converted value
+  */
+static uint32_t s5k5cag_ConvertValue(uint32_t feature, uint32_t value)
+{
+  uint32_t ret = 0;
+  
+  switch(feature)
+  {
+  case CAMERA_BLACK_WHITE:
+    {
+      switch(value)
+      {
+      case CAMERA_BLACK_WHITE_BW:
+        {
+          ret =  S5K5CAG_BLACK_WHITE_BW;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_NEGATIVE:
+        {
+          ret =  S5K5CAG_BLACK_WHITE_NEGATIVE;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_BW_NEGATIVE:
+        {
+          ret =  S5K5CAG_BLACK_WHITE_BW_NEGATIVE;
+          break;
+        }
+      case CAMERA_BLACK_WHITE_NORMAL:
+        {
+          ret =  S5K5CAG_BLACK_WHITE_NORMAL;
+          break;
+        }
+      default:
+        {
+          ret =  S5K5CAG_BLACK_WHITE_NORMAL;
+          break;
+        }
+      }
+      break;
+    }
+  case CAMERA_CONTRAST_BRIGHTNESS:
+    {
+      switch(value)
+      {
+      case CAMERA_BRIGHTNESS_LEVEL0:
+        {
+          ret =  S5K5CAG_BRIGHTNESS_LEVEL0;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL1:
+        {
+          ret =  S5K5CAG_BRIGHTNESS_LEVEL1;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL2:
+        {
+          ret =  S5K5CAG_BRIGHTNESS_LEVEL2;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL3:
+        {
+          ret =  S5K5CAG_BRIGHTNESS_LEVEL3;
+          break;
+        }
+      case CAMERA_BRIGHTNESS_LEVEL4:
+        {
+          ret =  S5K5CAG_BRIGHTNESS_LEVEL4;
+          break;
+        }        
+      case CAMERA_CONTRAST_LEVEL0:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL0;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL1:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL1;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL2:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL2;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL3:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL3;
+          break;
+        }
+      case CAMERA_CONTRAST_LEVEL4:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL4;
+          break;
+        }
+      default:
+        {
+          ret =  S5K5CAG_CONTRAST_LEVEL0;
+          break;
+        }
+      }
+      break;
+    }
+  case CAMERA_COLOR_EFFECT:
+    {
+      switch(value)
+      {
+      case CAMERA_COLOR_EFFECT_ANTIQUE:
+        {
+          ret =  S5K5CAG_COLOR_EFFECT_ANTIQUE;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_BLUE:
+        {
+          ret =  S5K5CAG_COLOR_EFFECT_BLUE;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_GREEN:
+        {
+          ret =  S5K5CAG_COLOR_EFFECT_GREEN;
+          break;
+        }
+      case CAMERA_COLOR_EFFECT_RED:
+        {
+          ret =  S5K5CAG_COLOR_EFFECT_RED;
+          break;
+        }
+      default:
+        {
+          ret =  S5K5CAG_COLOR_EFFECT_NONE;
+          break;
+        }
+      }
+      break;
+    default:
+      {
+        ret = 0;
+        break;
+      }    
+    }
+  }
+  
+  return ret;
+}
+         
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */  
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 148 - 0
bsp/stm32f411RE/Libraries/BSP/Components/s5k5cag/s5k5cag.h

@@ -0,0 +1,148 @@
+/**
+  ******************************************************************************
+  * @file    s5k5cag.h
+  * @author  MCD Application Team
+  * @version V1.0.0
+  * @date    05-March-2015
+  * @brief   This file contains all the functions prototypes for the s5k5cag.c
+  *          driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __S5K5CAG_H
+#define __S5K5CAG_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/camera.h"
+   
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @addtogroup s5k5cag
+  * @{
+  */
+
+/** @defgroup S5K5CAG_Exported_Types
+  * @{
+  */
+     
+/**
+  * @}
+  */ 
+
+/** @defgroup S5K5CAG_Exported_Constants
+  * @{
+  */
+/** 
+  * @brief  S5K5CAG ID
+  */  
+#define  S5K5CAG_ID                      ((uint16_t)0x05CA)
+/** 
+  * @brief  S5K5CAG Registers
+  */
+#define S5K5CAG_INFO_CHIPID1             ((uint16_t)0x0040)
+#define S5K5CAG_INFO_CHIPID2             ((uint16_t)0x0042)
+#define S5K5CAG_INFO_SVNVERSION          ((uint16_t)0x0048)
+#define S5K5CAG_INFO_DATE                ((uint16_t)0x004E)
+
+/** 
+ * @brief  S5K5CAG Features Parameters
+ */
+#define S5K5CAG_BRIGHTNESS_LEVEL0        ((uint16_t)0xFF00)  /* Brightness level -2         */
+#define S5K5CAG_BRIGHTNESS_LEVEL1        ((uint16_t)0xFFC0)  /* Brightness level -1         */
+#define S5K5CAG_BRIGHTNESS_LEVEL2        ((uint16_t)0x0000)  /* Brightness level 0          */
+#define S5K5CAG_BRIGHTNESS_LEVEL3        ((uint16_t)0x0050)  /* Brightness level +1         */
+#define S5K5CAG_BRIGHTNESS_LEVEL4        ((uint16_t)0x0080)  /* Brightness level +2         */
+
+#define S5K5CAG_BLACK_WHITE_BW           ((uint16_t)0x0001)  /* Black and white effect      */
+#define S5K5CAG_BLACK_WHITE_NEGATIVE     ((uint16_t)0x0003)  /* Negative effect             */
+#define S5K5CAG_BLACK_WHITE_BW_NEGATIVE  ((uint16_t)0x0002)  /* BW and Negative effect      */
+#define S5K5CAG_BLACK_WHITE_NORMAL       ((uint16_t)0x0000)  /* Normal effect               */
+
+#define S5K5CAG_CONTRAST_LEVEL0          ((uint16_t)0xFF80)  /* Contrast level -2           */
+#define S5K5CAG_CONTRAST_LEVEL1          ((uint16_t)0xFFC0)  /* Contrast level -1           */
+#define S5K5CAG_CONTRAST_LEVEL2          ((uint16_t)0x0000)  /* Contrast level 0            */
+#define S5K5CAG_CONTRAST_LEVEL3          ((uint16_t)0x0050)  /* Contrast level -1           */
+#define S5K5CAG_CONTRAST_LEVEL4          ((uint16_t)0x0080)  /* Contrast level -2           */
+
+#define S5K5CAG_COLOR_EFFECT_NONE        ((uint16_t)0x0000)  /* No color effect             */
+#define S5K5CAG_COLOR_EFFECT_ANTIQUE     ((uint16_t)0x0004)  /* Antique effect              */
+#define S5K5CAG_COLOR_EFFECT_BLUE        ((uint16_t)0x0001)  /* Blue effect                 */
+#define S5K5CAG_COLOR_EFFECT_GREEN       ((uint16_t)0x0002)  /* Green effect                */
+#define S5K5CAG_COLOR_EFFECT_RED         ((uint16_t)0x0003)  /* Red effect                  */
+/**
+  * @}
+  */
+  
+/** @defgroup S5K5CAG_Exported_Functions
+  * @{
+  */ 
+void     s5k5cag_Init(uint16_t DeviceAddr, uint32_t resolution);
+void     s5k5cag_Config(uint16_t DeviceAddr, uint32_t feature, uint32_t value, uint32_t BR_value);
+uint16_t s5k5cag_ReadID(uint16_t DeviceAddr);
+
+void     CAMERA_IO_Init(void);
+void     CAMERA_IO_Write(uint8_t addr, uint16_t reg, uint16_t value);
+uint16_t CAMERA_IO_Read(uint8_t addr, uint16_t reg);
+void     CAMERA_Delay(uint32_t delay);
+
+/* CAMERA driver structure */
+extern CAMERA_DrvTypeDef   s5k5cag_drv;
+/**
+  * @}
+  */    
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __S5K5CAG_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 307 - 0
bsp/stm32f411RE/Libraries/BSP/Components/st7735/Release_Notes.html

@@ -0,0 +1,307 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for ST7735 Component Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for ST7735 Component Drivers</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><span style="font-size: 10pt; font-family: Verdana;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.1/ 24-November-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b><span style="font-size: 10pt; font-family: Verdana;"><br></span></p><ul><li><span style="font-family: Verdana; font-size: 10pt;">st7735.h: change </span><span style="font-family: Verdana; font-size: 10pt;">"\" by&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">"/" in the </span><span style="font-family: Verdana; font-size: 10pt;">include path</span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"> to fix </span><span style="font-family: Verdana; font-size: 10pt;">compilation issues </span><span style="font-family: Verdana; font-size: 10pt;">under 
+Linux.</span><span style="font-family: Verdana; font-size: 10pt;"></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0/ 22-July-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b><span style="font-size: 10pt; font-family: Verdana;"><br></span></p><ul><li><span style="font-size: 10pt; font-family: Verdana;">LCD Component</span><span style="font-size: 10pt; font-family: Verdana;"> driver update in order to harmonize all LCD controllers Link usage (Change LCD_IO_WriteData to LCD_IO_WriteMultipleData)&nbsp;</span></li></ul>
+
+
+
+
+
+
+
+
+
+            
+
+
+            
+            
+
+
+            
+            
+
+
+
+
+
+
+            
+            
+            
+
+
+
+
+
+
+            
+            
+            
+
+
+
+
+
+            
+            
+            
+
+
+
+
+            
+            
+            
+
+            
+            
+
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0/ 22-April-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes</span></u></b></p><ul><li><span style="font-size: 10pt; font-family: Verdana;">First official release.</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 471 - 0
bsp/stm32f411RE/Libraries/BSP/Components/st7735/st7735.c

@@ -0,0 +1,471 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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****/
+

+ 214 - 0
bsp/stm32f411RE/Libraries/BSP/Components/st7735/st7735.h

@@ -0,0 +1,214 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 336 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/Release_Notes.html

@@ -0,0 +1,336 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STMPE1600 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for STMPE1600 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 10-February-2015 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes</span></u></b></p>
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+
+
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">Update IO_Pin parameter to uint32_t in all IO functionalities functions.</span></li><li><span style="font-family: Verdana; font-size: 10pt;">This version is to be used with Common V2.0.0 version.</span></li></ul><span style="font-size: 10pt; font-family: Verdana;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">stmpe1600.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 604 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/stmpe1600.c

@@ -0,0 +1,604 @@
+/**
+  ******************************************************************************
+  * @file    stmpe1600.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    10-February-2015
+  * @brief   This file provides a set of functions needed to manage the STMPE1600
+  *          IO Expander devices.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "stmpe1600.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Components
+  * @{
+  */ 
+  
+/** @defgroup STMPE1600
+  * @{
+  */   
+  
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup STMPE1600_Private_Types_Definitions
+  * @{
+  */ 
+  
+/* Private define ------------------------------------------------------------*/
+
+/** @defgroup STMPE1600_Private_Defines
+  * @{
+  */ 
+#define STMPE1600_MAX_INSTANCE        2
+
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup STMPE1600_Private_Macros
+  * @{
+  */ 
+  
+/* Private variables ---------------------------------------------------------*/
+static uint16_t tmp = 0;
+
+/** @defgroup STMPE1600_Private_Variables
+  * @{
+  */ 
+/* IO driver structure initialization */  
+IO_DrvTypeDef stmpe1600_io_drv = 
+{
+  stmpe1600_Init,
+  stmpe1600_ReadID,
+  stmpe1600_Reset,
+  stmpe1600_Start,
+  stmpe1600_IO_Config,
+  stmpe1600_IO_WritePin,
+  stmpe1600_IO_ReadPin,
+  0,
+  0,
+  stmpe1600_IO_ITStatus,
+  stmpe1600_IO_ClearIT,
+};
+
+uint8_t stmpe1600[STMPE1600_MAX_INSTANCE] = {0};
+/**
+  * @}
+  */ 
+    
+/* Private function prototypes -----------------------------------------------*/
+
+/** @defgroup STMPE1600_Private_Function_Prototypes
+  * @{
+  */
+static uint8_t stmpe1600_GetInstance(uint16_t DeviceAddr);
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup STMPE1600_Private_Functions
+  * @{
+  */ 
+
+/**
+  * @brief  Initialize the stmpe1600 and configure the needed hardware resources
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void stmpe1600_Init(uint16_t DeviceAddr)
+{
+  uint8_t instance;
+  uint8_t empty;
+  
+  /* Check if device instance already exists */
+  instance = stmpe1600_GetInstance(DeviceAddr);
+  
+  if(instance == 0xFF)
+  {
+    /* Look for empty instance */
+    empty = stmpe1600_GetInstance(0);
+    
+    if(empty < STMPE1600_MAX_INSTANCE)
+    {
+      /* Register the current device instance */
+      stmpe1600[empty] = DeviceAddr;
+      
+      /* Initialize IO BUS layer */
+      IOE_Init(); 
+      
+      /* Generate stmpe1600 Software reset */
+      stmpe1600_Reset(DeviceAddr);
+    }
+  } 
+}
+
+/**
+  * @brief  Configures the touch Screen Controller (Single point detection)
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void stmpe1600_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  /*Configuration already done during the initialization */ 
+}
+
+/**
+  * @brief  Reset the stmpe1600 by Software.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void stmpe1600_Reset(uint16_t DeviceAddr)
+{
+  /* Power Down the stmpe1600 */
+  IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint16_t)0x80);
+
+  /* Wait for a delay to ensure registers erasing */
+  IOE_Delay(2); 
+  
+  /* Power On the Codec after the power off: all registers are reinitialized */
+  IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint16_t)0x00); 
+  
+  /* Wait for a delay to ensure registers erasing */
+  IOE_Delay(2); 
+}
+
+/**
+  * @brief  Read the stmpe1600 device ID.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval The Device ID (two bytes).
+  */
+uint16_t stmpe1600_ReadID(uint16_t DeviceAddr)
+{
+  uint8_t tmpData[2] = {0 , 0};
+
+  /* Initialize IO BUS layer */
+  IOE_Init(); 
+  
+  /* Read the stmpe1600 device ID */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_CHP_ID, tmpData, 2);
+  
+  /* Return the device ID value */
+  return((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+}
+
+/**
+  * @brief  Set the global interrupt Polarity.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  Polarity: could be one of these values; 
+  *   @arg  STMPE1600_POLARITY_LOW: Interrupt line is active Low/Falling edge      
+  *   @arg  STMPE1600_POLARITY_HIGH: Interrupt line is active High/Rising edge               
+  * @retval None
+  */
+void stmpe1600_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity)
+{
+  uint8_t tmp = 0;
+  
+  /* Get the current register value */ 
+  tmp = IOE_Read(DeviceAddr, STMPE1600_REG_SYS_CTRL);
+  
+  /* Mask the polarity bit */
+  tmp &= ~(uint16_t)0x01;
+    
+  /* Set the Interrupt Output line polarity */
+  tmp |= (uint8_t)Polarity;
+  
+  /* Set the new register value */
+  IOE_Write(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmp);
+}
+
+/**
+  * @brief  Enable the Global interrupt.
+  * @param  DeviceAddr: Device address on communication Bus.        
+  * @retval None
+  */
+void stmpe1600_EnableGlobalIT(uint16_t DeviceAddr)
+{
+  uint8_t tmpData[2] = {0 , 0};
+
+  /* Configure NVIC IT for IOE */
+  IOE_ITConfig();
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Set the global interrupts to be Enabled */    
+  tmp |= (uint16_t)STMPE1600_IT_ENABLE;
+  
+  /* Write Back the Interrupt Control register */
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint8_t *)&tmp, 2); 
+}
+
+/**
+  * @brief  Disable the Global interrupt.
+  * @param  DeviceAddr: Device address on communication Bus.        
+  * @retval None
+  */
+void stmpe1600_DisableGlobalIT(uint16_t DeviceAddr)
+{ 
+  uint8_t tmpData[2] = {0 , 0};
+
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Set the global interrupts to be Enabled */    
+  tmp &= ~(uint16_t)STMPE1600_IT_ENABLE;
+  
+  /* Write Back the Interrupt Control register */
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_SYS_CTRL, (uint8_t *)&tmp, 2); 
+}
+
+/**
+  * @brief  Initialize the selected pin(s) direction.
+  * @param  DeviceAddr: Device address on communication Bus.   
+  * @param  IO_Pin: IO pin(s) to be configured. 
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.  
+  * @param  Direction: could be STMPE1600_DIRECTION_IN or STMPE1600_DIRECTION_OUT.      
+  * @retval None
+  */
+void stmpe1600_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPDR, tmpData, 2);
+
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Set the Pin direction */
+  if (Direction != STMPE1600_DIRECTION_IN)
+  {
+    tmp |= (uint16_t)IO_Pin;
+  }  
+  else 
+  {
+    tmp &= ~(uint16_t)IO_Pin;
+  }
+    
+  /* Set the new register value */
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPDR, (uint8_t *)&tmp, 2);      
+}
+
+/**
+  * @brief  Configure 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  STMPE1600_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         
+  * @retval 0 if no error, IO_Mode if error
+  */
+uint8_t stmpe1600_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode)
+{
+  uint8_t error_code = 0;
+    uint8_t buffer[2] = {0,0};  
+    
+  /* Configure IO pin according to selected IO mode */
+  switch(IO_Mode)
+  {
+  case IO_MODE_INPUT: /* Input mode */
+    stmpe1600_IO_DisablePinIT(DeviceAddr, IO_Pin);
+    stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN);
+    break;
+    
+  case IO_MODE_OUTPUT: /* Output mode */
+    stmpe1600_IO_DisablePinIT(DeviceAddr, IO_Pin);
+    stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_OUT);
+    break;
+  
+  case IO_MODE_IT_RISING_EDGE: /* Interrupt rising edge mode */
+    stmpe1600_SetITPolarity(DeviceAddr, STMPE1600_POLARITY_HIGH);
+    stmpe1600_IO_EnablePinIT(DeviceAddr, IO_Pin);
+    stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN); 
+    /* Clear all IO IT pending bits if any */
+    stmpe1600_IO_ClearIT(DeviceAddr, IO_Pin);
+    
+    /* Read GMPR to enable interrupt */
+    IOE_ReadMultiple(DeviceAddr , STMPE1600_REG_GPMR, buffer, 2);
+    break; 
+    
+  case IO_MODE_IT_FALLING_EDGE: /* Interrupt falling edge mode */
+    stmpe1600_SetITPolarity(DeviceAddr, STMPE1600_POLARITY_LOW);
+    stmpe1600_IO_EnablePinIT(DeviceAddr, IO_Pin);
+    stmpe1600_IO_InitPin(DeviceAddr, IO_Pin, STMPE1600_DIRECTION_IN); 
+    
+    /* Clear all IO IT pending bits if any */
+    stmpe1600_IO_ClearIT(DeviceAddr, IO_Pin);
+    
+    /* Read GMPR to enable interrupt */
+    IOE_ReadMultiple(DeviceAddr , STMPE1600_REG_GPMR, buffer, 2);    
+    break;
+
+  default:
+    error_code = (uint8_t) IO_Mode;
+	break;
+  } 
+  return error_code;
+}
+
+/**
+  * @brief  Enable polarity inversion of the selected IO pin(s).
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @param  IO_Pin: IO pin(s) to be configured.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15. 
+  * @retval None
+  */ 
+void stmpe1600_IO_PolarityInv_Enable(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPPIR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));  
+
+  /* Enable pin polarity inversion */
+  tmp |= (uint16_t)IO_Pin;
+    
+  /* Set the new register value */  
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPPIR, (uint8_t *)&tmp, 2);
+}
+
+/**
+  * @brief  Disable polarity inversion of the selected IO pins.
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @param  IO_Pin: IO pin(s) to be configured. 
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.
+  * @retval None
+  */ 
+void stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPPIR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));  
+
+  /* Disable pin polarity inversion */
+   tmp &= ~ (uint16_t)IO_Pin;
+    
+  /* Set the new register value */  
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPPIR, (uint8_t *)&tmp, 2);  
+}
+
+/**
+  * @brief  Set the value of the selected IO pins.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  IO_Pin: IO pin(s) to be set.
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.
+  * @param  PinState: The value to be set. 
+  * @retval None
+  */
+void stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));  
+  
+  /* Set the pin state */
+  if(PinState != 0)
+  {
+    tmp |= (uint16_t)IO_Pin;
+  }  
+  else 
+  {
+    tmp &= ~(uint16_t)IO_Pin;
+  }
+    
+  /* Set the new register value */  
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPSR, (uint8_t *)&tmp, 2);
+}
+
+/**
+  * @brief  Read the state of the selected IO pin(s).
+  * @param  DeviceAddr: Device address on communication Bus. 
+  * @param  IO_Pin: IO pin(s) to be read.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.
+  * @retval State of the selected IO pin(s).
+  */
+uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPMR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Return the pin(s) state */
+  return(tmp & IO_Pin);  
+}
+
+/**
+  * @brief  Enable the interrupt mode for the selected IO pin(s).
+  * @param  DeviceAddr: Device address on communication Bus.     
+  * @param  IO_Pin: IO pin(s) to be configured.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15. 
+  * @retval None
+  */
+void stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+    
+  /* Enable global interrupt */
+  stmpe1600_EnableGlobalIT(DeviceAddr);
+
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));  
+  
+  /* Put pin in IT mode */
+  tmp |= (uint16_t)IO_Pin;
+    
+  /* Write the new register value */
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, (uint8_t *)&tmp, 2);
+}
+
+/**
+  * @brief  Disable the interrupt mode for the selected IO pin(s).
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @param  IO_Pin: IO pin(s) to be configured.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15. 
+  * @retval None
+  */
+void stmpe1600_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the current register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));  
+  
+  /* Disable the IT pin mode */
+  tmp &= ~(uint16_t)IO_Pin;
+    
+  /* Set the new register value */
+  IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_IEGPIOR, (uint8_t *)&tmp, 2); 
+}
+
+/**
+  * @brief  Read the IT status of the selected IO pin(s)
+  *         (clears all the pending bits if any). 
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  IO_Pin: IO pin(s) to be checked.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.           
+  * @retval IT Status of the selected IO pin(s).
+  */
+uint32_t stmpe1600_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Return the pin IT status */
+  return((tmp & IO_Pin) == IO_Pin);  
+}
+
+/**
+  * @brief  Detect an IT pending bit from the selected IO pin(s).
+  *         (clears all the pending bits if any).
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @param  IO_Pin: IO pin(s) to be checked.  
+  *         This parameter could be any combination of the following values:
+  *   @arg  STMPE1600_PIN_x: where x can be from 0 to 15.           
+  * @retval IT pending bit detection status.
+  */
+uint8_t stmpe1600_IO_ReadIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+  
+  /* Get the register value */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
+  
+  tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
+  
+  /* Return if there is an IT pending bit or not */
+  return(tmp & IO_Pin);
+}
+
+/**
+  * @brief  Clear all the IT pending bits if any. 
+  * @param  DeviceAddr: Device address on communication Bus.            
+  * @retval None
+  */
+void stmpe1600_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin)
+{
+  uint8_t tmpData[2] = {0 , 0};
+    
+  /* Get the register value to clear all pending bits */
+  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_ISGPIOR, tmpData, 2);
+}
+
+/**
+  * @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 stmpe1600_GetInstance(uint16_t DeviceAddr)
+{
+  uint8_t idx = 0;
+  
+  /* Check all the registered instances */
+  for(idx = 0; idx < STMPE1600_MAX_INSTANCE ; idx ++)
+  {
+    /* Return index if there is address match */
+    if(stmpe1600[idx] == DeviceAddr)
+    {
+      return idx; 
+    }
+  }
+  
+  return 0xFF;
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */      
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 213 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe1600/stmpe1600.h

@@ -0,0 +1,213 @@
+/**
+  ******************************************************************************
+  * @file    stmpe1600.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    10-February-2015
+  * @brief   This file contains all the functions prototypes for the
+  *          stmpe1600.c IO expander driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __STMPE1600_H
+#define __STMPE1600_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif   
+   
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/io.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Component
+  * @{
+  */
+    
+/** @defgroup STMPE1600
+  * @{
+  */    
+
+/* Exported types ------------------------------------------------------------*/
+
+/** @defgroup STMPE1600_Exported_Types
+  * @{
+  */ 
+
+/* Exported constants --------------------------------------------------------*/
+  
+/** @defgroup STMPE1600_Exported_Constants
+  * @{
+  */ 
+
+/** 
+  * @brief STMPE1600 chip IDs  
+  */ 
+#define STMPE1600_ID                     0x1600
+
+/** 
+  * @brief  Interrupt enable  
+  */ 
+#define STMPE1600_IT_ENABLE              0x04
+
+/** 
+  * @brief  Identification registers & System Control  
+  */ 
+#define STMPE1600_REG_CHP_ID             0x00
+#define STMPE1600_REG_ID_VERSION         0x02
+#define STMPE1600_REG_SYS_CTRL           0x03
+
+/** 
+  * @brief  IO Registers  
+  */ 
+
+#define STMPE1600_REG_GPMR               0x10
+#define STMPE1600_REG_GPSR               0x12
+#define STMPE1600_REG_GPDR               0x14
+#define STMPE1600_REG_GPPIR              0x16
+   
+/** 
+  * @brief  Interrupt Control registers  
+  */ 
+#define STMPE1600_REG_IEGPIOR            0x08
+#define STMPE1600_REG_ISGPIOR            0x0A
+
+/** 
+  * @brief  IO Pins direction  
+  */
+#define STMPE1600_DIRECTION_IN           0x00
+#define STMPE1600_DIRECTION_OUT          0x01
+
+/** 
+  * @brief  IO IT polarity  
+  */
+#define STMPE1600_POLARITY_LOW           0x00
+#define STMPE1600_POLARITY_HIGH          0x01
+
+/** 
+  * @brief  IO Pins  
+  */     
+#define STMPE1600_PIN_0                  0x0001
+#define STMPE1600_PIN_1                  0x0002
+#define STMPE1600_PIN_2                  0x0004
+#define STMPE1600_PIN_3                  0x0008
+#define STMPE1600_PIN_4                  0x0010
+#define STMPE1600_PIN_5                  0x0020
+#define STMPE1600_PIN_6                  0x0040
+#define STMPE1600_PIN_7                  0x0080
+#define STMPE1600_PIN_8                  0x0100
+#define STMPE1600_PIN_9                  0x0200
+#define STMPE1600_PIN_10                 0x0400
+#define STMPE1600_PIN_11                 0x0800
+#define STMPE1600_PIN_12                 0x1000
+#define STMPE1600_PIN_13                 0x2000
+#define STMPE1600_PIN_14                 0x4000
+#define STMPE1600_PIN_15                 0x8000
+#define STMPE1600_PIN_ALL                0xFFFF    
+
+/**
+  * @}
+  */ 
+  
+/* Exported macro ------------------------------------------------------------*/
+  
+/** @defgroup STMPE1600_Exported_Macros
+  * @{
+  */ 
+
+/* Exported functions --------------------------------------------------------*/
+  
+/** @defgroup STMPE1600_Exported_Functions
+  * @{
+  */
+  
+/** 
+  * @brief STMPE1600 Control functions
+  */
+void     stmpe1600_Init(uint16_t DeviceAddr);
+void     stmpe1600_Reset(uint16_t DeviceAddr);
+uint16_t stmpe1600_ReadID(uint16_t DeviceAddr);
+void     stmpe1600_SetITPolarity(uint16_t DeviceAddr, uint8_t Polarity);
+void     stmpe1600_EnableGlobalIT(uint16_t DeviceAddr);
+void     stmpe1600_DisableGlobalIT(uint16_t DeviceAddr);
+
+/** 
+  * @brief STMPE1600 IO functionalities functions
+  */
+void     stmpe1600_IO_InitPin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t Direction);
+uint8_t  stmpe1600_IO_Config(uint16_t DeviceAddr, uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
+void     stmpe1600_IO_PolarityInv_Enable(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState);
+uint32_t stmpe1600_IO_ReadPin(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_IO_EnablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+uint32_t stmpe1600_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin);
+uint8_t  stmpe1600_IO_ReadIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_IO_ClearIT(uint16_t DeviceAddr, uint32_t IO_Pin);
+void     stmpe1600_Start(uint16_t DeviceAddr, uint32_t IO_Pin);
+
+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);
+void     IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
+
+/* STMPE1600 driver structure */
+extern IO_DrvTypeDef stmpe1600_io_drv;
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __STMPE1600_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */       
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 378 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/Release_Notes.html

@@ -0,0 +1,378 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STMPE811 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for STMPE811 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 15-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;">
+              <li><span style="font-size: 10pt; font-family: Verdana;">All functions: update IO_Pin parameter to uint32_t instead of uint16_t</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add a return valud for stmpe811_IO_Config() function</span></li><li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold;">Important Note</span>: 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</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+
+
+
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">stmpe811.h: change "\" by "/" in the include path to fix compilation issue under Linux</span><br>
+                <span style="font-size: 10pt; font-family: Verdana;"></span></li></ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 11-November-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            
+            
+            
+            <ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">Fix limitation related to the selection of alternate function for TS physical IO<br>
+                </span></li><li><span style="font-size: 10pt; font-family: Verdana;">Fix </span><span style="font-size: 10pt; font-family: Verdana;">wrong </span><span style="font-size: 10pt; font-family: Verdana;">pins definition of </span><span style="font-size: 10pt; font-family: Verdana;">the TS</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Swap implementation of <span style="font-style: italic;">stmpe811_IO_EnableAF()</span> and <span style="font-style: italic;">stmpe811_IO_DisableAF()</span> functions<br>
+                </span></li><li><span style="font-size: 10pt; font-family: Verdana;">Miscellaneous code cleanup of comments update<br>
+                </span></li></ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 977 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/stmpe811.c

@@ -0,0 +1,977 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 291 - 0
bsp/stm32f411RE/Libraries/BSP/Components/stmpe811/stmpe811.h

@@ -0,0 +1,291 @@
+/**
+  ******************************************************************************
+  * @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
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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****/

+ 278 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ts3510/Release_Notes.html

@@ -0,0 +1,278 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for TS3510 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head><body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for TS3510 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright 2014 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 02-December-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+
+
+
+
+
+
+
+
+            
+            
+            
+            
+            
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+
+
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+
+
+            
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+            
+            
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">ts3510.h: change "\" by "/" in the include path to fix compilation issue under Linux</span></li>
+            </ul>
+
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"><o:p></o:p></span></u></b></p>
+
+
+
+
+
+
+            
+            
+            <ul style="list-style-type: square;">
+<li><span style="font-size: 10pt; font-family: Verdana;">First official release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 256 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ts3510/ts3510.c

@@ -0,0 +1,256 @@
+/**
+  ******************************************************************************
+  * @file    ts3510.c
+  * @author  MCD Application Team
+  * @version V1.0.1
+  * @date    02-December-2014
+  * @brief   This file provides a set of functions needed to manage the TS3510
+  *          IO Expander devices.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 "ts3510.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup Component
+  * @{
+  */ 
+  
+/** @defgroup TS3510
+  * @{
+  */   
+  
+/* Private typedef -----------------------------------------------------------*/
+
+/** @defgroup TS3510_Private_Types_Definitions
+  * @{
+  */ 
+ 
+/* Private define ------------------------------------------------------------*/
+
+/** @defgroup TS3510_Private_Defines
+  * @{
+  */ 
+  
+/* Private macro -------------------------------------------------------------*/
+
+/** @defgroup TS3510_Private_Macros
+  * @{
+  */ 
+  
+/* Private variables ---------------------------------------------------------*/
+
+/** @defgroup TS3510_Private_Variables
+  * @{
+  */ 
+  
+/* Touch screen driver structure initialization */  
+TS_DrvTypeDef ts3510_ts_drv = 
+{
+  ts3510_Init,
+  ts3510_ReadID,
+  ts3510_Reset,
+  
+  ts3510_TS_Start,
+  ts3510_TS_DetectTouch,
+  ts3510_TS_GetXY,
+  
+  ts3510_TS_EnableIT,
+  ts3510_TS_ClearIT,
+  ts3510_TS_ITStatus,
+  ts3510_TS_DisableIT,
+};
+
+/**
+  * @}
+  */ 
+    
+/* Private function prototypes -----------------------------------------------*/
+
+/** @defgroup ts3510_Private_Function_Prototypes
+  * @{
+  */
+
+/* Private functions ---------------------------------------------------------*/
+
+/** @defgroup ts3510_Private_Functions
+  * @{
+  */
+
+/**
+  * @brief  Initialize the ts3510 and configure the needed hardware resources
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None
+  */
+void ts3510_Init(uint16_t DeviceAddr)
+{
+  /* Initialize IO BUS layer */
+  IOE_Init(); 
+  
+}
+ 
+/**
+  * @brief  Reset the ts3510 by Software.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void ts3510_Reset(uint16_t DeviceAddr)
+{
+
+}
+
+/**
+  * @brief  Read the ts3510 IO Expander device ID.
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval The Device ID (two bytes).
+  */
+uint16_t ts3510_ReadID(uint16_t DeviceAddr)
+{
+  return 0;
+}
+
+/**
+  * @brief  Configures the touch Screen Controller (Single point detection)
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval None.
+  */
+void ts3510_TS_Start(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @brief  Return if there is touch detected or not.
+  * @param  DeviceAddr: Device address on communication Bus.
+  * @retval Touch detected state.
+  */
+uint8_t ts3510_TS_DetectTouch(uint16_t DeviceAddr)
+{
+  uint8_t aBufferTS[11];
+  uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
+   
+  /* Prepare for LCD read data */
+  IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
+
+  /* Read TS data from LCD */
+  IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);  
+
+  /* check for first byte */
+  if((aBufferTS[1] == 0xFF) && (aBufferTS[2] == 0xFF) && (aBufferTS[3] == 0xFF) && (aBufferTS[4] == 0xFF))
+  {
+    return 0;
+  }
+  else
+  {
+    return 1;
+  }
+}
+
+/**
+  * @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 ts3510_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
+{
+  uint8_t aBufferTS[11];
+  uint8_t aTmpBuffer[2] = {TS3510_READ_CMD, TS3510_WRITE_CMD};
+  
+  /* Prepare for LCD read data */
+  IOE_WriteMultiple(DeviceAddr, TS3510_SEND_CMD_REG, aTmpBuffer, 2);
+
+  /* Read TS data from LCD */
+  IOE_ReadMultiple(DeviceAddr, TS3510_READ_BLOCK_REG, aBufferTS, 11);  
+
+  /* Calculate positions */
+  *X = (((aBufferTS[1] << 8) | aBufferTS[2]) << 12) / 640;
+  *Y = (((aBufferTS[3] << 8) | aBufferTS[4]) << 12) / 480;
+  
+  /* set position to be relative to 12bits resolution */
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void ts3510_TS_EnableIT(uint16_t DeviceAddr)
+{  
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.    
+  * @retval None
+  */
+void ts3510_TS_DisableIT(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @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 ts3510_TS_ITStatus(uint16_t DeviceAddr)
+{
+  return 0;
+}
+
+/**
+  * @brief  Configure the selected source to generate a global interrupt or not
+  * @param  DeviceAddr: Device address on communication Bus.  
+  * @retval None
+  */
+void ts3510_TS_ClearIT(uint16_t DeviceAddr)
+{
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */      
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 141 - 0
bsp/stm32f411RE/Libraries/BSP/Components/ts3510/ts3510.h

@@ -0,0 +1,141 @@
+/**
+  ******************************************************************************
+  * @file    ts3510.h
+  * @author  MCD Application Team
+  * @version V1.0.1
+  * @date    02-December-2014
+  * @brief   This file contains all the functions prototypes for the
+  *          ts3510.c IO expander driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  *
+  * 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 __TS3510_H
+#define __TS3510_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif   
+   
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/ts.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Component
+  * @{
+  */
+    
+/** @defgroup TS3510
+  * @{
+  */    
+
+/* Exported types ------------------------------------------------------------*/
+
+/** @defgroup TS3510_Exported_Types
+  * @{
+  */ 
+
+/* Exported constants --------------------------------------------------------*/
+  
+/** @defgroup TS3510_Exported_Constants
+  * @{
+  */ 
+
+/*  */   
+#define TS3510_READ_BLOCK_REG                     0x8A
+#define TS3510_SEND_CMD_REG                       0x00
+#define TS3510_READ_CMD                           0x81  
+#define TS3510_WRITE_CMD                          0x08     
+
+
+/**
+  * @}
+  */ 
+  
+/* Exported macro ------------------------------------------------------------*/
+   
+/** @defgroup ts3510_Exported_Macros
+  * @{
+  */ 
+
+/* Exported functions --------------------------------------------------------*/
+  
+/** @defgroup ts3510_Exported_Functions
+  * @{
+  */
+
+/** 
+  * @brief ts3510 Control functions
+  */
+void     ts3510_Init(uint16_t DeviceAddr);
+void     ts3510_Reset(uint16_t DeviceAddr);
+uint16_t ts3510_ReadID(uint16_t DeviceAddr);
+void     ts3510_TS_Start(uint16_t DeviceAddr);
+uint8_t  ts3510_TS_DetectTouch(uint16_t DeviceAddr);
+void     ts3510_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y);
+void     ts3510_TS_EnableIT(uint16_t DeviceAddr);
+void     ts3510_TS_DisableIT(uint16_t DeviceAddr);
+uint8_t  ts3510_TS_ITStatus (uint16_t DeviceAddr);
+void     ts3510_TS_ClearIT (uint16_t DeviceAddr);
+
+void     IOE_Init(void);
+void     IOE_Delay(uint32_t delay);
+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);
+void     IOE_WriteMultiple(uint8_t addr, uint8_t reg, uint8_t *buffer, uint16_t length);
+
+/* Touch screen driver structure */
+extern TS_DrvTypeDef ts3510_ts_drv;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __TS3510_H */
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */       
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 238 - 0
bsp/stm32f411RE/Libraries/BSP/Components/wm8994/Release_Notes.html

@@ -0,0 +1,238 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for WM8994 Component Driver</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for WM8994 Component Driver</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright 2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.0.0 / 24-June-2015 <o:p></o:p></span></h3>
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.h:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Add codec de-initialization function: wm8994_DeInit()</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add Audio IO </span><span style="font-size: 10pt; font-family: Verdana;">de-initialization function prototype: AUDIO_IO_DeInit()</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Add INPUT_DEVICE_INPUT_LINE_1 and&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">INPUT_DEVICE_INPUT_LINE_1</span><span style="font-family: Verdana; font-size: 10pt;"> support for AUDIO IN</span><span style="font-family: Verdana; font-size: 10pt;"></span></li><li><span style="font-family: Verdana; font-size: 10pt;">Add Input audio volume control support</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.c:&nbsp;</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Update wm8994_Init() function to support the Audio IN</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Update wm8994_Stop() function to only stop the codec if it was configured</span></li><li><span style="font-family: Verdana; font-size: 10pt;">Enable&nbsp;VMID_BUF_ENA bit in R57 ANTIPOP register (address 0x39) for all configurations</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-weight: bold;">NOTE:</span> This release must be used with BSP Common 
+driver V4.0.0 or later</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.2 / 12-February-2015 <o:p></o:p></span></h3>
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.c: Update the wm8994_Init() function to set the volume after enabling the dynamic charge pump power control mode&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;"></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.1 / 28-November-2014 <o:p></o:p></span></h3>
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;">wm8994.h: change </span><span style="font-family: Verdana; font-size: 10pt;">"\" by</span><span style="font-family: Verdana; font-size: 10pt;"> "/"&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;">in the</span><span style="font-family: Verdana; font-size: 10pt;"> include path to fix compilation issue with Linux</span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 180px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 18-February-2014 <o:p></o:p></span></h3>
+
+
+
+
+            
+            
+            
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span>
+
+
+            
+            <span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">First official release</span></li>
+            </ul><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic; font-weight: bold;"></span></span><span style="font-size: 10pt; font-family: Verdana;"></span><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="License"></a><span style="font-size: 12pt; color: white;">License<o:p></o:p></span><br></h2>
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<p class="MsoNormal"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><font size="-1"></font><o:p></o:p></span></p>
+<b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 924 - 0
bsp/stm32f411RE/Libraries/BSP/Components/wm8994/wm8994.c

@@ -0,0 +1,924 @@
+/**
+  ******************************************************************************
+  * @file    wm8994.c
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file provides the WM8994 Audio Codec driver.   
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "wm8994.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+  
+/** @addtogroup Components
+  * @{
+  */ 
+
+/** @addtogroup wm8994
+  * @brief     This file provides a set of functions needed to drive the 
+  *            WM8994 audio codec.
+  * @{
+  */
+
+/** @defgroup WM8994_Private_Types
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup WM8994_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 WM8994_Private_Macros
+  * @{
+  */
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup WM8994_Private_Variables
+  * @{
+  */
+
+/* Audio codec driver structure initialization */  
+AUDIO_DrvTypeDef wm8994_drv = 
+{
+  wm8994_Init,
+  wm8994_DeInit,
+  wm8994_ReadID,
+
+  wm8994_Play,
+  wm8994_Pause,
+  wm8994_Resume,
+  wm8994_Stop,  
+
+  wm8994_SetFrequency,
+  wm8994_SetVolume,
+  wm8994_SetMute,  
+  wm8994_SetOutputMode,
+
+  wm8994_Reset
+};
+
+static uint32_t outputEnabled = 0;
+static uint32_t inputEnabled = 0;
+/**
+  * @}
+  */ 
+
+/** @defgroup WM8994_Function_Prototypes
+  * @{
+  */
+static uint8_t CODEC_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
+/**
+  * @}
+  */ 
+
+/** @defgroup WM8994_Private_Functions
+  * @{
+  */ 
+
+/**
+  * @brief Initializes the audio codec and the control interface.
+  * @param DeviceAddr: Device address on communication Bus.   
+  * @param OutputInputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
+  *  OUTPUT_DEVICE_BOTH, OUTPUT_DEVICE_AUTO, INPUT_DEVICE_DIGITAL_MICROPHONE_1,
+  *  INPUT_DEVICE_DIGITAL_MICROPHONE_2, INPUT_DEVICE_INPUT_LINE_1 or INPUT_DEVICE_INPUT_LINE_2.
+  * @param Volume: Initial volume level (from 0 (Mute) to 100 (Max))
+  * @param AudioFreq: Audio Frequency 
+  * @retval 0 if correct communication, else wrong communication
+  */
+uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq)
+{
+  uint32_t counter = 0;
+  uint16_t output_device = OutputInputDevice & 0xFF;
+  uint16_t input_device = OutputInputDevice & 0xFF00;
+  uint16_t power_mgnt_reg_1 = 0;
+  
+  /* Initialize the Control interface of the Audio Codec */
+  AUDIO_IO_Init();
+  /* wm8994 Errata Work-Arounds */
+  counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0003);
+  counter += CODEC_IO_Write(DeviceAddr, 0x817, 0x0000);
+  counter += CODEC_IO_Write(DeviceAddr, 0x102, 0x0000);
+  
+  /* Enable VMID soft start (fast), Start-up Bias Current Enabled */
+  counter += CODEC_IO_Write(DeviceAddr, 0x39, 0x006C);
+  
+  /* Enable bias generator, Enable VMID */
+  counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x0003);
+  
+  /* Add Delay */
+  AUDIO_IO_Delay(50);
+
+  /* Path Configurations for output */
+  if (output_device > 0)
+  {
+    outputEnabled = 1;
+    switch (output_device)
+    {
+    case OUTPUT_DEVICE_SPEAKER:
+      /* Enable DAC1 (Left), Enable DAC1 (Right),
+      Disable DAC2 (Left), Disable DAC2 (Right)*/
+      counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C);
+
+      /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000);
+
+      /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000);
+
+      /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
+
+      /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
+      break;
+
+    case OUTPUT_DEVICE_HEADPHONE:
+      /* Disable DAC1 (Left), Disable DAC1 (Right),
+      Enable DAC2 (Left), Enable DAC2 (Right)*/
+      counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
+
+      /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+
+      /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+
+      /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
+
+      /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
+      break;
+
+    case OUTPUT_DEVICE_BOTH:
+      /* Enable DAC1 (Left), Enable DAC1 (Right),
+      also Enable DAC2 (Left), Enable DAC2 (Right)*/
+      counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C);
+
+      /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+
+      /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+
+      /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
+
+      /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
+      break;
+
+    case OUTPUT_DEVICE_AUTO :
+    default:
+      /* Disable DAC1 (Left), Disable DAC1 (Right),
+      Enable DAC2 (Left), Enable DAC2 (Right)*/
+      counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
+
+      /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+
+      /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+
+      /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
+
+      /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
+      break;
+    }
+  }
+  else
+  {
+    outputEnabled = 0;
+  }
+
+  /* Path Configurations for input */
+  if (input_device > 0)
+  {
+    inputEnabled = 1;
+    switch (input_device)
+    {
+    case INPUT_DEVICE_DIGITAL_MICROPHONE_2 :
+      /* Enable AIF1ADC2 (Left), Enable AIF1ADC2 (Right)
+       * Enable DMICDAT2 (Left), Enable DMICDAT2 (Right)
+       * Enable Left ADC, Enable Right ADC */
+      counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0C30);
+
+      /* Enable AIF1 DRC2 Signal Detect & DRC in AIF1ADC2 Left/Right Timeslot 1 */
+      counter += CODEC_IO_Write(DeviceAddr, 0x450, 0x00DB);
+
+      /* Disable IN1L, IN1R, IN2L, IN2R, Enable Thermal sensor & shutdown */
+      counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6000);
+
+      /* Enable the DMIC2(Left) to AIF1 Timeslot 1 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x608, 0x0002);
+
+      /* Enable the DMIC2(Right) to AIF1 Timeslot 1 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x609, 0x0002);
+
+      /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC2 signal detect */
+      counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000E);
+      break;
+
+    case INPUT_DEVICE_INPUT_LINE_1 :
+      /* Enable AIF1ADC1 (Left), Enable AIF1ADC1 (Right)
+       * Enable Left ADC, Enable Right ADC */
+      counter += CODEC_IO_Write(DeviceAddr, 0x04, 0x0303);
+
+      /* Enable AIF1 DRC1 Signal Detect & DRC in AIF1ADC1 Left/Right Timeslot 0 */
+      counter += CODEC_IO_Write(DeviceAddr, 0x440, 0x00DB);
+
+      /* Enable IN1L and IN1R, Disable IN2L and IN2R, Enable Thermal sensor & shutdown */
+      counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x6350);
+
+      /* Enable the ADCL(Left) to AIF1 Timeslot 0 (Left) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x606, 0x0002);
+
+      /* Enable the ADCR(Right) to AIF1 Timeslot 0 (Right) mixer path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x607, 0x0002);
+
+      /* GPIO1 pin configuration GP1_DIR = output, GP1_FN = AIF1 DRC1 signal detect */
+      counter += CODEC_IO_Write(DeviceAddr, 0x700, 0x000D);
+      break;
+
+    case INPUT_DEVICE_DIGITAL_MICROPHONE_1 :
+    case INPUT_DEVICE_INPUT_LINE_2 :
+    default:
+      /* Actually, no other input devices supported */
+      counter++;
+      break;
+    }
+  }
+  else
+  {
+    inputEnabled = 0;
+  }
+  
+  /*  Clock Configurations */
+  switch (AudioFreq)
+  {
+  case  AUDIO_FREQUENCY_8K:
+    /* AIF1 Sample Rate = 8 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003);
+    break;
+    
+  case  AUDIO_FREQUENCY_16K:
+    /* AIF1 Sample Rate = 16 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033);
+    break;
+    
+  case  AUDIO_FREQUENCY_48K:
+    /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
+    break;
+    
+  case  AUDIO_FREQUENCY_96K:
+    /* AIF1 Sample Rate = 96 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3);
+    break;
+    
+  case  AUDIO_FREQUENCY_11K:
+    /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013);
+    break;
+    
+  case  AUDIO_FREQUENCY_22K:
+    /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043);
+    break;
+    
+  case  AUDIO_FREQUENCY_44K:
+    /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073);
+    break; 
+    
+  default:
+    /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
+    break; 
+  }
+  /* AIF1 Word Length = 16-bits, AIF1 Format = I2S (Default Register Value) */
+  counter += CODEC_IO_Write(DeviceAddr, 0x300, 0x4010);
+  
+  /* slave mode */
+  counter += CODEC_IO_Write(DeviceAddr, 0x302, 0x0000);
+  
+  /* Enable the DSP processing clock for AIF1, Enable the core clock */
+  counter += CODEC_IO_Write(DeviceAddr, 0x208, 0x000A);
+  
+  /* Enable AIF1 Clock, AIF1 Clock Source = MCLK1 pin */
+  counter += CODEC_IO_Write(DeviceAddr, 0x200, 0x0001);
+
+  if (output_device > 0)  /* Audio output selected */
+  {
+    /* Analog Output Configuration */
+
+    /* Enable SPKRVOL PGA, Enable SPKMIXR, Enable SPKLVOL PGA, Enable SPKMIXL */
+    counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0300);
+
+    /* Left Speaker Mixer Volume = 0dB */
+    counter += CODEC_IO_Write(DeviceAddr, 0x22, 0x0000);
+
+    /* Speaker output mode = Class D, Right Speaker Mixer Volume = 0dB ((0x23, 0x0100) = class AB)*/
+    counter += CODEC_IO_Write(DeviceAddr, 0x23, 0x0000);
+
+    /* Unmute DAC2 (Left) to Left Speaker Mixer (SPKMIXL) path,
+    Unmute DAC2 (Right) to Right Speaker Mixer (SPKMIXR) path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x36, 0x0300);
+
+    /* Enable bias generator, Enable VMID, Enable SPKOUTL, Enable SPKOUTR */
+    counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x3003);
+
+    /* Headphone/Speaker Enable */
+
+    /* Enable Class W, Class W Envelope Tracking = AIF1 Timeslot 0 */
+    counter += CODEC_IO_Write(DeviceAddr, 0x51, 0x0005);
+
+    /* Enable bias generator, Enable VMID, Enable HPOUT1 (Left) and Enable HPOUT1 (Right) input stages */
+    /* idem for Speaker */
+    power_mgnt_reg_1 |= 0x0303 | 0x3003;
+    counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
+
+    /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate stages */
+    counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x0022);
+
+    /* Enable Charge Pump */
+    counter += CODEC_IO_Write(DeviceAddr, 0x4C, 0x9F25);
+
+    /* Add Delay */
+    AUDIO_IO_Delay(15);
+
+    /* Select DAC1 (Left) to Left Headphone Output PGA (HPOUT1LVOL) path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0001);
+
+    /* Select DAC1 (Right) to Right Headphone Output PGA (HPOUT1RVOL) path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0001);
+
+    /* Enable Left Output Mixer (MIXOUTL), Enable Right Output Mixer (MIXOUTR) */
+    /* idem for SPKOUTL and SPKOUTR */
+    counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x0030 | 0x0300);
+
+    /* Enable DC Servo and trigger start-up mode on left and right channels */
+    counter += CODEC_IO_Write(DeviceAddr, 0x54, 0x0033);
+
+    /* Add Delay */
+    AUDIO_IO_Delay(250);
+
+    /* Enable HPOUT1 (Left) and HPOUT1 (Right) intermediate and output stages. Remove clamps */
+    counter += CODEC_IO_Write(DeviceAddr, 0x60, 0x00EE);
+
+    /* Unmutes */
+
+    /* Unmute DAC 1 (Left) */
+    counter += CODEC_IO_Write(DeviceAddr, 0x610, 0x00C0);
+
+    /* Unmute DAC 1 (Right) */
+    counter += CODEC_IO_Write(DeviceAddr, 0x611, 0x00C0);
+
+    /* Unmute the AIF1 Timeslot 0 DAC path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0000);
+
+    /* Unmute DAC 2 (Left) */
+    counter += CODEC_IO_Write(DeviceAddr, 0x612, 0x00C0);
+
+    /* Unmute DAC 2 (Right) */
+    counter += CODEC_IO_Write(DeviceAddr, 0x613, 0x00C0);
+
+    /* Unmute the AIF1 Timeslot 1 DAC2 path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0000);
+    
+    /* Volume Control */
+    wm8994_SetVolume(DeviceAddr, Volume);
+  }
+
+  if (input_device > 0) /* Audio input selected */
+  {
+    if ((input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_1) || (input_device == INPUT_DEVICE_DIGITAL_MICROPHONE_2))
+    {
+      /* Enable Microphone bias 1 generator, Enable VMID */
+      power_mgnt_reg_1 |= 0x0013;
+      counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
+
+      /* ADC oversample enable */
+      counter += CODEC_IO_Write(DeviceAddr, 0x620, 0x0002);
+
+      /* AIF ADC2 HPF enable, HPF cut = voice mode 1 fc=127Hz at fs=8kHz */
+      counter += CODEC_IO_Write(DeviceAddr, 0x411, 0x3800);
+    }
+    else if ((input_device == INPUT_DEVICE_INPUT_LINE_1) || (input_device == INPUT_DEVICE_INPUT_LINE_2))
+    {
+      /* Enable normal bias generator, Enable VMID */
+      power_mgnt_reg_1 |= 0x0003;
+      counter += CODEC_IO_Write(DeviceAddr, 0x01, power_mgnt_reg_1);
+
+      /* Disable mute on IN1L, IN1L Volume = +0dB */
+      counter += CODEC_IO_Write(DeviceAddr, 0x18, 0x000B);
+
+      /* Disable mute on IN1R, IN1R Volume = +0dB */
+      counter += CODEC_IO_Write(DeviceAddr, 0x1A, 0x000B);
+
+      /* Disable mute on IN1L_TO_MIXINL, Gain = +0dB */
+      counter += CODEC_IO_Write(DeviceAddr, 0x29, 0x0025);
+
+      /* Disable mute on IN1R_TO_MIXINL, Gain = +0dB */
+      counter += CODEC_IO_Write(DeviceAddr, 0x2A, 0x0025);
+
+      /* IN1LN_TO_IN1L, IN1LP_TO_VMID, IN1RN_TO_IN1R, IN1RP_TO_VMID */
+      counter += CODEC_IO_Write(DeviceAddr, 0x28, 0x0011);
+
+      /* AIF ADC1 HPF enable, HPF cut = hifi mode fc=4Hz at fs=48kHz */
+      counter += CODEC_IO_Write(DeviceAddr, 0x410, 0x1800);
+    }
+    /* Volume Control */
+    wm8994_SetVolume(DeviceAddr, Volume);
+  }
+  /* Return communication control value */
+  return counter;  
+}
+
+/**
+  * @brief  Deinitializes the audio codec.
+  * @param  None
+  * @retval  None
+  */
+void wm8994_DeInit(void)
+{
+  /* Deinitialize Audio Codec interface */
+  AUDIO_IO_DeInit();
+}
+
+/**
+  * @brief  Get the WM8994 ID.
+  * @param DeviceAddr: Device address on communication Bus.
+  * @retval The WM8994 ID 
+  */
+uint32_t wm8994_ReadID(uint16_t DeviceAddr)
+{
+  /* Initialize the Control interface of the Audio Codec */
+  AUDIO_IO_Init();
+
+  return ((uint32_t)AUDIO_IO_Read(DeviceAddr, WM8994_CHIPID_ADDR));
+}
+
+/**
+  * @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 wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size)
+{
+  uint32_t counter = 0;
+ 
+  /* Resumes the audio file playing */  
+  /* Unmute the output first */
+  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
+  
+  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 wm8994_Pause(uint16_t DeviceAddr)
+{  
+  uint32_t counter = 0;
+ 
+  /* Pause the audio file playing */
+  /* Mute the output first */
+  counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
+  
+  /* Put the Codec in Power save mode */
+  counter += CODEC_IO_Write(DeviceAddr, 0x02, 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 wm8994_Resume(uint16_t DeviceAddr)
+{
+  uint32_t counter = 0;
+ 
+  /* Resumes the audio file playing */  
+  /* Unmute the output first */
+  counter += wm8994_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_SW: only mutes the audio codec. When resuming from this 
+  *                           mode the codec keeps the previous initialization
+  *                           (no need to re-Initialize the codec registers).
+  *          - 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 wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
+{
+  uint32_t counter = 0;
+
+  if (outputEnabled != 0)
+  {
+    /* Mute the output first */
+    counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
+
+    if (CodecPdwnMode == CODEC_PDWN_SW)
+    {
+       /* Only output mute required*/
+    }
+    else /* CODEC_PDWN_HW */
+    {
+      /* Mute the AIF1 Timeslot 0 DAC1 path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200);
+
+      /* Mute the AIF1 Timeslot 1 DAC2 path */
+      counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200);
+
+      /* Disable DAC1L_TO_HPOUT1L */
+      counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0000);
+
+      /* Disable DAC1R_TO_HPOUT1R */
+      counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0000);
+
+      /* Disable DAC1 and DAC2 */
+      counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0000);
+
+      /* Reset Codec by writing in 0x0000 address register */
+      counter += CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000);
+
+      outputEnabled = 0;
+    }
+  }
+  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 wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
+{
+  uint32_t counter = 0;
+  uint8_t convertedvol = VOLUME_CONVERT(Volume);
+
+  /* Output volume */
+  if (outputEnabled != 0)
+  {
+    if(convertedvol > 0x3E)
+    {
+      /* Unmute audio codec */
+      counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
+
+      /* Left Headphone Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x3F | 0x140);
+
+      /* Right Headphone Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x3F | 0x140);
+
+      /* Left Speaker Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x26, 0x3F | 0x140);
+
+      /* Right Speaker Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x27, 0x3F | 0x140);
+    }
+    else if (Volume == 0)
+    {
+      /* Mute audio codec */
+      counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON);
+    }
+    else
+    {
+      /* Unmute audio codec */
+      counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
+
+      /* Left Headphone Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x1C, convertedvol | 0x140);
+
+      /* Right Headphone Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x1D, convertedvol | 0x140);
+
+      /* Left Speaker Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x26, convertedvol | 0x140);
+
+      /* Right Speaker Volume */
+      counter += CODEC_IO_Write(DeviceAddr, 0x27, convertedvol | 0x140);
+    }
+  }
+
+  /* Input volume */
+  if (inputEnabled != 0)
+  {
+    convertedvol = VOLUME_IN_CONVERT(Volume);
+
+    /* Left AIF1 ADC1 volume */
+    counter += CODEC_IO_Write(DeviceAddr, 0x400, convertedvol | 0x100);
+
+    /* Right AIF1 ADC1 volume */
+    counter += CODEC_IO_Write(DeviceAddr, 0x401, convertedvol | 0x100);
+
+    /* Left AIF1 ADC2 volume */
+    counter += CODEC_IO_Write(DeviceAddr, 0x404, convertedvol | 0x100);
+
+    /* Right AIF1 ADC2 volume */
+    counter += CODEC_IO_Write(DeviceAddr, 0x405, convertedvol | 0x100);
+  }
+  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 wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
+{
+  uint32_t counter = 0;
+  
+  if (outputEnabled != 0)
+  {
+    /* Set the Mute mode */
+    if(Cmd == AUDIO_MUTE_ON)
+    {
+      /* Soft Mute the AIF1 Timeslot 0 DAC1 path L&R */
+      counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200);
+
+      /* Soft Mute the AIF1 Timeslot 1 DAC2 path L&R */
+      counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200);
+    }
+    else /* AUDIO_MUTE_OFF Disable the Mute */
+    {
+      /* Unmute the AIF1 Timeslot 0 DAC1 path L&R */
+      counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0000);
+
+      /* Unmute the AIF1 Timeslot 1 DAC2 path L&R */
+      counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0000);
+    }
+  }
+  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 or OUTPUT_DEVICE_AUTO 
+  * @retval 0 if correct communication, else wrong communication
+  */
+uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
+{
+  uint32_t counter = 0; 
+  
+  switch (Output) 
+  {
+  case OUTPUT_DEVICE_SPEAKER:
+    /* Enable DAC1 (Left), Enable DAC1 (Right), 
+    Disable DAC2 (Left), Disable DAC2 (Right)*/
+    counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0C0C);
+    
+    /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0000);
+    
+    /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0000);
+    
+    /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
+    
+    /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
+    break;
+    
+  case OUTPUT_DEVICE_HEADPHONE:
+    /* Disable DAC1 (Left), Disable DAC1 (Right), 
+    Enable DAC2 (Left), Enable DAC2 (Right)*/
+    counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
+    
+    /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+    
+    /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+    
+    /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
+    
+    /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
+    break;
+    
+  case OUTPUT_DEVICE_BOTH:
+    /* Enable DAC1 (Left), Enable DAC1 (Right), 
+    also Enable DAC2 (Left), Enable DAC2 (Right)*/
+    counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303 | 0x0C0C);
+    
+    /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+    
+    /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+    
+    /* Enable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0002);
+    
+    /* Enable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0002);
+    break;
+    
+  default:
+    /* Disable DAC1 (Left), Disable DAC1 (Right), 
+    Enable DAC2 (Left), Enable DAC2 (Right)*/
+    counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0303);
+    
+    /* Enable the AIF1 Timeslot 0 (Left) to DAC 1 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x601, 0x0001);
+    
+    /* Enable the AIF1 Timeslot 0 (Right) to DAC 1 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x602, 0x0001);
+    
+    /* Disable the AIF1 Timeslot 1 (Left) to DAC 2 (Left) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x604, 0x0000);
+    
+    /* Disable the AIF1 Timeslot 1 (Right) to DAC 2 (Right) mixer path */
+    counter += CODEC_IO_Write(DeviceAddr, 0x605, 0x0000);
+    break;    
+  }  
+  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 wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq)
+{
+  uint32_t counter = 0;
+ 
+  /*  Clock Configurations */
+  switch (AudioFreq)
+  {
+  case  AUDIO_FREQUENCY_8K:
+    /* AIF1 Sample Rate = 8 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0003);
+    break;
+    
+  case  AUDIO_FREQUENCY_16K:
+    /* AIF1 Sample Rate = 16 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0033);
+    break;
+    
+  case  AUDIO_FREQUENCY_48K:
+    /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
+    break;
+    
+  case  AUDIO_FREQUENCY_96K:
+    /* AIF1 Sample Rate = 96 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x00A3);
+    break;
+    
+  case  AUDIO_FREQUENCY_11K:
+    /* AIF1 Sample Rate = 11.025 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0013);
+    break;
+    
+  case  AUDIO_FREQUENCY_22K:
+    /* AIF1 Sample Rate = 22.050 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0043);
+    break;
+    
+  case  AUDIO_FREQUENCY_44K:
+    /* AIF1 Sample Rate = 44.1 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0073);
+    break; 
+    
+  default:
+    /* AIF1 Sample Rate = 48 (KHz), ratio=256 */ 
+    counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0083);
+    break; 
+  }
+  return counter;
+}
+
+/**
+  * @brief Resets wm8994 registers.
+  * @param DeviceAddr: Device address on communication Bus. 
+  * @retval 0 if correct communication, else wrong communication
+  */
+uint32_t wm8994_Reset(uint16_t DeviceAddr)
+{
+  uint32_t counter = 0;
+  
+  /* Reset Codec by writing in 0x0000 address register */
+  counter = CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000);
+  outputEnabled = 0;
+  inputEnabled=0;
+
+  return counter;
+}
+
+/**
+  * @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, uint16_t Reg, uint16_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****/

+ 187 - 0
bsp/stm32f411RE/Libraries/BSP/Components/wm8994/wm8994.h

@@ -0,0 +1,187 @@
+/**
+  ******************************************************************************
+  * @file    wm8994.h
+  * @author  MCD Application Team
+  * @version V2.0.0
+  * @date    24-June-2015
+  * @brief   This file contains all the functions prototypes for the 
+  *          wm8994.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __WM8994_H
+#define __WM8994_H
+
+/* Includes ------------------------------------------------------------------*/
+#include "../Common/audio.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup Component
+  * @{
+  */ 
+  
+/** @addtogroup WM8994
+  * @{
+  */
+
+/** @defgroup WM8994_Exported_Types
+  * @{
+  */
+
+/**
+  * @}
+  */
+
+/** @defgroup WM8994_Exported_Constants
+  * @{
+  */ 
+
+/******************************************************************************/
+/***************************  Codec User defines ******************************/
+/******************************************************************************/
+/* Codec output DEVICE */
+#define OUTPUT_DEVICE_SPEAKER                 ((uint16_t)0x0001)
+#define OUTPUT_DEVICE_HEADPHONE               ((uint16_t)0x0002)
+#define OUTPUT_DEVICE_BOTH                    ((uint16_t)0x0003)
+#define OUTPUT_DEVICE_AUTO                    ((uint16_t)0x0004)
+#define INPUT_DEVICE_DIGITAL_MICROPHONE_1     ((uint16_t)0x0100)
+#define INPUT_DEVICE_DIGITAL_MICROPHONE_2     ((uint16_t)0x0200)
+#define INPUT_DEVICE_INPUT_LINE_1             ((uint16_t)0x0300)
+#define INPUT_DEVICE_INPUT_LINE_2             ((uint16_t)0x0400)
+
+/* 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)  
+
+#define VOLUME_CONVERT(Volume)        (((Volume) > 100)? 100:((uint8_t)(((Volume) * 63) / 100)))
+#define VOLUME_IN_CONVERT(Volume)     (((Volume) >= 100)? 239:((uint8_t)(((Volume) * 240) / 100)))
+
+/******************************************************************************/
+/****************************** REGISTER MAPPING ******************************/
+/******************************************************************************/
+/** 
+  * @brief  WM8994 ID  
+  */  
+#define  WM8994_ID    0x8994
+
+/**
+  * @brief Device ID Register: Reading from this register will indicate device 
+  *                            family ID 8994h
+  */
+#define WM8994_CHIPID_ADDR                  0x00
+
+/**
+  * @}
+  */ 
+
+/** @defgroup WM8994_Exported_Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup WM8994_Exported_Functions
+  * @{
+  */
+    
+/*------------------------------------------------------------------------------
+                           Audio Codec functions 
+------------------------------------------------------------------------------*/
+/* High Layer codec functions */
+uint32_t wm8994_Init(uint16_t DeviceAddr, uint16_t OutputInputDevice, uint8_t Volume, uint32_t AudioFreq);
+void     wm8994_DeInit(void);
+uint32_t wm8994_ReadID(uint16_t DeviceAddr);
+uint32_t wm8994_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
+uint32_t wm8994_Pause(uint16_t DeviceAddr);
+uint32_t wm8994_Resume(uint16_t DeviceAddr);
+uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t Cmd);
+uint32_t wm8994_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
+uint32_t wm8994_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
+uint32_t wm8994_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
+uint32_t wm8994_SetFrequency(uint16_t DeviceAddr, uint32_t AudioFreq);
+uint32_t wm8994_Reset(uint16_t DeviceAddr);
+
+/* AUDIO IO functions */
+void    AUDIO_IO_Init(void);
+void    AUDIO_IO_DeInit(void);
+void    AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
+uint8_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
+void    AUDIO_IO_Delay(uint32_t Delay);
+
+/* Audio driver structure */
+extern AUDIO_DrvTypeDef   wm8994_drv;
+
+#endif /* __WM8994_H */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 171 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/Release_Notes.html

@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+
+  
+  <link rel="File-List" href="Library_files/filelist.xml">
+
+  
+  <link rel="Edit-Time-Data" href="Library_files/editdata.mso"><!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><title>Release Notes for STM32446E_EVAL Evaluation Board Drivers</title><!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>STMicroelectronics</o:Author> <o:LastAuthor>STMicroelectronics</o:LastAuthor> <o:Revision>37</o:Revision> <o:TotalTime>136</o:TotalTime> <o:Created>2009-02-27T19:26:00Z</o:Created> <o:LastSaved>2009-03-01T17:56:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>522</o:Words> <o:Characters>2977</o:Characters> <o:Company>STMicroelectronics</o:Company> <o:Lines>24</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3493</o:CharactersWithSpaces> <o:Version>11.6568</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>110</w:Zoom> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]-->
+
+
+  
+
+  
+
+  
+  <style>
+<!--
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+{mso-style-parent:"";
+margin:0in;
+margin-bottom:.0001pt;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+h2
+{mso-style-next:Normal;
+margin-top:12.0pt;
+margin-right:0in;
+margin-bottom:3.0pt;
+margin-left:0in;
+mso-pagination:widow-orphan;
+page-break-after:avoid;
+mso-outline-level:2;
+font-size:14.0pt;
+font-family:Arial;
+font-weight:bold;
+font-style:italic;}
+a:link, span.MsoHyperlink
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+a:visited, span.MsoHyperlinkFollowed
+{color:blue;
+text-decoration:underline;
+text-underline:single;}
+p
+{mso-margin-top-alt:auto;
+margin-right:0in;
+mso-margin-bottom-alt:auto;
+margin-left:0in;
+mso-pagination:widow-orphan;
+font-size:12.0pt;
+font-family:"Times New Roman";
+mso-fareast-font-family:"Times New Roman";}
+@page Section1
+{size:8.5in 11.0in;
+margin:1.0in 1.25in 1.0in 1.25in;
+mso-header-margin:.5in;
+mso-footer-margin:.5in;
+mso-paper-source:0;}
+div.Section1
+{page:Section1;}
+-->
+  </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="5122"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]-->
+  <meta content="MCD Application Team" name="author"></head>
+<body link="blue" vlink="blue">
+<div class="Section1">
+<p class="MsoNormal"><span style="font-family: Arial;"><o:p><br>
+</o:p></span></p>
+<div align="center">
+<table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+  <tbody>
+    <tr>
+      <td style="padding: 0cm;" valign="top">
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" cellspacing="0" width="900">
+        <tbody>
+          <tr>
+            <td style="vertical-align: top;">
+            <p class="MsoNormal"><span style="font-size: 8pt; font-family: Arial; color: blue;"><a href="../../../Release_Notes.html">Back to Release page</a><o:p></o:p></span></p>
+            </td>
+          </tr>
+          <tr style="">
+            <td style="padding: 1.5pt;">
+            <h1 style="margin-bottom: 18pt; text-align: center;" align="center"><span style="font-size: 20pt; font-family: Verdana; color: rgb(51, 102, 255);">Release
+Notes for STM32446E_EVAL Evaluation Board Drivers</span><span style="font-size: 20pt; font-family: Verdana;"><o:p></o:p></span></h1>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;">Copyright
+2015 STMicroelectronics</span><span style="color: black;"><u1:p></u1:p><o:p></o:p></span></p>
+            <p class="MsoNormal" style="text-align: center;" align="center"><span style="font-size: 10pt; font-family: Arial; color: black;"><img alt="" id="_x0000_i1025" src="../../../_htmresc/st_logo.png" style="border: 0px solid ; width: 86px; height: 65px;"></span><span style="font-size: 10pt;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-family: Arial; display: none;"><o:p>&nbsp;</o:p></span></p>
+      <table class="MsoNormalTable" style="width: 675pt;" border="0" cellpadding="0" width="900">
+        <tbody>
+          <tr style="">
+            <td style="padding: 0cm;" valign="top">
+            <span style="font-family: &quot;Times New Roman&quot;;">
+            </span>
+            <h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><a name="History"></a><span style="font-size: 12pt; color: white;">Update History</span></h2>
+            <h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.1.0 / 14-August-2015</span></h3><p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            
+            <ul><li><span style="font-family: Verdana; font-size: 10pt;">stm32446e_eval.c</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Add AUDIO_IO_DeInit() function to align with BSP Components Common drivers V4.0.0</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;">stm32446e_eval_audio.c</span></li><ul><li class="MsoNormal" style="margin: 4.5pt 0in; font-size: 12pt; font-family: 'Times New Roman'; color: black;"><span style="font-size: 10pt; font-family: Verdana;">Reset audio codec before initialization</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul></ul><span style="font-family: Verdana; font-size: 10pt;"></span><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt; width: 200px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V1.0.0 / 11-March-2015</span></h3>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt;"><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;">Main
+Changes<o:p></o:p></span></u></b></p>
+
+
+            
+            <ul style="margin-top: 0cm;" type="square">
+<li class="MsoNormal"><span style="font-family: Verdana; font-size: 10pt;">First official 
+release</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><h2 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><span style="font-size: 12pt; color: white;">License<o:p></o:p></span></h2>
+
+            <div style="text-align: justify;">
+            <div style="text-align: justify;"><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:</span><br>
+            </font>
+            <ol><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Redistributions
+in binary form must reproduce the above copyright notice, this list of
+conditions and the following disclaimer in </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">the documentation and/or other materials provided with the distribution.</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></font></li><li><font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived </span><br>
+                </font>
+              </li></ol>
+            <font size="-1"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from this software without specific prior written permission.</span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span><br>
+            <span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR </span><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></font>
+            
+            </div>
+<span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></div>
+<span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span> <b><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></b>
+            
+            <div class="MsoNormal" style="text-align: center;" align="center"><span style="color: black;">
+            <hr align="center" size="2" width="100%"></span></div>
+            <p class="MsoNormal" style="margin: 4.5pt 0cm 4.5pt 18pt; text-align: center;" align="center"><span style="font-size: 10pt; font-family: Verdana; color: black;">For
+complete documentation on </span><span style="font-size: 10pt; font-family: Verdana;">STM32<span style="color: black;">&nbsp;Microcontrollers
+visit </span><u><span style="color: blue;"><a href="http://www.st.com/internet/mcu/class/1734.jsp" target="_blank">www.st.com/STM32</a></span></u></span><span style="font-size: 10pt; font-family: Verdana;"><a target="_blank" href="http://www.st.com/internet/mcu/family/141.jsp"><u><span style="color: blue;"></span></u></a></span><span style="font-size: 10pt; font-family: Verdana;"><u><span style="color: blue;"></span></u></span><span style="color: black;"><o:p></o:p></span></p>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <p class="MsoNormal"><span style="font-size: 10pt;"><o:p></o:p></span></p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</div>
+<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
+</div>
+
+</body></html>

+ 1362 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval.c

@@ -0,0 +1,1362 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file provides a set of firmware functions to manage LEDs, 
+  *          push-buttons and COM ports available on STM32446E-EVAL evaluation
+  *          board(MB1045) RevB from STMicroelectronics.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+  
+/* File Info: ------------------------------------------------------------------
+                                   User NOTE
+
+   This driver requires the stm32446e_eval_io to manage the joystick
+
+------------------------------------------------------------------------------*/
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval.h"
+#if defined(USE_IOEXPANDER)
+#include "stm32446e_eval_io.h"
+#endif /* USE_IOEXPANDER */
+
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL STM32446E-EVAL LOW LEVEL
+  * @{
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_TypesDefinitions STM32446E Eval Low Level Private Typedef
+  * @{
+  */
+typedef struct
+{
+  __IO uint16_t REG;
+  __IO uint16_t RAM;
+}LCD_CONTROLLER_TypeDef;
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_Defines STM32446E Eval Low Level Private Def
+  * @{
+  */
+/**
+ * @brief STM32446E EVAL BSP Driver version number V1.1.0
+   */
+#define __STM32446E_EVAL_BSP_VERSION_MAIN   (0x01) /*!< [31:24] main version */
+#define __STM32446E_EVAL_BSP_VERSION_SUB1   (0x01) /*!< [23:16] sub1 version */
+#define __STM32446E_EVAL_BSP_VERSION_SUB2   (0x00) /*!< [15:8]  sub2 version */
+#define __STM32446E_EVAL_BSP_VERSION_RC     (0x00) /*!< [7:0]  release candidate */
+#define __STM32446E_EVAL_BSP_VERSION         ((__STM32446E_EVAL_BSP_VERSION_MAIN << 24)\
+                                             |(__STM32446E_EVAL_BSP_VERSION_SUB1 << 16)\
+                                             |(__STM32446E_EVAL_BSP_VERSION_SUB2 << 8 )\
+                                             |(__STM32446E_EVAL_BSP_VERSION_RC))
+											                                    
+/* compared to F4xG we use BANK1 rather then BANK3 since we use FMC_NE1 signal (not FMC_NE3) */																				
+#define FMC_BANK1_BASE  ((uint32_t)(0x60000000 | 0x00000000))  
+#define FMC_BANK3_BASE  ((uint32_t)(0x60000000 | 0x08000000))  
+#define FMC_BANK1       ((LCD_CONTROLLER_TypeDef *) FMC_BANK1_BASE)
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_Macros STM32446E Eval Low Level Private Macro
+  * @{
+  */
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_Variables STM32446E Eval Low Level Variables 
+  * @{
+  */
+
+#if defined(USE_IOEXPANDER)
+const uint32_t GPIO_PIN[LEDn] = {LED1_PIN,
+                                 LED2_PIN,
+                                 LED3_PIN,
+                                 LED4_PIN};
+#else
+const uint32_t GPIO_PIN[LEDn] = {LED1_PIN,
+                                 LED3_PIN};
+#endif /* USE_IOEXPANDER */
+
+
+GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT,
+                                      TAMPER_BUTTON_GPIO_PORT,
+                                      KEY_BUTTON_GPIO_PORT};
+
+const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN,
+                                      TAMPER_BUTTON_PIN,
+                                      KEY_BUTTON_PIN};
+
+const uint16_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn,
+                                       TAMPER_BUTTON_EXTI_IRQn,
+                                       KEY_BUTTON_EXTI_IRQn};
+
+USART_TypeDef* COM_USART[COMn] = {EVAL_COM1};
+
+GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT};
+
+GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT};
+
+const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN};
+
+const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN};
+
+const uint16_t COM_TX_AF[COMn] = {EVAL_COM1_TX_AF};
+
+const uint16_t COM_RX_AF[COMn] = {EVAL_COM1_RX_AF};
+
+static FMPI2C_HandleTypeDef hEvalI2c;
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_FunctionPrototypes STM32446E Eval Low Level Private Prototypes
+  * @{
+  */
+static void     I2Cx_MspInit(void);
+static void     I2Cx_Init(void);
+#if defined(USE_IOEXPANDER)
+static void     I2Cx_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
+static uint8_t  I2Cx_Read(uint8_t Addr, uint8_t Reg);
+#endif /* USE_IOEXPANDER */     
+
+static HAL_StatusTypeDef I2Cx_ReadMultiple(uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
+static HAL_StatusTypeDef I2Cx_WriteMultiple(uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length);
+static HAL_StatusTypeDef I2Cx_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
+static void     I2Cx_Error(uint8_t Addr);
+
+static void     FMC_BANK1_WriteData(uint16_t Data);
+static void     FMC_BANK1_WriteReg(uint8_t Reg);
+static uint16_t FMC_BANK1_ReadData(void);
+static void     FMC_BANK1_Init(void);
+static void     FMC_BANK1_MspInit(void);
+
+/* IOExpander IO functions */
+#if defined(USE_IOEXPANDER)
+void            MFX_IO_Init(void);
+void            MFX_IO_DeInit(void);
+void            MFX_IO_ITConfig(void);
+void            MFX_IO_Delay(uint32_t Delay);
+void            MFX_IO_Write(uint16_t Addr, uint8_t Reg, uint8_t Value);
+uint8_t         MFX_IO_Read(uint16_t Addr, uint8_t Reg);
+uint16_t        MFX_IO_ReadMultiple(uint16_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
+void            MFX_IO_Wakeup(void);
+void            MFX_IO_EnableWakeupPin(void);
+#endif /* USE_IOEXPANDER */
+
+/* LCD IO functions */
+void            LCD_IO_Init(void);
+void            LCD_IO_WriteData(uint16_t RegValue);
+void            LCD_IO_WriteReg(uint8_t Reg);
+uint16_t        LCD_IO_ReadData(void);
+
+/* AUDIO IO functions */
+void            AUDIO_IO_Init(void);
+void            AUDIO_IO_DeInit(void);
+void            AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
+uint16_t        AUDIO_IO_Read(uint8_t Addr, uint16_t Reg);
+void            AUDIO_IO_Delay(uint32_t Delay);
+
+/* CAMERA IO functions */
+void            CAMERA_IO_Init(void);
+void            CAMERA_Delay(uint32_t Delay);
+void            CAMERA_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value);
+uint16_t        CAMERA_IO_Read(uint8_t Addr, uint16_t Reg);
+
+/* I2C EEPROM IO function */
+void                EEPROM_IO_Init(void);
+HAL_StatusTypeDef   EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
+HAL_StatusTypeDef   EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
+HAL_StatusTypeDef   EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
+
+
+/**
+  * @}
+  */
+    
+
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Private_Functions STM32446E Eval Low Level Private Functions
+  * @{
+  */ 
+
+  /**
+  * @brief  This method returns the STM32446E EVAL BSP Driver revision
+  * @param  None
+  * @retval version: 0xXYZR (8bits for each decimal, R for RC)
+  */
+uint32_t BSP_GetVersion(void)
+{
+  return __STM32446E_EVAL_BSP_VERSION;
+}
+
+/**
+  * @brief  Configures LEDs.
+  * @param  Led: LED to be configured. 
+  *          This parameter can be one of the following values:
+  *            @arg  LED1
+  *            @arg  LED2
+  *            @arg  LED3
+  *            @arg  LED4
+  * @retval None
+  */
+void BSP_LED_Init(Led_TypeDef Led)
+{
+#if !defined(USE_STM32446E_EVAL_REVA)
+  GPIO_InitTypeDef  gpio_init_structure;
+
+  /* On RevB led1 and Led3 are on GPIO while Led2 and Led4 on Mfx*/
+  if ((Led == LED1) || (Led == LED3))
+  {
+    /* Enable the GPIO_LED clock */
+    LEDx_GPIO_CLK_ENABLE();
+
+    /* Configure the GPIO_LED pin */
+    gpio_init_structure.Pin = GPIO_PIN[Led];
+    gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
+    gpio_init_structure.Pull = GPIO_PULLUP;
+    gpio_init_structure.Speed = GPIO_SPEED_HIGH;
+  
+    HAL_GPIO_Init(LEDx_GPIO_PORT, &gpio_init_structure);
+    
+    /* By default, turn off LED */
+    HAL_GPIO_WritePin(LEDx_GPIO_PORT, GPIO_PIN[Led], GPIO_PIN_SET);
+  }
+  else  /* Led2 and Led4 */
+  {
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+#if defined(USE_IOEXPANDER)  /* (USE_IOEXPANDER always defined for RevA) */
+    /* Initialize the IO functionalities (Mfx) */
+    BSP_IO_Init();
+    /* GPIO_PIN[Led]  depends on the board revision: */
+    /*  - in case of RevA all leds are on IOEXPANDER (Mfx)  */
+    /*  - in case of RevB just led 2 and led4 on IOEXPANDER (Mfx) */
+    BSP_IO_ConfigPin(GPIO_PIN[Led], IO_MODE_OUTPUT_PP_PU);
+    BSP_IO_WritePin(GPIO_PIN[Led], BSP_IO_PIN_SET);
+#endif /* USE_IOEXPANDER */     
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  }
+#endif /* !USE_STM32446E_EVAL_REVA */
+}
+
+
+/**
+  * @brief  DeInit LEDs.
+  * @param  Led: LED to be configured. 
+  *          This parameter can be one of the following values:
+  *            @arg  LED1
+  *            @arg  LED2
+  *            @arg  LED3
+  *            @arg  LED4
+  * @note Led DeInit does not disable the GPIO clock nor disable the Mfx 
+  * @retval None
+  */
+void BSP_LED_DeInit(Led_TypeDef Led)
+{
+#if !defined(USE_STM32446E_EVAL_REVA)
+  GPIO_InitTypeDef  gpio_init_structure;
+
+  /* On RevB led1 and Led3 are on GPIO while Led2 and Led4 on Mfx*/
+  if ((Led == LED1) || (Led == LED3))
+  {
+    /* Turn off LED */
+    HAL_GPIO_WritePin(LEDx_GPIO_PORT, GPIO_PIN[Led], GPIO_PIN_RESET);
+    /* DeInit the GPIO_LED pin */
+    gpio_init_structure.Pin = GPIO_PIN[Led];
+    HAL_GPIO_DeInit(LEDx_GPIO_PORT, gpio_init_structure.Pin);
+  }
+  else
+  {
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+#if defined(USE_IOEXPANDER)   /* (USE_IOEXPANDER always defined for RevA) */
+    /* GPIO_PIN[Led]  depends on the board revision: */
+    /*  - in case of RevA all leds are on IOEXPANDER (Mfx)  */
+    /*  - in case of RevB just led 2 and led4 on IOEXPANDER (Mfx) */
+    BSP_IO_ConfigPin(GPIO_PIN[Led], IO_MODE_OFF);
+#endif /* USE_IOEXPANDER */     
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  }
+#endif /* !USE_STM32446E_EVAL_REVA */
+}
+
+/**
+  * @brief  Turns selected LED On.
+  * @param  Led: LED to be set on 
+  *          This parameter can be one of the following values:
+  *            @arg  LED1
+  *            @arg  LED2
+  *            @arg  LED3
+  *            @arg  LED4
+  * @retval None
+  */
+void BSP_LED_On(Led_TypeDef Led)
+{
+  
+#if !defined(USE_STM32446E_EVAL_REVA)
+  /* On RevB led1 and Led3 are on GPIO while Led2 and Led4 on Mfx*/
+  if ((Led == LED1) || (Led == LED3))
+  {
+     HAL_GPIO_WritePin(LEDx_GPIO_PORT, GPIO_PIN[Led], GPIO_PIN_RESET);
+  }
+  else
+  {
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+#if defined(USE_IOEXPANDER) /* (USE_IOEXPANDER always defined for RevA) */
+    /* GPIO_PIN[Led]  depends on the board revision: */
+    /*  - in case of RevA all leds are on IOEXPANDER (Mfx)  */
+    /*  - in case of RevB just led 2 and led4 on IOEXPANDER (Mfx) */
+    BSP_IO_WritePin(GPIO_PIN[Led], BSP_IO_PIN_RESET);
+#endif /* USE_IOEXPANDER */     
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  }
+#endif /* !USE_STM32446E_EVAL_REVA */
+}
+
+/**
+  * @brief  Turns selected LED Off. 
+  * @param  Led: LED to be set off
+  *          This parameter can be one of the following values:
+  *            @arg  LED1
+  *            @arg  LED2
+  *            @arg  LED3
+  *            @arg  LED4
+  * @retval None
+  */
+void BSP_LED_Off(Led_TypeDef Led)
+{
+  
+#if !defined(USE_STM32446E_EVAL_REVA)
+  /* On RevB led1 and Led3 are on GPIO while Led2 and Led4 on Mfx*/
+  if ((Led == LED1) || (Led == LED3))
+  {
+     HAL_GPIO_WritePin(LEDx_GPIO_PORT, GPIO_PIN[Led], GPIO_PIN_SET);
+  }
+  else
+  {
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+#if defined(USE_IOEXPANDER) /* (USE_IOEXPANDER always defined for RevA) */
+    /* GPIO_PIN[Led]  depends on the board revision: */
+    /*  - in case of RevA all leds are on IOEXPANDER (Mfx)  */
+    /*  - in case of RevB just led 2 and led4 on IOEXPANDER (Mfx) */
+    BSP_IO_WritePin(GPIO_PIN[Led], BSP_IO_PIN_SET);
+#endif /* USE_IOEXPANDER */     
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  }
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+}
+
+/**
+  * @brief  Toggles the selected LED.
+  * @param  Led: LED to be toggled
+  *          This parameter can be one of the following values:
+  *            @arg  LED1
+  *            @arg  LED2
+  *            @arg  LED3
+  *            @arg  LED4
+  * @retval None
+  */
+void BSP_LED_Toggle(Led_TypeDef Led)
+{
+  
+#if !defined(USE_STM32446E_EVAL_REVA)
+  /* On RevB led1 and Led3 are on GPIO while Led2 and Led4 on Mfx*/
+  if ((Led == LED1) || (Led == LED3))
+  {
+     HAL_GPIO_TogglePin(LEDx_GPIO_PORT, GPIO_PIN[Led]);
+  }
+  else
+  {
+#endif /* !USE_STM32446E_EVAL_REVA */
+
+#if defined(USE_IOEXPANDER) /* (USE_IOEXPANDER always defined for RevA) */
+    /* GPIO_PIN[Led]  depends on the board revision: */
+    /*  - in case of RevA all leds are on IOEXPANDER (Mfx)  */
+    /*  - in case of RevB just led 2 and led4 on IOEXPANDER (Mfx) */
+    BSP_IO_TogglePin(GPIO_PIN[Led]);
+#endif /* USE_IOEXPANDER */     
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  }
+#endif /* !USE_STM32446E_EVAL_REVA */
+}
+
+/**
+  * @brief  Configures button GPIO and EXTI Line.
+  * @param  Button: Button to be configured
+  *          This parameter can be one of the following values:
+  *            @arg  BUTTON_WAKEUP: Wakeup Push Button 
+  *            @arg  BUTTON_TAMPER: Tamper Push Button  
+  *            @arg  BUTTON_KEY: Key Push Button
+  * @param  ButtonMode: Button mode
+  *          This parameter can be one of the following values:
+  *            @arg  BUTTON_MODE_GPIO: Button will be used as simple IO
+  *            @arg  BUTTON_MODE_EXTI: Button will be connected to EXTI line 
+  *                                    with interrupt generation capability  
+  * @note On STM32446E-EVAL evaluation board, the three buttons (Wakeup, Tamper
+  *       and key buttons) are mapped on the same push button named "Wakeup/Tamper"
+  *       on the board serigraphy.
+  * @retval None
+  */
+void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
+{
+  GPIO_InitTypeDef gpio_init_structure;
+  
+  /* Enable the BUTTON clock */
+  BUTTONx_GPIO_CLK_ENABLE(Button);
+  
+  if(ButtonMode == BUTTON_MODE_GPIO)
+  {
+    /* Configure Button pin as input */
+    gpio_init_structure.Pin = BUTTON_PIN[Button];
+    gpio_init_structure.Mode = GPIO_MODE_INPUT;
+    gpio_init_structure.Pull = GPIO_NOPULL;
+    gpio_init_structure.Speed = GPIO_SPEED_FAST;
+    HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
+  }
+  
+  if(ButtonMode == BUTTON_MODE_EXTI)
+  {
+    /* Configure Button pin as input with External interrupt */
+    gpio_init_structure.Pin = BUTTON_PIN[Button];
+    gpio_init_structure.Pull = GPIO_NOPULL;
+    gpio_init_structure.Speed = GPIO_SPEED_FAST;
+    
+    if(Button != BUTTON_WAKEUP)
+    {
+      gpio_init_structure.Mode = GPIO_MODE_IT_FALLING; 
+    }
+    else
+    {
+      gpio_init_structure.Mode = GPIO_MODE_IT_RISING;
+    }
+    
+    HAL_GPIO_Init(BUTTON_PORT[Button], &gpio_init_structure);
+    
+    /* Enable and set Button EXTI Interrupt to the lowest priority */
+    HAL_NVIC_SetPriority((IRQn_Type)(BUTTON_IRQn[Button]), 0x0F, 0x00);
+    HAL_NVIC_EnableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
+  }
+}
+
+/**
+  * @brief  Push Button DeInit.
+  * @param  Button: Button to be configured
+  *          This parameter can be one of the following values:
+  *            @arg  BUTTON_WAKEUP: Wakeup Push Button 
+  *            @arg  BUTTON_TAMPER: Tamper Push Button  
+  *            @arg  BUTTON_KEY: Key Push Button
+  * @note On STM32446E-EVAL evaluation board, the three buttons (Wakeup, Tamper
+  *       and key buttons) are mapped on the same push button nammed "Wakeup/Tamper"
+  *       on the board serigraphy.
+  * @note PB DeInit does not disable the GPIO clock
+  * @retval None
+  */
+void BSP_PB_DeInit(Button_TypeDef Button)
+{
+    GPIO_InitTypeDef gpio_init_structure;
+
+    gpio_init_structure.Pin = BUTTON_PIN[Button];
+    HAL_NVIC_DisableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
+    HAL_GPIO_DeInit(BUTTON_PORT[Button], gpio_init_structure.Pin);
+}
+
+
+/**
+  * @brief  Returns the selected button state.
+  * @param  Button: Button to be checked
+  *          This parameter can be one of the following values:
+  *            @arg  BUTTON_WAKEUP: Wakeup Push Button 
+  *            @arg  BUTTON_TAMPER: Tamper Push Button 
+  *            @arg  BUTTON_KEY: Key Push Button
+  * @note On STM32446E-EVAL evaluation board, the three buttons (Wakeup, Tamper
+  *       and key buttons) are mapped on the same push button nammed "Wakeup/Tamper"
+  *       on the board serigraphy.
+  * @retval The Button GPIO pin value
+  */
+uint32_t BSP_PB_GetState(Button_TypeDef Button)
+{
+  return HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
+}
+
+/**
+  * @brief  Configures COM port.
+  * @param  COM: COM port to be configured.
+  *          This parameter can be one of the following values:
+  *            @arg  COM1 
+  *            @arg  COM2 
+  * @param  huart: Pointer to a UART_HandleTypeDef structure that contains the
+  *                configuration information for the specified USART peripheral.
+  * @retval None
+  */
+void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *huart)
+{
+  GPIO_InitTypeDef gpio_init_structure;
+
+  /* Enable GPIO clock */
+  EVAL_COMx_TX_GPIO_CLK_ENABLE(COM);
+  EVAL_COMx_RX_GPIO_CLK_ENABLE(COM);
+
+  /* Enable USART clock */
+  EVAL_COMx_CLK_ENABLE(COM);
+
+  /* Configure USART Tx as alternate function */
+  gpio_init_structure.Pin = COM_TX_PIN[COM];
+  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+  gpio_init_structure.Speed = GPIO_SPEED_FAST;
+  gpio_init_structure.Pull = GPIO_PULLUP;
+  gpio_init_structure.Alternate = COM_TX_AF[COM];
+  HAL_GPIO_Init(COM_TX_PORT[COM], &gpio_init_structure);
+
+  /* Configure USART Rx as alternate function */
+  gpio_init_structure.Pin = COM_RX_PIN[COM];
+  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+  gpio_init_structure.Alternate = COM_RX_AF[COM];
+  HAL_GPIO_Init(COM_RX_PORT[COM], &gpio_init_structure);
+
+  /* USART configuration */
+  huart->Instance = COM_USART[COM];
+  HAL_UART_Init(huart);
+}
+
+/**
+  * @brief  DeInit COM port.
+  * @param  COM: COM port to be configured.
+  *          This parameter can be one of the following values:
+  *            @arg  COM1 
+  *            @arg  COM2 
+  * @param  huart: Pointer to a UART_HandleTypeDef structure that contains the
+  *                configuration information for the specified USART peripheral.
+  * @retval None
+  */
+void BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart)
+{
+  /* USART configuration */
+  huart->Instance = COM_USART[COM];
+  HAL_UART_DeInit(huart);
+
+  /* Enable USART clock */
+  EVAL_COMx_CLK_DISABLE(COM);
+
+  /* DeInit GPIO pins can be done in the application 
+     (by surcharging this __weak function) */
+
+  /* GPIO pins clock, FMC clock and DMA clock can be shut down in the application 
+     by surcharging this __weak function */ 
+}
+
+#if defined(USE_IOEXPANDER)
+
+/**
+  * @brief  Configures joystick GPIO and EXTI modes.
+  * @param  JoyMode: Button mode.
+  *          This parameter can be one of the following values:
+  *            @arg  JOY_MODE_GPIO: Joystick pins will be used as simple IOs
+  *            @arg  JOY_MODE_EXTI: Joystick pins will be connected to EXTI line 
+  *                                 with interrupt generation capability  
+  * @retval IO_OK: if all initializations are OK. Other value if error.
+  */
+uint8_t BSP_JOY_Init(JOYMode_TypeDef JoyMode)
+{
+  uint8_t ret = 0;
+  
+  /* Initialize the IO functionalities */
+  ret = BSP_IO_Init();
+  
+  /* Configure joystick pins in IT mode */
+  if(JoyMode == JOY_MODE_EXTI)
+  {
+    /* Configure IO interrupt acquisition mode */
+    BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_IT_FALLING_EDGE_PU);
+  }
+  else
+  {
+    BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_INPUT_PU);
+  }
+  
+  return ret; 
+}
+
+
+/**
+  * @brief  DeInit joystick GPIOs.
+  * @note   JOY DeInit does not disable the Mfx, just set the Mfx pins in Off mode
+  * @retval None.
+  */
+void BSP_JOY_DeInit(void)
+{
+    BSP_IO_ConfigPin(JOY_ALL_PINS, IO_MODE_OFF);
+}
+
+/**
+  * @brief  Returns the current joystick status.
+  * @param  None
+  * @retval Code of the joystick key pressed
+  *          This code can be one of the following values:
+  *            @arg  JOY_NONE
+  *            @arg  JOY_SEL
+  *            @arg  JOY_DOWN
+  *            @arg  JOY_LEFT
+  *            @arg  JOY_RIGHT
+  *            @arg  JOY_UP
+  */
+JOYState_TypeDef BSP_JOY_GetState(void)
+{
+  uint16_t pin_status = 0;   
+  
+  /* Read the status joystick pins */
+  pin_status = BSP_IO_ReadPin(JOY_ALL_PINS);
+   
+  /* Check the pressed keys */  
+  if((pin_status & JOY_NONE_PIN) == JOY_NONE)
+  {
+    return(JOYState_TypeDef) JOY_NONE;
+  }
+  else if(!(pin_status & JOY_SEL_PIN))
+  {
+    return(JOYState_TypeDef) JOY_SEL;
+  }
+  else if(!(pin_status & JOY_DOWN_PIN))
+  {
+    return(JOYState_TypeDef) JOY_DOWN;
+  } 
+  else if(!(pin_status & JOY_LEFT_PIN))
+  {
+    return(JOYState_TypeDef) JOY_LEFT;
+  }
+  else if(!(pin_status & JOY_RIGHT_PIN))
+  {
+    return(JOYState_TypeDef) JOY_RIGHT;
+  }
+  else if(!(pin_status & JOY_UP_PIN))
+  {
+    return(JOYState_TypeDef) JOY_UP;
+  }
+  else
+  { 
+    return(JOYState_TypeDef) JOY_NONE;
+  }  
+}
+
+#endif /* USE_IOEXPANDER */
+
+
+/*******************************************************************************
+                            BUS OPERATIONS
+*******************************************************************************/
+
+/******************************* I2C Routines *********************************/
+/**
+  * @brief  Initializes I2C MSP.
+  * @param  None
+  * @retval None
+  */
+static void I2Cx_MspInit(void)
+{
+  GPIO_InitTypeDef  gpio_init_structure;  
+  
+  /*** Configure the GPIOs ***/  
+  /* Enable GPIO clock */
+  EVAL_I2Cx_SCL_SDA_GPIO_CLK_ENABLE();
+  
+  /* Configure I2C Tx as alternate function */
+  gpio_init_structure.Pin = EVAL_I2Cx_SCL_PIN;
+  gpio_init_structure.Mode = GPIO_MODE_AF_OD;
+  gpio_init_structure.Pull = GPIO_NOPULL;
+  gpio_init_structure.Speed = GPIO_SPEED_FAST;
+  gpio_init_structure.Alternate = EVAL_I2Cx_SCL_SDA_AF;
+  HAL_GPIO_Init(EVAL_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
+  
+  /* Configure I2C Rx as alternate function */
+  gpio_init_structure.Pin = EVAL_I2Cx_SDA_PIN;
+  HAL_GPIO_Init(EVAL_I2Cx_SCL_SDA_GPIO_PORT, &gpio_init_structure);
+  
+  /*** Configure the I2C peripheral ***/ 
+  /* Enable I2C clock */
+  EVAL_I2Cx_CLK_ENABLE();
+  
+  /* Force the I2C peripheral clock reset */  
+  EVAL_I2Cx_FORCE_RESET(); 
+  
+  /* Release the I2C peripheral clock reset */  
+  EVAL_I2Cx_RELEASE_RESET(); 
+  
+  /* Enable and set I2Cx Interrupt to a lower priority */
+  HAL_NVIC_SetPriority(EVAL_I2Cx_EV_IRQn, 0x05, 0);
+  HAL_NVIC_EnableIRQ(EVAL_I2Cx_EV_IRQn);
+  
+  /* Enable and set I2Cx Interrupt to a lower priority */
+  HAL_NVIC_SetPriority(EVAL_I2Cx_ER_IRQn, 0x05, 0);
+  HAL_NVIC_EnableIRQ(EVAL_I2Cx_ER_IRQn);
+}
+
+/**
+  * @brief  Initializes I2C HAL.
+  * @param  None
+  * @retval None
+  */
+static void I2Cx_Init(void)
+{
+  if(HAL_FMPI2C_GetState(&hEvalI2c) == HAL_FMPI2C_STATE_RESET)
+  {
+    hEvalI2c.Instance              = EVAL_I2Cx;
+    hEvalI2c.Init.Timing           = EVAL_I2Cx_TIMING;
+    hEvalI2c.Init.OwnAddress1     = 0;
+    hEvalI2c.Init.AddressingMode  = FMPI2C_ADDRESSINGMODE_7BIT;
+    hEvalI2c.Init.DualAddressMode = FMPI2C_DUALADDRESS_DISABLE;
+    hEvalI2c.Init.OwnAddress2     = 0;
+    hEvalI2c.Init.GeneralCallMode = FMPI2C_GENERALCALL_DISABLE;
+    hEvalI2c.Init.NoStretchMode   = FMPI2C_NOSTRETCH_DISABLE;  
+    
+    /* Init the I2C */
+    I2Cx_MspInit();
+    HAL_FMPI2C_Init(&hEvalI2c);    
+  }
+}
+
+#if defined(USE_IOEXPANDER)
+
+
+/**
+  * @brief  Writes a single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @param  Value: Data to be written
+  * @retval None
+  */
+static void I2Cx_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+
+  status = HAL_FMPI2C_Mem_Write(&hEvalI2c, Addr, (uint16_t)Reg, FMPI2C_MEMADD_SIZE_8BIT, &Value, 1, 100); 
+
+  /* Check the communication status */
+  if(status != HAL_OK)
+  {
+    /* Execute user timeout callback */
+    I2Cx_Error(Addr);
+  }
+}
+
+/**
+  * @brief  Reads a single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @retval Read data
+  */
+static uint8_t I2Cx_Read(uint8_t Addr, uint8_t Reg)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  uint8_t Value = 0;
+  
+  status = HAL_FMPI2C_Mem_Read(&hEvalI2c, Addr, Reg, FMPI2C_MEMADD_SIZE_8BIT, &Value, 1, 1000);
+  
+  /* Check the communication status */
+  if(status != HAL_OK)
+  {
+    /* Execute user timeout callback */
+    I2Cx_Error(Addr);
+  }
+  return Value;   
+}
+
+#endif /* USE_IOEXPANDER */     
+
+/**
+  * @brief  Reads multiple data.
+  * @param  Addr: I2C address
+  * @param  Reg: Reg address 
+  * @param  Buffer: Pointer to data buffer
+  * @param  Length: Length of the data
+  * @retval Number of read data
+  */
+static HAL_StatusTypeDef I2Cx_ReadMultiple(uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  
+  status = HAL_FMPI2C_Mem_Read(&hEvalI2c, Addr, (uint16_t)Reg, MemAddSize, Buffer, Length, 1000);
+  
+  /* Check the communication status */
+  if(status != HAL_OK)
+  {
+    /* I2C error occurred */
+    I2Cx_Error(Addr);
+  }
+  return status;    
+}
+
+/**
+  * @brief  Writes a value in a register of the device through BUS in using DMA mode.
+  * @param  Addr: Device address on BUS Bus.  
+  * @param  Reg: The target register address to write
+  * @param  pBuffer: The target register value to be written 
+  * @param  Length: buffer size to be written
+  * @retval HAL status
+  */
+static HAL_StatusTypeDef I2Cx_WriteMultiple(uint8_t Addr, uint16_t Reg, uint16_t MemAddSize, uint8_t *Buffer, uint16_t Length)
+{
+  HAL_StatusTypeDef status = HAL_OK;
+  
+  status = HAL_FMPI2C_Mem_Write(&hEvalI2c, Addr, (uint16_t)Reg, MemAddSize, Buffer, Length, 1000);
+  
+  /* Check the communication status */
+  if(status != HAL_OK)
+  {
+    /* Re-Initialize the I2C Bus */
+    I2Cx_Error(Addr);
+  }
+  return status;
+}
+
+/**
+  * @brief  Checks if target device is ready for communication. 
+  * @note   This function is used with Memory devices
+  * @param  DevAddress: Target device address
+  * @param  Trials: Number of trials
+  * @retval HAL status
+  */
+static HAL_StatusTypeDef I2Cx_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
+{ 
+  return (HAL_FMPI2C_IsDeviceReady(&hEvalI2c, DevAddress, Trials, 1000));
+}
+
+/**
+  * @brief  Manages error callback by re-initializing I2C.
+  * @param  Addr: I2C Address
+  * @retval None
+  */
+static void I2Cx_Error(uint8_t Addr)
+{
+  /* De-initialize the I2C communication bus */
+  HAL_FMPI2C_DeInit(&hEvalI2c);
+  
+  /* Re-Initialize the I2C communication bus */
+  I2Cx_Init();
+}
+
+/*************************** FMC Routines ************************************/
+/**
+  * @brief  Initializes FMC_BANK1 MSP.
+  * @param  None
+  * @retval None
+  */
+static void FMC_BANK1_MspInit(void)
+{
+  GPIO_InitTypeDef gpio_init_structure;
+    
+  /* Enable FMC clock */
+  __HAL_RCC_FMC_CLK_ENABLE(); 
+  
+  /* Enable GPIOs clock */
+  __HAL_RCC_GPIOD_CLK_ENABLE();
+  __HAL_RCC_GPIOE_CLK_ENABLE();
+  __HAL_RCC_GPIOF_CLK_ENABLE();
+  
+  /* Common GPIO configuration */
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF12_FMC; 
+  
+  /* GPIOD configuration */ /* GPIO_PIN_7 is  FMC_NE1 */
+  gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_8 |\
+                              GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15 | GPIO_PIN_7;
+   
+  HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+  /* GPIOE configuration */  
+  gpio_init_structure.Pin   = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3| GPIO_PIN_4 | GPIO_PIN_7     |\
+                              GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |\
+                              GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
+  HAL_GPIO_Init(GPIOE, &gpio_init_structure);
+  
+  /* GPIOF configuration */  
+  gpio_init_structure.Pin   = GPIO_PIN_0 ;  
+  HAL_GPIO_Init(GPIOF, &gpio_init_structure);
+}
+
+
+/**
+  * @brief  Initializes LCD IO.
+  * @param  None
+  * @retval None
+  */
+static void FMC_BANK1_Init(void) 
+{  
+  SRAM_HandleTypeDef hsram;
+  FMC_NORSRAM_TimingTypeDef sram_timing;
+  
+  /*** Configure the SRAM Bank 1 ***/
+  /* Configure IPs */
+  hsram.Instance  = FMC_NORSRAM_DEVICE;
+  hsram.Extended  = FMC_NORSRAM_EXTENDED_DEVICE;
+
+  sram_timing.AddressSetupTime      = 5;
+  sram_timing.AddressHoldTime       = 1;
+  sram_timing.DataSetupTime         = 9;
+  sram_timing.BusTurnAroundDuration = 0;
+  sram_timing.CLKDivision           = 2;
+  sram_timing.DataLatency           = 2;
+  sram_timing.AccessMode            = FMC_ACCESS_MODE_A;
+  
+  hsram.Init.NSBank             = FMC_NORSRAM_BANK1;
+  hsram.Init.DataAddressMux     = FMC_DATA_ADDRESS_MUX_DISABLE;
+  hsram.Init.MemoryType         = FMC_MEMORY_TYPE_SRAM;
+  hsram.Init.MemoryDataWidth    = FMC_NORSRAM_MEM_BUS_WIDTH_16;
+  hsram.Init.BurstAccessMode    = FMC_BURST_ACCESS_MODE_DISABLE;
+  hsram.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
+  hsram.Init.WrapMode           = FMC_WRAP_MODE_DISABLE;
+  hsram.Init.WaitSignalActive   = FMC_WAIT_TIMING_BEFORE_WS;
+  hsram.Init.WriteOperation     = FMC_WRITE_OPERATION_ENABLE;
+  hsram.Init.WaitSignal         = FMC_WAIT_SIGNAL_DISABLE;
+  hsram.Init.ExtendedMode       = FMC_EXTENDED_MODE_DISABLE;
+  hsram.Init.AsynchronousWait   = FMC_ASYNCHRONOUS_WAIT_DISABLE;
+  hsram.Init.WriteBurst         = FMC_WRITE_BURST_DISABLE;
+  hsram.Init.ContinuousClock    = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
+  hsram.Init.WriteFifo          = FMC_WRITE_FIFO_DISABLE;
+  hsram.Init.PageSize           = FMC_PAGE_SIZE_NONE;
+
+  /* Initialize the SRAM controller */
+  FMC_BANK1_MspInit();
+  HAL_SRAM_Init(&hsram, &sram_timing, &sram_timing);   
+}
+
+
+/**
+  * @brief  Writes register value.
+  * @param  Data: Data to be written 
+  * @retval None
+  */
+static void FMC_BANK1_WriteData(uint16_t Data) 
+{
+  /* Write 16-bit Reg */
+  FMC_BANK1->RAM = Data;
+}
+
+/**
+  * @brief  Writes register address.
+  * @param  Reg: Register to be written
+  * @retval None
+  */
+static void FMC_BANK1_WriteReg(uint8_t Reg) 
+{
+  /* Write 16-bit Index, then write register */
+  FMC_BANK1->REG = Reg;
+}
+
+/**
+  * @brief  Reads register value.
+  * @param  None
+  * @retval Read value
+  */
+static uint16_t FMC_BANK1_ReadData(void) 
+{
+  return FMC_BANK1->RAM;
+}
+
+/*******************************************************************************
+                            LINK OPERATIONS
+*******************************************************************************/
+
+#if defined(USE_IOEXPANDER)
+
+/********************************* LINK MFX ***********************************/
+
+/**
+  * @brief  Initializes MFX low level.
+  * @param  None
+  * @retval None
+  */
+void MFX_IO_Init(void)
+{
+  I2Cx_Init();
+}
+
+/**
+  * @brief  DeInitializes MFX low level.
+  * @param  None
+  * @retval None
+  */
+void MFX_IO_DeInit(void)
+{
+}
+
+/**
+  * @brief  Configures MFX low level interrupt.
+  * @param  None
+  * @retval None
+  */
+void MFX_IO_ITConfig(void)
+{
+  GPIO_InitTypeDef  gpio_init_structure;
+
+  /* Enable the GPIO EXTI clock */
+  __HAL_RCC_GPIOA_CLK_ENABLE();
+  __HAL_RCC_SYSCFG_CLK_ENABLE();
+
+  /* PA0 is the MFX_OUT_IRQ (often used for EXTI_WKUP) */    
+  gpio_init_structure.Pin   = GPIO_PIN_0;
+  gpio_init_structure.Pull  = GPIO_NOPULL;
+  gpio_init_structure.Speed = GPIO_SPEED_LOW;
+  gpio_init_structure.Mode  = GPIO_MODE_IT_RISING;
+  HAL_GPIO_Init(GPIOA, &gpio_init_structure);
+
+  /* Enable and set GPIO EXTI Interrupt to the lowest priority */
+  HAL_NVIC_SetPriority((IRQn_Type)(EXTI0_IRQn), 0x0F, 0x0F);
+  HAL_NVIC_EnableIRQ((IRQn_Type)(EXTI0_IRQn));
+}
+
+/**
+  * @brief  MFX writes single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @param  Value: Data to be written
+  * @retval None
+  */
+void MFX_IO_Write(uint16_t Addr, uint8_t Reg, uint8_t Value)
+{
+  I2Cx_Write((uint8_t) Addr, Reg, Value);
+}
+
+/**
+  * @brief  MFX reads single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @retval Read data
+  */
+uint8_t MFX_IO_Read(uint16_t Addr, uint8_t Reg)
+{
+  return I2Cx_Read((uint8_t) Addr, Reg);
+}
+
+/**
+  * @brief  MFX reads multiple data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @param  Buffer: Pointer to data buffer
+  * @param  Length: Length of the data
+  * @retval Number of read data
+  */
+uint16_t MFX_IO_ReadMultiple(uint16_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length)
+{
+ return I2Cx_ReadMultiple((uint8_t) Addr, (uint16_t)Reg, FMPI2C_MEMADD_SIZE_8BIT, Buffer, Length);
+}
+
+/**
+  * @brief  MFX delay 
+  * @param  Delay: Delay in ms
+  * @retval None
+  */
+void MFX_IO_Delay(uint32_t Delay)
+{
+  HAL_Delay(Delay);
+}
+
+/**
+  * @brief  Used by Lx family but requested for MFX component compatibility.
+  * @param  None
+  * @retval None
+  */
+void MFX_IO_Wakeup(void) 
+{
+}
+
+/**
+  * @brief  Used by Lx family but requested for MXF component compatibility.
+  * @param  None
+  * @retval None
+  */
+void MFX_IO_EnableWakeupPin(void) 
+{
+}
+
+#endif /* USE_IOEXPANDER */
+
+/********************************* LINK LCD ***********************************/
+
+/**
+  * @brief  Initializes LCD low level.
+  * @param  None
+  * @retval None
+  */
+void LCD_IO_Init(void) 
+{
+    FMC_BANK1_Init();
+}
+
+/**
+  * @brief  Writes data on LCD data register.
+  * @param  Data: Data to be written
+  * @retval None
+  */
+void LCD_IO_WriteData(uint16_t RegValue) 
+{
+  /* Write 16-bit Reg */
+  FMC_BANK1_WriteData(RegValue);
+}
+
+/**
+  * @brief  Writes register on LCD register.
+  * @param  Reg: Register to be written
+  * @retval None
+  */
+void LCD_IO_WriteReg(uint8_t Reg) 
+{
+  /* Write 16-bit Index, then Write Reg */
+  FMC_BANK1_WriteReg(Reg);
+}
+
+/**
+  * @brief  Reads data from LCD data register.
+  * @param  None
+  * @retval Read data.
+  */
+uint16_t LCD_IO_ReadData(void) 
+{
+  return FMC_BANK1_ReadData();
+}
+
+/********************************* LINK AUDIO *********************************/
+
+/**
+  * @brief  Initializes Audio low level.
+  * @param  None
+  * @retval None
+  */
+void AUDIO_IO_Init(void) 
+{
+  I2Cx_Init();
+}
+
+/**
+  * @brief  DeInitializes Audio low level.
+  */
+void AUDIO_IO_DeInit(void)
+{
+
+}
+
+/**
+  * @brief  Writes a single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Reg address 
+  * @param  Value: Data to be written
+  * @retval None
+  */
+void AUDIO_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
+{
+  uint16_t tmp = Value;
+  
+  Value = ((uint16_t)(tmp >> 8) & 0x00FF);
+  
+  Value |= ((uint16_t)(tmp << 8)& 0xFF00);
+  
+  I2Cx_WriteMultiple(Addr, Reg, FMPI2C_MEMADD_SIZE_16BIT,(uint8_t*)&Value, 2);
+}
+
+/**
+  * @brief  Reads a single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Reg address 
+  * @retval Data to be read
+  */
+uint16_t AUDIO_IO_Read(uint8_t Addr, uint16_t Reg)
+{
+  uint16_t read_value = 0, tmp = 0;
+  
+  I2Cx_ReadMultiple(Addr, Reg, FMPI2C_MEMADD_SIZE_16BIT, (uint8_t*)&read_value, 2); 
+  
+  tmp = ((uint16_t)(read_value >> 8) & 0x00FF);
+  
+  tmp |= ((uint16_t)(read_value << 8)& 0xFF00);
+  
+  read_value = tmp;
+  
+  return read_value;
+}
+
+/**
+  * @brief  AUDIO Codec delay 
+  * @param  Delay: Delay in ms
+  * @retval None
+  */
+void AUDIO_IO_Delay(uint32_t Delay)
+{
+  HAL_Delay(Delay);
+}
+
+/********************************* LINK CAMERA ********************************/
+
+/**
+  * @brief  Initializes Camera low level.
+  * @param  None
+  * @retval None
+  */
+void CAMERA_IO_Init(void) 
+{
+  I2Cx_Init();
+}
+
+/**
+  * @brief  Camera writes single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @param  Value: Data to be written
+  * @retval None
+  */
+void CAMERA_IO_Write(uint8_t Addr, uint16_t Reg, uint16_t Value)
+{
+  uint16_t tmp = Value;
+  /* For S5K5CAG sensor, 16 bits accesses are used */
+  Value = ((uint16_t)(tmp >> 8) & 0x00FF);
+  Value |= ((uint16_t)(tmp << 8)& 0xFF00);
+  I2Cx_WriteMultiple(Addr, Reg, FMPI2C_MEMADD_SIZE_16BIT,(uint8_t*)&Value, 2);
+}
+
+/**
+  * @brief  Camera reads single data.
+  * @param  Addr: I2C address
+  * @param  Reg: Register address 
+  * @retval Read data
+  */
+uint16_t CAMERA_IO_Read(uint8_t Addr, uint16_t Reg)
+{
+  uint16_t read_value = 0, tmp = 0;
+  /* For S5K5CAG sensor, 16 bits accesses are used */
+  I2Cx_ReadMultiple(Addr, Reg, FMPI2C_MEMADD_SIZE_16BIT, (uint8_t*)&read_value, 2);
+  tmp = ((uint16_t)(read_value >> 8) & 0x00FF);
+  tmp |= ((uint16_t)(read_value << 8)& 0xFF00);
+  read_value = tmp;
+  return read_value;
+}
+
+/**
+  * @brief  Camera delay 
+  * @param  Delay: Delay in ms
+  * @retval None
+  */
+void CAMERA_Delay(uint32_t Delay)
+{
+  HAL_Delay(Delay);
+}
+
+/******************************** LINK I2C EEPROM *****************************/
+
+/**
+  * @brief  Initializes peripherals used by the I2C EEPROM driver.
+  * @param  None
+  * @retval None
+  */
+void EEPROM_IO_Init(void)
+{
+  I2Cx_Init();
+}
+
+/**
+  * @brief  Write data to I2C EEPROM driver in using DMA channel.
+  * @param  DevAddress: Target device address
+  * @param  MemAddress: Internal memory address
+  * @param  pBuffer: Pointer to data buffer
+  * @param  BufferSize: Amount of data to be sent
+  * @retval HAL status
+  */
+HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
+{
+  return (I2Cx_WriteMultiple(DevAddress, MemAddress, FMPI2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
+}
+
+/**
+  * @brief  Read data from I2C EEPROM driver in using DMA channel.
+  * @param  DevAddress: Target device address
+  * @param  MemAddress: Internal memory address
+  * @param  pBuffer: Pointer to data buffer
+  * @param  BufferSize: Amount of data to be read
+  * @retval HAL status
+  */
+HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize)
+{
+  return (I2Cx_ReadMultiple(DevAddress, MemAddress, FMPI2C_MEMADD_SIZE_16BIT, pBuffer, BufferSize));
+}
+
+/**
+  * @brief  Checks if target device is ready for communication. 
+  * @note   This function is used with Memory devices
+  * @param  DevAddress: Target device address
+  * @param  Trials: Number of trials
+  * @retval HAL status
+  */
+HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials)
+{ 
+  return (I2Cx_IsDeviceReady(DevAddress, Trials));
+}
+
+
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */    
+    
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 407 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval.h

@@ -0,0 +1,407 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains definitions for STM32446E_EVAL's LEDs,
+  *          push-buttons and COM ports hardware resources.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* IMPORTANT: in order to compile with RevA following flag shall be defined  */
+/* in the preprocessor options:  USE_STM32446E_EVAL_REVA !!!!!!!!!! */
+  
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32446E_EVAL_H
+#define __STM32446E_EVAL_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* USE_STM32446E_EVAL_REVA must USE USE_IOEXPANDER */
+#if defined(USE_STM32446E_EVAL_REVA)
+#ifndef USE_IOEXPANDER
+#define USE_IOEXPANDER
+#endif // USE_IOEXPANDER
+#endif // USE_STM32446E_EVAL_REVA
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f4xx_hal.h"
+   
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+      
+/** @defgroup STM32446E_EVAL_LOW_LEVEL STM32446E-EVAL LOW LEVEL
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Types STM32446E EVAL Low Level Exported Types
+  * @{
+  */
+typedef enum 
+{
+#if defined(USE_IOEXPANDER)
+LED1 = 0,
+LED_GREEN = LED1,
+LED2 = 1,
+LED_ORANGE = LED2,
+LED3 = 2,
+LED_RED = LED3,
+LED4 = 3,
+LED_BLUE = LED4
+#else
+LED1 = 0,
+LED_GREEN = LED1,
+LED3 = 1,
+LED_RED = LED3,
+#endif /* USE_IOEXPANDER */
+}Led_TypeDef;
+
+
+typedef enum 
+{  
+  BUTTON_WAKEUP = 0,
+  BUTTON_TAMPER = 1,
+  BUTTON_KEY = 2
+}Button_TypeDef;
+
+typedef enum 
+{  
+  BUTTON_MODE_GPIO = 0,
+  BUTTON_MODE_EXTI = 1
+}ButtonMode_TypeDef;
+
+#if defined(USE_IOEXPANDER)
+typedef enum 
+{  
+  JOY_MODE_GPIO = 0,
+  JOY_MODE_EXTI = 1
+}JOYMode_TypeDef;
+
+typedef enum 
+{ 
+  JOY_NONE  = 0,
+  JOY_SEL   = 1,
+  JOY_DOWN  = 2,
+  JOY_LEFT  = 3,
+  JOY_RIGHT = 4,
+  JOY_UP    = 5
+}JOYState_TypeDef;
+#endif /* USE_IOEXPANDER */
+
+typedef enum 
+{
+  COM1 = 0,
+  COM2 = 1
+}COM_TypeDef;
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Constants STM32446E EVAL Low Level Exported Constants
+  * @{
+  */ 
+
+/** 
+  * @brief  Define for STM32446E_EVAL board
+  */ 
+#if !defined (USE_STM32446E_EVAL)
+ #define USE_STM32446E_EVAL
+#endif
+
+/** @addtogroup STM32446E_EVAL_LOW_LEVEL_LED STM32446E EVAL Low Level Led
+  * @{
+  */
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+
+#if defined(USE_IOEXPANDER)
+#define LEDn                             ((uint8_t)4)
+#define LED2_PIN                         IO_PIN_21
+#define LED4_PIN                         IO_PIN_23
+#else
+#define LEDn                             ((uint8_t)2)
+#endif /* USE_IOEXPANDER */
+
+#define LEDx_GPIO_PORT                   GPIOB
+#define LEDx_GPIO_CLK_ENABLE()           __HAL_RCC_GPIOB_CLK_ENABLE()
+#define LEDx_GPIO_CLK_DISABLE()          __HAL_RCC_GPIOB_CLK_DISABLE()
+#define LED1_PIN                         GPIO_PIN_11
+#define LED3_PIN                         GPIO_PIN_4
+
+#else
+
+#define LEDn                             ((uint8_t)4)
+#define LED1_PIN                         IO_PIN_20
+#define LED3_PIN                         IO_PIN_22
+#define LED2_PIN                         IO_PIN_21
+#define LED4_PIN                         IO_PIN_23
+
+#endif // !USE_STM32446E_EVAL_REVA
+
+
+/**
+  * @}
+  */ 
+  
+/** @addtogroup STM32446E_EVAL_LOW_LEVEL_BUTTON STM32446E EVAL Low Level Button
+  * @{
+  */ 
+/* Joystick pins are connected to IO Expander (accessible through FMPI2C interface) */ 
+#define BUTTONn                             ((uint8_t)3) 
+
+/**
+  * @brief Wakeup push-button
+  */
+#define WAKEUP_BUTTON_PIN                   GPIO_PIN_13
+#define WAKEUP_BUTTON_GPIO_PORT             GPIOC
+#define WAKEUP_BUTTON_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOC_CLK_ENABLE()  
+#define WAKEUP_BUTTON_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOC_CLK_DISABLE()
+#define WAKEUP_BUTTON_EXTI_IRQn             EXTI15_10_IRQn 
+
+/**
+  * @brief Tamper push-button
+  */
+#define TAMPER_BUTTON_PIN                    GPIO_PIN_13
+#define TAMPER_BUTTON_GPIO_PORT              GPIOC
+#define TAMPER_BUTTON_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOC_CLK_ENABLE()  
+#define TAMPER_BUTTON_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOC_CLK_DISABLE()
+#define TAMPER_BUTTON_EXTI_IRQn              EXTI15_10_IRQn
+
+/**
+  * @brief Key push-button
+  */
+#define KEY_BUTTON_PIN                       GPIO_PIN_13
+#define KEY_BUTTON_GPIO_PORT                 GPIOC
+#define KEY_BUTTON_GPIO_CLK_ENABLE()         __HAL_RCC_GPIOC_CLK_ENABLE()  
+#define KEY_BUTTON_GPIO_CLK_DISABLE()        __HAL_RCC_GPIOC_CLK_DISABLE()
+#define KEY_BUTTON_EXTI_IRQn                 EXTI15_10_IRQn
+
+/**
+  * @brief MFX Irq Out Pin
+  */
+#define MFX_IRQOUT_PIN                    GPIO_PIN_0
+#define MFX_IRQOUT_GPIO_PORT              GPIOA
+#define MFX_IRQOUT_GPIO_CLK_ENABLE()      __HAL_RCC_GPIOA_CLK_ENABLE()  
+#define MFX_IRQOUT_GPIO_CLK_DISABLE()     __HAL_RCC_GPIOA_CLK_DISABLE()
+#define MFX_IRQOUT_EXTI_IRQn              EXTI0_IRQn
+
+#define BUTTONx_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == 0) {WAKEUP_BUTTON_GPIO_CLK_ENABLE();} else\
+                                                   if((__INDEX__) == 1) {TAMPER_BUTTON_GPIO_CLK_ENABLE();} else\
+                                                                        {KEY_BUTTON_GPIO_CLK_ENABLE();   }} while(0)											   
+
+#define BUTTONx_GPIO_CLK_DISABLE(__INDEX__)    (((__INDEX__) == 0) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\
+                                                ((__INDEX__) == 1) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() : KEY_BUTTON_GPIO_CLK_DISABLE())
+/**
+  * @}
+  */ 
+
+/** @addtogroup STM32446E_EVAL_LOW_LEVEL_COM STM32446E EVAL Low Level COM
+  * @{
+  */
+#define COMn                             ((uint8_t)1)
+
+/**
+ * @brief Definition for COM port1, connected to USART1
+ */ 
+#define EVAL_COM1                          USART1
+#define EVAL_COM1_CLK_ENABLE()             __HAL_RCC_USART1_CLK_ENABLE()   
+#define EVAL_COM1_CLK_DISABLE()            __HAL_RCC_USART1_CLK_DISABLE()
+
+#define EVAL_COM1_TX_PIN                   GPIO_PIN_9
+#define EVAL_COM1_TX_GPIO_PORT             GPIOA
+#define EVAL_COM1_TX_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()   
+#define EVAL_COM1_TX_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()  
+#define EVAL_COM1_TX_AF                    GPIO_AF7_USART1
+
+#define EVAL_COM1_RX_PIN                   GPIO_PIN_10
+#define EVAL_COM1_RX_GPIO_PORT             GPIOA
+#define EVAL_COM1_RX_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOA_CLK_ENABLE()   
+#define EVAL_COM1_RX_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOA_CLK_DISABLE()  
+#define EVAL_COM1_RX_AF                    GPIO_AF7_USART1
+
+#define EVAL_COM1_IRQn                     USART1_IRQn
+
+#define EVAL_COMx_CLK_ENABLE(__INDEX__)            do { if((__INDEX__) == COM1) {EVAL_COM1_CLK_ENABLE();} } while(0)
+#define EVAL_COMx_CLK_DISABLE(__INDEX__)           (((__INDEX__) == 0) ? EVAL_COM1_CLK_DISABLE() : 0)
+
+#define EVAL_COMx_TX_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == COM1) {EVAL_COM1_TX_GPIO_CLK_ENABLE();} } while(0)
+#define EVAL_COMx_TX_GPIO_CLK_DISABLE(__INDEX__)   (((__INDEX__) == 0) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() : 0)
+
+#define EVAL_COMx_RX_GPIO_CLK_ENABLE(__INDEX__)    do { if((__INDEX__) == COM1) {EVAL_COM1_RX_GPIO_CLK_ENABLE();} } while(0)
+#define EVAL_COMx_RX_GPIO_CLK_DISABLE(__INDEX__)   (((__INDEX__) == 0) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() : 0)
+
+/**
+  * @brief Joystick Pins definition 
+  */ 
+#if defined(USE_IOEXPANDER)
+
+#define JOY_SEL_PIN                    IO_PIN_5
+#define JOY_UP_PIN                     IO_PIN_4
+#define JOY_DOWN_PIN                   IO_PIN_3
+#define JOY_LEFT_PIN                   IO_PIN_2
+#define JOY_RIGHT_PIN                  IO_PIN_1
+#define JOY_NONE_PIN                   JOY_ALL_PINS
+#define JOY_ALL_PINS                   (IO_PIN_5 | IO_PIN_1 | IO_PIN_2 | IO_PIN_3 | IO_PIN_4)
+
+#endif /* USE_IOEXPANDER */
+
+/**
+  * @brief Eval Pins definition connected to MFX
+  */
+
+#if defined(USE_IOEXPANDER)
+
+#define XSDN_PIN                       IO_PIN_10    
+#define RSTI_PIN                       IO_PIN_11    
+#define CAM_PLUG_PIN                   IO_PIN_12    
+#define AUDIO_INT_PIN                  IO_PIN_5     
+#define OTG_FS1_OVER_CURRENT_PIN       IO_PIN_6      
+#define OTG_FS1_POWER_SWITCH_PIN       IO_PIN_7     
+#define OTG_FS2_OVER_CURRENT_PIN       IO_PIN_8     
+#define SD_DETECT_PIN                  IO_PIN_15    
+
+#endif /* USE_IOEXPANDER */
+
+
+/* Exported constant IO ------------------------------------------------------*/
+
+/*  The MFX_I2C_ADDR input pin selects the MFX I2C device address 
+        MFX_I2C_ADDR input pin     MFX I2C device address
+            0                           b: 1000 010x    (0x84)
+            1                           b: 1000 011x    (0x86)
+   This input is sampled during the MFX firmware startup.  */
+
+#define IO_I2C_ADDRESS                   ((uint16_t)0x84)  /*mfx MFX_I2C_ADDR 0*/
+#define IO_I2C_ADDRESS_2                 ((uint16_t)0x86)  /*mfx MFX_I2C_ADDR 1*/
+#define TS_I2C_ADDRESS                   ((uint16_t)0x84)  /*mfx MFX_I2C_ADDR 0*/
+#define TS_I2C_ADDRESS_2                 ((uint16_t)0x86)  /*mfx MFX_I2C_ADDR 1*/
+
+
+#define CAMERA_I2C_ADDRESS               ((uint16_t)0x5A)
+#define AUDIO_I2C_ADDRESS                ((uint16_t)0x34)
+#define EEPROM_I2C_ADDRESS_A01           ((uint16_t)0xA0)
+#define EEPROM_I2C_ADDRESS_A02           ((uint16_t)0xA6)  
+
+
+/* User can use this section to tailor I2Cx/I2Cx instance used and associated 
+   resources */
+/* Definition for I2Cx clock resources */
+#define EVAL_I2Cx                             FMPI2C1
+#define EVAL_I2Cx_CLK_ENABLE()                __HAL_RCC_FMPI2C1_CLK_ENABLE()
+#define EVAL_I2Cx_CLK_DISABLE()               __HAL_RCC_FMPI2C1_CLK_DISABLE()
+#define EVAL_DMAx_CLK_ENABLE()                __HAL_RCC_DMA1_CLK_ENABLE()
+#define EVAL_I2Cx_SCL_SDA_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOD_CLK_ENABLE()
+#define EVAL_I2Cx_SCL_SDA_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOD_CLK_DISABLE()
+
+#define EVAL_I2Cx_FORCE_RESET()               __HAL_RCC_FMPI2C1_FORCE_RESET()
+#define EVAL_I2Cx_RELEASE_RESET()             __HAL_RCC_FMPI2C1_RELEASE_RESET()
+   
+/* Definition for I2Cx Pins */
+#define EVAL_I2Cx_SCL_PIN                     GPIO_PIN_12
+#define EVAL_I2Cx_SCL_SDA_GPIO_PORT           GPIOD
+#define EVAL_I2Cx_SCL_SDA_AF                  GPIO_AF4_FMPI2C1
+#define EVAL_I2Cx_SDA_PIN                     GPIO_PIN_13
+
+/* I2C interrupt requests */
+#define EVAL_I2Cx_EV_IRQn                     FMPI2C1_EV_IRQn
+#define EVAL_I2Cx_ER_IRQn                     FMPI2C1_ER_IRQn
+
+#ifndef EVAL_I2Cx_TIMING  
+#define EVAL_I2Cx_TIMING                      ((uint32_t)0x00805252)   
+#endif /* EVAL_I2Cx_TIMING */
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Macros STM32446E EVAL Low Level Exported Macros
+  * @{
+  */  
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LOW_LEVEL_Exported_Functions STM32446E EVAL Low Level Exported Functions
+  * @{
+  */
+uint32_t         BSP_GetVersion(void);  
+void             BSP_LED_Init(Led_TypeDef Led);
+void             BSP_LED_DeInit(Led_TypeDef Led);
+void             BSP_LED_On(Led_TypeDef Led);
+void             BSP_LED_Off(Led_TypeDef Led);
+void             BSP_LED_Toggle(Led_TypeDef Led);
+void             BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode);
+void             BSP_PB_DeInit(Button_TypeDef Button);
+uint32_t         BSP_PB_GetState(Button_TypeDef Button);
+void             BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef *husart);
+void             BSP_COM_DeInit(COM_TypeDef COM, UART_HandleTypeDef *huart);
+#if defined(USE_IOEXPANDER)
+uint8_t          BSP_JOY_Init(JOYMode_TypeDef JoyMode);
+void             BSP_JOY_DeInit(void);
+JOYState_TypeDef BSP_JOY_GetState(void);
+void             BSP_MFX_reg_access_for_debug(void);
+#endif /* USE_IOEXPANDER */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 1368 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_audio.c

@@ -0,0 +1,1368 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_audio.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file provides the Audio driver for the STM32446E-EVAL evaluation board.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */
+
+/*==============================================================================
+                                 User NOTES
+                                 
+How To use this driver:
+-----------------------
+   + This driver supports STM32F4xx devices on STM32446E-EVAL (MB1045) Evaluation boards.
+   + Call the function BSP_AUDIO_OUT_Init(
+                                    OutputDevice: physical output mode (OUTPUT_DEVICE_SPEAKER, 
+                                                  OUTPUT_DEVICE_HEADPHONE or OUTPUT_DEVICE_BOTH)
+                                    Volume      : Initial volume to be set (0 is min (mute), 100 is max (100%)
+                                    AudioFreq   : Audio frequency in Hz (8000, 16000, 22500, 32000...)
+                                                  this parameter is relative to the audio file/stream type.
+                                   )
+      This function configures all the hardware required for the audio application (codec, I2C, SAI, 
+      GPIOs, DMA and interrupt if needed). This function returns AUDIO_OK if configuration is OK.
+      If the returned value is different from AUDIO_OK or the function is stuck then the communication with
+      the codec or the MFX has failed (try to un-plug the power or reset device in this case).
+      - OUTPUT_DEVICE_SPEAKER  : only speaker will be set as output for the audio stream.
+      - OUTPUT_DEVICE_HEADPHONE: only headphones will be set as output for the audio stream.
+      - OUTPUT_DEVICE_BOTH     : both Speaker and Headphone are used as outputs for the audio stream
+                                 at the same time.
+      Note. On STM32446E-EVAL SAI_DMA is configured in CIRCULAR mode. Due to this the application
+        does NOT need to call BSP_AUDIO_OUT_ChangeBuffer() to assure streaming.
+   + Call the function BSP_EVAL_AUDIO_OUT_Play(
+                                  pBuffer: pointer to the audio data file address
+                                  Size   : size of the buffer to be sent in Bytes
+                                 )
+      to start playing (for the first time) from the audio file/stream.
+   + Call the function BSP_AUDIO_OUT_Pause() to pause playing   
+   + Call the function BSP_AUDIO_OUT_Resume() to resume playing.
+       Note. After calling BSP_AUDIO_OUT_Pause() function for pause, only BSP_AUDIO_OUT_Resume() should be called
+          for resume (it is not allowed to call BSP_AUDIO_OUT_Play() in this case).
+       Note. This function should be called only when the audio file is played or paused (not stopped).
+   + For each mode, you may need to implement the relative callback functions into your code.
+      The Callback functions are named AUDIO_OUT_XXX_CallBack() and only their prototypes are declared in 
+      the stm32446e_eval_audio.h file. (refer to the example for more details on the callbacks implementations)
+   + To Stop playing, to modify the volume level, the frequency, the audio frame slot, 
+      the device output mode the mute or the stop, use the functions: BSP_AUDIO_OUT_SetVolume(), 
+      AUDIO_OUT_SetFrequency(), BSP_AUDIO_OUT_SetAudioFrameSlot(), BSP_AUDIO_OUT_SetOutputMode(),
+      BSP_AUDIO_OUT_SetMute() and BSP_AUDIO_OUT_Stop().
+   + The driver API and the callback functions are at the end of the stm32446e_eval_audio.h file.
+ 
+
+Driver architecture:
+--------------------
+   + This driver provides the High Audio Layer: consists of the function API exported in the stm32446e_eval_audio.h file
+     (BSP_AUDIO_OUT_Init(), BSP_AUDIO_OUT_Play() ...)
+   + This driver provide also the Media Access Layer (MAL): which consists of functions allowing to access the media containing/
+     providing the audio file/stream. These functions are also included as local functions into
+     the stm32446e_eval_audio_codec.c file (I2Sx_Init(), I2Sx_DeInit(), SAIx_Init() and SAIx_DeInit())
+
+Known Limitations:
+------------------
+   1- If the TDM Format used to play in parallel 2 audio Stream (the first Stream is configured in codec SLOT0 and second 
+      Stream in SLOT1) the Pause/Resume, volume and mute feature will control the both streams.
+   2- Parsing of audio file is not implemented (in order to determine audio file properties: Mono/Stereo, Data size, 
+      File size, Audio Frequency, Audio Data header size ...). The configuration is fixed for the given audio file.
+   3- Supports only Stereo audio streaming.
+   4- Supports only 16-bits audio data size.
+==============================================================================*/
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval_audio.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_AUDIO STM32446E-EVAL AUDIO
+  * @brief This file includes the low layer driver for wm8994 Audio Codec
+  *        available on STM32446E-EVAL evaluation board(MB1045).
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_Private_Types STM32446E Eval Audio Private Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_AUDIO_Private_Defines STM32446E Eval Audio Private Defines
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_Private_Macros STM32446E Eval Audio Private macros 
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_AUDIO_Private_Variables STM32446E Eval Audio Private Variables
+  * @{
+  */
+  
+/*
+Note: 
+  these global variables are not compliant to naming rules (upper case without "_" ), 
+  but we keep this naming for compatibility, in fact these variables (not static)
+  could have been used by the application, example the stm32f4xx_it.c:
+    void DMA2_Stream6_IRQHandler(void)
+     {  HAL_DMA_IRQHandler(haudio_out_sai.hdmatx);  }
+*/
+AUDIO_DrvTypeDef          *audio_drv;
+SAI_HandleTypeDef         haudio_out_sai;
+I2S_HandleTypeDef         haudio_in_i2s;
+TIM_HandleTypeDef         haudio_tim;
+
+PDMFilter_InitStruct Filter[2];
+uint8_t Channel_Demux[128] = {
+    0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+    0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+    0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
+    0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
+    0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+    0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
+    0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
+    0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
+    0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
+    0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
+    0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
+    0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
+    0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
+    0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
+    0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
+    0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f
+};
+   
+uint16_t __IO AudioInVolume = DEFAULT_AUDIO_IN_VOLUME;
+    
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_Private_Function_Prototypes STM32446E Eval Audio Private Prototypes
+  * @{
+  */
+static void SAIx_Init(uint32_t AudioFreq);
+static void SAIx_DeInit(void);
+static void I2Sx_Init(uint32_t AudioFreq);
+static void I2Sx_DeInit(void);
+static void TIMx_IC_MspInit(TIM_HandleTypeDef *htim);
+static void TIMx_IC_MspDeInit(TIM_HandleTypeDef *htim);
+static void TIMx_Init(void);
+static void TIMx_DeInit(void);
+static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbr);
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_out_Private_Functions STM32446E Eval AudioOut Private Functions
+  * @{
+  */ 
+
+/**
+  * @brief  Configures the audio peripherals.
+  * @param  OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
+  *                       or OUTPUT_DEVICE_BOTH.
+  * @param  Volume: Initial volume level (from 0 (Mute) to 100 (Max))
+  * @param  AudioFreq: Audio frequency used to play the audio stream.
+  * @note   The I2S PLL input clock must be done in the user application.  
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
+{ 
+  uint8_t ret = AUDIO_ERROR;
+  uint32_t deviceid = 0x00;
+
+  SAIx_DeInit();
+
+  /* PLL clock is set depending by the AudioFreq (44.1khz vs 48khz groups) */ 
+  BSP_AUDIO_OUT_ClockConfig(&haudio_out_sai, AudioFreq, NULL);
+ 
+  /* SAI data transfer preparation:
+  Prepare the Media to be used for the audio transfer from memory to SAI peripheral */
+  haudio_out_sai.Instance = AUDIO_SAIx;
+  if(HAL_SAI_GetState(&haudio_out_sai) == HAL_SAI_STATE_RESET)
+  {
+    /* Init the SAI MSP: this __weak function can be redefined by the application*/
+    BSP_AUDIO_OUT_MspInit(&haudio_out_sai, NULL);
+  }
+  SAIx_Init(AudioFreq);
+  
+  /* wm8994 codec initialization */
+  deviceid = wm8994_drv.ReadID(AUDIO_I2C_ADDRESS);
+  
+  if((deviceid) == WM8994_ID)
+  {  
+    /* Initialize the audio driver structure */
+    audio_drv = &wm8994_drv; 
+    ret = AUDIO_OK;
+  }
+  else
+  {
+    ret = AUDIO_ERROR;
+  }
+
+  if(ret == AUDIO_OK)
+  {
+    /* Resets the audio codec. */
+    audio_drv->Reset(AUDIO_I2C_ADDRESS);
+    /* Initialize the codec internal registers */
+    audio_drv->Init(AUDIO_I2C_ADDRESS, OutputDevice, Volume, AudioFreq);
+  }
+ 
+  return ret;
+}
+
+/**
+  * @brief  Starts playing audio stream from a data buffer for a determined size. 
+  * @param  pBuffer: Pointer to the buffer 
+  * @param  Size: Number of audio data BYTES.
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_Play(uint16_t* pBuffer, uint32_t Size)
+{
+  /* Call the audio Codec Play function */
+  if(audio_drv->Play(AUDIO_I2C_ADDRESS, pBuffer, Size) != 0)
+  {  
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Update the Media layer and enable it for play */  
+    HAL_SAI_Transmit_DMA(&haudio_out_sai, (uint8_t*) pBuffer, DMA_MAX(Size / AUDIODATA_SIZE));
+    
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Sends n-Bytes on the SAI interface.
+  * @param  pData: pointer on data address 
+  * @param  Size: number of data to be written
+  * @retval None
+  */
+void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size)
+{
+   HAL_SAI_Transmit_DMA(&haudio_out_sai, (uint8_t*) pData, Size);
+}
+
+/**
+  * @brief  This function Pauses the audio file stream. In case
+  *         of using DMA, the DMA Pause feature is used.
+  * @WARNING When calling BSP_AUDIO_OUT_Pause() function for pause, only
+  *          BSP_AUDIO_OUT_Resume() function should be called for resume (use of BSP_AUDIO_OUT_Play() 
+  *          function for resume could lead to unexpected behavior).
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_Pause(void)
+{    
+  /* Call the Audio Codec Pause/Resume function */
+  if(audio_drv->Pause(AUDIO_I2C_ADDRESS) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Call the Media layer pause function */
+    HAL_SAI_DMAPause(&haudio_out_sai);
+    
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  This function  Resumes the audio file stream.  
+  * @WARNING When calling BSP_AUDIO_OUT_Pause() function for pause, only
+  *          BSP_AUDIO_OUT_Resume() function should be called for resume (use of BSP_AUDIO_OUT_Play() 
+  *          function for resume could lead to unexpected behavior).
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_Resume(void)
+{    
+  /* Call the Audio Codec Pause/Resume function */
+  if(audio_drv->Resume(AUDIO_I2C_ADDRESS) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Call the Media layer pause/resume function */
+    HAL_SAI_DMAResume(&haudio_out_sai);
+    
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Stops audio playing and Power down the Audio Codec. 
+  * @param  Option: could be one of the following parameters 
+  *           - CODEC_PDWN_SW: for software power off (by writing registers). 
+  *                            Then no need to reconfigure the Codec after power on.
+  *           - CODEC_PDWN_HW: completely shut down the codec (physically). 
+  *                            Then need to reconfigure the Codec after power on.  
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option)
+{
+  /* Call the Media layer stop function */
+  HAL_SAI_DMAStop(&haudio_out_sai);
+
+  /* Call Audio Codec Stop function */
+  if(audio_drv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    if(Option == CODEC_PDWN_HW)
+    { 
+      /* Wait at least 100us */
+      HAL_Delay(1);
+    }
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Controls the current audio volume level. 
+  * @param  Volume: Volume level to be set in percentage from 0% to 100% (0 for 
+  *         Mute and 100 for Max volume level).
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume)
+{
+  /* Call the codec volume control function with converted volume value */
+  if(audio_drv->SetVolume(AUDIO_I2C_ADDRESS, Volume) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Enables or disables the MUTE mode by software 
+  * @param  Cmd: Could be AUDIO_MUTE_ON to mute sound or AUDIO_MUTE_OFF to 
+  *         unmute the codec and restore previous volume level.
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd)
+{ 
+  /* Call the Codec Mute function */
+  if(audio_drv->SetMute(AUDIO_I2C_ADDRESS, Cmd) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Switch dynamically (while audio file is played) the output target 
+  *         (speaker or headphone).
+  * @param  Output: The audio output target: OUTPUT_DEVICE_SPEAKER,
+  *         OUTPUT_DEVICE_HEADPHONE or OUTPUT_DEVICE_BOTH
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output)
+{
+  /* Call the Codec output device function */
+  if(audio_drv->SetOutputMode(AUDIO_I2C_ADDRESS, Output) != 0)
+  {
+    return AUDIO_ERROR;
+  }
+  else
+  {
+    /* Return AUDIO_OK when all operations are correctly done */
+    return AUDIO_OK;
+  }
+}
+
+/**
+  * @brief  Updates the audio frequency.
+  * @param  AudioFreq: Audio frequency used to play the audio stream.
+  * @note   This API should be called after the BSP_AUDIO_OUT_Init() to adjust the
+  *         audio frequency.
+  * @retval None
+  */
+void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq)
+{ 
+  /* PLL clock is set depending by the AudioFreq (44.1khz vs 48khz groups) */ 
+  BSP_AUDIO_OUT_ClockConfig(&haudio_out_sai, AudioFreq, NULL);
+
+  /* Disable SAI peripheral to allow access to SAI internal registers */
+  __HAL_SAI_DISABLE(&haudio_out_sai);
+    
+  /* Update the SAI audio frequency configuration */
+  haudio_out_sai.Init.AudioFrequency = AudioFreq;
+  HAL_SAI_Init(&haudio_out_sai);
+  
+  /* Enable SAI peripheral to generate MCLK */
+  __HAL_SAI_ENABLE(&haudio_out_sai);
+}
+
+/**
+  * @brief  Updates the Audio frame slot configuration.
+  * @param  AudioFrameSlot: specifies the audio Frame slot
+  *         This parameter can be any value of @ref CODEC_AudioFrame_SLOT_TDMMode
+  * @note   This API should be called after the BSP_AUDIO_OUT_Init() to adjust the
+  *         audio frame slot.
+  * @retval None
+  */
+void BSP_AUDIO_OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot)
+{ 
+  /* Disable SAI peripheral to allow access to SAI internal registers */
+  __HAL_SAI_DISABLE(&haudio_out_sai);
+  
+  /* Update the SAI audio frame slot configuration */
+  haudio_out_sai.SlotInit.SlotActive = AudioFrameSlot;
+  HAL_SAI_Init(&haudio_out_sai);
+  
+  /* Enable SAI peripheral to generate MCLK */
+  __HAL_SAI_ENABLE(&haudio_out_sai);
+}
+
+/**
+  * @brief  Deinit the audio peripherals.
+  * @param  None
+  * @retval None
+  */
+void BSP_AUDIO_OUT_DeInit(void)
+{
+  SAIx_DeInit();
+  /* DeInit the SAI MSP : this __weak function can be rewritten by the applic */
+  BSP_AUDIO_OUT_MspDeInit(&haudio_out_sai, NULL);
+}
+
+/**
+  * @brief  Tx Transfer completed callbacks.
+  * @param  hsai: SAI handle
+  * @retval None
+  */
+void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai)
+{
+  /* Manage the remaining file size and new address offset: This function 
+     should be coded by user (its prototype is already declared in stm32446e_eval_audio.h) */
+  BSP_AUDIO_OUT_TransferComplete_CallBack();
+}
+
+/**
+  * @brief  Tx Half Transfer completed callbacks.
+  * @param  hsai: SAI handle
+  * @retval None
+  */
+void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai)
+{
+  /* Manage the remaining file size and new address offset: This function 
+     should be coded by user (its prototype is already declared in stm32446e_eval_audio.h) */
+  BSP_AUDIO_OUT_HalfTransfer_CallBack();
+}
+
+/**
+  * @brief  SAI error callbacks.
+  * @param  hsai: SAI handle
+  * @retval None
+  */
+void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai)
+{
+  BSP_AUDIO_OUT_Error_CallBack();
+}
+
+/**
+  * @brief  Manages the DMA full Transfer complete event.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
+{
+}
+
+/**
+  * @brief  Manages the DMA Half Transfer complete event.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack(void)
+{ 
+}
+
+/**
+  * @brief  Manages the DMA FIFO error event.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_Error_CallBack(void)
+{
+}
+
+/**
+  * @brief  Initializes BSP_AUDIO_OUT MSP.
+  * @param  hsai: SAI handle
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_MspInit(SAI_HandleTypeDef *hsai, void *Params)
+{ 
+  static DMA_HandleTypeDef hdma_sai_tx;
+  GPIO_InitTypeDef  gpio_init_structure;  
+
+  /* Enable SAI clock */
+  AUDIO_SAIx_CLK_ENABLE();
+  
+  /* Enable GPIO clock */
+  AUDIO_SAIx_MCLK_SCK_ENABLE();
+  AUDIO_SAIx_SD_FS_ENABLE();
+  
+  /* CODEC_SAI pins configuration: FS, SCK, MCK and SD pins ------------------*/
+  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull = GPIO_NOPULL;
+  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
+
+  gpio_init_structure.Alternate = AUDIO_SAIx_MCLK_SD_FS_AF;
+  gpio_init_structure.Pin = AUDIO_SAIx_FS_PIN | AUDIO_SAIx_SD_PIN;
+  HAL_GPIO_Init(AUDIO_SAIx_SD_FS_GPIO_PORT, &gpio_init_structure);
+
+  gpio_init_structure.Alternate = AUDIO_SAIx_MCLK_SD_FS_AF;
+  gpio_init_structure.Pin = AUDIO_SAIx_MCK_PIN;
+  HAL_GPIO_Init(AUDIO_SAIx_MCLK_SCK_GPIO_PORT, &gpio_init_structure);
+
+  gpio_init_structure.Alternate = AUDIO_SAIx_SCK_AF;
+  gpio_init_structure.Pin = AUDIO_SAIx_SCK_PIN ;
+  HAL_GPIO_Init(AUDIO_SAIx_MCLK_SCK_GPIO_PORT, &gpio_init_structure);
+ 
+  /* Enable the DMA clock */
+  AUDIO_SAIx_DMAx_CLK_ENABLE();
+    
+  if(hsai->Instance == AUDIO_SAIx)
+  {
+    /* Configure the hdma_sai_tx handle parameters */   
+    hdma_sai_tx.Init.Channel             = AUDIO_SAIx_DMAx_CHANNEL;
+    hdma_sai_tx.Init.Direction           = DMA_MEMORY_TO_PERIPH;
+    hdma_sai_tx.Init.PeriphInc           = DMA_PINC_DISABLE;
+    hdma_sai_tx.Init.MemInc              = DMA_MINC_ENABLE;
+    hdma_sai_tx.Init.PeriphDataAlignment = AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE;
+    hdma_sai_tx.Init.MemDataAlignment    = AUDIO_SAIx_DMAx_MEM_DATA_SIZE;
+    hdma_sai_tx.Init.Mode                = DMA_CIRCULAR;
+    hdma_sai_tx.Init.Priority            = DMA_PRIORITY_HIGH;
+    hdma_sai_tx.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;         
+    hdma_sai_tx.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+    hdma_sai_tx.Init.MemBurst            = DMA_MBURST_SINGLE;
+    hdma_sai_tx.Init.PeriphBurst         = DMA_PBURST_SINGLE; 
+    
+    hdma_sai_tx.Instance = AUDIO_SAIx_DMAx_STREAM;
+    
+    /* Associate the DMA handle */
+    __HAL_LINKDMA(hsai, hdmatx, hdma_sai_tx);
+    
+    /* Deinitialize the Stream for new transfer */
+    HAL_DMA_DeInit(&hdma_sai_tx);
+    
+    /* Configure the DMA Stream */
+    HAL_DMA_Init(&hdma_sai_tx);      
+  }
+  
+  /* SAI DMA IRQ Channel configuration */
+  HAL_NVIC_SetPriority(AUDIO_SAIx_DMAx_IRQ, AUDIO_OUT_IRQ_PREPRIO, 0);
+  HAL_NVIC_EnableIRQ(AUDIO_SAIx_DMAx_IRQ); 
+}
+
+/**
+  * @brief  Deinitializes SAI MSP.
+  * @param  hsai: SAI handle
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_MspDeInit(SAI_HandleTypeDef *hsai, void *Params)
+{
+    GPIO_InitTypeDef  gpio_init_structure;
+
+    /* SAI DMA IRQ Channel deactivation */
+    HAL_NVIC_DisableIRQ(AUDIO_SAIx_DMAx_IRQ);
+
+    if(hsai->Instance == AUDIO_SAIx)
+    {
+      /* Deinitialize the DMA stream */
+      HAL_DMA_DeInit(hsai->hdmatx);
+    }
+
+    /* Disable SAI peripheral */
+    __HAL_SAI_DISABLE(hsai);  
+
+    /* Deactives CODEC_SAI pins FS, SCK, MCK and SD by putting them in input mode */
+    gpio_init_structure.Pin = AUDIO_SAIx_FS_PIN | AUDIO_SAIx_SD_PIN;
+    HAL_GPIO_DeInit(AUDIO_SAIx_SD_FS_GPIO_PORT, gpio_init_structure.Pin);
+
+    gpio_init_structure.Pin = AUDIO_SAIx_MCK_PIN;
+    HAL_GPIO_DeInit(AUDIO_SAIx_MCLK_SCK_GPIO_PORT, gpio_init_structure.Pin);
+
+    gpio_init_structure.Pin = AUDIO_SAIx_SCK_PIN ;
+    HAL_GPIO_DeInit(AUDIO_SAIx_MCLK_SCK_GPIO_PORT, gpio_init_structure.Pin);
+  
+    /* Disable SAI clock */
+    AUDIO_SAIx_CLK_DISABLE();
+
+    /* GPIO pins clock and DMA clock can be shut down in the application 
+       by surcharging this __weak function */ 
+}
+
+/**
+  * @brief  Clock Config.
+  * @param  hsai: might be required to set audio peripheral predivider if any.
+  * @param  AudioFreq: Audio frequency used to play the audio stream.
+  * @note   This API is called by BSP_AUDIO_OUT_Init() and BSP_AUDIO_OUT_SetFrequency()
+  *         Being __weak it can be overwritten by the application     
+  * @retval None
+  */
+__weak void BSP_AUDIO_OUT_ClockConfig(SAI_HandleTypeDef *hsai, uint32_t AudioFreq, void *Params)
+{ 
+  RCC_PeriphCLKInitTypeDef rcc_ex_clk_init_struct;
+
+  HAL_RCCEx_GetPeriphCLKConfig(&rcc_ex_clk_init_struct);
+  
+  /* Set the PLL configuration according to the audio frequency */
+  if((AudioFreq == AUDIO_FREQUENCY_11K) || (AudioFreq == AUDIO_FREQUENCY_22K) || (AudioFreq == AUDIO_FREQUENCY_44K))
+  {
+    /* Configure PLLSAI prescalers */
+    /* PLLSAI_VCO: VCO_429M 
+    SAI_CLK(first level) = PLLSAI_VCO/PLLSAIQ = 429/2 = 214.5 Mhz
+    SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ = 214.5/19 = 11.289 Mhz */ 
+    rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI2;
+    rcc_ex_clk_init_struct.Sai2ClockSelection = RCC_SAI2CLKSOURCE_PLLSAI;
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIM = 8; 
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIN = 429; 
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIQ = 2; 
+    rcc_ex_clk_init_struct.PLLSAIDivQ = 19; 
+    
+    HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
+    
+  }
+  else /* AUDIO_FREQUENCY_8K, AUDIO_FREQUENCY_16K, AUDIO_FREQUENCY_48K), AUDIO_FREQUENCY_96K */
+  {
+    /* SAI clock config 
+    PLLSAI_VCO: VCO_344M 
+    SAI_CLK(first level) = PLLSAI_VCO/PLLSAIQ = 344/7 = 49.142 Mhz 
+    SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ = 49.142/1 = 49.142 Mhz */  
+    rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI2;
+    rcc_ex_clk_init_struct.Sai2ClockSelection = RCC_SAI2CLKSOURCE_PLLSAI;
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIM = 8; 
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIN = 344; 
+    rcc_ex_clk_init_struct.PLLSAI.PLLSAIQ = 7; 
+    rcc_ex_clk_init_struct.PLLSAIDivQ = 1;       
+    
+    HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
+  }
+}
+
+/*******************************************************************************
+                            Static Functions
+*******************************************************************************/
+
+/**
+  * @brief  Initializes the Audio Codec audio interface (SAI).
+  * @param  AudioFreq: Audio frequency to be configured for the SAI peripheral.
+  * @note   The default SlotActive configuration is set to CODEC_AUDIOFRAME_SLOT_0123 
+  *         and user can update this configuration using 
+  * @retval None
+  */
+static void SAIx_Init(uint32_t AudioFreq)
+{
+  /* Initialize the hAudioOutSai Instance parameter */
+  haudio_out_sai.Instance = AUDIO_SAIx;
+  
+  /* Disable SAI peripheral to allow access to SAI internal registers */
+  __HAL_SAI_DISABLE(&haudio_out_sai);
+  
+  /* Configure SAI_Block_x 
+  LSBFirst: Disabled 
+  DataSize: 16 */
+  haudio_out_sai.Init.AudioFrequency = AudioFreq;
+  haudio_out_sai.Init.ClockSource = SAI_CLKSOURCE_PLLSAI;
+  haudio_out_sai.Init.AudioMode = SAI_MODEMASTER_TX;
+  haudio_out_sai.Init.NoDivider = SAI_MASTERDIVIDER_ENABLE;
+  haudio_out_sai.Init.Protocol = SAI_FREE_PROTOCOL;
+  haudio_out_sai.Init.DataSize = SAI_DATASIZE_16;
+  haudio_out_sai.Init.FirstBit = SAI_FIRSTBIT_MSB;
+  haudio_out_sai.Init.ClockStrobing = SAI_CLOCKSTROBING_RISINGEDGE;
+  haudio_out_sai.Init.Synchro = SAI_ASYNCHRONOUS;
+  haudio_out_sai.Init.OutputDrive = SAI_OUTPUTDRIVE_ENABLE;
+  haudio_out_sai.Init.FIFOThreshold = SAI_FIFOTHRESHOLD_1QF;
+  
+  /* Configure SAI_Block_x Frame 
+  Frame Length: 64
+  Frame active Length: 32
+  FS Definition: Start frame + Channel Side identification
+  FS Polarity: FS active Low
+  FS Offset: FS asserted one bit before the first bit of slot 0 */ 
+  haudio_out_sai.FrameInit.FrameLength = 64; 
+  haudio_out_sai.FrameInit.ActiveFrameLength = 32;
+  haudio_out_sai.FrameInit.FSDefinition = SAI_FS_CHANNEL_IDENTIFICATION;
+  haudio_out_sai.FrameInit.FSPolarity = SAI_FS_ACTIVE_LOW;
+  haudio_out_sai.FrameInit.FSOffset = SAI_FS_BEFOREFIRSTBIT;
+  
+  /* Configure SAI Block_x Slot 
+  Slot First Bit Offset: 0
+  Slot Size  : 16
+  Slot Number: 4
+  Slot Active: All slot actives */
+  haudio_out_sai.SlotInit.FirstBitOffset = 0;
+  haudio_out_sai.SlotInit.SlotSize = SAI_SLOTSIZE_DATASIZE;
+  haudio_out_sai.SlotInit.SlotNumber = 4; 
+  haudio_out_sai.SlotInit.SlotActive = CODEC_AUDIOFRAME_SLOT_0123;
+
+  HAL_SAI_Init(&haudio_out_sai);
+  
+  /* Enable SAI peripheral to generate MCLK */
+  __HAL_SAI_ENABLE(&haudio_out_sai);
+}
+
+
+
+/**
+  * @brief  Deinitializes the Audio Codec audio interface (SAI).
+  * @param  None
+  * @retval None
+  */
+static void SAIx_DeInit(void)
+{
+  /* Initialize the hAudioOutSai Instance parameter */
+  haudio_out_sai.Instance = AUDIO_SAIx;
+
+  /* Disable SAI peripheral */
+  __HAL_SAI_DISABLE(&haudio_out_sai);
+
+  HAL_SAI_DeInit(&haudio_out_sai);
+}
+
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_AUDIO_in_Private_Functions STM32446E Eval AudioIn Private functions
+  * @{
+  */ 
+  
+/**
+  * @brief  Initializes wave recording.
+  * @note   This function assumes that the I2S input clock (through PLL_R in 
+  *         Devices RevA/Z and through dedicated PLLI2S_R in Devices RevB/Y)
+  *         is already configured and ready to be used.  
+  * @param  AudioFreq: Audio frequency to be configured for the I2S peripheral. 
+  * @param  BitRes: Audio frequency to be configured for the I2S peripheral.
+  * @param  ChnlNbr: Audio frequency to be configured for the I2S peripheral.
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
+{
+  RCC_PeriphCLKInitTypeDef rcc_ex_clk_init_struct;
+
+  I2Sx_DeInit();
+  
+  HAL_RCCEx_GetPeriphCLKConfig(&rcc_ex_clk_init_struct);
+  rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_I2S_APB1; /*SPI3 & TIM4 on APB1*/
+  rcc_ex_clk_init_struct.PLLI2S.PLLI2SN = 384;
+  rcc_ex_clk_init_struct.PLLI2S.PLLI2SR = 2;
+  HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct); 
+  
+  /* Configure the PDM library */
+  PDMDecoder_Init(AudioFreq, ChnlNbr);
+ 
+  /* Configure the I2S peripheral */
+  haudio_in_i2s.Instance = AUDIO_I2Sx;
+  if(HAL_I2S_GetState(&haudio_in_i2s) == HAL_I2S_STATE_RESET)
+  { 
+    /* Initialize the I2S Msp: this __weak function can be rewritten by the application */
+    BSP_AUDIO_IN_MspInit(&haudio_in_i2s, NULL);
+  }
+  I2Sx_Init(AudioFreq);
+
+  /* Return AUDIO_OK when all operations are correctly done */
+  return AUDIO_OK;
+}
+
+/**
+  * @brief  Starts audio recording.
+  * @param  pbuf: Main buffer pointer for the recorded data storing  
+  * @param  size: Current size of the recorded buffer
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_Record(uint16_t* pbuf, uint32_t size)
+{
+  uint32_t ret = AUDIO_ERROR;
+  
+  /* Start the process receive DMA */
+  HAL_I2S_Receive_DMA(&haudio_in_i2s, pbuf, size);
+  
+  /* Return AUDIO_OK when all operations are correctly done */
+  ret = AUDIO_OK;
+  
+  return ret;
+}
+
+/**
+  * @brief  Stops audio recording.
+  * @param  None
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_Stop(void)
+{
+  uint32_t ret = AUDIO_ERROR;
+  
+  /* Call the Media layer pause function */
+  HAL_I2S_DMAPause(&haudio_in_i2s);  
+  
+  /* TIMx Peripheral clock disable */
+  AUDIO_TIMx_CLK_DISABLE();
+
+  /* Return AUDIO_OK when all operations are correctly done */
+  ret = AUDIO_OK;
+  
+  return ret;
+}
+
+/**
+  * @brief  Pauses the audio file stream.
+  * @param  None
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_Pause(void)
+{    
+  /* Call the Media layer pause function */
+  HAL_I2S_DMAPause(&haudio_in_i2s);
+  
+  /* Return AUDIO_OK when all operations are correctly done */
+  return AUDIO_OK;
+}
+
+/**
+  * @brief  Resumes the audio file stream.
+  * @param  None    
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_Resume(void)
+{    
+  /* Call the Media layer pause/resume function */
+  HAL_I2S_DMAResume(&haudio_in_i2s);
+  
+  /* Return AUDIO_OK when all operations are correctly done */
+  return AUDIO_OK;
+}
+
+/**
+  * @brief  Controls the audio in volume level. 
+  * @param  Volume: Volume level to be set in percentage from 0% to 100% (0 for 
+  *         Mute and 100 for Max volume level).
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume)
+{
+  /* Set the Global variable AudioInVolume  */
+  AudioInVolume = Volume; 
+  
+  /* Return AUDIO_OK when all operations are correctly done */
+  return AUDIO_OK;
+}
+
+/**
+  * @brief  Deinit the audio IN peripherals.
+  * @param  None
+  * @retval None
+  */
+void BSP_AUDIO_IN_DeInit(void)
+{
+  I2Sx_DeInit();
+    /* DeInit the I2S MSP : this __weak function can be rewritten by the applic */
+  BSP_AUDIO_IN_MspDeInit(&haudio_in_i2s, NULL);
+  TIMx_DeInit();
+}
+
+/**
+  * @brief  Converts audio format from PDM to PCM. 
+  * @param  PDMBuf: Pointer to data PDM buffer
+  * @param  PCMBuf: Pointer to data PCM buffer
+  * @retval AUDIO_OK if correct communication, else wrong communication
+  */
+uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t* PDMBuf, uint16_t* PCMBuf)
+{
+  uint8_t app_pdm[INTERNAL_BUFF_SIZE*2];
+  uint8_t byte1 = 0, byte2 = 0;
+  uint32_t index = 0; 
+  
+  /* PDM Demux */
+  for(index = 0; index<INTERNAL_BUFF_SIZE/2; index++)
+  {
+    byte2 = (PDMBuf[index] >> 8)& 0xFF;
+    byte1 = (PDMBuf[index] & 0xFF);
+    app_pdm[(index*2)+1] = Channel_Demux[byte1 & CHANNEL_DEMUX_MASK] | Channel_Demux[byte2 & CHANNEL_DEMUX_MASK] << 4;
+    app_pdm[(index*2)] = Channel_Demux[(byte1 >> 1) & CHANNEL_DEMUX_MASK] | Channel_Demux[(byte2 >> 1) & CHANNEL_DEMUX_MASK] << 4;
+  }
+  
+  for(index = 0; index < DEFAULT_AUDIO_IN_CHANNEL_NBR; index++)
+  {
+    /* PDM to PCM filter */
+    PDM_Filter_64_LSB((uint8_t*)&app_pdm[index], (uint16_t*)&(PCMBuf[index]), AudioInVolume , (PDMFilter_InitStruct *)&Filter[index]);
+  }
+    
+  /* Return AUDIO_OK when all operations are correctly done */
+  return AUDIO_OK; 
+}
+
+ /**
+  * @brief  Rx Transfer completed callbacks.
+  * @param  hi2s: I2S handle
+  * @retval None
+  */
+void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s)
+{
+  /* Call the record update function to get the next buffer to fill and its size (size is ignored) */
+  BSP_AUDIO_IN_TransferComplete_CallBack();
+}
+
+/**
+  * @brief  Rx Half Transfer completed callbacks.
+  * @param  hi2s: I2S handle
+  * @retval None
+  */
+void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
+{
+  /* Manage the remaining file size and new address offset: This function 
+     should be coded by user (its prototype is already declared in stm32446e_eval_audio.h) */
+  BSP_AUDIO_IN_HalfTransfer_CallBack();
+}
+
+/**
+  * @brief  I2S error callbacks.
+  * @param  hi2s: I2S handle
+  * @retval None
+  */
+void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s)
+{
+  /* Manage the error generated on DMA FIFO: This function 
+     should be coded by user (its prototype is already declared in stm32446e_eval_audio.h) */
+  BSP_AUDIO_IN_Error_Callback();
+}
+
+/**
+  * @brief  User callback when record buffer is filled.
+  * @param  None  
+  * @retval None
+  */
+__weak void BSP_AUDIO_IN_TransferComplete_CallBack(void)
+{
+  /* This function should be implemented by the user application.
+     It is called into this driver when the current buffer is filled
+     to prepare the next buffer pointer and its size. */
+}
+
+/**
+  * @brief  Manages the DMA Half Transfer complete event.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
+{ 
+  /* This function should be implemented by the user application.
+     It is called into this driver when the current buffer is filled
+     to prepare the next buffer pointer and its size. */
+}
+
+/**
+  * @brief  Audio IN Error callback function.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_AUDIO_IN_Error_Callback(void)
+{   
+  /* This function is called when an Interrupt due to transfer error on or peripheral
+     error occurs. */
+}
+
+/**
+  * @brief  Initializes BSP_AUDIO_IN MSP.
+  * @param  hsai: I2S handle
+  * @retval None
+  */
+__weak void BSP_AUDIO_IN_MspInit(I2S_HandleTypeDef *hi2s, void *Params)
+{
+  static DMA_HandleTypeDef hdma_i2s_rx;
+  GPIO_InitTypeDef  gpio_init_structure;  
+
+  /* Configure the Timer which clocks the MEMS */
+  /* Moved inside MSP to allow applic to redefine the TIMx_MspInit */
+  TIMx_Init();
+  
+  /* Enable I2S clock */
+  AUDIO_I2Sx_CLK_ENABLE();
+  
+  /* Enable SCK and SD GPIO clock */
+  AUDIO_I2Sx_SD_GPIO_CLK_ENABLE();
+  AUDIO_I2Sx_SCK_GPIO_CLK_ENABLE();
+  /* CODEC_I2S pins configuration: SCK and SD pins */
+  gpio_init_structure.Pin = AUDIO_I2Sx_SCK_PIN;
+  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull = GPIO_NOPULL;
+  gpio_init_structure.Speed = GPIO_SPEED_FAST;
+  gpio_init_structure.Alternate = AUDIO_I2Sx_SCK_AF;
+  HAL_GPIO_Init(AUDIO_I2Sx_SCK_GPIO_PORT, &gpio_init_structure);
+  
+  gpio_init_structure.Pin = AUDIO_I2Sx_SD_PIN;
+  gpio_init_structure.Alternate = AUDIO_I2Sx_SD_AF;
+  HAL_GPIO_Init(AUDIO_I2Sx_SD_GPIO_PORT, &gpio_init_structure); 
+  
+  /* Enable the DMA clock */
+  AUDIO_I2Sx_DMAx_CLK_ENABLE();
+    
+  if(hi2s->Instance == AUDIO_I2Sx)
+  {
+    /* Configure the hdma_i2s_rx handle parameters */   
+    hdma_i2s_rx.Init.Channel             = AUDIO_I2Sx_DMAx_CHANNEL;
+    hdma_i2s_rx.Init.Direction           = DMA_PERIPH_TO_MEMORY;
+    hdma_i2s_rx.Init.PeriphInc           = DMA_PINC_DISABLE;
+    hdma_i2s_rx.Init.MemInc              = DMA_MINC_ENABLE;
+    hdma_i2s_rx.Init.PeriphDataAlignment = AUDIO_I2Sx_DMAx_PERIPH_DATA_SIZE;
+    hdma_i2s_rx.Init.MemDataAlignment    = AUDIO_I2Sx_DMAx_MEM_DATA_SIZE;
+    hdma_i2s_rx.Init.Mode                = DMA_CIRCULAR;
+    hdma_i2s_rx.Init.Priority            = DMA_PRIORITY_HIGH;
+    hdma_i2s_rx.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;         
+    hdma_i2s_rx.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+    hdma_i2s_rx.Init.MemBurst            = DMA_MBURST_SINGLE;
+    hdma_i2s_rx.Init.PeriphBurst         = DMA_MBURST_SINGLE; 
+    
+    hdma_i2s_rx.Instance = AUDIO_I2Sx_DMAx_STREAM;
+    
+    /* Associate the DMA handle */
+    __HAL_LINKDMA(hi2s, hdmarx, hdma_i2s_rx);
+    
+    /* Deinitialize the Stream for new transfer */
+    HAL_DMA_DeInit(&hdma_i2s_rx);
+    
+    /* Configure the DMA Stream */
+    HAL_DMA_Init(&hdma_i2s_rx);      
+  }
+  
+  /* I2S DMA IRQ Channel configuration */
+  HAL_NVIC_SetPriority(AUDIO_I2Sx_DMAx_IRQ, AUDIO_IN_IRQ_PREPRIO, 0);
+  HAL_NVIC_EnableIRQ(AUDIO_I2Sx_DMAx_IRQ); 
+}
+
+/**
+  * @brief  DeInitializes BSP_AUDIO_IN MSP.
+  * @param  hsai: I2S handle
+  * @retval None
+  */
+__weak void BSP_AUDIO_IN_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params)
+{
+    GPIO_InitTypeDef  gpio_init_structure;  
+
+    static DMA_HandleTypeDef hdma_i2s_rx;
+
+    /* I2S DMA IRQ Channel deactivation */
+    HAL_NVIC_DisableIRQ(AUDIO_I2Sx_DMAx_IRQ); 
+    
+    if(hi2s->Instance == AUDIO_I2Sx)
+    {
+      /* Deinitialize the Stream for new transfer */
+      HAL_DMA_DeInit(&hdma_i2s_rx);
+    }
+
+   /* Disable I2S block */
+    __HAL_I2S_DISABLE(hi2s);
+
+    /* Disable pins: SCK and SD pins */
+    gpio_init_structure.Pin = AUDIO_I2Sx_SCK_PIN;
+    HAL_GPIO_DeInit(AUDIO_I2Sx_SCK_GPIO_PORT, gpio_init_structure.Pin);
+    gpio_init_structure.Pin = AUDIO_I2Sx_SD_PIN;
+    HAL_GPIO_DeInit(AUDIO_I2Sx_SD_GPIO_PORT, gpio_init_structure.Pin); 
+
+    /* Disable I2S clock */
+    AUDIO_I2Sx_CLK_DISABLE();
+
+    /* GPIO pins clock and DMA clock can be shut down in the applic 
+       by surcgarging this __weak function */ 
+}
+
+
+/*******************************************************************************
+                            Static Functions
+*******************************************************************************/
+
+/**
+  * @brief  Initializes the PDM library.
+  * @param  AudioFreq: Audio sampling frequency
+  * @param  ChnlNbr: Number of audio channels (1: mono; 2: stereo)
+  * @retval None
+  */
+static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbr)
+{ 
+  uint32_t i = 0;
+  
+  /* Enable CRC peripheral to unlock the PDM library */
+  __HAL_RCC_CRC_CLK_ENABLE();
+  
+  for(i = 0; i < ChnlNbr; i++)
+  {
+    /* Filter LP & HP Init */
+    Filter[i].LP_HZ = AudioFreq/2;
+    Filter[i].HP_HZ = 10;
+    Filter[i].Fs = AudioFreq;
+    Filter[i].Out_MicChannels = ChnlNbr;
+    Filter[i].In_MicChannels = ChnlNbr; 
+    PDM_Filter_Init((PDMFilter_InitStruct *)&Filter[i]);
+  }  
+}
+
+/**
+  * @brief  Initializes the Audio Codec audio interface (I2S)
+  * @note   This function assumes that the I2S input clock (through PLL_R in 
+  *         Devices RevA/Z and through dedicated PLLI2S_R in Devices RevB/Y)
+  *         is already configured and ready to be used.    
+  * @param  AudioFreq: Audio frequency to be configured for the I2S peripheral. 
+  * @retval None
+  */
+static void I2Sx_Init(uint32_t AudioFreq)
+{
+  /* Initialize the hAudioInI2s Instance parameter */
+  haudio_in_i2s.Instance = AUDIO_I2Sx;
+
+ /* Disable I2S block */
+  __HAL_I2S_DISABLE(&haudio_in_i2s);
+  
+  /* I2S2 peripheral configuration */
+  haudio_in_i2s.Init.AudioFreq = 4 * AudioFreq;
+  haudio_in_i2s.Init.ClockSource = I2S_CLOCK_PLL;
+  haudio_in_i2s.Init.CPOL = I2S_CPOL_HIGH;
+  haudio_in_i2s.Init.DataFormat = I2S_DATAFORMAT_16B;
+  haudio_in_i2s.Init.MCLKOutput = I2S_MCLKOUTPUT_DISABLE;
+  haudio_in_i2s.Init.Mode = I2S_MODE_MASTER_RX;
+  haudio_in_i2s.Init.Standard = I2S_STANDARD_LSB;
+  
+  /* Init the I2S */
+  HAL_I2S_Init(&haudio_in_i2s); 
+
+ /* Disable I2S block */
+  __HAL_I2S_ENABLE(&haudio_in_i2s);
+
+}
+
+/**
+  * @brief  Deinitializes the Audio Codec audio interface (I2S).
+  * @param  None
+  * @retval None
+  */
+static void I2Sx_DeInit(void)
+{
+  /* Initialize the hAudioInI2s Instance parameter */
+  haudio_in_i2s.Instance = AUDIO_I2Sx;
+
+ /* Disable I2S block */
+  __HAL_I2S_DISABLE(&haudio_in_i2s);
+
+  /* DeInit the I2S */
+  HAL_I2S_DeInit(&haudio_in_i2s); 
+}
+
+
+/**
+  * @brief  Initializes the TIM INput Capture MSP.
+  * @param  htim: TIM handle
+  * @retval None
+  */
+static void TIMx_IC_MspInit(TIM_HandleTypeDef *htim)
+{
+  GPIO_InitTypeDef   gpio_init_structure;
+  
+  /* Enable peripherals and GPIO Clocks --------------------------------------*/
+  /* TIMx Peripheral clock enable */
+  AUDIO_TIMx_CLK_ENABLE();
+    
+  /* Enable GPIO Channels Clock */
+  AUDIO_TIMx_GPIO_CLK_ENABLE();
+  
+  /* Configure I/Os ----------------------------------------------------------*/
+  /* Common configuration for all channels */
+  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull = GPIO_NOPULL;
+  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = AUDIO_TIMx_AF;
+  
+  /* Configure TIM input channel */
+  gpio_init_structure.Pin = AUDIO_TIMx_IN_GPIO_PIN;
+  HAL_GPIO_Init(AUDIO_TIMx_GPIO_PORT, &gpio_init_structure);
+
+  /* Configure TIM output channel */
+  gpio_init_structure.Pin = AUDIO_TIMx_OUT_GPIO_PIN;
+  HAL_GPIO_Init(AUDIO_TIMx_GPIO_PORT, &gpio_init_structure);
+
+}
+
+/**
+  * @brief  Initializes the TIM INput Capture MSP.
+  * @param  htim: TIM handle
+  * @retval None
+  */
+static void TIMx_IC_MspDeInit(TIM_HandleTypeDef *htim)
+{
+    /* Disable TIMx Peripheral clock  */
+    AUDIO_TIMx_CLK_DISABLE();
+
+    /* GPIO pins clock and DMA clock can be shut down in the applic 
+       by surcgarging this __weak function */ 
+}
+
+/**
+  * @brief  Configure TIM as a clock divider by 2.
+  *         I2S_SCK is externally connected to TIMx input channel
+  * @param  None
+  * @retval None
+  */
+static void TIMx_Init(void)
+{
+  TIM_IC_InitTypeDef     s_ic_config;
+  TIM_OC_InitTypeDef     s_oc_config;
+  TIM_ClockConfigTypeDef s_clk_source_config;
+  TIM_SlaveConfigTypeDef s_slave_config;
+  
+  /* Configure the TIM peripheral --------------------------------------------*/
+  /* Set TIMx instance */
+  haudio_tim.Instance = AUDIO_TIMx;
+  /* Timer Input Capture Configuration Structure declaration */
+   /* Initialize TIMx peripheral as follow:
+       + Period = 0xFFFF
+       + Prescaler = 0
+       + ClockDivision = 0
+       + Counter direction = Up
+  */
+  haudio_tim.Init.Period        = 1;
+  haudio_tim.Init.Prescaler     = 0;
+  haudio_tim.Init.ClockDivision = 0;
+  haudio_tim.Init.CounterMode   = TIM_COUNTERMODE_UP; 
+  
+  /* Initialize the TIMx peripheral with the structure above */
+  TIMx_IC_MspInit(&haudio_tim);
+  HAL_TIM_IC_Init(&haudio_tim);
+  
+  /* Configure the Input Capture channel -------------------------------------*/ 
+  /* Configure the Input Capture of channel 2 */
+  s_ic_config.ICPolarity  = TIM_ICPOLARITY_FALLING;
+  s_ic_config.ICSelection = TIM_ICSELECTION_DIRECTTI;
+  s_ic_config.ICPrescaler = TIM_ICPSC_DIV1;
+  s_ic_config.ICFilter    = 0;
+  HAL_TIM_IC_ConfigChannel(&haudio_tim, &s_ic_config, AUDIO_TIMx_IN_CHANNEL);
+  
+  /* Select external clock mode 1 */
+  s_clk_source_config.ClockSource = TIM_CLOCKSOURCE_ETRMODE1;
+  s_clk_source_config.ClockPolarity = TIM_CLOCKPOLARITY_NONINVERTED;
+  s_clk_source_config.ClockPrescaler = TIM_CLOCKPRESCALER_DIV1;
+  s_clk_source_config.ClockFilter = 0;   
+  HAL_TIM_ConfigClockSource(&haudio_tim, &s_clk_source_config);
+  
+  /* Select Input Channel as input trigger */
+  s_slave_config.InputTrigger = TIM_TS_TI1FP1;
+  s_slave_config.SlaveMode = TIM_SLAVEMODE_EXTERNAL1;
+  s_slave_config.TriggerPolarity = TIM_TRIGGERPOLARITY_NONINVERTED;
+  s_slave_config.TriggerPrescaler = TIM_CLOCKPRESCALER_DIV1;
+  s_slave_config.TriggerFilter = 0;
+  HAL_TIM_SlaveConfigSynchronization(&haudio_tim, &s_slave_config);
+  
+  /* Output Compare PWM Mode configuration: Channel2 */
+  s_oc_config.OCMode = TIM_OCMODE_PWM1;
+  s_oc_config.OCIdleState = TIM_OCIDLESTATE_SET;
+  s_oc_config.Pulse = 1;
+  s_oc_config.OCPolarity = TIM_OCPOLARITY_HIGH;
+  s_oc_config.OCNPolarity = TIM_OCNPOLARITY_HIGH;
+  s_oc_config.OCFastMode = TIM_OCFAST_DISABLE;
+  s_oc_config.OCNIdleState = TIM_OCNIDLESTATE_SET;
+  
+  /* Initialize the TIM4 Channel2 with the structure above */
+  HAL_TIM_PWM_ConfigChannel(&haudio_tim, &s_oc_config, AUDIO_TIMx_OUT_CHANNEL);
+  
+  /* Start the TIM4 Channel2 */
+  HAL_TIM_PWM_Start(&haudio_tim, AUDIO_TIMx_OUT_CHANNEL);
+
+  /* Start the TIM4 Channel1 */
+  HAL_TIM_IC_Start(&haudio_tim, AUDIO_TIMx_IN_CHANNEL);
+}
+
+/**
+  * @brief  Configure TIM as a clock divider by 2.
+  *         I2S_SCK is externally connected to TIMx input channel
+  * @param  None
+  * @retval None
+  */
+static void TIMx_DeInit(void)
+{
+  haudio_tim.Instance = AUDIO_TIMx;
+  
+  /* Stop the TIM4 Channel2 */
+  HAL_TIM_PWM_Stop(&haudio_tim, AUDIO_TIMx_OUT_CHANNEL);
+  /* Stop the TIM4 Channel1 */
+  HAL_TIM_IC_Stop(&haudio_tim, AUDIO_TIMx_IN_CHANNEL);
+
+  HAL_TIM_IC_DeInit(&haudio_tim);
+  
+  /* Initialize the TIMx peripheral with the structure above */
+  TIMx_IC_MspDeInit(&haudio_tim);
+}
+
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 328 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_audio.h

@@ -0,0 +1,328 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_audio.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_audio.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32446E_EVAL_AUDIO_H
+#define __STM32446E_EVAL_AUDIO_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+/* Include audio component Driver */
+#include "../Components/wm8994/wm8994.h"
+#include "stm32446e_eval.h"
+#include "../../../Middlewares/ST/STM32_Audio/Addons/PDM/pdm_filter.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_AUDIO STM32446E-EVAL AUDIO
+  * @{
+  */
+
+/** @defgroup STM32446E_EVAL_AUDIO_Exported_Types STM32446E EVAL Audio Exported Types
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_Exported_Constants  STM32446E EVAL Audio Exported Constants
+  * @{
+  */
+ 
+/*------------------------------------------------------------------------------
+                          USER SAI defines parameters
+ -----------------------------------------------------------------------------*/
+/** @defgroup CODEC_AudioFrame_SLOT_TDMMode  STM32446E EVAL Audio Slot TDM mode 
+  * @brief In W8994 codec the Audio frame contains 4 slots : TDM Mode
+  * TDM format :
+  * +------------------|------------------|--------------------|-------------------+ 
+  * | CODEC_SLOT0 Left | CODEC_SLOT1 Left | CODEC_SLOT0 Right  | CODEC_SLOT1 Right |
+  * +------------------------------------------------------------------------------+
+  * @{
+  */
+/* To have 2 separate audio stream in Both headphone and speaker the 4 slot must be activated */
+#define CODEC_AUDIOFRAME_SLOT_0123                   SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_1 | SAI_SLOTACTIVE_2 | SAI_SLOTACTIVE_3
+/* To have an audio stream in headphone only SAI Slot 0 and Slot 2 must be activated */ 
+#define CODEC_AUDIOFRAME_SLOT_02                     SAI_SLOTACTIVE_0 | SAI_SLOTACTIVE_2 
+/* To have an audio stream in speaker only SAI Slot 1 and Slot 3 must be activated */ 
+#define CODEC_AUDIOFRAME_SLOT_13                     SAI_SLOTACTIVE_1 | SAI_SLOTACTIVE_3
+/**
+  * @}
+  */ 
+  
+/* SAI peripheral configuration defines */
+#define AUDIO_SAIx                           SAI2_Block_B
+#define AUDIO_SAIx_CLK_ENABLE()              __HAL_RCC_SAI2_CLK_ENABLE()
+#define AUDIO_SAIx_CLK_DISABLE()             __HAL_RCC_SAI2_CLK_DISABLE()
+#define AUDIO_SAIx_SCK_AF                    GPIO_AF8_SAI2
+#define AUDIO_SAIx_MCLK_SD_FS_AF             GPIO_AF10_SAI2
+
+   
+#define AUDIO_SAIx_MCLK_SCK_ENABLE()         __HAL_RCC_GPIOA_CLK_ENABLE()
+#define AUDIO_SAIx_MCLK_SCK_DISABLE()        __HAL_RCC_GPIOA_CLK_DISABLE()
+#define AUDIO_SAIx_MCK_PIN                   GPIO_PIN_1 /* PA1 */
+#define AUDIO_SAIx_SCK_PIN                   GPIO_PIN_2 /* PA2 */
+#define AUDIO_SAIx_MCLK_SCK_GPIO_PORT        GPIOA
+#define AUDIO_SAIx_SD_FS_ENABLE()            __HAL_RCC_GPIOG_CLK_ENABLE()
+#define AUDIO_SAIx_SD_FS_DISABLE()           __HAL_RCC_GPIOG_CLK_DISABLE()
+#define AUDIO_SAIx_FS_PIN                    GPIO_PIN_9 /* PG9 */
+#define AUDIO_SAIx_SD_PIN                    GPIO_PIN_10 /* PG10 */
+#define AUDIO_SAIx_SD_FS_GPIO_PORT           GPIOG
+
+
+/* SAI DMA Stream definitions */
+#define AUDIO_SAIx_DMAx_CLK_ENABLE()         __HAL_RCC_DMA2_CLK_ENABLE()
+#define AUDIO_SAIx_DMAx_CLK_DISABLE()        __HAL_RCC_DMA2_CLK_DISABLE()
+#define AUDIO_SAIx_DMAx_STREAM               DMA2_Stream6
+#define AUDIO_SAIx_DMAx_CHANNEL              DMA_CHANNEL_3
+#define AUDIO_SAIx_DMAx_IRQ                  DMA2_Stream6_IRQn
+#define AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE     DMA_PDATAALIGN_HALFWORD
+#define AUDIO_SAIx_DMAx_MEM_DATA_SIZE        DMA_MDATAALIGN_HALFWORD
+#define DMA_MAX_SZE                          0xFFFF
+   
+#define AUDIO_SAIx_DMAx_IRQHandler           DMA2_Stream6_IRQHandler
+
+/* Select the interrupt preemption priority for the DMA interrupt */
+#define AUDIO_OUT_IRQ_PREPRIO           ((uint32_t)5)   /* Select the preemption priority level(0 is the highest) */   
+
+/*------------------------------------------------------------------------------
+                        AUDIO IN CONFIGURATION
+------------------------------------------------------------------------------*/
+/* SPI Configuration defines */
+#define AUDIO_I2Sx                          SPI3
+#define AUDIO_I2Sx_CLK_ENABLE()             __HAL_RCC_SPI3_CLK_ENABLE()
+#define AUDIO_I2Sx_CLK_DISABLE()            __HAL_RCC_SPI3_CLK_DISABLE()
+#define AUDIO_I2Sx_SCK_PIN                   GPIO_PIN_3
+#define AUDIO_I2Sx_SCK_GPIO_PORT             GPIOB
+#define AUDIO_I2Sx_SCK_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOB_CLK_ENABLE()
+#define AUDIO_I2Sx_SCK_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOB_CLK_DISABLE()
+#define AUDIO_I2Sx_SCK_AF                    GPIO_AF6_SPI3
+
+#define AUDIO_I2Sx_SD_PIN                   GPIO_PIN_1
+#define AUDIO_I2Sx_SD_GPIO_PORT             GPIOC
+#define AUDIO_I2Sx_SD_GPIO_CLK_ENABLE()     __HAL_RCC_GPIOC_CLK_ENABLE()
+#define AUDIO_I2Sx_SD_GPIO_CLK_DISABLE()    __HAL_RCC_GPIOC_CLK_DISABLE()
+#define AUDIO_I2Sx_SD_AF                    GPIO_AF5_SPI3
+
+/* I2S DMA Stream Rx definitions */
+#define AUDIO_I2Sx_DMAx_CLK_ENABLE()        __HAL_RCC_DMA1_CLK_ENABLE()
+#define AUDIO_I2Sx_DMAx_CLK_DISABLE()       __HAL_RCC_DMA1_CLK_DISABLE()
+#define AUDIO_I2Sx_DMAx_STREAM              DMA1_Stream2
+#define AUDIO_I2Sx_DMAx_CHANNEL             DMA_CHANNEL_0
+#define AUDIO_I2Sx_DMAx_IRQ                 DMA1_Stream2_IRQn
+#define AUDIO_I2Sx_DMAx_PERIPH_DATA_SIZE    DMA_PDATAALIGN_HALFWORD
+#define AUDIO_I2Sx_DMAx_MEM_DATA_SIZE       DMA_MDATAALIGN_HALFWORD
+   
+#define AUDIO_I2Sx_DMAx_IRQHandler          DMA1_Stream2_IRQHandler
+  
+/* Select the interrupt preemption priority and subpriority for the IT/DMA interrupt */
+#define AUDIO_IN_IRQ_PREPRIO                ((uint32_t)6)   /* Select the preemption priority level(0 is the highest) */
+
+
+/* Two channels are used:
+   - one channel as input which is connected to I2S SCK in stereo mode 
+   - one channel as output which divides the frequency on the input
+*/
+
+#define AUDIO_TIMx_CLK_ENABLE()             __HAL_RCC_TIM4_CLK_ENABLE()
+#define AUDIO_TIMx_CLK_DISABLE()            __HAL_RCC_TIM4_CLK_DISABLE()
+#define AUDIO_TIMx                          TIM4
+#define AUDIO_TIMx_IN_CHANNEL               TIM_CHANNEL_1
+#define AUDIO_TIMx_OUT_CHANNEL              TIM_CHANNEL_2 /* Select channel 2 as output */
+#define AUDIO_TIMx_GPIO_CLK_ENABLE()        __HAL_RCC_GPIOB_CLK_ENABLE()
+#define AUDIO_TIMx_GPIO_CLK_DISABLE()       __HAL_RCC_GPIOB_CLK_DISABLE()
+#define AUDIO_TIMx_GPIO_PORT                GPIOB
+#define AUDIO_TIMx_IN_GPIO_PIN              GPIO_PIN_6
+#define AUDIO_TIMx_OUT_GPIO_PIN             GPIO_PIN_7
+#define AUDIO_TIMx_AF                       GPIO_AF2_TIM4
+
+/*------------------------------------------------------------------------------
+             CONFIGURATION: Audio Driver Configuration parameters
+------------------------------------------------------------------------------*/
+
+#define AUDIODATA_SIZE                      2   /* 16-bits audio data size */
+
+/* Audio status definition */     
+#define AUDIO_OK                            ((uint8_t)0)
+#define AUDIO_ERROR                         ((uint8_t)1)
+#define AUDIO_TIMEOUT                       ((uint8_t)2)
+
+/* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */
+#define DEFAULT_AUDIO_IN_FREQ               I2S_AUDIOFREQ_16K
+#define DEFAULT_AUDIO_IN_BIT_RESOLUTION     ((uint8_t)16)
+#define DEFAULT_AUDIO_IN_CHANNEL_NBR        ((uint8_t)2) /* Mono = 1, Stereo = 2 */
+#define DEFAULT_AUDIO_IN_VOLUME             ((uint16_t)64)
+
+/* PDM buffer input size */
+#define INTERNAL_BUFF_SIZE                  (128*DEFAULT_AUDIO_IN_FREQ/16000*DEFAULT_AUDIO_IN_CHANNEL_NBR)
+/* PCM buffer output size */
+#define PCM_OUT_SIZE                        (DEFAULT_AUDIO_IN_FREQ/1000*2)
+#define CHANNEL_DEMUX_MASK                  ((uint8_t)0x55)
+   
+/*------------------------------------------------------------------------------
+                    OPTIONAL Configuration defines parameters
+------------------------------------------------------------------------------*/
+
+/* Delay for the Codec to be correctly reset */
+#define CODEC_RESET_DELAY           ((uint8_t)5)
+   
+
+/*------------------------------------------------------------------------------
+                            OUTPUT DEVICES definition
+------------------------------------------------------------------------------*/
+
+/* Alias on existing output devices to adapt for 2 headphones output */
+#define OUTPUT_DEVICE_HEADPHONE1 OUTPUT_DEVICE_HEADPHONE
+#define OUTPUT_DEVICE_HEADPHONE2 OUTPUT_DEVICE_SPEAKER /* Headphone2 is connected to Speaker output of the wm8994 */
+   
+/**
+  * @}
+  */
+ 
+/** @defgroup STM32446E_EVAL_AUDIO_Exported_Variables  STM32446E EVAL Audio Exported Variables
+  * @{
+  */
+extern __IO uint16_t AudioInVolume;
+ /**
+  * @}
+  */
+   
+/** @defgroup STM32446E_EVAL_AUDIO_Exported_Macros  STM32446E EVAL Audio Exported Macros
+  * @{
+  */
+#define DMA_MAX(x)           (((x) <= DMA_MAX_SZE)? (x):DMA_MAX_SZE)
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_OUT_Exported_Functions  STM32446E EVAL AudioOUT Exported Functions
+  * @{
+  */
+uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
+uint8_t BSP_AUDIO_OUT_Play(uint16_t* pBuffer, uint32_t Size);
+void    BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size);
+uint8_t BSP_AUDIO_OUT_Pause(void);
+uint8_t BSP_AUDIO_OUT_Resume(void);
+uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option);
+uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume);
+void    BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq);
+void    BSP_AUDIO_OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot);
+uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd);
+uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output);
+void    BSP_AUDIO_OUT_DeInit(void);
+
+/* User Callbacks: user has to implement these functions in his code if they are needed. */
+/* This function is called when the requested data has been completely transferred.*/
+void    BSP_AUDIO_OUT_TransferComplete_CallBack(void);
+
+/* This function is called when half of the requested buffer has been transferred. */
+void    BSP_AUDIO_OUT_HalfTransfer_CallBack(void);
+
+/* This function is called when an Interrupt due to transfer error on or peripheral
+   error occurs. */
+void    BSP_AUDIO_OUT_Error_CallBack(void);
+
+/* These function can be modified in case the current settings (e.g. DMA stream)
+   need to be changed for specific application needs */
+void  BSP_AUDIO_OUT_ClockConfig(SAI_HandleTypeDef *hsai, uint32_t AudioFreq, void *Params);
+void  BSP_AUDIO_OUT_MspInit(SAI_HandleTypeDef *hsai, void *Params);
+void  BSP_AUDIO_OUT_MspDeInit(SAI_HandleTypeDef *hsai, void *Params);
+
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_AUDIO_IN_Exported_Functions  STM32446E EVAL AudioIN Exported Functions
+  * @{
+  */
+uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr);
+uint8_t BSP_AUDIO_IN_Record(uint16_t *pData, uint32_t Size);
+uint8_t BSP_AUDIO_IN_Stop(void);
+uint8_t BSP_AUDIO_IN_Pause(void);
+uint8_t BSP_AUDIO_IN_Resume(void);
+uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume);
+void    BSP_AUDIO_IN_DeInit(void);
+uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t* PDMBuf, uint16_t* PCMBuf);
+/* User Callbacks: user has to implement these functions in his code if they are needed. */
+/* This function should be implemented by the user application.
+   It is called into this driver when the current buffer is filled to prepare the next
+   buffer pointer and its size. */
+void    BSP_AUDIO_IN_TransferComplete_CallBack(void);
+void    BSP_AUDIO_IN_HalfTransfer_CallBack(void);
+
+/* This function is called when an Interrupt due to transfer error on or peripheral
+   error occurs. */
+void    BSP_AUDIO_IN_Error_Callback(void);
+
+/* These function can be modified in case the current settings (e.g. DMA stream)
+   need to be changed for specific application needs */
+void  BSP_AUDIO_IN_MspInit(I2S_HandleTypeDef *hi2s, void *Params);
+void  BSP_AUDIO_IN_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params);
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_AUDIO_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 686 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_camera.c

@@ -0,0 +1,686 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_camera.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file includes the driver for Camera modules mounted on
+  *          STM32446E-EVAL evaluation board.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+  
+/* File Info: ------------------------------------------------------------------
+                                   User NOTES
+1. How to use this driver:
+--------------------------
+   - This driver is used to drive the camera.
+   - The S5K5CAG component driver MUST be included with this driver.
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the camera using the BSP_CAMERA_Init() function.
+     o Start the camera capture/snapshot using the CAMERA_Start() function.
+     o Suspend, resume or stop the camera capture using the following functions:
+      - BSP_CAMERA_Suspend()
+      - BSP_CAMERA_Resume()
+      - BSP_CAMERA_Stop()
+      
+  + Options
+     o Increase or decrease on the fly the brightness and/or contrast
+       using the following function:
+       - BSP_CAMERA_ContrastBrightnessConfig 
+     o Add a special effect on the fly using the following functions:
+       - BSP_CAMERA_BlackWhiteConfig()
+       - BSP_CAMERA_ColorEffectConfig()  
+      
+------------------------------------------------------------------------------*/
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval_camera.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_CAMERA STM32446E-EVAL CAMERA
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_CAMERA_Private_TypesDefinitions STM32446E Eval Camera Private TypesDef
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_CAMERA_Private_Defines STM32446E Eval Camera Private Defines
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_CAMERA_Private_Macros STM32446E Eval Camera Private Macros
+  * @{
+  */
+/**
+  * @}
+  */  
+
+/** @defgroup STM32446E_EVAL_CAMERA_Private_Variables STM32446E Eval Camera Private Variables
+  * @{
+  */ 
+  
+  /*
+Note: 
+  camera_drv variable is not compliant to naming rules (upper case without "_" ), 
+  but we keep this naming for compatibility, in fact these variables (not static)
+  could have been used by the application, example the stm32f4xx_it.c.
+*/
+CAMERA_DrvTypeDef   *camera_drv;
+
+static DCMI_HandleTypeDef  hDcmiEval;
+uint32_t currentResolution;
+static uint32_t  cameraHwAddress;
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_CAMERA_Private_FunctionPrototypes STM32446E Eval Camera Private Prototypes
+  * @{
+  */
+static uint32_t GetSize(uint32_t Resolution);
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_CAMERA_Private_Functions STM32446E Eval Camera Private Functions
+  * @{
+  */
+
+/**
+  * @brief  Initializes the camera.
+  * @param  Camera: Pointer to the camera configuration structure
+  * @retval Camera status
+  */
+uint8_t BSP_CAMERA_Init(uint32_t Resolution)
+{ 
+  DCMI_HandleTypeDef *phdcmi;
+  
+  uint8_t ret = CAMERA_ERROR;
+  
+  /* Get the DCMI handle structure */
+  phdcmi = &hDcmiEval;
+
+  /*** Configures the DCMI to interface with the camera module ***/
+  /* DCMI configuration */
+  phdcmi->Init.CaptureRate      = DCMI_CR_ALL_FRAME;
+  phdcmi->Init.HSPolarity       = DCMI_HSPOLARITY_HIGH;
+  phdcmi->Init.SynchroMode      = DCMI_SYNCHRO_HARDWARE;
+  phdcmi->Init.VSPolarity       = DCMI_VSPOLARITY_HIGH;
+  phdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
+  phdcmi->Init.PCKPolarity      = DCMI_PCKPOLARITY_RISING;
+  phdcmi->Init.ByteSelectMode   = DCMI_BSM_ALL;
+  phdcmi->Init.ByteSelectStart  = DCMI_OEBS_ODD;
+  phdcmi->Init.LineSelectMode   = DCMI_LSM_ALL;
+  phdcmi->Init.LineSelectStart  = DCMI_OELS_ODD; 
+  phdcmi->Instance              = DCMI;
+
+  /* Configure IO functionalities for CAMERA detect pin */
+  BSP_IO_Init(); 
+  
+  /* Apply Camera hardware reset */
+  BSP_CAMERA_HwReset();
+
+  /* Check if the CAMERA is plugged */
+  if(BSP_IO_ReadPin(CAM_PLUG_PIN))
+  {
+    return CAMERA_ERROR;
+  }
+
+  if (s5k5cag_ReadID(CAMERA_I2C_ADDRESS) == S5K5CAG_ID)
+  {
+    /* Initialize the camera driver structure */
+    camera_drv = &s5k5cag_drv;
+    cameraHwAddress = CAMERA_I2C_ADDRESS;
+
+    /* DCMI Initialization */
+    BSP_CAMERA_MspInit(&hDcmiEval, NULL);
+    HAL_DCMI_Init(phdcmi);
+
+    /* Camera Init */
+    camera_drv->Init(cameraHwAddress, Resolution);
+
+    currentResolution = Resolution;
+
+    /* Return CAMERA_OK status */
+    ret = CAMERA_OK;
+  }
+  else
+  {
+    /* No supported camera sensor found */
+    ret = CAMERA_ERROR;
+  }
+  
+  return ret;
+}
+
+
+/**
+  * @brief  DeInitializes the camera.
+  * @param  Camera: Pointer to the camera configuration structure
+  * @retval Camera status
+  */
+uint8_t BSP_CAMERA_DeInit(void)
+{ 
+  hDcmiEval.Instance              = DCMI;
+
+  HAL_DCMI_DeInit(&hDcmiEval);
+  BSP_CAMERA_MspDeInit(&hDcmiEval, NULL);
+  return CAMERA_OK;
+}
+
+/**
+  * @brief  Starts the camera capture in continuous mode.
+  * @param  buff: pointer to the camera output buffer
+  * @retval None
+  */
+void BSP_CAMERA_ContinuousStart(uint8_t *buff)
+{ 
+  /* Start the camera capture */
+  HAL_DCMI_Start_DMA(&hDcmiEval, DCMI_MODE_CONTINUOUS, (uint32_t)buff, GetSize(currentResolution));  
+}
+
+/**
+  * @brief  Starts the camera capture in snapshot mode.
+  * @param  buff: pointer to the camera output buffer
+  * @retval None
+  */
+void BSP_CAMERA_SnapshotStart(uint8_t *buff)
+{ 
+  /* Start the camera capture */
+  HAL_DCMI_Start_DMA(&hDcmiEval, DCMI_MODE_SNAPSHOT, (uint32_t)buff, GetSize(currentResolution));  
+}
+
+/**
+  * @brief Suspend the CAMERA capture 
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_Suspend(void) 
+{
+  /* Disable the DMA */
+  __HAL_DMA_DISABLE(hDcmiEval.DMA_Handle);
+  /* Disable the DCMI */
+  __HAL_DCMI_DISABLE(&hDcmiEval);
+  
+}
+
+/**
+  * @brief Resume the CAMERA capture 
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_Resume(void) 
+{
+  /* Enable the DCMI */
+  __HAL_DCMI_ENABLE(&hDcmiEval);
+  /* Enable the DMA */
+  __HAL_DMA_ENABLE(hDcmiEval.DMA_Handle);
+}
+
+/**
+  * @brief  Stop the CAMERA capture 
+  * @param  None
+  * @retval Camera status
+  */
+uint8_t BSP_CAMERA_Stop(void) 
+{
+  DCMI_HandleTypeDef *phdcmi;
+  
+  uint8_t ret = CAMERA_ERROR;
+  
+  /* Get the DCMI handle structure */
+  phdcmi = &hDcmiEval;  
+  
+  if(HAL_DCMI_Stop(phdcmi) == HAL_OK)
+  {
+     ret = CAMERA_OK;
+  }
+  
+  /* Set Camera in Power Down */
+  BSP_CAMERA_PwrDown();
+
+  return ret;
+}
+
+/**
+  * @brief  CAMERA hardware reset
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_HwReset(void)
+{
+  /* Camera sensor RESET sequence */
+  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
+  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
+
+  /* Assert the camera STANDBY pin (active high)  */
+  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_SET);
+
+  /* Assert the camera RSTI pin (active low) */
+  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
+
+  HAL_Delay(100);   /* RST and XSDN signals asserted during 100ms */
+
+  /* De-assert the camera STANDBY pin (active high) */
+  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);
+
+  HAL_Delay(3);     /* RST de-asserted and XSDN asserted during 3ms */
+
+  /* De-assert the camera RSTI pin (active low) */
+  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_SET);
+
+  HAL_Delay(6);     /* RST de-asserted during 3ms */
+}
+
+/**
+  * @brief  CAMERA power down
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_PwrDown(void)
+{
+  /* Camera power down sequence */
+  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
+  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
+
+  /* De-assert the camera STANDBY pin (active high) */
+  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);
+
+  /* Assert the camera RSTI pin (active low) */
+  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
+}
+
+/**
+  * @brief  Configures the camera contrast and brightness.
+  * @param  contrast_level: Contrast level
+  *          This parameter can be one of the following values:
+  *            @arg  CAMERA_CONTRAST_LEVEL4: for contrast +2
+  *            @arg  CAMERA_CONTRAST_LEVEL3: for contrast +1
+  *            @arg  CAMERA_CONTRAST_LEVEL2: for contrast  0
+  *            @arg  CAMERA_CONTRAST_LEVEL1: for contrast -1
+  *            @arg  CAMERA_CONTRAST_LEVEL0: for contrast -2
+  * @param  brightness_level: Contrast level
+  *          This parameter can be one of the following values:
+  *            @arg  CAMERA_BRIGHTNESS_LEVEL4: for brightness +2
+  *            @arg  CAMERA_BRIGHTNESS_LEVEL3: for brightness +1
+  *            @arg  CAMERA_BRIGHTNESS_LEVEL2: for brightness  0
+  *            @arg  CAMERA_BRIGHTNESS_LEVEL1: for brightness -1
+  *            @arg  CAMERA_BRIGHTNESS_LEVEL0: for brightness -2    
+  * @retval None
+  */
+void BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level)
+{
+  if(camera_drv->Config != NULL)
+  {
+    camera_drv->Config(cameraHwAddress, CAMERA_CONTRAST_BRIGHTNESS, contrast_level, brightness_level);
+  }  
+}
+
+/**
+  * @brief  Configures the camera white balance.
+  * @param  Mode: black_white mode
+  *          This parameter can be one of the following values:
+  *            @arg  CAMERA_BLACK_WHITE_BW
+  *            @arg  CAMERA_BLACK_WHITE_NEGATIVE
+  *            @arg  CAMERA_BLACK_WHITE_BW_NEGATIVE
+  *            @arg  CAMERA_BLACK_WHITE_NORMAL       
+  * @retval None
+  */
+void BSP_CAMERA_BlackWhiteConfig(uint32_t Mode)
+{
+  if(camera_drv->Config != NULL)
+  {
+    camera_drv->Config(cameraHwAddress, CAMERA_BLACK_WHITE, Mode, 0);
+  }  
+}
+
+/**
+  * @brief  Configures the camera color effect.
+  * @param  Effect: Color effect
+  *          This parameter can be one of the following values:
+  *            @arg  CAMERA_COLOR_EFFECT_ANTIQUE               
+  *            @arg  CAMERA_COLOR_EFFECT_BLUE        
+  *            @arg  CAMERA_COLOR_EFFECT_GREEN    
+  *            @arg  CAMERA_COLOR_EFFECT_RED        
+  * @retval None
+  */
+void BSP_CAMERA_ColorEffectConfig(uint32_t Effect)
+{
+  if(camera_drv->Config != NULL)
+  {
+    camera_drv->Config(cameraHwAddress, CAMERA_COLOR_EFFECT, Effect, 0);
+  }  
+}
+
+/**
+  * @brief  Handles DCMI interrupt request.
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_IRQHandler(void) 
+{
+  HAL_DCMI_IRQHandler(&hDcmiEval);
+}
+
+/**
+  * @brief  Handles DMA interrupt request.
+  * @param  None
+  * @retval None
+  */
+void BSP_CAMERA_DMA_IRQHandler(void) 
+{
+  HAL_DMA_IRQHandler(hDcmiEval.DMA_Handle);
+}
+
+/**
+  * @brief  Get the capture size.
+  * @param  resolution: the current resolution.
+  * @retval capture size.
+  */
+static uint32_t GetSize(uint32_t Resolution)
+{ 
+  uint32_t size = 0;
+  
+  /* Get capture size */
+  switch (Resolution)
+  {
+  case CAMERA_R160x120:
+    {
+      size =  0x2580;
+    }
+    break;    
+  case CAMERA_R320x240:
+    {
+      size =  0x9600;
+    }
+    break;
+  case CAMERA_R480x272:
+    {
+      size =  0xFF00;
+    }
+    break;
+  case CAMERA_R640x480:
+    {
+      size =  0x25800;
+    }    
+    break;
+  default:
+    {
+      break;
+    }
+  }
+  
+  return size;
+}
+
+/**
+  * @brief  Initializes the DCMI MSP.
+  * @param  hdcmi: HDMI handle 
+  * @retval None
+  */
+__weak void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params)
+{
+  static DMA_HandleTypeDef hdma_eval;
+  GPIO_InitTypeDef gpio_init_structure;
+  
+  /*** Enable peripherals and GPIO clocks ***/
+  /* Enable DCMI clock */
+  __HAL_RCC_DCMI_CLK_ENABLE();
+
+  /* Enable DMA2 clock */
+  __HAL_RCC_DMA2_CLK_ENABLE(); 
+  
+  /* Enable GPIO clocks */
+  __HAL_RCC_GPIOA_CLK_ENABLE();
+  __HAL_RCC_GPIOB_CLK_ENABLE();
+  __HAL_RCC_GPIOC_CLK_ENABLE();
+  __HAL_RCC_GPIOD_CLK_ENABLE();
+  __HAL_RCC_GPIOE_CLK_ENABLE();
+
+  /*** Configure the GPIO ***/
+  /* Configure DCMI GPIO as alternate function */
+  gpio_init_structure.Pin       = GPIO_PIN_4 | GPIO_PIN_6; 
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF13_DCMI;  
+  HAL_GPIO_Init(GPIOA, &gpio_init_structure);
+ 
+#if !defined(USE_STM32446E_EVAL_REVA)
+  gpio_init_structure.Pin       = GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9; 
+#else
+  gpio_init_structure.Pin       = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9; 
+#endif // !USE_STM32446E_EVAL_REVA
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
+  HAL_GPIO_Init(GPIOB, &gpio_init_structure);
+
+  gpio_init_structure.Pin       = GPIO_PIN_6 | GPIO_PIN_7  | GPIO_PIN_8  |\
+                                  GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 |\
+                                  GPIO_PIN_12; 
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
+  HAL_GPIO_Init(GPIOC, &gpio_init_structure);
+
+#if !defined(USE_STM32446E_EVAL_REVA)
+  gpio_init_structure.Pin       = GPIO_PIN_2 | GPIO_PIN_6; 
+#else
+  gpio_init_structure.Pin       = GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_6; 
+#endif // !USE_STM32446E_EVAL_REVA
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF13_DCMI;   
+  HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+  
+  /*** Configure the DMA ***/
+  /* Set the parameters to be configured */
+  hdma_eval.Init.Channel             = DMA_CHANNEL_1;
+  hdma_eval.Init.Direction           = DMA_PERIPH_TO_MEMORY;
+  hdma_eval.Init.PeriphInc           = DMA_PINC_DISABLE;
+  hdma_eval.Init.MemInc              = DMA_MINC_ENABLE;
+  hdma_eval.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
+  hdma_eval.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
+  hdma_eval.Init.Mode                = DMA_CIRCULAR;
+  hdma_eval.Init.Priority            = DMA_PRIORITY_HIGH;
+  hdma_eval.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;         
+  hdma_eval.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+  hdma_eval.Init.MemBurst            = DMA_MBURST_SINGLE;
+  hdma_eval.Init.PeriphBurst         = DMA_PBURST_SINGLE; 
+
+  hdma_eval.Instance = DMA2_Stream1;
+
+  /* Associate the initialized DMA handle to the DCMI handle */
+  __HAL_LINKDMA(hdcmi, DMA_Handle, hdma_eval);
+  
+  /*** Configure the NVIC for DCMI and DMA ***/
+  /* NVIC configuration for DCMI transfer complete interrupt */
+  HAL_NVIC_SetPriority(DCMI_IRQn, 5, 0);
+  HAL_NVIC_EnableIRQ(DCMI_IRQn);  
+  
+  /* NVIC configuration for DMA2D transfer complete interrupt */
+  HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 5, 0);
+  HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
+  
+  /* Configure the DMA stream */
+  HAL_DMA_Init(hdcmi->DMA_Handle);  
+}
+
+
+/**
+  * @brief  DeInitializes the DCMI MSP.
+  * @param  hdcmi: HDMI handle 
+  * @retval None
+  */
+__weak void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params)
+{
+    /* Disable NVIC  for DCMI transfer complete interrupt */
+    HAL_NVIC_DisableIRQ(DCMI_IRQn);  
+  
+    /* Disable NVIC for DMA2 transfer complete interrupt */
+    HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
+  
+    /* Configure the DMA stream */
+    HAL_DMA_DeInit(hdcmi->DMA_Handle);  
+
+    /* Disable DCMI clock */
+    __HAL_RCC_DCMI_CLK_DISABLE();
+
+    /* GPIO pins clock and DMA clock can be shut down in the application 
+       by surcharging this __weak function */ 
+}
+
+/**
+  * @brief  Line event callback
+  * @param  hdcmi: pointer to the DCMI handle  
+  * @retval None
+  */
+void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi)
+{        
+  BSP_CAMERA_LineEventCallback();
+}
+
+/**
+  * @brief  Line Event callback.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_CAMERA_LineEventCallback(void)
+{
+  /* NOTE : This function Should not be modified, when the callback is needed,
+            the HAL_DCMI_LineEventCallback could be implemented in the user file
+   */
+}
+
+/**
+  * @brief  VSYNC event callback
+  * @param  hdcmi: pointer to the DCMI handle  
+  * @retval None
+  */
+void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi)
+{        
+  BSP_CAMERA_VsyncEventCallback();
+}
+
+/**
+  * @brief  VSYNC Event callback.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_CAMERA_VsyncEventCallback(void)
+{
+  /* NOTE : This function Should not be modified, when the callback is needed,
+            the HAL_DCMI_VsyncEventCallback could be implemented in the user file
+   */
+}
+
+/**
+  * @brief  Frame event callback
+  * @param  hdcmi: pointer to the DCMI handle  
+  * @retval None
+  */
+void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi)
+{        
+  BSP_CAMERA_FrameEventCallback();
+}
+
+/**
+  * @brief  Frame Event callback.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_CAMERA_FrameEventCallback(void)
+{
+  /* NOTE : This function Should not be modified, when the callback is needed,
+            the HAL_DCMI_FrameEventCallback could be implemented in the user file
+   */
+}
+
+/**
+  * @brief  Error callback
+  * @param  hdcmi: pointer to the DCMI handle  
+  * @retval None
+  */
+void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi)
+{        
+  BSP_CAMERA_ErrorCallback();
+}
+
+/**
+  * @brief  Error callback.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_CAMERA_ErrorCallback(void)
+{
+  /* NOTE : This function Should not be modified, when the callback is needed,
+            the HAL_DCMI_ErrorCallback could be implemented in the user file
+   */
+}
+
+/**
+  * @}
+  */  
+  
+/**
+  * @}
+  */
+  
+/**
+  * @}
+  */
+  
+/**
+  * @}
+  */      
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 150 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_camera.h

@@ -0,0 +1,150 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_camera.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_camera.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32446E_EVAL_CAMERA_H
+#define __STM32446E_EVAL_CAMERA_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+/* Include Camera component Driver */
+#include "../Components/s5k5cag/s5k5cag.h"
+
+/* Include IO Driver */
+#include "stm32446e_eval_io.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_CAMERA STM32446E-EVAL CAMERA
+  * @{
+  */ 
+   
+/** @defgroup STM32446E_EVAL_CAMERA_Exported_Types STM32446E EVAL Camera Exported Types
+  * @{
+  */
+  
+/** 
+  * @brief  Camera State structures definition  
+  */  
+typedef enum 
+{
+  CAMERA_OK       = 0x00,
+  CAMERA_ERROR    = 0x01,
+  CAMERA_TIMEOUT  = 0x02 
+}Camera_StatusTypeDef;
+
+#define RESOLUTION_R160x120      CAMERA_R160x120      /* QQVGA Resolution     */
+#define RESOLUTION_R320x240      CAMERA_R320x240      /* QVGA Resolution      */
+#define RESOLUTION_R480x272      CAMERA_R480x272      /* 480x272 Resolution   */
+#define RESOLUTION_R640x480      CAMERA_R640x480      /* VGA Resolution       */  
+/**
+  * @}
+  */ 
+ 
+/** @defgroup STM32446E_EVAL_CAMERA_Exported_Constants STM32446E EVAL Camera Exported Constants
+  * @{
+  */
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_CAMERA_Exported_Functions STM32446E EVAL Camera Exported Functions
+  * @{
+  */    
+uint8_t BSP_CAMERA_Init(uint32_t Resolution);  
+uint8_t BSP_CAMERA_DeInit(void);
+void    BSP_CAMERA_ContinuousStart(uint8_t *buff);
+void    BSP_CAMERA_SnapshotStart(uint8_t *buff);
+void    BSP_CAMERA_Suspend(void);
+void    BSP_CAMERA_Resume(void);
+uint8_t BSP_CAMERA_Stop(void); 
+void    BSP_CAMERA_HwReset(void);
+void    BSP_CAMERA_PwrDown(void);
+void    BSP_CAMERA_LineEventCallback(void);
+void    BSP_CAMERA_VsyncEventCallback(void);
+void    BSP_CAMERA_FrameEventCallback(void);
+void    BSP_CAMERA_ErrorCallback(void);
+
+/* Camera features functions prototype */
+void    BSP_CAMERA_ContrastBrightnessConfig(uint32_t contrast_level, uint32_t brightness_level);
+void    BSP_CAMERA_BlackWhiteConfig(uint32_t Mode);
+void    BSP_CAMERA_ColorEffectConfig(uint32_t Effect);
+
+/* To be called in DCMI_IRQHandler function */
+void    BSP_CAMERA_IRQHandler(void);
+/* To be called in DMA2_Stream1_IRQHandler function */
+void    BSP_CAMERA_DMA_IRQHandler(void);
+   
+/* These functions can be modified in case the current settings (e.g. DMA stream)
+   need to be changed for specific application needs */
+void BSP_CAMERA_MspInit(DCMI_HandleTypeDef *hdcmi, void *Params);
+void BSP_CAMERA_MspDeInit(DCMI_HandleTypeDef *hdcmi, void *Params);
+
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_CAMERA_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 478 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_eeprom.c

@@ -0,0 +1,478 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_eeprom.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file provides a set of functions needed to manage an I2C M24LR64 
+  *          EEPROM memory.
+  *          To be able to use this driver, the switch EE_M24LR64 must be defined
+  *          in your toolchain compiler preprocessor
+  *          
+  *          =================================================================== 
+  *          Notes:
+  *           - This driver is intended for STM32F4xx families devices only. 
+  *           - The I2C EEPROM memory (M24LR64) is available on separate daughter 
+  *             board ANT7-M24LR-A, which is not provided with the STM32446E_EVAL
+  *             board.
+  *             To use this driver you have to connect the ANT7-M24LR-A to CN3 
+  *             connector of STM32446E_EVAL board.
+  *          ===================================================================
+  *              
+  *          It implements a high level communication layer for read and write 
+  *          from/to this memory. The needed STM32F4xx hardware resources (I2C and 
+  *          GPIO) are defined in stm32446e_eval.h file, and the initialization is
+  *          performed in EEPROM_IO_Init() function declared in stm32446e_eval.c
+  *          file.
+  *          You can easily tailor this driver to any other development board, 
+  *          by just adapting the defines for hardware resources and 
+  *          EEPROM_IO_Init() function. 
+  *        
+  *          @note In this driver, basic read and write functions (BSP_EEPROM_ReadBuffer() 
+  *                and BSP_EEPROM_WritePage()) use DMA mode to perform the data 
+  *                transfer to/from EEPROM memory.
+  *
+  *         @note   Regarding BSP_EEPROM_WritePage(), it is a optimized function to perform
+  *                small write (less than 1 page) BUT The number of bytes (combined to write start address) must not 
+  *                cross the EEPROM page boundary. This function can only write into
+  *                the boundaries of an EEPROM page.
+  *                This function doesn't check on boundaries condition (in this driver 
+  *                the function BSP_EEPROM_WriteBuffer() which calls BSP_EEPROM_WritePage() is 
+  *                responsible of checking on Page boundaries).
+  * 
+  *             
+  *     +-----------------------------------------------------------------+
+  *     |               Pin assignment for M24LR64 EEPROM                 |
+  *     +---------------------------------------+-----------+-------------+
+  *     |  STM32F4xx I2C Pins                   |   EEPROM  |   Pin       |
+  *     +---------------------------------------+-----------+-------------+
+  *     | .                                     |   E0(GND) |    1  (0V)  |
+  *     | .                                     |   AC0     |    2        |
+  *     | .                                     |   AC1     |    3        |
+  *     | .                                     |   VSS     |    4  (0V)  |
+  *     | SDA                                   |   SDA     |    5        |
+  *     | SCL                                   |   SCL     |    6        |
+  *     | .                                     |   E1(GND) |    7  (0V)  |
+  *     | .                                     |   VDD     |    8 (3.3V) |
+  *     +---------------------------------------+-----------+-------------+
+  *
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "stm32446e_eval_eeprom.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+  
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_EEPROM STM32446E-EVAL EEPROM
+  * @brief This file includes the I2C EEPROM driver of STM32446E-EVAL evaluation board.
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Types STM32446E Eval Eeprom Private Types
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Defines STM32446E Eval Eeprom Private Defines
+  * @{
+  */  
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Macros STM32446E Eval Eeprom Private Macros
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Variables STM32446E Eval Eeprom Private Variables
+  * @{
+  */
+__IO uint16_t EEPROMAddress = 0;
+__IO uint16_t EEPROMDataRead;
+__IO uint8_t  EEPROMDataWrite;
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Function_Prototypes STM32446E Eval Eeprom Private Prototypes
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Private_Functions STM32446E Eval Eeprom Private Functions
+  * @{
+  */ 
+
+/**
+  * @brief  Initializes peripherals used by the I2C EEPROM driver.
+  * @param  None
+  * 
+  * @note   There are 2 different versions of M24LR64 (A01 & A02).
+  *             Then try to connect on 1st one (EEPROM_I2C_ADDRESS_A01) 
+  *             and if problem, check the 2nd one (EEPROM_I2C_ADDRESS_A02)
+  * @retval EEPROM_OK (0) if operation is correctly performed, else return value 
+  *         different from EEPROM_OK (0)
+  */
+uint32_t BSP_EEPROM_Init(void)
+{ 
+  /* I2C Initialization */
+  EEPROM_IO_Init();
+  
+  /* Select the EEPROM address for A01 and check if OK */
+  EEPROMAddress = EEPROM_I2C_ADDRESS_A01;
+  if(EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK) 
+  {
+    /* Select the EEPROM address for A02 and check if OK */
+    EEPROMAddress = EEPROM_I2C_ADDRESS_A02;
+    if(EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
+    {
+      return EEPROM_FAIL;
+    }
+  }
+  return EEPROM_OK;
+}
+
+/**
+  * @brief  DeInitializes the EEPROM.
+  * @param  None
+  * @retval EEPROM state
+  */
+uint8_t BSP_EEPROM_DeInit(void)
+{ 
+  /* I2C won't be disabled because common to other functionalities */
+  return EEPROM_OK;
+}
+
+/**
+  * @brief  Reads a block of data from the EEPROM.
+  * @param  pBuffer: pointer to the buffer that receives the data read from 
+  *         the EEPROM.
+  * @param  ReadAddr: EEPROM's internal address to start reading from.
+  * @param  NumByteToRead: pointer to the variable holding number of bytes to 
+  *         be read from the EEPROM.
+  * 
+  *        @note The variable pointed by NumByteToRead is reset to 0 when all the 
+  *              data are read from the EEPROM. Application should monitor this 
+  *              variable in order know when the transfer is complete.
+  * 
+  * @retval EEPROM_OK (0) if operation is correctly performed, else return value 
+  *         different from EEPROM_OK (0) or the timeout user callback.
+  */
+uint32_t BSP_EEPROM_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead)
+{  
+  uint32_t buffersize = *NumByteToRead;
+  
+  /* Set the pointer to the Number of data to be read. This pointer will be used 
+     by the DMA Transfer Completer interrupt Handler in order to reset the 
+     variable to 0. User should check on this variable in order to know if the 
+     DMA transfer has been complete or not. */
+  EEPROMDataRead = *NumByteToRead;
+  
+  if(EEPROM_IO_ReadData(EEPROMAddress, ReadAddr, pBuffer, buffersize) != HAL_OK)
+  {
+    BSP_EEPROM_TIMEOUT_UserCallback();
+    return EEPROM_FAIL;
+  }
+
+  /* If all operations OK, return EEPROM_OK (0) */
+  return EEPROM_OK;
+}
+
+/**
+  * @brief  Writes more than one byte to the EEPROM with a single WRITE cycle.
+  *
+  * @note   The number of bytes (combined to write start address) must not 
+  *         cross the EEPROM page boundary. This function can only write into
+  *         the boundaries of an EEPROM page.
+  *         This function doesn't check on boundaries condition (in this driver 
+  *         the function BSP_EEPROM_WriteBuffer() which calls BSP_EEPROM_WritePage() is 
+  *         responsible of checking on Page boundaries).
+  * 
+  * @param  pBuffer: pointer to the buffer containing the data to be written to 
+  *         the EEPROM.
+  * @param  WriteAddr: EEPROM's internal address to write to.
+  * @param  NumByteToWrite: pointer to the variable holding number of bytes to 
+  *         be written into the EEPROM. 
+  * 
+  *        @note The variable pointed by NumByteToWrite is reset to 0 when all the 
+  *              data are written to the EEPROM. Application should monitor this 
+  *              variable in order know when the transfer is complete.
+  * 
+  *        @note This function just configure the communication and enable the DMA 
+  *              channel to transfer data. Meanwhile, the user application may perform 
+  *              other tasks in parallel.
+  * 
+  * @retval EEPROM_OK (0) if operation is correctly performed, else return value 
+  *         different from EEPROM_OK (0) or the timeout user callback.
+  */
+uint32_t BSP_EEPROM_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite)
+{ 
+  uint32_t buffersize = *NumByteToWrite;
+  uint32_t status = EEPROM_OK;
+  
+  /* Set the pointer to the Number of data to be written. This pointer will be used 
+      by the DMA Transfer Completer interrupt Handler in order to reset the 
+      variable to 0. User should check on this variable in order to know if the 
+      DMA transfer has been complete or not. */
+  EEPROMDataWrite = *NumByteToWrite;  
+  
+  if(EEPROM_IO_WriteData(EEPROMAddress, WriteAddr, pBuffer, buffersize) != HAL_OK)
+  {
+    BSP_EEPROM_TIMEOUT_UserCallback();
+    status = EEPROM_FAIL;
+  }
+  
+  if(BSP_EEPROM_WaitEepromStandbyState() != EEPROM_OK) 
+  {
+    return EEPROM_FAIL;
+  }
+  
+  /* If all operations OK, return EEPROM_OK (0) */
+  return status;
+}
+
+/**
+  * @brief  Writes buffer of data to the I2C EEPROM.
+  * @param  pBuffer: pointer to the buffer  containing the data to be written 
+  *         to the EEPROM.
+  * @param  WriteAddr: EEPROM's internal address to write to.
+  * @param  NumByteToWrite: number of bytes to write to the EEPROM.
+  * @retval EEPROM_OK (0) if operation is correctly performed, else return value 
+  *         different from EEPROM_OK (0) or the timeout user callback.
+  */
+uint32_t BSP_EEPROM_WriteBuffer(uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite)
+{
+  uint16_t numofpage = 0, numofsingle = 0, count = 0;
+  uint16_t addr = 0;
+  uint8_t  dataindex = 0;
+  uint32_t status = EEPROM_OK;
+
+  addr = WriteAddr % EEPROM_PAGESIZE;
+  count = EEPROM_PAGESIZE - addr;
+  numofpage =  NumByteToWrite / EEPROM_PAGESIZE;
+  numofsingle = NumByteToWrite % EEPROM_PAGESIZE;
+ 
+  /* If WriteAddr is EEPROM_PAGESIZE aligned */
+  if(addr == 0) 
+  {
+    /* If NumByteToWrite < EEPROM_PAGESIZE */
+    if(numofpage == 0) 
+    {
+      /* Store the number of data to be written */
+      dataindex = numofsingle;
+      /* Start writing data */
+      status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+      if(status != EEPROM_OK)
+      {
+        return status;
+      }
+    }
+    /* If NumByteToWrite > EEPROM_PAGESIZE */
+    else  
+    {
+      while(numofpage--)
+      {
+        /* Store the number of data to be written */
+        dataindex = EEPROM_PAGESIZE;        
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+        
+        WriteAddr +=  EEPROM_PAGESIZE;
+        pBuffer += EEPROM_PAGESIZE;
+      }
+      
+      if(numofsingle!=0)
+      {
+        /* Store the number of data to be written */
+        dataindex = numofsingle;          
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+      }
+    }
+  }
+  /* If WriteAddr is not EEPROM_PAGESIZE aligned */
+  else 
+  {
+    /* If NumByteToWrite < EEPROM_PAGESIZE */
+    if(numofpage== 0) 
+    {
+      /* If the number of data to be written is more than the remaining space 
+      in the current page: */
+      if(NumByteToWrite > count)
+      {
+        /* Store the number of data to be written */
+        dataindex = count;        
+        /* Write the data contained in same page */
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+        
+        /* Store the number of data to be written */
+        dataindex = (NumByteToWrite - count);          
+        /* Write the remaining data in the following page */
+        status = BSP_EEPROM_WritePage((uint8_t*)(pBuffer + count), (WriteAddr + count), (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+      }      
+      else      
+      {
+        /* Store the number of data to be written */
+        dataindex = numofsingle;         
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+      }     
+    }
+    /* If NumByteToWrite > EEPROM_PAGESIZE */
+    else
+    {
+      NumByteToWrite -= count;
+      numofpage =  NumByteToWrite / EEPROM_PAGESIZE;
+      numofsingle = NumByteToWrite % EEPROM_PAGESIZE;
+      
+      if(count != 0)
+      {  
+        /* Store the number of data to be written */
+        dataindex = count;         
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+        WriteAddr += count;
+        pBuffer += count;
+      } 
+      
+      while(numofpage--)
+      {
+        /* Store the number of data to be written */
+        dataindex = EEPROM_PAGESIZE;          
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+        WriteAddr +=  EEPROM_PAGESIZE;
+        pBuffer += EEPROM_PAGESIZE;  
+      }
+      if(numofsingle != 0)
+      {
+        /* Store the number of data to be written */
+        dataindex = numofsingle;           
+        status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t*)(&dataindex));
+        if(status != EEPROM_OK)
+        {
+          return status;
+        }
+      }
+    }
+  }  
+                                   
+  /* If all operations OK, return EEPROM_OK (0) */
+  return EEPROM_OK;
+}
+
+/**
+  * @brief  Wait for EEPROM Standby state.
+  * 
+  * @note  This function allows to wait and check that EEPROM has finished the 
+  *        last operation. It is mostly used after Write operation: after receiving
+  *        the buffer to be written, the EEPROM may need additional time to actually
+  *        perform the write operation. During this time, it doesn't answer to
+  *        I2C packets addressed to it. Once the write operation is complete
+  *        the EEPROM responds to its address.
+  * 
+  * @param  None
+  * @retval EEPROM_OK (0) if operation is correctly performed, else return value 
+  *         different from EEPROM_OK (0) or the timeout user callback.
+  */
+uint32_t BSP_EEPROM_WaitEepromStandbyState(void)      
+{
+  /* Check if the maximum allowed number of trials has bee reached */
+  if(EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
+  {
+    /* If the maximum number of trials has been reached, exit the function */
+    BSP_EEPROM_TIMEOUT_UserCallback();
+    return EEPROM_TIMEOUT;
+  }
+  return EEPROM_OK;
+}
+
+/**
+  * @brief  Basic management of the timeout situation.
+  * @param  None
+  * @retval None
+  */
+__weak void BSP_EEPROM_TIMEOUT_UserCallback(void)
+{
+}
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 140 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_eeprom.h

@@ -0,0 +1,140 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_eeprom.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains all the functions prototypes for 
+  *          the stm32446e_eval_eeprom.c firmware driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32F446E_EVAL_EEPROM_H
+#define __STM32F446E_EVAL_EEPROM_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+  
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_EEPROM STM32446E-EVAL EEPROM
+  * @brief This file includes the I2C EEPROM driver of STM32446E-EVAL evaluation board.
+  * @{
+  */
+
+/** @defgroup STM32446E_EVAL_EEPROM_Exported_Types STM32446E EVAL EEPROM Exported Types
+  * @{
+  */ 
+/**
+  * @}
+  */
+  
+/** @defgroup STM32446E_EVAL_EEPROM_Exported_Constants STM32446E EVAL EEPROM Exported Constants
+  * @{
+  */
+/* EEPROM hardware address and page size */ 
+#define EEPROM_PAGESIZE             ((uint8_t)4)
+#define EEPROM_MAX_SIZE             ((uint16_t)0x2000) /* 64Kbit */
+                                
+
+/* Maximum number of trials for EEPROM_WaitEepromStandbyState() function */
+#define EEPROM_MAX_TRIALS           ((uint32_t)3000)
+      
+#define EEPROM_OK                   ((uint32_t)0)
+#define EEPROM_FAIL                 ((uint32_t)1)
+#define EEPROM_TIMEOUT              ((uint32_t)2)
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_EEPROM_Exported_Macros STM32446E EVAL EEPROM Exported Macros
+  * @{
+  */    
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_EEPROM_Exported_Functions STM32446E EVAL EEPROM Exported Functions
+  * @{
+  */ 
+uint32_t BSP_EEPROM_Init(void);
+uint8_t BSP_EEPROM_DeInit(void);
+uint32_t BSP_EEPROM_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead);
+uint32_t BSP_EEPROM_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint8_t* NumByteToWrite);
+uint32_t BSP_EEPROM_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite);
+uint32_t BSP_EEPROM_WaitEepromStandbyState(void);
+
+/* USER Callbacks: This function is declared as __weak in EEPROM driver and 
+   should be implemented into user application.  
+   BSP_EEPROM_TIMEOUT_UserCallback() function is called whenever a timeout condition 
+   occurs during communication (waiting on an event that doesn't occur, bus
+   errors, busy devices ...). */
+void     BSP_EEPROM_TIMEOUT_UserCallback(void);
+
+/* Link function for I2C EEPROM peripheral */
+void              EEPROM_IO_Init(void);
+HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
+HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
+HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_EEPROM_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 327 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_io.c

@@ -0,0 +1,327 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_io.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file provides a set of functions needed to manage the IO pins
+  *          on STM32446E-EVAL evaluation board.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* File Info : -----------------------------------------------------------------
+                                   User NOTES
+1. How To use this driver:
+--------------------------
+   - This driver is used to drive the IO module of the STM32446E-EVAL evaluation
+     board.
+   - The MFXSTM32L152 IO expander device component driver must be included with this 
+     driver in order to run the IO functionalities commanded by the IO expander (MFX)
+     device mounted on the evaluation board.
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the IO module using the BSP_IO_Init() function. This 
+       function includes the MSP layer hardware resources initialization and the
+       communication layer configuration to start the IO functionalities use.    
+  
+  + IO functionalities use
+     o The IO pin mode is configured when calling the function BSP_IO_ConfigPin(), you 
+       must specify the desired IO mode by choosing the "IO_ModeTypedef" parameter 
+       predefined value.
+     o If an IO pin is used in interrupt mode, the function BSP_IO_ITGetStatus() is 
+       needed to get the interrupt status. To clear the IT pending bits, you should 
+       call the function BSP_IO_ITClear() with specifying the IO pending bit to clear.
+     o The IT is handled using the corresponding external interrupt IRQ handler,
+       the user IT callback treatment is implemented on the same external interrupt
+       callback.
+     o The IRQ_OUT pin (common for all functionalities: TS, JOY, SD, etc)  can be  
+       configured using the function BSP_IO_ConfigIrqOutPin()
+     o To get/set an IO pin combination state you can use the functions 
+       BSP_IO_ReadPin()/BSP_IO_WritePin() or the function BSP_IO_TogglePin() to toggle the pin 
+       state.
+ 
+------------------------------------------------------------------------------*/
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval_io.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_IO STM32446E-EVAL IO 
+  * @{
+  */   
+
+/** @defgroup STM32446E_EVAL_IO_Private_Types_Definitions STM32446E Eval Io Private TypesDef
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_IO_Private_Defines STM32446E Eval Io Private Defines
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_IO_Private_Macros STM32446E Eval Io Private Macros
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_IO_Private_Variables STM32446E Eval Io Private Variables
+  * @{
+  */ 
+static IO_DrvTypeDef *IoDrv = NULL;
+static  uint8_t mfxstm32l152Identifier;
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_IO_Private_Function_Prototypes STM32446E Eval Io Private Prototypes
+  * @{
+  */ 
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_IO_Private_Functions STM32446E Eval Io Private Functions
+  * @{
+  */ 
+
+/**
+  * @brief  Initializes and configures the IO functionalities and configures all
+  *         necessary hardware resources (MFX, ...).
+  * @note   BSP_IO_Init() is using HAL_Delay() function to ensure that MFXSTM32L152
+  *         IO Expander is correctly reset. HAL_Delay() function provides accurate
+  *         delay (in milliseconds) based on variable incremented in SysTick ISR. 
+  *         This implies that if BSP_IO_Init() is called from a peripheral ISR process,
+  *         then the SysTick interrupt must have higher priority (numerically lower)
+  *         than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
+  * @param  None
+  * @retval IO_OK if all initializations are OK. Other value if error.
+  */
+uint8_t BSP_IO_Init(void)
+{
+  uint8_t ret = IO_OK;
+
+  if (  IoDrv == NULL)
+  {
+    /* Read ID and verify the IO expander is ready */
+    mfxstm32l152Identifier=0;
+    mfxstm32l152Identifier = mfxstm32l152_io_drv.ReadID(IO_I2C_ADDRESS);
+    if((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2))
+    {
+      /* Initialize the IO driver structure */
+      IoDrv = &mfxstm32l152_io_drv;
+    }
+    else
+    {
+      ret = IO_ERROR;
+    }
+
+    if(ret == IO_OK)
+    {
+      IoDrv->Init(IO_I2C_ADDRESS);
+      IoDrv->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
+    }
+  }
+
+  return ret;
+}
+
+/**
+  * @brief  DeInit allows Mfx Initialization to be executed again
+  * @note   BSP_IO_Init() has no effect if the IoDrv is already initialized
+  *         BSP_IO_DeInit() allows to erase the pointer such to allow init to be effective 
+  * @param  None
+  * @retval IO_OK 
+  */
+uint8_t BSP_IO_DeInit(void)
+{
+  IoDrv = NULL;
+  return IO_OK;
+}
+
+/**
+  * @brief  Gets the selected pins IT status.
+  * @param  IoPin: Selected pins to check the status. 
+  *          This parameter can be any combination of the IO pins.  
+  * @retval IO_OK if read status OK. Other value if error.
+  */
+uint32_t BSP_IO_ITGetStatus(uint32_t IoPin)
+{
+  /* Return the IO Pin IT status */
+  return (IoDrv->ITStatus(IO_I2C_ADDRESS, IoPin));
+}
+
+/**
+  * @brief  Clears all the IO IT pending bits.
+  * @param  None
+  * @retval None
+  */
+void BSP_IO_ITClear(void)
+{
+  /* Clear all IO IT pending bits */
+  IoDrv->ClearIT(IO_I2C_ADDRESS, MFXSTM32L152_GPIO_PINS_ALL);
+}
+
+/**
+  * @brief  Configures the IO pin(s) according to IO mode structure value.
+  * @param  IoPin: IO pin(s) to be configured. 
+  *          This parameter can be one of the following values:
+  *            @arg  MFXSTM32L152_GPIO_PIN_x: where x can be from 0 to 23.
+  * @param  IoMode: IO pin mode to configure
+  *          This parameter can 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            
+  *            @arg  IO_MODE_ANALOG
+  *            @arg  IO_MODE_OFF
+  *            @arg  IO_MODE_INPUT_PU,
+  *            @arg  IO_MODE_INPUT_PD,
+  *            @arg  IO_MODE_OUTPUT_OD,
+  *            @arg  IO_MODE_OUTPUT_OD_PU,
+  *            @arg  IO_MODE_OUTPUT_OD_PD,
+  *            @arg  IO_MODE_OUTPUT_PP,
+  *            @arg  IO_MODE_OUTPUT_PP_PU,
+  *            @arg  IO_MODE_OUTPUT_PP_PD,
+  *            @arg  IO_MODE_IT_RISING_EDGE_PU
+  *            @arg  IO_MODE_IT_FALLING_EDGE_PU
+  *            @arg  IO_MODE_IT_LOW_LEVEL_PU
+  *            @arg  IO_MODE_IT_HIGH_LEVEL_PU
+  *            @arg  IO_MODE_IT_RISING_EDGE_PD
+  *            @arg  IO_MODE_IT_FALLING_EDGE_PD
+  *            @arg  IO_MODE_IT_LOW_LEVEL_PD
+  *            @arg  IO_MODE_IT_HIGH_LEVEL_PD
+  * @retval IO_OK if all initializations are OK. Other value if error.  
+  */
+uint8_t BSP_IO_ConfigPin(uint32_t IoPin, IO_ModeTypedef IoMode)
+{
+  /* Configure the selected IO pin(s) mode */
+  IoDrv->Config(IO_I2C_ADDRESS, IoPin, IoMode);
+  
+  return IO_OK;  
+}
+
+/**
+  * @brief  Sets the IRQ_OUT pin polarity and type
+  * @param  IoIrqOutPinPolarity: High/Low
+  * @param  IoIrqOutPinType:     OpenDrain/PushPull 
+  * @retval OK
+  */
+uint8_t BSP_IO_ConfigIrqOutPin(uint8_t IoIrqOutPinPolarity, uint8_t IoIrqOutPinType)
+{
+  if((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2))
+  {
+    /* Initialize the IO driver structure */
+    mfxstm32l152_SetIrqOutPinPolarity(IO_I2C_ADDRESS, IoIrqOutPinPolarity);
+    mfxstm32l152_SetIrqOutPinType(IO_I2C_ADDRESS, IoIrqOutPinType);
+  }
+
+  return IO_OK;
+}
+
+/**
+  * @brief  Sets the selected pins state.
+  * @param  IoPin: Selected pins to write. 
+  *          This parameter can be any combination of the IO pins. 
+  * @param  PinState: New pins state to write  
+  * @retval None
+  */
+void BSP_IO_WritePin(uint32_t IoPin, BSP_IO_PinStateTypeDef PinState)
+{
+  /* Set the Pin state */
+  IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, PinState);
+}
+
+/**
+  * @brief  Gets the selected pins current state.
+  * @param  IoPin: Selected pins to read. 
+  *          This parameter can be any combination of the IO pins. 
+  * @retval The current pins state 
+  */
+uint32_t BSP_IO_ReadPin(uint32_t IoPin)
+{
+ return(IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin));
+}
+
+/**
+  * @brief  Toggles the selected pins state.
+  * @param  IoPin: Selected pins to toggle. 
+  *          This parameter can be any combination of the IO pins.  
+  * @note   This function is only used to toggle one pin in the same time  
+  * @retval None
+  */
+void BSP_IO_TogglePin(uint32_t IoPin)
+{
+  /* Toggle the current pin state */
+  if(IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin) != 0) /* Set */
+  {
+    IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 0); /* Reset */
+  }
+  else
+  {
+    IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 1); /* Set */
+  } 
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 159 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_io.h

@@ -0,0 +1,159 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_io.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_io.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32446E_EVAL_IO_H
+#define __STM32446E_EVAL_IO_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif   
+   
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval.h"
+/* Include IO component driver */
+#include "../Components/mfxstm32l152/mfxstm32l152.h"  
+   
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_IO STM32446E-EVAL IO
+  * @{
+  */    
+
+/** @defgroup STM32446E_EVAL_IO_Exported_Types STM32446E EVAL IO Exported Types
+  * @{
+  */
+
+typedef enum
+{
+  BSP_IO_PIN_RESET = 0,
+  BSP_IO_PIN_SET   = 1
+}BSP_IO_PinStateTypeDef;
+ 
+typedef enum 
+{
+  IO_OK       = 0,
+  IO_ERROR    = 1,
+  IO_TIMEOUT  = 2
+}IO_StatusTypeDef;
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_IO_Exported_Constants STM32446E EVAL IO Exported Constants
+  * @{
+  */    
+#define IO_PIN_0                  ((uint32_t)0x0001)
+#define IO_PIN_1                  ((uint32_t)0x0002)
+#define IO_PIN_2                  ((uint32_t)0x0004)
+#define IO_PIN_3                  ((uint32_t)0x0008)
+#define IO_PIN_4                  ((uint32_t)0x0010)
+#define IO_PIN_5                  ((uint32_t)0x0020)
+#define IO_PIN_6                  ((uint32_t)0x0040)
+#define IO_PIN_7                  ((uint32_t)0x0080)
+#define IO_PIN_8                  ((uint32_t)0x0100)
+#define IO_PIN_9                  ((uint32_t)0x0200)
+#define IO_PIN_10                 ((uint32_t)0x0400)
+#define IO_PIN_11                 ((uint32_t)0x0800)
+#define IO_PIN_12                 ((uint32_t)0x1000)
+#define IO_PIN_13                 ((uint32_t)0x2000)
+#define IO_PIN_14                 ((uint32_t)0x4000)
+#define IO_PIN_15                 ((uint32_t)0x8000)
+#define IO_PIN_16               ((uint32_t)0x010000)
+#define IO_PIN_17               ((uint32_t)0x020000)
+#define IO_PIN_18               ((uint32_t)0x040000)
+#define IO_PIN_19               ((uint32_t)0x080000)
+#define IO_PIN_20               ((uint32_t)0x100000)
+#define IO_PIN_21               ((uint32_t)0x200000)
+#define IO_PIN_22               ((uint32_t)0x400000)
+#define IO_PIN_23               ((uint32_t)0x800000)
+#define IO_PIN_ALL              ((uint32_t)0xFFFFFF)  
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_IO_Exported_Macro STM32446E EVAL IO Exported Macro
+  * @{
+  */ 
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_IO_Exported_Functions STM32446E EVAL IO Exported Functions
+  * @{
+  */
+uint8_t  BSP_IO_Init(void);
+uint8_t  BSP_IO_DeInit(void);
+uint8_t  BSP_IO_ConfigIrqOutPin(uint8_t IoIrqOutPinPolarity, uint8_t IoIrqOutPinType);
+uint32_t BSP_IO_ITGetStatus(uint32_t IoPin);
+void     BSP_IO_ITClear(void);
+uint8_t  BSP_IO_ConfigPin(uint32_t IoPin, IO_ModeTypedef IoMode);
+void     BSP_IO_WritePin(uint32_t IoPin, BSP_IO_PinStateTypeDef PinState);
+uint32_t BSP_IO_ReadPin(uint32_t IoPin);
+void     BSP_IO_TogglePin(uint32_t IoPin);
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_IO_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 1088 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_lcd.c

@@ -0,0 +1,1088 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_lcd.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file includes the driver for Liquid Crystal Display (LCD) module
+  *          mounted on STM32446E-EVAL evaluation board.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* File Info : -----------------------------------------------------------------
+                                   User NOTES
+1. How To use this driver:
+--------------------------
+   - This driver is used to drive indirectly an LCD TFT.
+   - This driver supports the ILI9325 LCD mounted on MB785 daughter board 
+   - The ILI9325 component driver MUST be included with this driver.  
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the LCD using the BSP_LCD_Init() function.
+  
+  + Display on LCD
+     o Clear the hole LCD using BSP_LCD_Clear() function or only one specified string
+       line using the BSP_LCD_ClearStringLine() function.
+     o Display a character on the specified line and column using the BSP_LCD_DisplayChar()
+       function or a complete string line using the BSP_LCD_DisplayStringAtLine() function.
+     o Display a string line on the specified position (x,y in pixel) and align mode
+       using the BSP_LCD_DisplayStringAtLine() function.          
+     o Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap) 
+       on LCD using the available set of functions.     
+ 
+------------------------------------------------------------------------------*/
+    
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval_lcd.h"  
+#include "../../../Utilities/Fonts/fonts.h"
+#include "../../../Utilities/Fonts/font24.c"
+#include "../../../Utilities/Fonts/font20.c"
+#include "../../../Utilities/Fonts/font16.c"
+#include "../../../Utilities/Fonts/font12.c"
+#include "../../../Utilities/Fonts/font8.c"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_LCD STM32446E-EVAL LCD
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Private_TypesDefinitions STM32446E Eval Lcd Private TypesDef
+  * @{
+  */ 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Private_Defines STM32446E Eval Lcd Private Defines
+  * @{
+  */
+#define POLY_X(Z)              ((int32_t)((Points + Z)->X))
+#define POLY_Y(Z)              ((int32_t)((Points + Z)->Y))      
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Private_Macros STM32446E Eval Lcd Private Macros
+  * @{
+  */
+#define ABS(X)  ((X) > 0 ? (X) : -(X))      
+/**
+  * @}
+  */ 
+    
+/** @defgroup STM32446E_EVAL_LCD_Private_Variables STM32446E Eval Lcd Private Variables
+  * @{
+  */ 
+LCD_DrawPropTypeDef DrawProp;
+static LCD_DrvTypeDef  *LcdDrv; 
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Private_FunctionPrototypes STM32446E Eval Lcd Private Prototypes
+  * @{
+  */ 
+static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c);
+static void SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3);
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Private_Functions STM32446E Eval Lcd Private Functions
+  * @{
+  */
+
+/**
+  * @brief  Initializes the LCD.
+  * @param  None
+  * @retval LCD state
+  */
+uint8_t BSP_LCD_Init(void)
+{ 
+  uint8_t ret = LCD_ERROR;
+  
+  /* Default value for draw propriety */
+  DrawProp.BackColor = 0xFFFF;
+  DrawProp.pFont     = &Font24;
+  DrawProp.TextColor = 0x0000;
+  
+  if(ili9325_drv.ReadID() == ILI9325_ID)
+  {
+    LcdDrv = &ili9325_drv;
+
+    /* LCD Init */   
+    LcdDrv->Init();
+    
+    /* Initialize the font */
+    BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+
+    ret = LCD_OK;
+  }
+  
+  return ret;
+}
+
+/**
+  * @brief  DeInitializes the LCD.
+  * @param  None
+  * @retval LCD state
+  */
+uint8_t BSP_LCD_DeInit(void)
+{ 
+  /* Actually LcdDrv does not provide a DeInit function */
+  return LCD_OK;
+}
+
+/**
+  * @brief  Gets the LCD X size.
+  * @param  None    
+  * @retval Used LCD X size
+  */
+uint32_t BSP_LCD_GetXSize(void)
+{
+  return(LcdDrv->GetLcdPixelWidth());
+}
+
+/**
+  * @brief  Gets the LCD Y size.
+  * @param  None   
+  * @retval Used LCD Y size
+  */
+uint32_t BSP_LCD_GetYSize(void)
+{
+  return(LcdDrv->GetLcdPixelHeight());
+}
+
+/**
+  * @brief  Gets the LCD text color.
+  * @param  None 
+  * @retval Used text color.
+  */
+uint16_t BSP_LCD_GetTextColor(void)
+{
+  return DrawProp.TextColor;
+}
+
+/**
+  * @brief  Gets the LCD background color.
+  * @param  None
+  * @retval Used background color
+  */
+uint16_t BSP_LCD_GetBackColor(void)
+{
+  return DrawProp.BackColor;
+}
+
+/**
+  * @brief  Sets the LCD text color.
+  * @param  Color: Text color code RGB(5-6-5)
+  * @retval None
+  */
+void BSP_LCD_SetTextColor(uint16_t Color)
+{
+  DrawProp.TextColor = Color;
+}
+
+/**
+  * @brief  Sets the LCD background color.
+  * @param  Color: Background color code RGB(5-6-5)
+  * @retval None
+  */
+void BSP_LCD_SetBackColor(uint16_t Color)
+{
+  DrawProp.BackColor = Color;
+}
+
+/**
+  * @brief  Sets the LCD text font.
+  * @param  fonts: Font to be used
+  * @retval None
+  */
+void BSP_LCD_SetFont(sFONT *fonts)
+{
+  DrawProp.pFont = fonts;
+}
+
+/**
+  * @brief  Gets the LCD text font.
+  * @param  None
+  * @retval Used font
+  */
+sFONT *BSP_LCD_GetFont(void)
+{
+  return DrawProp.pFont;
+}
+
+/**
+  * @brief  Clears the hole LCD.
+  * @param  Color: Color of the background
+  * @retval None
+  */
+void BSP_LCD_Clear(uint16_t Color)
+{ 
+  uint32_t counter = 0;
+  uint32_t y_size = 0;
+  uint32_t color_backup = DrawProp.TextColor; 
+
+  DrawProp.TextColor = Color;
+  y_size =  BSP_LCD_GetYSize();
+  
+  for(counter = 0; counter < y_size; counter++)
+  {
+    BSP_LCD_DrawHLine(0, counter, BSP_LCD_GetXSize());
+  }
+  DrawProp.TextColor = color_backup; 
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+}
+
+/**
+  * @brief  Clears the selected line.
+  * @param  Line: Line to be cleared
+  *          This parameter can be one of the following values:
+  *            @arg  0..9: if the Current fonts is Font16x24
+  *            @arg  0..19: if the Current fonts is Font12x12 or Font8x12
+  *            @arg  0..29: if the Current fonts is Font8x8
+  * @retval None
+  */
+void BSP_LCD_ClearStringLine(uint16_t Line)
+{ 
+  uint32_t color_backup = DrawProp.TextColor; 
+
+  DrawProp.TextColor = DrawProp.BackColor;;
+    
+  /* Draw a rectangle with background color */
+  BSP_LCD_FillRect(0, (Line * DrawProp.pFont->Height), BSP_LCD_GetXSize(), DrawProp.pFont->Height);
+  
+  DrawProp.TextColor = color_backup;
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+}
+
+/**
+  * @brief  Displays one character.
+  * @param  Xpos: Start column address
+  * @param  Ypos: Line where to display the character shape.
+  * @param  Ascii: Character ascii code
+  *           This parameter must be a number between Min_Data = 0x20 and Max_Data = 0x7E 
+  * @retval None
+  */
+void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii)
+{
+  DrawChar(Xpos, Ypos, &DrawProp.pFont->table[(Ascii-' ') *\
+    DrawProp.pFont->Height * ((DrawProp.pFont->Width + 7) / 8)]);
+}
+
+/**
+  * @brief  Displays characters on the LCD.
+  * @param  Xpos: X position (in pixel)
+  * @param  Ypos: Y position (in pixel)   
+  * @param  Text: Pointer to string to display on LCD
+  * @param  Mode: Display mode
+  *          This parameter can be one of the following values:
+  *            @arg  CENTER_MODE
+  *            @arg  RIGHT_MODE
+  *            @arg  LEFT_MODE   
+  * @retval None
+  */
+void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode)
+{
+  uint16_t refcolumn = 1, i = 0;
+  uint32_t size = 0, xsize = 0; 
+  uint8_t  *ptr = Text;
+  
+  /* Get the text size */
+  while (*ptr++) size ++ ;
+  
+  /* Characters number per line */
+  xsize = (BSP_LCD_GetXSize()/DrawProp.pFont->Width);
+  
+  switch (Mode)
+  {
+  case CENTER_MODE:
+    {
+      refcolumn = Xpos + ((xsize - size)* DrawProp.pFont->Width) / 2;
+      break;
+    }
+  case LEFT_MODE:
+    {
+      refcolumn = Xpos;
+      break;
+    }
+  case RIGHT_MODE:
+    {
+      refcolumn =  - Xpos + ((xsize - size)*DrawProp.pFont->Width);
+      break;
+    }    
+  default:
+    {
+      refcolumn = Xpos;
+      break;
+    }
+  }
+  
+  /* Check that the Start column is located in the screen */
+  if ((refcolumn < 1) || (refcolumn >= 0x8000))
+  {
+    refcolumn = 1;
+  }
+
+  /* Send the string character by character on lCD */
+  while ((*Text != 0) & (((BSP_LCD_GetXSize() - (i*DrawProp.pFont->Width)) & 0xFFFF) >= DrawProp.pFont->Width))
+  {
+    /* Display one character on LCD */
+    BSP_LCD_DisplayChar(refcolumn, Ypos, *Text);
+    /* Decrement the column position by 16 */
+    refcolumn += DrawProp.pFont->Width;
+    /* Point on the next character */
+    Text++;
+    i++;
+  }
+}
+
+/**
+  * @brief  Displays a character on the LCD.
+  * @param  Line: Line where to display the character shape
+  *          This parameter can be one of the following values:
+  *            @arg  0..9: if the Current fonts is Font16x24  
+  *            @arg  0..19: if the Current fonts is Font12x12 or Font8x12
+  *            @arg  0..29: if the Current fonts is Font8x8
+  * @param  ptr: Pointer to string to display on LCD
+  * @retval None
+  */
+void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr)
+{
+  BSP_LCD_DisplayStringAt(0, LINE(Line), ptr, LEFT_MODE);
+}
+
+/**
+  * @brief  Reads an LCD pixel.
+  * @param  Xpos: X position 
+  * @param  Ypos: Y position 
+  * @retval RGB pixel color
+  */
+uint16_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos)
+{
+  uint16_t ret = 0;
+  
+  if(LcdDrv->ReadPixel != NULL)
+  {
+    ret = LcdDrv->ReadPixel(Xpos, Ypos);
+  }
+    
+  return ret;
+}
+
+/**
+  * @brief  Draws a pixel on LCD.
+  * @param  Xpos: X position 
+  * @param  Ypos: Y position
+  * @param  RGB_Code: Pixel color in RGB mode (5-6-5)  
+  * @retval None
+  */
+void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code)
+{
+  if(LcdDrv->WritePixel != NULL)
+  {
+    LcdDrv->WritePixel(Xpos, Ypos, RGB_Code);
+  }
+}
+  
+/**
+  * @brief  Draws an horizontal line.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Length: Line length
+  * @retval None
+  */
+void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint32_t index = 0;
+  
+  if(LcdDrv->DrawHLine != NULL)
+  {
+    LcdDrv->DrawHLine(DrawProp.TextColor, Xpos, Ypos, Length);
+  }
+  else
+  {
+    for(index = 0; index < Length; index++)
+    {
+      BSP_LCD_DrawPixel((Xpos + index), Ypos, DrawProp.TextColor);
+    }
+  }
+}
+
+/**
+  * @brief  Draws a vertical line.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Length: Line length
+  * @retval None
+  */
+void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
+{
+  uint32_t index = 0;
+  
+  if(LcdDrv->DrawVLine != NULL)
+  {
+    LcdDrv->DrawVLine(DrawProp.TextColor, Xpos, Ypos, Length);
+  }
+  else
+  {
+    for(index = 0; index < Length; index++)
+    {
+      BSP_LCD_DrawPixel(Xpos, Ypos + index, DrawProp.TextColor);
+    }
+  }
+}
+
+/**
+  * @brief  Draws an uni-line (between two points).
+  * @param  x1: Point 1 X position
+  * @param  y1: Point 1 Y position
+  * @param  x2: Point 2 X position
+  * @param  y2: Point 2 Y position
+  * @retval None
+  */
+void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
+{
+  int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, 
+  yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, 
+  curpixel = 0;
+  
+  deltax = ABS(x2 - x1);        /* The difference between the x's */
+  deltay = ABS(y2 - y1);        /* The difference between the y's */
+  x = x1;                       /* Start x off at the first pixel */
+  y = y1;                       /* Start y off at the first pixel */
+  
+  if (x2 >= x1)                 /* The x-values are increasing */
+  {
+    xinc1 = 1;
+    xinc2 = 1;
+  }
+  else                          /* The x-values are decreasing */
+  {
+    xinc1 = -1;
+    xinc2 = -1;
+  }
+  
+  if (y2 >= y1)                 /* The y-values are increasing */
+  {
+    yinc1 = 1;
+    yinc2 = 1;
+  }
+  else                          /* The y-values are decreasing */
+  {
+    yinc1 = -1;
+    yinc2 = -1;
+  }
+  
+  if (deltax >= deltay)         /* There is at least one x-value for every y-value */
+  {
+    xinc1 = 0;                  /* Don't change the x when numerator >= denominator */
+    yinc2 = 0;                  /* Don't change the y for every iteration */
+    den = deltax;
+    num = deltax / 2;
+    numadd = deltay;
+    numpixels = deltax;         /* There are more x-values than y-values */
+  }
+  else                          /* There is at least one y-value for every x-value */
+  {
+    xinc2 = 0;                  /* Don't change the x for every iteration */
+    yinc1 = 0;                  /* Don't change the y when numerator >= denominator */
+    den = deltay;
+    num = deltay / 2;
+    numadd = deltax;
+    numpixels = deltay;         /* There are more y-values than x-values */
+  }
+  
+  for (curpixel = 0; curpixel <= numpixels; curpixel++)
+  {
+    BSP_LCD_DrawPixel(x, y, DrawProp.TextColor);  /* Draw the current pixel */
+    num += numadd;                            /* Increase the numerator by the top of the fraction */
+    if (num >= den)                           /* Check if numerator >= denominator */
+    {
+      num -= den;                             /* Calculate the new numerator value */
+      x += xinc1;                             /* Change the x as appropriate */
+      y += yinc1;                             /* Change the y as appropriate */
+    }
+    x += xinc2;                               /* Change the x as appropriate */
+    y += yinc2;                               /* Change the y as appropriate */
+  }
+}
+
+/**
+  * @brief  Draws a rectangle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Width: Rectangle width  
+  * @param  Height: Rectangle height
+  * @retval None
+  */
+void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  /* Draw horizontal lines */
+  BSP_LCD_DrawHLine(Xpos, Ypos, Width);
+  BSP_LCD_DrawHLine(Xpos, (Ypos+ Height), Width);
+  
+  /* Draw vertical lines */
+  BSP_LCD_DrawVLine(Xpos, Ypos, Height);
+  BSP_LCD_DrawVLine((Xpos + Width), Ypos, Height);
+}
+                            
+/**
+  * @brief  Draws a circle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Radius: Circle radius
+  * @retval None
+  */
+void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
+{
+  int32_t  decision;       /* Decision Variable */ 
+  uint32_t  current_x;   /* Current X Value */
+  uint32_t  current_y;   /* Current Y Value */ 
+  
+  decision = 3 - (Radius << 1);
+  current_x = 0;
+  current_y = Radius;
+  
+  while (current_x <= current_y)
+  {
+    BSP_LCD_DrawPixel((Xpos + current_x), (Ypos - current_y), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - current_x), (Ypos - current_y), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + current_y), (Ypos - current_x), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - current_y), (Ypos - current_x), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + current_x), (Ypos + current_y), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - current_x), (Ypos + current_y), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos + current_y), (Ypos + current_x), DrawProp.TextColor);
+
+    BSP_LCD_DrawPixel((Xpos - current_y), (Ypos + current_x), DrawProp.TextColor);   
+
+    /* Initialize the font */
+    BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
+
+    if (decision < 0)
+    { 
+      decision += (current_x << 2) + 6;
+    }
+    else
+    {
+      decision += ((current_x - current_y) << 2) + 10;
+      current_y--;
+    }
+    current_x++;
+  } 
+}
+
+/**
+  * @brief  Draws an poly-line (between many points).
+  * @param  Points: Pointer to the points array
+  * @param  PointCount: Number of points
+  * @retval None
+  */
+void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount)
+{
+  int16_t x = 0, y = 0;
+
+  if(PointCount < 2)
+  {
+    return;
+  }
+
+  BSP_LCD_DrawLine(Points->X, Points->Y, (Points+PointCount-1)->X, (Points+PointCount-1)->Y);
+  
+  while(--PointCount)
+  {
+    x = Points->X;
+    y = Points->Y;
+    Points++;
+    BSP_LCD_DrawLine(x, y, Points->X, Points->Y);
+  }
+}
+
+/**
+  * @brief  Draws an ellipse on LCD.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  XRadius: Ellipse X radius
+  * @param  YRadius: Ellipse Y radius
+  * @retval None
+  */
+void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
+{
+  int x = 0, y = -YRadius, err = 2-2*XRadius, e2;
+  float k = 0, rad1 = 0, rad2 = 0;
+  
+  rad1 = XRadius;
+  rad2 = YRadius;
+  
+  k = (float)(rad2/rad1);
+  
+  do {      
+    BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/k)), (Ypos+y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/k)), (Ypos+y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos+(uint16_t)(x/k)), (Ypos-y), DrawProp.TextColor);
+    BSP_LCD_DrawPixel((Xpos-(uint16_t)(x/k)), (Ypos-y), DrawProp.TextColor);      
+    
+    e2 = err;
+    if (e2 <= x) {
+      err += ++x*2+1;
+      if (-y == x && e2 <= y) e2 = 0;
+    }
+    if (e2 > y) err += ++y*2+1;     
+  }
+  while (y <= 0);
+}
+
+/**
+  * @brief  Draws a bitmap picture (16 bpp).
+  * @param  Xpos: Bmp X position in the LCD
+  * @param  Ypos: Bmp Y position in the LCD
+  * @param  pbmp: Pointer to Bmp picture address.
+  * @retval None
+  */
+void BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
+{
+  uint32_t height = 0;
+  uint32_t width  = 0;
+  
+  
+  /* Read bitmap width */
+  width = *(uint16_t *) (pbmp + 18);
+  width |= (*(uint16_t *) (pbmp + 20)) << 16;
+  
+  /* Read bitmap height */
+  height = *(uint16_t *) (pbmp + 22);
+  height |= (*(uint16_t *) (pbmp + 24)) << 16; 
+  
+  SetDisplayWindow(Xpos, Ypos, width, height);
+  
+  if(LcdDrv->DrawBitmap != NULL)
+  {
+    LcdDrv->DrawBitmap(Xpos, Ypos, pbmp);
+  } 
+  SetDisplayWindow(0, 0, BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
+}
+
+/**
+  * @brief  Draws RGB Image (16 bpp).
+  * @param  Xpos:  X position in the LCD
+  * @param  Ypos:  Y position in the LCD
+  * @param  Xsize: X size in the LCD
+  * @param  Ysize: Y size in the LCD
+  * @param  pdata: Pointer to the RGB Image address.
+  * @retval None
+  */
+void BSP_LCD_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
+{
+  
+  SetDisplayWindow(Xpos, Ypos, Xsize, Ysize);
+  
+  if(LcdDrv->DrawRGBImage != NULL)
+  {
+    LcdDrv->DrawRGBImage(Xpos, Ypos, Xsize, Ysize, pdata);
+  } 
+  SetDisplayWindow(0, 0, BSP_LCD_GetXSize(), BSP_LCD_GetYSize());
+}
+
+/**
+  * @brief  Draws a full rectangle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Width: Rectangle width  
+  * @param  Height: Rectangle height
+  * @retval None
+  */
+void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+  do
+  {
+    BSP_LCD_DrawHLine(Xpos, Ypos++, Width);    
+  }
+  while(Height--);
+}
+
+/**
+  * @brief  Draws a full circle.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  Radius: Circle radius
+  * @retval None
+  */
+void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
+{
+  int32_t  decision;        /* Decision Variable */ 
+  uint32_t  current_x;    /* Current X Value */
+  uint32_t  current_y;    /* Current Y Value */ 
+  
+  decision = 3 - (Radius << 1);
+
+  current_x = 0;
+  current_y = Radius;
+  
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+
+  while (current_x <= current_y)
+  {
+    if(current_y > 0) 
+    {
+      BSP_LCD_DrawHLine(Xpos - current_y, Ypos + current_x, 2*current_y);
+      BSP_LCD_DrawHLine(Xpos - current_y, Ypos - current_x, 2*current_y);
+    }
+
+    if(current_x > 0) 
+    {
+      BSP_LCD_DrawHLine(Xpos - current_x, Ypos - current_y, 2*current_x);
+      BSP_LCD_DrawHLine(Xpos - current_x, Ypos + current_y, 2*current_x);
+    }
+    if (decision < 0)
+    { 
+      decision += (current_x << 2) + 6;
+    }
+    else
+    {
+      decision += ((current_x - current_y) << 2) + 10;
+      current_y--;
+    }
+    current_x++;
+  }
+
+  BSP_LCD_SetTextColor(DrawProp.TextColor);
+  BSP_LCD_DrawCircle(Xpos, Ypos, Radius);
+}
+
+/**
+  * @brief  Draws a full poly-line (between many points).
+  * @param  Points: Pointer to the points array
+  * @param  PointCount: Number of points
+  * @retval None
+  */
+void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount)
+{
+  int16_t X = 0, Y = 0, X2 = 0, Y2 = 0, X_center = 0, Y_center = 0, X_first = 0, Y_first = 0, pixelX = 0, pixelY = 0, counter = 0;
+  uint16_t  IMAGE_LEFT = 0, IMAGE_RIGHT = 0, IMAGE_TOP = 0, IMAGE_BOTTOM = 0;  
+  
+  IMAGE_LEFT = IMAGE_RIGHT = Points->X;
+  IMAGE_TOP= IMAGE_BOTTOM = Points->Y;
+  
+  for(counter = 1; counter < PointCount; counter++)
+  {
+    pixelX = POLY_X(counter);
+    if(pixelX < IMAGE_LEFT)
+    {
+      IMAGE_LEFT = pixelX;
+    }
+    if(pixelX > IMAGE_RIGHT)
+    {
+      IMAGE_RIGHT = pixelX;
+    }
+    
+    pixelY = POLY_Y(counter);
+    if(pixelY < IMAGE_TOP)
+    { 
+      IMAGE_TOP = pixelY;
+    }
+    if(pixelY > IMAGE_BOTTOM)
+    {
+      IMAGE_BOTTOM = pixelY;
+    }
+  }  
+  
+  if(PointCount < 2)
+  {
+    return;
+  }
+  
+  X_center = (IMAGE_LEFT + IMAGE_RIGHT)/2;
+  Y_center = (IMAGE_BOTTOM + IMAGE_TOP)/2;
+  
+  X_first = Points->X;
+  Y_first = Points->Y;
+  
+  while(--PointCount)
+  {
+    X = Points->X;
+    Y = Points->Y;
+    Points++;
+    X2 = Points->X;
+    Y2 = Points->Y;    
+    
+    FillTriangle(X, X2, X_center, Y, Y2, Y_center);
+    FillTriangle(X, X_center, X2, Y, Y_center, Y2);
+    FillTriangle(X_center, X2, X, Y_center, Y2, Y);   
+  }
+  
+  FillTriangle(X_first, X2, X_center, Y_first, Y2, Y_center);
+  FillTriangle(X_first, X_center, X2, Y_first, Y_center, Y2);
+  FillTriangle(X_center, X2, X_first, Y_center, Y2, Y_first);   
+}
+
+/**
+  * @brief  Draws a full ellipse.
+  * @param  Xpos: X position
+  * @param  Ypos: Y position
+  * @param  XRadius: Ellipse X radius
+  * @param  YRadius: Ellipse Y radius  
+  * @retval None
+  */
+void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
+{
+  int x = 0, y = -YRadius, err = 2-2*XRadius, e2;
+  float k = 0, rad1 = 0, rad2 = 0;
+  
+  rad1 = XRadius;
+  rad2 = YRadius;
+  
+  k = (float)(rad2/rad1);    
+  
+  do 
+  { 
+    BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/k)), (Ypos+y), (2*(uint16_t)(x/k) + 1));
+    BSP_LCD_DrawHLine((Xpos-(uint16_t)(x/k)), (Ypos-y), (2*(uint16_t)(x/k) + 1));
+    
+    e2 = err;
+    if (e2 <= x) 
+    {
+      err += ++x*2+1;
+      if (-y == x && e2 <= y) e2 = 0;
+    }
+    if (e2 > y) err += ++y*2+1;
+  }
+  while (y <= 0);
+}
+
+/**
+  * @brief  Enables the display.
+  * @param  None
+  * @retval None
+  */
+void BSP_LCD_DisplayOn(void)
+{
+  LcdDrv->DisplayOn();
+}
+
+/**
+  * @brief  Disables the display.
+  * @param  None
+  * @retval None
+  */
+void BSP_LCD_DisplayOff(void)
+{
+  LcdDrv->DisplayOff();
+}
+
+/******************************************************************************
+                            Static Functions
+*******************************************************************************/
+
+/**
+  * @brief  Draws a character on LCD.
+  * @param  Xpos: Line where to display the character shape
+  * @param  Ypos: Start column address
+  * @param  c: Pointer to the character data
+  * @retval None
+  */
+static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c)
+{
+  uint32_t i = 0, j = 0;
+  uint16_t height, width;
+  uint8_t offset;
+  uint8_t *pchar;
+  uint32_t line;
+  
+  height = DrawProp.pFont->Height;
+  width  = DrawProp.pFont->Width;
+  
+  offset =  8 *((width + 7)/8) -  width ;
+  
+  for(i = 0; i < height; i++)
+  {
+    pchar = ((uint8_t *)c + (width + 7)/8 * i);
+    
+    switch(((width + 7)/8))
+    {
+    case 1:
+      line =  pchar[0];
+      break;    
+
+    case 2:
+      line =  (pchar[0]<< 8) | pchar[1];
+      break;
+      
+    case 3:
+    default:
+      line =  (pchar[0]<< 16) | (pchar[1]<< 8) | pchar[2];
+      break;
+    }  
+    
+    for (j = 0; j < width; j++)
+    {
+      if(line & (1 << (width- j + offset- 1))) 
+      {
+        BSP_LCD_DrawPixel((Xpos + j), Ypos, DrawProp.TextColor);
+      }
+      else
+      {
+        BSP_LCD_DrawPixel((Xpos + j), Ypos, DrawProp.BackColor);
+      } 
+    }
+    Ypos++;
+  }
+}
+
+/**
+  * @brief  Sets display window.
+  * @param  LayerIndex: layer index
+  * @param  Xpos: LCD X position
+  * @param  Ypos: LCD Y position
+  * @param  Width: LCD window width
+  * @param  Height: LCD window height  
+  * @retval None
+  */
+static void SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
+{
+  if(LcdDrv->SetDisplayWindow != NULL)
+  {
+    LcdDrv->SetDisplayWindow(Xpos, Ypos, Width, Height);
+  }  
+}
+
+/**
+  * @brief  Fills a triangle (between 3 points).
+  * @param  Points: Pointer to the points array
+  * @param  x1: Point 1 X position
+  * @param  y1: Point 1 Y position
+  * @param  x2: Point 2 X position
+  * @param  y2: Point 2 Y position
+  * @param  x3: Point 3 X position
+  * @param  y3: Point 3 Y position
+  * @retval None
+  */
+static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3)
+{ 
+  int16_t deltax = 0, deltay = 0, x = 0, y = 0, xinc1 = 0, xinc2 = 0, 
+  yinc1 = 0, yinc2 = 0, den = 0, num = 0, numadd = 0, numpixels = 0, 
+  curpixel = 0;
+  
+  deltax = ABS(x2 - x1);        /* The difference between the x's */
+  deltay = ABS(y2 - y1);        /* The difference between the y's */
+  x = x1;                       /* Start x off at the first pixel */
+  y = y1;                       /* Start y off at the first pixel */
+  
+  if (x2 >= x1)                 /* The x-values are increasing */
+  {
+    xinc1 = 1;
+    xinc2 = 1;
+  }
+  else                          /* The x-values are decreasing */
+  {
+    xinc1 = -1;
+    xinc2 = -1;
+  }
+  
+  if (y2 >= y1)                 /* The y-values are increasing */
+  {
+    yinc1 = 1;
+    yinc2 = 1;
+  }
+  else                          /* The y-values are decreasing */
+  {
+    yinc1 = -1;
+    yinc2 = -1;
+  }
+  
+  if (deltax >= deltay)         /* There is at least one x-value for every y-value */
+  {
+    xinc1 = 0;                  /* Don't change the x when numerator >= denominator */
+    yinc2 = 0;                  /* Don't change the y for every iteration */
+    den = deltax;
+    num = deltax / 2;
+    numadd = deltay;
+    numpixels = deltax;         /* There are more x-values than y-values */
+  }
+  else                          /* There is at least one y-value for every x-value */
+  {
+    xinc2 = 0;                  /* Don't change the x for every iteration */
+    yinc1 = 0;                  /* Don't change the y when numerator >= denominator */
+    den = deltay;
+    num = deltay / 2;
+    numadd = deltax;
+    numpixels = deltay;         /* There are more y-values than x-values */
+  }
+  
+  for (curpixel = 0; curpixel <= numpixels; curpixel++)
+  {
+    BSP_LCD_DrawLine(x, y, x3, y3);
+    
+    num += numadd;              /* Increase the numerator by the top of the fraction */
+    if (num >= den)             /* Check if numerator >= denominator */
+    {
+      num -= den;               /* Calculate the new numerator value */
+      x += xinc1;               /* Change the x as appropriate */
+      y += yinc1;               /* Change the y as appropriate */
+    }
+    x += xinc2;                 /* Change the x as appropriate */
+    y += yinc2;                 /* Change the y as appropriate */
+  } 
+}
+
+/**
+  * @}
+  */  
+  
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */     
+
+/**
+  * @}
+  */  
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 202 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_lcd.h

@@ -0,0 +1,202 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_lcd.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_lcd.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32446E_EVAL_LCD_H
+#define __STM32446E_EVAL_LCD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval.h" 
+#include "../Components/ili9325/ili9325.h"
+#include "../../../Utilities/Fonts/fonts.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_LCD STM32446E-EVAL LCD
+  * @{
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Exported_Types STM32446E EVAL LCD Exported Types
+  * @{
+  */
+typedef struct 
+{ 
+  uint32_t TextColor;
+  uint32_t BackColor;
+  sFONT    *pFont; 
+}LCD_DrawPropTypeDef;
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_LCD_Exported_Constants STM32446E EVAL LCD Exported Constants
+  * @{
+  */
+/** 
+  * @brief  LCD status structure definition  
+  */     
+#define LCD_OK         ((uint8_t)0x00)
+#define LCD_ERROR      ((uint8_t)0x01)
+#define LCD_TIMEOUT    ((uint8_t)0x02)
+    
+typedef struct 
+{
+  int16_t X;
+  int16_t Y;
+}Point, * pPoint; 
+
+/** 
+  * @brief  Line mode structures definition
+  */ 
+typedef enum
+{
+  CENTER_MODE          = 0x01,    /* Center mode */
+  RIGHT_MODE           = 0x02,    /* Right mode  */
+  LEFT_MODE            = 0x03     /* Left mode   */
+}Line_ModeTypdef;
+
+/** 
+  * @brief  LCD color  
+  */ 
+#define LCD_COLOR_BLUE          ((uint16_t)0x001F)
+#define LCD_COLOR_GREEN         ((uint16_t)0x07E0)
+#define LCD_COLOR_RED           ((uint16_t)0xF800)
+#define LCD_COLOR_CYAN          ((uint16_t)0x07FF)
+#define LCD_COLOR_MAGENTA       ((uint16_t)0xF81F)
+#define LCD_COLOR_YELLOW        ((uint16_t)0xFFE0)
+#define LCD_COLOR_LIGHTBLUE     ((uint16_t)0x841F)
+#define LCD_COLOR_LIGHTGREEN    ((uint16_t)0x87F0)
+#define LCD_COLOR_LIGHTRED      ((uint16_t)0xFC10)
+#define LCD_COLOR_LIGHTMAGENTA  ((uint16_t)0xFC1F)
+#define LCD_COLOR_LIGHTYELLOW   ((uint16_t)0xFFF0)
+#define LCD_COLOR_DARKBLUE      ((uint16_t)0x0010)
+#define LCD_COLOR_DARKGREEN     ((uint16_t)0x0400)
+#define LCD_COLOR_DARKRED       ((uint16_t)0x8000)
+#define LCD_COLOR_DARKCYAN      ((uint16_t)0x0410)
+#define LCD_COLOR_DARKMAGENTA   ((uint16_t)0x8010)
+#define LCD_COLOR_DARKYELLOW    ((uint16_t)0x8400)
+#define LCD_COLOR_WHITE         ((uint16_t)0xFFFF)
+#define LCD_COLOR_LIGHTGRAY     ((uint16_t)0xD69A)
+#define LCD_COLOR_GRAY          ((uint16_t)0x8410)
+#define LCD_COLOR_DARKGRAY      ((uint16_t)0x4208)
+#define LCD_COLOR_BLACK         ((uint16_t)0x0000)
+#define LCD_COLOR_BROWN         ((uint16_t)0xA145)
+#define LCD_COLOR_ORANGE        ((uint16_t)0xFD20)
+
+/** 
+  * @brief LCD default font 
+  */ 
+#define LCD_DEFAULT_FONT         Font24
+
+/**
+  * @}
+  */
+
+/** @defgroup STM32446E_EVAL_LCD_Exported_Functions STM32446E EVAL LCD Exported Functions
+  * @{
+  */   
+uint8_t  BSP_LCD_Init(void);
+uint8_t  BSP_LCD_DeInit(void);
+uint32_t BSP_LCD_GetXSize(void);
+uint32_t BSP_LCD_GetYSize(void);
+ 
+uint16_t BSP_LCD_GetTextColor(void);
+uint16_t BSP_LCD_GetBackColor(void);
+void     BSP_LCD_SetTextColor(__IO uint16_t Color);
+void     BSP_LCD_SetBackColor(__IO uint16_t Color);
+void     BSP_LCD_SetFont(sFONT *fonts);
+sFONT    *BSP_LCD_GetFont(void);
+
+void     BSP_LCD_Clear(uint16_t Color);
+void     BSP_LCD_ClearStringLine(uint16_t Line);
+void     BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *ptr);
+void     BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Line_ModeTypdef Mode);
+void     BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
+
+uint16_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
+void     BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
+void     BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
+void     BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
+void     BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
+void     BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+void     BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
+void     BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
+void     BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
+void     BSP_LCD_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
+void     BSP_LCD_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pbmp);
+void     BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
+void     BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
+void     BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
+void     BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
+
+void     BSP_LCD_DisplayOff(void);
+void     BSP_LCD_DisplayOn(void);
+ 
+/**
+  * @}
+  */
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_LCD_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 831 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_qspi.c

@@ -0,0 +1,831 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_qspi.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file includes a standard driver for the N25Q256A QSPI 
+  *          memory mounted on STM32446E-EVAL board.
+  @verbatim
+  ==============================================================================
+                     ##### How to use this driver #####
+  ==============================================================================  
+  [..] 
+   (#) This driver is used to drive the N25Q256A QSPI external 
+       memory mounted on STM32446E-EVAL evaluation board.
+       
+   (#) This driver need a specific component driver (N25Q256A) to be included with.
+
+   (#) Initialization steps:
+       (++) Initialize the QPSI external memory using the BSP_QSPI_Init() function. This 
+            function includes the MSP layer hardware resources initialization and the
+            QSPI interface with the external memory.
+  
+   (#) QSPI memory operations
+       (++) QSPI memory can be accessed with read/write operations once it is
+            initialized.
+            Read/write operation can be performed with AHB access using the functions
+            BSP_QSPI_Read()/BSP_QSPI_Write(). 
+       (++) The function BSP_QSPI_GetInfo() returns the configuration of the QSPI memory. 
+            (see the QSPI memory data sheet)
+       (++) Perform erase block operation using the function BSP_QSPI_Erase_Block() and by
+            specifying the block address. You can perform an erase operation of the whole 
+            chip by calling the function BSP_QSPI_Erase_Chip(). 
+       (++) The function BSP_QSPI_GetStatus() returns the current status of the QSPI memory. 
+            (see the QSPI memory data sheet)
+  @endverbatim
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 "stm32446e_eval_qspi.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_QSPI STM32446E-EVAL QSPI
+  * @{
+  */ 
+
+
+/* Private variables ---------------------------------------------------------*/
+
+/** @defgroup STM32446E_EVAL_QSPI_Private_Variables Private Variables
+  * @{
+  */       
+QSPI_HandleTypeDef QSPIHandle;
+
+/**
+  * @}
+  */ 
+
+
+
+/* Private functions ---------------------------------------------------------*/
+    
+/** @defgroup STM32446E_EVAL_QSPI_Private_Functions Private Functions
+  * @{
+  */ 
+static uint8_t QSPI_ResetMemory          (QSPI_HandleTypeDef *hqspi);
+static uint8_t QSPI_EnterFourBytesAddress(QSPI_HandleTypeDef *hqspi);
+static uint8_t QSPI_DummyCyclesCfg       (QSPI_HandleTypeDef *hqspi);
+static uint8_t QSPI_WriteEnable          (QSPI_HandleTypeDef *hqspi);
+static uint8_t QSPI_AutoPollingMemReady(QSPI_HandleTypeDef *hqspi, uint32_t Timeout);
+
+/**
+  * @}
+  */
+    
+/** @defgroup STM32446E_EVAL_QSPI_Exported_Functions Exported Functions
+  * @{
+  */ 
+
+/**
+  * @brief  Initializes the QSPI interface.
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_Init(void)
+{ 
+  QSPIHandle.Instance = QUADSPI;
+
+  /* Call the DeInit function to reset the driver */
+  if (HAL_QSPI_DeInit(&QSPIHandle) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+        
+  /* System level initialization */
+  BSP_QSPI_MspInit(&QSPIHandle, NULL);
+  
+  /* QSPI initialization */
+  QSPIHandle.Init.ClockPrescaler     = 1; /* QSPI freq = 180 MHz/(1+1) = 90 Mhz */
+  QSPIHandle.Init.FifoThreshold      = 4;
+  QSPIHandle.Init.SampleShifting     = QSPI_SAMPLE_SHIFTING_HALFCYCLE;
+  QSPIHandle.Init.FlashSize          = POSITION_VAL(N25Q256A_FLASH_SIZE) - 1;
+  QSPIHandle.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_2_CYCLE;
+  QSPIHandle.Init.ClockMode          = QSPI_CLOCK_MODE_0;
+  QSPIHandle.Init.FlashID            = QSPI_FLASH_ID_1;
+  QSPIHandle.Init.DualFlash          = QSPI_DUALFLASH_DISABLE;
+
+  if (HAL_QSPI_Init(&QSPIHandle) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* QSPI memory reset */
+  if (QSPI_ResetMemory(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_NOT_SUPPORTED;
+  }
+ 
+  /* Set the QSPI memory in 4-bytes address mode */
+  if (QSPI_EnterFourBytesAddress(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_NOT_SUPPORTED;
+  }
+ 
+  /* Configuration of the dummy cycles on QSPI memory side */
+  if (QSPI_DummyCyclesCfg(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_NOT_SUPPORTED;
+  }
+  
+  return QSPI_OK;
+}
+
+/**
+  * @brief  De-Initializes the QSPI interface.
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_DeInit(void)
+{ 
+  QSPIHandle.Instance = QUADSPI;
+
+  /* Call the DeInit function to reset the driver */
+  if (HAL_QSPI_DeInit(&QSPIHandle) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+        
+  /* System level De-initialization */
+  BSP_QSPI_MspDeInit(&QSPIHandle, NULL);
+  
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Reads an amount of data from the QSPI memory.
+  * @param  pData: Pointer to data to be read
+  * @param  ReadAddr: Read start address
+  * @param  Size: Size of data to read    
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_Read(uint8_t* pData, uint32_t ReadAddr, uint32_t Size)
+{
+  QSPI_CommandTypeDef s_command;
+
+  /* Initialize the read command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = QUAD_INOUT_FAST_READ_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_4_LINES;
+  s_command.AddressSize       = QSPI_ADDRESS_32_BITS;
+  s_command.Address           = ReadAddr;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_4_LINES;
+  s_command.DummyCycles       = N25Q256A_DUMMY_CYCLES_READ_QUAD;
+  s_command.NbData            = Size;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+  
+  /* Configure the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  /* Reception of the data */
+  if (HAL_QSPI_Receive(&QSPIHandle, pData, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Writes an amount of data to the QSPI memory.
+  * @param  pData: Pointer to data to be written
+  * @param  WriteAddr: Write start address
+  * @param  Size: Size of data to write    
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_Write(uint8_t* pData, uint32_t WriteAddr, uint32_t Size)
+{
+  QSPI_CommandTypeDef s_command;
+  uint32_t end_addr, current_size, current_addr;
+
+  /* Calculation of the size between the write address and the end of the page */
+  current_addr = 0;
+
+  while (current_addr <= WriteAddr)
+  {
+    current_addr += N25Q256A_PAGE_SIZE;
+  }
+  current_size = current_addr - WriteAddr;
+
+  /* Check if the size of the data is less than the remaining place in the page */
+  if (current_size > Size)
+  {
+    current_size = Size;
+  }
+
+  /* Initialize the adress variables */
+  current_addr = WriteAddr;
+  end_addr = WriteAddr + Size;
+
+  /* Initialize the program command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = EXT_QUAD_IN_FAST_PROG_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_4_LINES;
+  s_command.AddressSize       = QSPI_ADDRESS_32_BITS;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_4_LINES;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+  
+  /* Perform the write page by page */
+  do
+  {
+    s_command.Address = current_addr;
+    s_command.NbData  = current_size;
+
+    /* Enable write operations */
+    if (QSPI_WriteEnable(&QSPIHandle) != QSPI_OK)
+    {
+      return QSPI_ERROR;
+    }
+    
+    /* Configure the command */
+    if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+    {
+      return QSPI_ERROR;
+    }
+    
+    /* Transmission of the data */
+    if (HAL_QSPI_Transmit(&QSPIHandle, pData, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+    {
+      return QSPI_ERROR;
+    }
+    
+    /* Configure automatic polling mode to wait for end of program */  
+    if (QSPI_AutoPollingMemReady(&QSPIHandle, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != QSPI_OK)
+    {
+      return QSPI_ERROR;
+    }
+    
+    /* Update the address and size variables for next page programming */
+    current_addr += current_size;
+    pData += current_size;
+    current_size = ((current_addr + N25Q256A_PAGE_SIZE) > end_addr) ? (end_addr - current_addr) : N25Q256A_PAGE_SIZE;
+  } while (current_addr < end_addr);
+  
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Erases the specified block of the QSPI memory. 
+  * @param  BlockAddress: Block address to erase  
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress)
+{
+  QSPI_CommandTypeDef s_command;
+
+  /* Initialize the erase command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = SUBSECTOR_ERASE_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_1_LINE;
+  s_command.AddressSize       = QSPI_ADDRESS_32_BITS;
+  s_command.Address           = BlockAddress;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_NONE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Enable write operations */
+  if (QSPI_WriteEnable(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Send the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  /* Configure automatic polling mode to wait for end of erase */  
+  if (QSPI_AutoPollingMemReady(&QSPIHandle, N25Q256A_SUBSECTOR_ERASE_MAX_TIME) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Erases the entire QSPI memory.
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_Erase_Chip(void)
+{
+  QSPI_CommandTypeDef s_command;
+
+  /* Initialize the erase command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = BULK_ERASE_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_NONE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Enable write operations */
+  if (QSPI_WriteEnable(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Send the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  /* Configure automatic polling mode to wait for end of erase */  
+  if (QSPI_AutoPollingMemReady(&QSPIHandle, N25Q256A_BULK_ERASE_MAX_TIME) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Reads current status of the QSPI memory.
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_GetStatus(void)
+{
+  QSPI_CommandTypeDef s_command;
+  uint8_t reg;
+
+  /* Initialize the read flag status register command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = READ_FLAG_STATUS_REG_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_1_LINE;
+  s_command.DummyCycles       = 0;
+  s_command.NbData            = 1;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Configure the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Reception of the data */
+  if (HAL_QSPI_Receive(&QSPIHandle, &reg, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  /* Check the value of the register */
+  if ((reg & (N25Q256A_FSR_PRERR | N25Q256A_FSR_VPPERR | N25Q256A_FSR_PGERR | N25Q256A_FSR_ERERR)) != 0)
+  {
+    return QSPI_ERROR;
+  }
+  else if ((reg & (N25Q256A_FSR_PGSUS | N25Q256A_FSR_ERSUS)) != 0)
+  {
+    return QSPI_SUSPENDED;
+  }
+  else if ((reg & N25Q256A_FSR_READY) != 0)
+  {
+    return QSPI_OK;
+  }
+  else
+  {
+    return QSPI_BUSY;
+  }
+}
+
+/**
+  * @brief  Return the configuration of the QSPI memory.
+  * @param  pInfo: pointer on the configuration structure  
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_GetInfo(QSPI_Info* pInfo)
+{
+  /* Configure the structure with the memory configuration */
+  pInfo->FlashSize          = N25Q256A_FLASH_SIZE;
+  pInfo->EraseSectorSize    = N25Q256A_SUBSECTOR_SIZE;
+  pInfo->EraseSectorsNumber = (N25Q256A_FLASH_SIZE/N25Q256A_SUBSECTOR_SIZE);
+  pInfo->ProgPageSize       = N25Q256A_PAGE_SIZE;
+  pInfo->ProgPagesNumber    = (N25Q256A_FLASH_SIZE/N25Q256A_PAGE_SIZE);
+  
+  return QSPI_OK;
+}
+
+/**
+  * @brief  Configure the QSPI in memory-mapped mode
+  * @param  None  
+  * @retval QSPI memory status
+  */
+uint8_t BSP_QSPI_MemoryMappedMode(void)
+{
+  QSPI_CommandTypeDef      s_command;
+  QSPI_MemoryMappedTypeDef s_mem_mapped_cfg;
+
+  /* Configure the command for the read instruction */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = QUAD_INOUT_FAST_READ_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_4_LINES;
+  s_command.AddressSize       = QSPI_ADDRESS_32_BITS;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_4_LINES;
+  s_command.DummyCycles       = N25Q256A_DUMMY_CYCLES_READ_QUAD;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+  
+  /* Configure the memory mapped mode */
+  s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_ENABLE;
+  s_mem_mapped_cfg.TimeOutPeriod     = 1;
+  
+  if (HAL_QSPI_MemoryMapped(&QSPIHandle, &s_command, &s_mem_mapped_cfg) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @}
+  */
+
+/** @addtogroup STM32446E_EVAL_QSPI_Private_Functions 
+  * @{
+  */ 
+
+/**
+  * @brief QSPI MSP Initialization
+  *        This function configures the hardware resources used in this example:
+  *           - Peripheral's clock enable
+  *           - Peripheral's GPIO Configuration
+  *           - NVIC configuration for QSPI interrupt
+  * @retval None
+  */
+__weak void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params)
+{
+  GPIO_InitTypeDef gpio_init_structure;
+
+  /*##-1- Enable peripherals and GPIO Clocks #################################*/
+  /* Enable the QuadSPI memory interface clock */
+  QSPI_CLK_ENABLE();
+  /* Reset the QuadSPI memory interface */
+  QSPI_FORCE_RESET();
+  QSPI_RELEASE_RESET();
+  /* Enable GPIO clocks */
+  QSPI_CS_GPIO_CLK_ENABLE();
+  QSPI_CLK_GPIO_CLK_ENABLE();
+  QSPI_Dx_GPIO_CLK_ENABLE();
+
+  /*##-2- Configure peripheral GPIO ##########################################*/
+  /* QSPI CS GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_CS_PIN;
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF10_QSPI;
+  HAL_GPIO_Init(QSPI_CS_GPIO_PORT, &gpio_init_structure);
+
+  /* QSPI CLK GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_CLK_PIN;
+  gpio_init_structure.Pull      = GPIO_NOPULL;
+  gpio_init_structure.Alternate = GPIO_AF9_QSPI;
+  HAL_GPIO_Init(QSPI_CLK_GPIO_PORT, &gpio_init_structure);
+
+  /* QSPI D0 GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_D0_PIN;
+  gpio_init_structure.Alternate = GPIO_AF10_QSPI;
+  HAL_GPIO_Init(QSPI_D0_GPIO_PORT, &gpio_init_structure);
+
+  /* QSPI D1 GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_D1_PIN;
+  gpio_init_structure.Alternate = GPIO_AF10_QSPI;
+  HAL_GPIO_Init(QSPI_D1_GPIO_PORT, &gpio_init_structure);
+
+  /* QSPI D2 GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_D2_PIN;
+  gpio_init_structure.Alternate = GPIO_AF9_QSPI;
+  HAL_GPIO_Init(QSPI_D2_GPIO_PORT, &gpio_init_structure);
+
+  /* QSPI D3 GPIO pin configuration  */
+  gpio_init_structure.Pin       = QSPI_D3_PIN;
+  gpio_init_structure.Alternate = GPIO_AF9_QSPI;
+  HAL_GPIO_Init(QSPI_D3_GPIO_PORT, &gpio_init_structure);
+}
+
+
+/**
+  * @brief QSPI MSP De-Initialization
+  *        This function frees the hardware resources used in this example:
+  *          - Disable the Peripheral's clock
+  *          - Revert GPIO and NVIC configuration to their default state
+  * @retval None
+  */
+__weak void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params)
+{
+    /*##-1- Disable the NVIC for QSPI ###########################################*/
+    HAL_NVIC_DisableIRQ(QUADSPI_IRQn);
+
+    /*##-2- Disable peripherals and GPIO Clocks ################################*/
+    /* De-Configure QSPI specific pins (not common to any other blocks) */
+    HAL_GPIO_DeInit(QSPI_D0_GPIO_PORT, QSPI_D0_PIN);
+    HAL_GPIO_DeInit(QSPI_D1_GPIO_PORT, QSPI_D1_PIN);
+    HAL_GPIO_DeInit(QSPI_D2_GPIO_PORT, QSPI_D2_PIN);
+    HAL_GPIO_DeInit(QSPI_D3_GPIO_PORT, QSPI_D3_PIN);
+
+    /*##-3- Reset peripherals ##################################################*/
+    /* Reset the QuadSPI memory interface */
+    QSPI_FORCE_RESET();
+    QSPI_RELEASE_RESET();
+
+    /* Disable the QuadSPI memory interface clock */
+    QSPI_CLK_DISABLE();
+}
+
+/**
+  * @brief  This function reset the QSPI memory.
+  * @param  hqspi: QSPI handle
+  * @retval None
+  */
+static uint8_t QSPI_ResetMemory(QSPI_HandleTypeDef *hqspi)
+{
+  QSPI_CommandTypeDef s_command;
+
+  /* Initialize the reset enable command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = RESET_ENABLE_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_NONE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Send the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Send the reset memory command */
+  s_command.Instruction = RESET_MEMORY_CMD;
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Configure automatic polling mode to wait the memory is ready */  
+  if (QSPI_AutoPollingMemReady(&QSPIHandle, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  This function set the QSPI memory in 4-byte address mode
+  * @param  hqspi: QSPI handle
+  * @retval None
+  */
+static uint8_t QSPI_EnterFourBytesAddress(QSPI_HandleTypeDef *hqspi)
+{
+  QSPI_CommandTypeDef s_command;
+
+  /* Initialize the command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = ENTER_4_BYTE_ADDR_MODE_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_NONE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Enable write operations */
+  if (QSPI_WriteEnable(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Send the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Configure automatic polling mode to wait the memory is ready */  
+  if (QSPI_AutoPollingMemReady(&QSPIHandle, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  This function configure the dummy cycles on memory side.
+  * @param  hqspi: QSPI handle
+  * @retval None
+  */
+static uint8_t QSPI_DummyCyclesCfg(QSPI_HandleTypeDef *hqspi)
+{
+  QSPI_CommandTypeDef s_command;
+  uint8_t reg;
+
+  /* Initialize the read volatile configuration register command */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = READ_VOL_CFG_REG_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_1_LINE;
+  s_command.DummyCycles       = 0;
+  s_command.NbData            = 1;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  /* Configure the command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Reception of the data */
+  if (HAL_QSPI_Receive(&QSPIHandle, &reg, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Enable write operations */
+  if (QSPI_WriteEnable(&QSPIHandle) != QSPI_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Update volatile configuration register (with new dummy cycles) */  
+  s_command.Instruction = WRITE_VOL_CFG_REG_CMD;
+  MODIFY_REG(reg, N25Q256A_VCR_NB_DUMMY, (N25Q256A_DUMMY_CYCLES_READ_QUAD << POSITION_VAL(N25Q256A_VCR_NB_DUMMY)));
+      
+  /* Configure the write volatile configuration register command */
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  /* Transmission of the data */
+  if (HAL_QSPI_Transmit(&QSPIHandle, &reg, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  return QSPI_OK;
+}
+
+/**
+  * @brief  This function send a Write Enable and wait it is effective.
+  * @param  hqspi: QSPI handle
+  * @retval None
+  */
+static uint8_t QSPI_WriteEnable(QSPI_HandleTypeDef *hqspi)
+{
+  QSPI_CommandTypeDef     s_command;
+  QSPI_AutoPollingTypeDef s_config;
+
+  /* Enable write operations */
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = WRITE_ENABLE_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_NONE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  if (HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+  
+  /* Configure automatic polling mode to wait for write enabling */  
+  s_config.Match           = N25Q256A_SR_WREN;
+  s_config.Mask            = N25Q256A_SR_WREN;
+  s_config.MatchMode       = QSPI_MATCH_MODE_AND;
+  s_config.StatusBytesSize = 1;
+  s_config.Interval        = 0x10;
+  s_config.AutomaticStop   = QSPI_AUTOMATIC_STOP_ENABLE;
+
+  s_command.Instruction    = READ_STATUS_REG_CMD;
+  s_command.DataMode       = QSPI_DATA_1_LINE;
+
+  if (HAL_QSPI_AutoPolling(&QSPIHandle, &s_command, &s_config, HAL_QPSI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+
+/**
+  * @brief  This function read the SR of the memory and wait the EOP.
+  * @param  hqspi: QSPI handle
+  * @retval None
+  */
+static uint8_t QSPI_AutoPollingMemReady(QSPI_HandleTypeDef *hqspi, uint32_t Timeout)
+{
+  QSPI_CommandTypeDef     s_command;
+  QSPI_AutoPollingTypeDef s_config;
+
+  /* Configure automatic polling mode to wait for memory ready */  
+  s_command.InstructionMode   = QSPI_INSTRUCTION_1_LINE;
+  s_command.Instruction       = READ_STATUS_REG_CMD;
+  s_command.AddressMode       = QSPI_ADDRESS_NONE;
+  s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE;
+  s_command.DataMode          = QSPI_DATA_1_LINE;
+  s_command.DummyCycles       = 0;
+  s_command.DdrMode           = QSPI_DDR_MODE_DISABLE;
+  s_command.DdrHoldHalfCycle  = QSPI_DDR_HHC_ANALOG_DELAY;
+  s_command.SIOOMode          = QSPI_SIOO_INST_EVERY_CMD;
+
+  s_config.Match           = 0;
+  s_config.Mask            = N25Q256A_SR_WIP;
+  s_config.MatchMode       = QSPI_MATCH_MODE_AND;
+  s_config.StatusBytesSize = 1;
+  s_config.Interval        = 0x10;
+  s_config.AutomaticStop   = QSPI_AUTOMATIC_STOP_ENABLE;
+
+  if (HAL_QSPI_AutoPolling(&QSPIHandle, &s_command, &s_config, Timeout) != HAL_OK)
+  {
+    return QSPI_ERROR;
+  }
+
+  return QSPI_OK;
+}
+/**
+  * @}
+  */  
+  
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+  
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+

+ 176 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_qspi.h

@@ -0,0 +1,176 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_qspi.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_qspi.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32446E_EVAL_QSPI_H
+#define __STM32446E_EVAL_QSPI_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32f4xx_hal.h"
+#include "../Components/n25q256a/n25q256a.h"
+
+/** @defgroup STM32446E_EVAL_QSPI STM32446E-EVAL QSPI
+  * @{
+  */    
+
+  
+/* Exported constants --------------------------------------------------------*/ 
+/** @defgroup STM32446E_EVAL_QSPI_Exported_Constants Exported Constants
+  * @{
+  */
+/* QSPI Error codes */
+#define QSPI_OK            ((uint8_t)0x00)
+#define QSPI_ERROR         ((uint8_t)0x01)
+#define QSPI_BUSY          ((uint8_t)0x02)
+#define QSPI_NOT_SUPPORTED ((uint8_t)0x04)
+#define QSPI_SUSPENDED     ((uint8_t)0x08)
+
+
+/* Definition for QSPI clock resources */
+#define QSPI_CLK_ENABLE()           __HAL_RCC_QSPI_CLK_ENABLE()
+#define QSPI_CLK_DISABLE()          __HAL_RCC_QSPI_CLK_DISABLE()
+#define QSPI_CS_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOG_CLK_ENABLE()
+#define QSPI_CS_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOG_CLK_DISABLE()
+#if !defined(USE_STM32446E_EVAL_REVA)
+#define QSPI_CLK_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOD_CLK_ENABLE()
+#define QSPI_CLK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
+#else
+#define QSPI_CLK_GPIO_CLK_ENABLE()  __HAL_RCC_GPIOB_CLK_ENABLE()
+#define QSPI_CLK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
+#endif // !USE_STM32446E_EVAL_REVA
+#define QSPI_Dx_GPIO_CLK_ENABLE()   __HAL_RCC_GPIOF_CLK_ENABLE()
+#define QSPI_Dx_GPIO_CLK_DISABLE()  __HAL_RCC_GPIOF_CLK_DISABLE()
+
+#define QSPI_FORCE_RESET()          __HAL_RCC_QSPI_FORCE_RESET()
+#define QSPI_RELEASE_RESET()        __HAL_RCC_QSPI_RELEASE_RESET()
+
+/* Definition for QSPI Pins */
+#define QSPI_CS_PIN                GPIO_PIN_6
+#define QSPI_CS_GPIO_PORT          GPIOG
+#if !defined(USE_STM32446E_EVAL_REVA)
+#define QSPI_CLK_PIN               GPIO_PIN_3
+#define QSPI_CLK_GPIO_PORT         GPIOD
+#else
+#define QSPI_CLK_PIN               GPIO_PIN_2
+#define QSPI_CLK_GPIO_PORT         GPIOB
+#endif // !USE_STM32446E_EVAL_REVA
+#define QSPI_D0_PIN                GPIO_PIN_8
+#define QSPI_D0_GPIO_PORT          GPIOF
+#define QSPI_D1_PIN                GPIO_PIN_9
+#define QSPI_D1_GPIO_PORT          GPIOF
+#define QSPI_D2_PIN                GPIO_PIN_7
+#define QSPI_D2_GPIO_PORT          GPIOF
+#define QSPI_D3_PIN                GPIO_PIN_6
+#define QSPI_D3_GPIO_PORT          GPIOF
+
+
+/**
+  * @}
+  */
+
+/* Exported types ------------------------------------------------------------*/
+/** @defgroup STM32446E_EVAL_QSPI_Exported_Types Exported Types
+  * @{
+  */
+/* QSPI Info */
+typedef struct {
+  uint32_t FlashSize;          /*!< Size of the flash */
+  uint32_t EraseSectorSize;    /*!< Size of sectors for the erase operation */
+  uint32_t EraseSectorsNumber; /*!< Number of sectors for the erase operation */
+  uint32_t ProgPageSize;       /*!< Size of pages for the program operation */
+  uint32_t ProgPagesNumber;    /*!< Number of pages for the program operation */
+} QSPI_Info;
+
+/**
+  * @}
+  */
+
+  
+/* Exported functions --------------------------------------------------------*/
+/** @defgroup STM32446E_EVAL_QSPI_Exported_Functions  Exported Functions
+  * @{
+  */  
+uint8_t BSP_QSPI_Init       (void);
+uint8_t BSP_QSPI_DeInit     (void);
+uint8_t BSP_QSPI_Read       (uint8_t* pData, uint32_t ReadAddr, uint32_t Size);
+uint8_t BSP_QSPI_Write      (uint8_t* pData, uint32_t WriteAddr, uint32_t Size);
+uint8_t BSP_QSPI_Erase_Block(uint32_t BlockAddress);
+uint8_t BSP_QSPI_Erase_Chip (void);
+uint8_t BSP_QSPI_GetStatus  (void);
+uint8_t BSP_QSPI_GetInfo    (QSPI_Info* pInfo);
+uint8_t BSP_QSPI_MemoryMappedMode(void);
+
+/* These function can be modified in case the current settings (e.g. DMA stream)
+   need to be changed for specific application needs */
+void BSP_QSPI_MspInit(QSPI_HandleTypeDef *hqspi, void *Params);
+void BSP_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi, void *Params);
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_QSPI_H */
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 612 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_sd.c

@@ -0,0 +1,612 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_sd.c
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file includes the uSD card driver mounted on STM32446E-EVAL
+  *          evaluation board.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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.
+  *
+  ******************************************************************************
+  */ 
+
+/* File Info : -----------------------------------------------------------------
+                                   User NOTES
+1. How To use this driver:
+--------------------------
+   - This driver is used to drive the micro SD external card mounted on STM32446E-EVAL
+     evaluation board.
+   - This driver does not need a specific component driver for the micro SD device
+     to be included with.
+
+2. Driver description:
+---------------------
+  + Initialization steps:
+     o Initialize the micro SD card using the BSP_SD_Init() function. This 
+       function includes the MSP layer hardware resources initialization and the
+       SDIO interface configuration to interface with the external micro SD. It 
+       also includes the micro SD initialization sequence.
+     o To check the SD card presence you can use the function BSP_SD_IsDetected() which 
+       returns the detection status 
+     o If SD presence detection interrupt mode is desired, you must configure the 
+       SD detection interrupt mode by calling the function BSP_SD_ITConfig(). The interrupt 
+       is generated as an external interrupt whenever the micro SD card is 
+       plugged/unplugged in/from the evaluation board. The SD detection interrupt
+       is handled by calling the function BSP_SD_DetectIT() which is called in the IRQ
+       handler file, the user callback is implemented in the function BSP_SD_DetectCallback().
+     o The function BSP_SD_GetCardInfo() is used to get the micro SD card information 
+       which is stored in the structure "HAL_SD_CardInfoTypedef".
+  
+  + Micro SD card operations
+     o The micro SD card can be accessed with read/write block(s) operations once 
+       it is ready for access. The access can be performed whether using the polling 
+       mode by calling the functions BSP_SD_ReadBlocks()/BSP_SD_WriteBlocks(), or by DMA 
+       transfer using the functions BSP_SD_ReadBlocks_DMA()/BSP_SD_WriteBlocks_DMA()
+     o The DMA transfer complete is used with interrupt mode. Once the SD transfer
+       is complete, the SD interrupt is handled using the function BSP_SD_IRQHandler(),
+       the DMA Tx/Rx transfer complete are handled using the functions
+       BSP_SD_DMA_Tx_IRQHandler()/BSP_SD_DMA_Rx_IRQHandler(). The corresponding user callbacks 
+       are implemented by the user at application level. 
+     o The SD erase block(s) is performed using the function BSP_SD_Erase() with specifying
+       the number of blocks to erase.
+     o The SD runtime status is returned when calling the function BSP_SD_GetStatus().
+ 
+------------------------------------------------------------------------------*/ 
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval_sd.h"
+
+/** @addtogroup BSP
+  * @{
+  */
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */ 
+  
+/** @defgroup STM32446E_EVAL_SD STM32446E-EVAL SD
+  * @{
+  */ 
+
+
+/** @defgroup STM32446E_EVAL_SD_Private_TypesDefinitions STM32446E Eval Sd Private TypesDef
+  * @{
+  */
+/**
+  * @}
+  */ 
+
+/** @defgroup STM32446E_EVAL_SD_Private_Defines STM32446E Eval Sd Private Defines
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_SD_Private_Macros STM32446E Eval Sd Private Macro
+  * @{
+  */    
+/**
+  * @}
+  */  
+
+/** @defgroup STM32446E_EVAL_SD_Private_Variables STM32446E Eval Sd Private Variables
+  * @{
+  */
+static SD_HandleTypeDef uSdHandle;
+static SD_CardInfo uSdCardInfo;
+static uint8_t UseExtiModeDetection = 0;
+
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_SD_Private_FunctionPrototypes STM32446E Eval Sd Private Prototypes
+  * @{
+  */
+/**
+  * @}
+  */ 
+  
+/** @defgroup STM32446E_EVAL_SD_Private_Functions STM32446E Eval Sd Private Functions
+  * @{
+  */
+
+/**
+  * @brief  Initializes the SD card device.
+  * @param  None
+  * @retval SD status
+  */
+uint8_t BSP_SD_Init(void)
+{ 
+  uint8_t sd_state = MSD_OK;
+  
+  /* uSD device interface configuration */
+  uSdHandle.Instance = SDIO;
+
+  uSdHandle.Init.ClockEdge           = SDIO_CLOCK_EDGE_RISING;
+  uSdHandle.Init.ClockBypass         = SDIO_CLOCK_BYPASS_DISABLE;
+  uSdHandle.Init.ClockPowerSave      = SDIO_CLOCK_POWER_SAVE_DISABLE;
+  uSdHandle.Init.BusWide             = SDIO_BUS_WIDE_1B;
+  uSdHandle.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_ENABLE;
+  uSdHandle.Init.ClockDiv            = SDIO_TRANSFER_CLK_DIV;
+  
+  /* Initialize IO functionalities (MFX) used by SD detect pin */
+  BSP_IO_Init(); 
+  
+  /* Check if the SD card is plugged in the slot */
+  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT);
+  if(BSP_SD_IsDetected() != SD_PRESENT)
+  {
+    return MSD_ERROR_SD_NOT_PRESENT;
+  }
+  
+  /* Msp SD initialization */
+  BSP_SD_MspInit(&uSdHandle, NULL);
+
+  /* HAL SD initialization */
+  if(HAL_SD_Init(&uSdHandle, &uSdCardInfo) != SD_OK)
+  {
+    sd_state = MSD_ERROR;
+  }
+  
+  /* Configure SD Bus width */
+  if(sd_state == MSD_OK)
+  {
+    /* Enable wide operation */
+    if(HAL_SD_WideBusOperation_Config(&uSdHandle, SDIO_BUS_WIDE_4B) != SD_OK)
+    {
+      sd_state = MSD_ERROR;
+    }
+    else
+    {
+      sd_state = MSD_OK;
+    }
+  }
+  
+  return  sd_state;
+}
+
+/**
+  * @brief  DeInitializes the SD card device.
+  * @param  None
+  * @retval SD status
+  */
+uint8_t BSP_SD_DeInit(void)
+{ 
+  uint8_t sd_state = MSD_OK;
+ 
+  uSdHandle.Instance = SDIO;
+  
+  /* Set back Mfx pin to INPUT mode in case it was in exti */
+  UseExtiModeDetection = 0;
+  BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_INPUT);
+
+  /* HAL SD deinitialization */
+  if(HAL_SD_DeInit(&uSdHandle) != HAL_OK)
+  {
+    sd_state = MSD_ERROR;
+  }
+
+  /* Msp SD deinitialization */
+  uSdHandle.Instance = SDIO;
+  BSP_SD_MspDeInit(&uSdHandle, NULL);
+  
+  return  sd_state;
+}
+
+/**
+  * @brief  Configures Interrupt mode for SD detection pin.
+  * @param  None
+  * @retval Returns 0
+  */
+uint8_t BSP_SD_ITConfig(void)
+{  
+  /* Configure Interrupt mode for SD detection pin */  
+  /* Note: disabling exti mode can be done calling SD_DeInit() */
+  UseExtiModeDetection = 1;  
+  BSP_SD_IsDetected();
+
+  return 0;
+}
+
+/**
+ * @brief  Detects if SD card is correctly plugged in the memory slot or not.
+ * @param  None
+ * @retval Returns if SD is detected or not
+ */
+uint8_t BSP_SD_IsDetected(void)
+{
+  __IO uint8_t status = SD_PRESENT;
+  
+  /* Check SD card detect pin */
+  if((BSP_IO_ReadPin(SD_DETECT_PIN)&SD_DETECT_PIN) != SD_DETECT_PIN)
+  {
+     if (UseExtiModeDetection)
+     {
+      BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_RISING_EDGE);
+     }
+
+  }
+  else
+  {
+    status = SD_NOT_PRESENT;
+    if (UseExtiModeDetection)
+    {
+      BSP_IO_ConfigPin(SD_DETECT_PIN, IO_MODE_IT_FALLING_EDGE);
+    }
+  }
+ 
+  return status;
+}
+
+
+
+/**
+  * @brief  Reads block(s) from a specified address in an SD card, in polling mode.
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  ReadAddr: Address from where data is to be read  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to read 
+  * @retval SD status
+  */
+uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+{
+  if(HAL_SD_ReadBlocks(&uSdHandle, pData, ReadAddr, BlockSize, NumOfBlocks) != SD_OK)
+  {
+    return MSD_ERROR;
+  }
+  else
+  {
+    return MSD_OK;
+  }
+}
+
+/**
+  * @brief  Writes block(s) to a specified address in an SD card, in polling mode. 
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  WriteAddr: Address from where data is to be written  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to write
+  * @retval SD status
+  */
+uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+{
+  if(HAL_SD_WriteBlocks(&uSdHandle, pData, WriteAddr, BlockSize, NumOfBlocks) != SD_OK)
+  {
+    return MSD_ERROR;
+  }
+  else
+  {
+    return MSD_OK;
+  }
+}
+
+/**
+  * @brief  Reads block(s) from a specified address in an SD card, in DMA mode.
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  ReadAddr: Address from where data is to be read  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to read 
+  * @retval SD status
+  */
+uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+{
+  uint8_t sd_state = MSD_OK;
+  
+  /* Read block(s) in DMA transfer mode */
+  if(HAL_SD_ReadBlocks_DMA(&uSdHandle, pData, ReadAddr, BlockSize, NumOfBlocks) != SD_OK)
+  {
+    sd_state = MSD_ERROR;
+  }
+  
+  /* Wait until transfer is complete */
+  if(sd_state == MSD_OK)
+  {
+    if(HAL_SD_CheckReadOperation(&uSdHandle, (uint32_t)SD_DATATIMEOUT) != SD_OK)
+    {
+      sd_state = MSD_ERROR;
+    }
+    else
+    {
+      sd_state = MSD_OK;
+    }
+  }
+  
+  return sd_state; 
+}
+
+/**
+  * @brief  Writes block(s) to a specified address in an SD card, in DMA mode.
+  * @param  pData: Pointer to the buffer that will contain the data to transmit
+  * @param  WriteAddr: Address from where data is to be written  
+  * @param  BlockSize: SD card data block size, that should be 512
+  * @param  NumOfBlocks: Number of SD blocks to write 
+  * @retval SD status
+  */
+uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+{
+  uint8_t sd_state = MSD_OK;
+  
+  /* Write block(s) in DMA transfer mode */
+  if(HAL_SD_WriteBlocks_DMA(&uSdHandle, pData, WriteAddr, BlockSize, NumOfBlocks) != SD_OK)
+  {
+    sd_state = MSD_ERROR;
+  }
+  
+  /* Wait until transfer is complete */
+  if(sd_state == MSD_OK)
+  {
+    if(HAL_SD_CheckWriteOperation(&uSdHandle, (uint32_t)SD_DATATIMEOUT) != SD_OK)
+    {
+      sd_state = MSD_ERROR;
+    }
+    else
+    {
+      sd_state = MSD_OK;
+    }
+  }
+  
+  return sd_state;  
+}
+
+/**
+  * @brief  Erases the specified memory area of the given SD card. 
+  * @param  StartAddr: Start byte address
+  * @param  EndAddr: End byte address
+  * @retval SD status
+  */
+uint8_t BSP_SD_Erase(uint64_t StartAddr, uint64_t EndAddr)
+{
+  if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != SD_OK)
+  {
+    return MSD_ERROR;
+  }
+  else
+  {
+    return MSD_OK;
+  }
+}
+
+/**
+  * @brief  Initializes the SD MSP.
+  * @param  hsd: SD handle
+  * @retval None
+  */
+__weak void BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params)
+{
+  static DMA_HandleTypeDef dma_rx_handle;
+  static DMA_HandleTypeDef dma_tx_handle;
+  GPIO_InitTypeDef gpio_init_structure;
+
+  /* SD pins are in conflict with Camera pins therefore Camera is power down */
+  /* __weak function can be modified by the application */
+  BSP_IO_ConfigPin(RSTI_PIN, IO_MODE_OUTPUT);
+  BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
+  /* De-assert the camera STANDBY pin (active high) */
+  BSP_IO_WritePin(XSDN_PIN, BSP_IO_PIN_RESET);
+  /* Assert the camera RSTI pin (active low) */
+  BSP_IO_WritePin(RSTI_PIN, BSP_IO_PIN_RESET);
+  HAL_Delay(100);
+  
+  /* Enable SDIO clock */
+  __HAL_RCC_SDIO_CLK_ENABLE();
+  
+  /* Enable DMA2 clocks */
+  __DMAx_TxRx_CLK_ENABLE();
+
+  /* Enable GPIOs clock */
+  __HAL_RCC_GPIOC_CLK_ENABLE();
+  __HAL_RCC_GPIOD_CLK_ENABLE();
+  
+  /* Common GPIO configuration */
+  gpio_init_structure.Mode      = GPIO_MODE_AF_PP;
+  gpio_init_structure.Pull      = GPIO_PULLUP;
+  gpio_init_structure.Speed     = GPIO_SPEED_HIGH;
+  gpio_init_structure.Alternate = GPIO_AF12_SDIO;
+  
+  /* GPIOC configuration */
+  gpio_init_structure.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
+   
+  HAL_GPIO_Init(GPIOC, &gpio_init_structure);
+
+  /* GPIOD configuration */
+  gpio_init_structure.Pin = GPIO_PIN_2;
+  HAL_GPIO_Init(GPIOD, &gpio_init_structure);
+
+  /* NVIC configuration for SDIO interrupts */
+  HAL_NVIC_SetPriority(SDIO_IRQn, 5, 0);
+  HAL_NVIC_EnableIRQ(SDIO_IRQn);
+    
+  /* Configure DMA Rx parameters */
+  dma_rx_handle.Init.Channel             = SD_DMAx_Rx_CHANNEL;
+  dma_rx_handle.Init.Direction           = DMA_PERIPH_TO_MEMORY;
+  dma_rx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
+  dma_rx_handle.Init.MemInc              = DMA_MINC_ENABLE;
+  dma_rx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
+  dma_rx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
+  dma_rx_handle.Init.Mode                = DMA_PFCTRL;
+  dma_rx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
+  dma_rx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
+  dma_rx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+  dma_rx_handle.Init.MemBurst            = DMA_MBURST_INC4;
+  dma_rx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
+  
+  dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
+  
+  /* Associate the DMA handle */
+  __HAL_LINKDMA(hsd, hdmarx, dma_rx_handle);
+  
+  /* Deinitialize the stream for new transfer */
+  HAL_DMA_DeInit(&dma_rx_handle);
+  
+  /* Configure the DMA stream */
+  HAL_DMA_Init(&dma_rx_handle);
+  
+  /* Configure DMA Tx parameters */
+  dma_tx_handle.Init.Channel             = SD_DMAx_Tx_CHANNEL;
+  dma_tx_handle.Init.Direction           = DMA_MEMORY_TO_PERIPH;
+  dma_tx_handle.Init.PeriphInc           = DMA_PINC_DISABLE;
+  dma_tx_handle.Init.MemInc              = DMA_MINC_ENABLE;
+  dma_tx_handle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
+  dma_tx_handle.Init.MemDataAlignment    = DMA_MDATAALIGN_WORD;
+  dma_tx_handle.Init.Mode                = DMA_PFCTRL;
+  dma_tx_handle.Init.Priority            = DMA_PRIORITY_VERY_HIGH;
+  dma_tx_handle.Init.FIFOMode            = DMA_FIFOMODE_ENABLE;
+  dma_tx_handle.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+  dma_tx_handle.Init.MemBurst            = DMA_MBURST_INC4;
+  dma_tx_handle.Init.PeriphBurst         = DMA_PBURST_INC4;
+  
+  dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
+  
+  /* Associate the DMA handle */
+  __HAL_LINKDMA(hsd, hdmatx, dma_tx_handle);
+  
+  /* Deinitialize the stream for new transfer */
+  HAL_DMA_DeInit(&dma_tx_handle);
+  
+  /* Configure the DMA stream */
+  HAL_DMA_Init(&dma_tx_handle); 
+  
+  /* NVIC configuration for DMA transfer complete interrupt */
+  HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 6, 0);
+  HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
+  
+  /* NVIC configuration for DMA transfer complete interrupt */
+  HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 6, 0);
+  HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
+}
+
+/**
+  * @brief  DeInitializes the SD MSP.
+  * @param  hsd: SD handle
+  * @retval None
+  */
+__weak void BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params)
+{
+    static DMA_HandleTypeDef dma_rx_handle;
+    static DMA_HandleTypeDef dma_tx_handle;
+
+    /* Disable NVIC for DMA transfer complete interrupts */
+    HAL_NVIC_DisableIRQ(SD_DMAx_Rx_IRQn);
+    HAL_NVIC_DisableIRQ(SD_DMAx_Tx_IRQn);
+  
+    /* Deinitialize the stream for new transfer */
+    dma_rx_handle.Instance = SD_DMAx_Rx_STREAM;
+    HAL_DMA_DeInit(&dma_rx_handle);
+  
+    /* Deinitialize the stream for new transfer */
+    dma_tx_handle.Instance = SD_DMAx_Tx_STREAM;
+    HAL_DMA_DeInit(&dma_tx_handle);
+  
+    /* Disable NVIC for SDIO interrupts */
+    HAL_NVIC_DisableIRQ(SDIO_IRQn);
+
+    /* DeInit GPIO pins can be done in the application 
+       (by surcharging this __weak function) */
+
+    /* Disable SDIO clock */
+    __HAL_RCC_SDIO_CLK_DISABLE();
+
+    /* GPIO pins clock and DMA clocks can be shut down in the application 
+       by surcharging this __weak function */ 
+}
+
+/**
+  * @brief  Handles SD card interrupt request.
+  * @param  None
+  * @retval None
+  */
+void BSP_SD_IRQHandler(void)
+{
+  HAL_SD_IRQHandler(&uSdHandle);
+}
+
+/**
+  * @brief  Handles SD DMA Tx transfer interrupt request.
+  * @param  None
+  * @retval None
+  */
+void BSP_SD_DMA_Tx_IRQHandler(void)
+{
+  HAL_DMA_IRQHandler(uSdHandle.hdmatx); 
+}
+
+/**
+  * @brief  Handles SD DMA Rx transfer interrupt request.
+  * @param  None
+  * @retval None
+  */
+void BSP_SD_DMA_Rx_IRQHandler(void)
+{
+  HAL_DMA_IRQHandler(uSdHandle.hdmarx);
+}
+
+/**
+  * @brief  Gets the current SD card data status.
+  * @param  None
+  * @retval Data transfer state.
+  *          This value can be one of the following values:
+  *            @arg  SD_TRANSFER_OK: No data transfer is acting
+  *            @arg  SD_TRANSFER_BUSY: Data transfer is acting
+  *            @arg  SD_TRANSFER_ERROR: Data transfer error 
+  */
+HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void)
+{
+  return(HAL_SD_GetStatus(&uSdHandle));
+}
+
+/**
+  * @brief  Get SD information about specific SD card.
+  * @param  CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
+  * @retval None 
+  */
+void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo)
+{
+  /* Get SD card Information */
+  HAL_SD_Get_CardInfo(&uSdHandle, CardInfo);
+}
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */
+ 
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 159 - 0
bsp/stm32f411RE/Libraries/BSP/STM32446E_EVAL/stm32446e_eval_sd.h

@@ -0,0 +1,159 @@
+/**
+  ******************************************************************************
+  * @file    stm32446e_eval_sd.h
+  * @author  MCD Application Team
+  * @version V1.1.0
+  * @date    14-August-2015
+  * @brief   This file contains the common defines and functions prototypes for
+  *          the stm32446e_eval_sd.c driver.
+  ******************************************************************************
+  * @attention
+  *
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
+  *
+  * 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 __STM32446E_EVAL_SD_H
+#define __STM32446E_EVAL_SD_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif 
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32446e_eval.h"
+#include "stm32446e_eval_io.h"
+
+/** @addtogroup BSP
+  * @{
+  */ 
+
+/** @addtogroup STM32446E_EVAL
+  * @{
+  */
+    
+/** @defgroup STM32446E_EVAL_SD STM32446E-EVAL SD
+  * @{
+  */    
+
+/** @defgroup STM32446E_EVAL_SD_Exported_Types STM32446E EVAL SD Exported Types
+  * @{
+  */
+
+/** 
+  * @brief SD Card information structure 
+  */
+#define SD_CardInfo HAL_SD_CardInfoTypedef
+/**
+  * @}
+  */
+   
+/** 
+  * @brief  SD status structure definition  
+  */     
+#define   MSD_OK                        ((uint8_t)0x00)
+#define   MSD_ERROR                     ((uint8_t)0x01)
+#define   MSD_ERROR_SD_NOT_PRESENT      ((uint8_t)0x02)
+   
+/** @defgroup STM32446E_EVAL_SD_Exported_Constants STM32446E EVAL SD Exported Constants
+  * @{
+  */ 
+#define SD_PRESENT               ((uint8_t)0x01)
+#define SD_NOT_PRESENT           ((uint8_t)0x00)
+
+#define SD_DATATIMEOUT           ((uint32_t)100000000)
+    
+/* DMA definitions for SD DMA transfer */
+#define __DMAx_TxRx_CLK_ENABLE            __HAL_RCC_DMA2_CLK_ENABLE
+#define SD_DMAx_Tx_CHANNEL                DMA_CHANNEL_4
+#define SD_DMAx_Rx_CHANNEL                DMA_CHANNEL_4
+#define SD_DMAx_Tx_STREAM                 DMA2_Stream6  
+#define SD_DMAx_Rx_STREAM                 DMA2_Stream3  
+#define SD_DMAx_Tx_IRQn                   DMA2_Stream6_IRQn
+#define SD_DMAx_Rx_IRQn                   DMA2_Stream3_IRQn
+#define SD_DMAx_Tx_IRQHandler             DMA2_Stream6_IRQHandler   
+#define SD_DMAx_Rx_IRQHandler             DMA2_Stream3_IRQHandler 
+#define SD_DetectIRQHandler()             HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8)
+/**
+  * @}
+  */
+  
+/** @defgroup STM32446E_EVAL_SD_Exported_Macro STM32446E EVAL SD Exported Macro
+  * @{
+  */ 
+/**
+  * @}
+  */
+   
+/** @defgroup STM32446E_EVAL_SD_Exported_Functions STM32446E EVAL SD Exported Functions
+  * @{
+  */   
+uint8_t BSP_SD_Init(void);
+uint8_t BSP_SD_DeInit(void);
+uint8_t BSP_SD_ITConfig(void);
+void    BSP_SD_DetectIT(void);
+void    BSP_SD_DetectCallback(void);
+uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+uint8_t BSP_SD_Erase(uint64_t StartAddr, uint64_t EndAddr);
+void    BSP_SD_IRQHandler(void);
+void    BSP_SD_DMA_Tx_IRQHandler(void);
+void    BSP_SD_DMA_Rx_IRQHandler(void);
+HAL_SD_TransferStateTypedef BSP_SD_GetStatus(void);
+void    BSP_SD_GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo);
+uint8_t BSP_SD_IsDetected(void);
+
+/* These function can be modified in case the current settings (e.g. DMA stream)
+   need to be changed for specific application needs */
+void    BSP_SD_MspInit(SD_HandleTypeDef *hsd, void *Params);
+void    BSP_SD_MspDeInit(SD_HandleTypeDef *hsd, void *Params);
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+/**
+  * @}
+  */ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32446E_EVAL_SD_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels