Compare commits

...

35 Commits

Author SHA1 Message Date
Arash_mrad 067ba6592b Update README.md 2024-09-03 22:12:24 +10:00
Milad 02040f3f8a updated the file to show to arash. 2024-09-03 21:59:51 +10:00
Tasnim 42472d601c Release v1.8.6 2024-08-02 11:53:51 +01:00
Tasnim 3d53398c29 [HAL] Upload new fixes 2024-07-01 14:13:52 +01:00
karim e520340527 [HAL] Upload new fixes 2024-06-20 14:15:21 +01:00
karim 7b479bfd21 [HAL] Upload new fixes 2024-05-22 16:50:01 +01:00
sirine eljazi 7174d37853 [PRJ] Update license paragraph of SW4STM32 linker files 2024-05-22 13:43:58 +01:00
Rania JMAI 67f128d83b [BSP] Replace 'BSP/Components/<component>' folders by submodules 2024-04-29 15:06:41 +01:00
Tasnim bf08129dc1 [HAL][LL] Upload new fixes 2024-04-26 12:52:40 +01:00
Rania JMAI 7dadc1a490 [HAL] Upload new fixes 2024-04-01 13:47:35 +01:00
Tasnim 726163ed2a [CMSIS] Upload new fixes 2024-02-27 09:06:36 +01:00
Tasnim 1ef7b664c5 [HAL] Upload new fixes 2024-01-25 16:27:38 +01:00
Ali Labbene 1386f613e0 [BSP] Replace 'BSP/<board>' folders by submodules 2024-01-15 15:37:15 +01:00
Ali Labbene 00cec97220 [DOC] Highlight important info in README.md 2024-01-15 15:26:37 +01:00
Ali Labbene 306fe898fb [PRJ] Add the list of unavailable projects into the README.md file 2024-01-15 15:00:56 +01:00
Ali Labbene 6cb97170c7 [DOC] Rename License.md in capital letters 2024-01-15 14:56:36 +01:00
Ali Labbene 7de79e327d [HAL] Upload new fixes 2023-12-18 12:48:49 +01:00
Rania JMAI e226c47ca6 [HAL] Upload new fixes 2023-11-20 10:14:04 +01:00
Ali Labbene 61998a7993 [CMSIS][HAL] Replace 'CMSIS Device' and 'HAL Driver' folders by submodules 2023-10-31 14:13:29 +01:00
Kilani Akrich 6533756854 [PRJ][APPS][USBH] Fix stack corruption due to inconsistent type of local variable in MSC_File_Operations() 2023-10-10 10:29:10 +01:00
Tasnim bdec2f6b06 Add SECURITY.md 2023-05-23 17:29:48 +01:00
Rania JMAI 5326afcfb2 Release v1.8.5 2023-04-28 10:02:38 +01:00
Denys Fedoryshchenko 756b239424 startup_stm32f100xb.s: Small typo fix for SPI1_IRQHandler
Fixes small typo that cause lot of confusion for users using CMSIS.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
2023-04-06 11:32:37 +01:00
Binder Tronics e978fcac56 add missing e in the 2023-04-04 13:38:45 +01:00
Tasnim 2009da0b5e [DOC] Correct typo in README.md 2023-03-27 12:26:13 +01:00
Ali Labbene 2976d3b5b5 [PRJ] Remove projects using MW libraries subject to click-thru
Rationale:
- MW libraries subject to click-thru have been already removed from this repo, but not the projects using them.
- Building these projects, whether manually or automatically via some ACI tool would yield errors.
- Particularly with daily (or nightly) builds in the frame of a CI/CD strategy, such errors would pollute the logs uselessly.

Note: If needed, the removed items can be found in the full firmware package on st.com. Please refer to the README.md file for further details.
2022-12-19 17:34:29 +01:00
deividAlfa 218b5100dd Declare DMA Handler State as volatile
Not doing so causes issues when optimizations are enabled, the flag can change at any time by the DMA interrupt, but the compiler is unaware.
2022-04-19 15:11:54 +01:00
Ali Labbene 156741e067 [PROJECTS][NUCLEO-F103RB][EEPROM] Replace hard-coded page end address by a variable in EE_VerifyPageFullyErased()
Fixes issue raised in #11.
2022-01-21 17:54:07 +01:00
Eya c750eab699 Release v1.8.4 2021-06-07 17:37:27 +01:00
Maerdl 0813c2c1a3 wrong define used to clear I2C ADDR flag 2021-05-12 15:46:34 +01:00
Attie Grande f5aaa9b454 Add support for running SYSCLK from PLL1, via PLL2.
For parts like the STM32F1 Connectivity Line (STM32F105xx, STM32F107xx),
it is occasionally necessary to source SYSCLK via PLL2. This patch will
add this support.

- Add: `UTILS_GetPLL2OutputFrequency()` to calculate the output frequency of PLL2
- Add: `LL_PLL_ConfigSystemClock_PLL2()` to configure the system clock as sourced from HSE, via PLL2 and PLL1.
- Add: Miscellaneous support definitions.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
2021-04-05 14:25:41 +01:00
Eya 276c4ab953 Release v1.8.3 2020-10-30 15:10:41 +01:00
rihab kouki 003dfc9e6c Release v1.8.2 2020-10-05 08:36:58 +01:00
Eya 6ead386a08 Release v1.8.1 2020-08-28 17:16:38 +01:00
Ali Labbene 5ddefcd6a6 Update CONTRIBUTING.md and PULL_REQUEST_TEMPLATE.md with CLA procedure description and mention that pull-requests are now accepted 2020-03-26 10:42:15 +01:00
3252 changed files with 62809 additions and 372554 deletions

View File

@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help us improve the quality of our software
title: ''
labels: ''
assignees: ''
@ -9,20 +9,24 @@ assignees: ''
**Caution**
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus)
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
**Describe the set-up**
* The board (either ST RPN reference or your custom board)
* IDE or at least the compiler and its version
* The board (either ST RPN reference or your custom board).
* IDE or at least the compiler and its version.
**Describe the bug**
A clear and concise description of what the bug is.
**How To Reproduce**
1. Indicate the global behavior of your application project
2. The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...)
3. The use case that generates the problem
4. How we can reproduce the problem
1. Indicate the global behavior of your application project.
2. The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...).
3. The use case that generates the problem.
4. How we can reproduce the problem.
**Additional context**
If you have a first analysis or patch correction, thank you to share your proposal.

View File

@ -9,11 +9,11 @@ assignees: ''
**Caution**
The Issues are strictly limited for the reporting of problem encountered with the software provided in this project.
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus)
For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
**Describe the set-up**
* The board (either ST RPN reference or your custom board)
* IDE or at least the compiler and its version
* The board (either ST RPN reference or your custom board).
* IDE or at least the compiler and its version.
**Additional context**
If you have a first analysis or a patch proposal, thank you to share your proposal.

View File

@ -1,8 +1,5 @@
## IMPORTANT INFORMATION
## IMPORTANT INFORMATION
### Contributor License Agreement (CLA)
* The Pull Request feature will be considered by STMicroelectronics only after a **Contributor License Agreement (CLA)** mechanism has been deployed.
* We are currently working on the set-up of this procedure.
* The Pull Request feature will be considered by STMicroelectronics after the signature of a **Contributor License Agreement (CLA)** by the submitter.
* If you did not sign such agreement, please follow the steps mentioned in the [CONTRIBUTING.md](https://github.com/STMicroelectronics/STM32CubeF1/blob/master/CONTRIBUTING.md) file.

68
.gitmodules vendored Normal file
View File

@ -0,0 +1,68 @@
[submodule "Drivers/CMSIS/Device/ST/STM32F1xx"]
path = Drivers/CMSIS/Device/ST/STM32F1xx
url = https://github.com/STMicroelectronics/cmsis_device_f1.git
branch = master
[submodule "Drivers/STM32F1xx_HAL_Driver"]
path = Drivers/STM32F1xx_HAL_Driver
url = https://github.com/STMicroelectronics/stm32f1xx_hal_driver.git
branch = master
[submodule "Drivers/BSP/STM32F1xx_Nucleo"]
path = Drivers/BSP/STM32F1xx_Nucleo
url = https://github.com/STMicroelectronics/stm32f1xx-nucleo-bsp.git
branch = main
[submodule "Drivers/BSP/STM32VL-Discovery"]
path = Drivers/BSP/STM32VL-Discovery
url = https://github.com/STMicroelectronics/stm32vldiscovery-bsp.git
branch = main
[submodule "Drivers/BSP/STM3210C_EVAL"]
path = Drivers/BSP/STM3210C_EVAL
url = https://github.com/STMicroelectronics/stm3210c-eval-bsp.git
branch = main
[submodule "Drivers/BSP/STM3210E_EVAL"]
path = Drivers/BSP/STM3210E_EVAL
url = https://github.com/STMicroelectronics/stm3210e-eval-bsp.git
branch = main
[submodule "Drivers/BSP/Components/Common"]
path = Drivers/BSP/Components/Common
url = https://github.com/STMicroelectronics/stm32-bsp-common.git
branch = main
[submodule "Drivers/BSP/Components/ak4343"]
path = Drivers/BSP/Components/ak4343
url = https://github.com/STMicroelectronics/stm32-ak4343.git
branch = main
[submodule "Drivers/BSP/Components/cs43l22"]
path = Drivers/BSP/Components/cs43l22
url = https://github.com/STMicroelectronics/stm32-cs43l22.git
branch = main
[submodule "Drivers/BSP/Components/hx8347d"]
path = Drivers/BSP/Components/hx8347d
url = https://github.com/STMicroelectronics/stm32-hx8347d.git
branch = main
[submodule "Drivers/BSP/Components/ili9320"]
path = Drivers/BSP/Components/ili9320
url = https://github.com/STMicroelectronics/stm32-ili9320.git
branch = main
[submodule "Drivers/BSP/Components/ili9325"]
path = Drivers/BSP/Components/ili9325
url = https://github.com/STMicroelectronics/stm32-ili9325.git
branch = main
[submodule "Drivers/BSP/Components/lis302dl"]
path = Drivers/BSP/Components/lis302dl
url = https://github.com/STMicroelectronics/stm32-lis302dl.git
branch = main
[submodule "Drivers/BSP/Components/spfd5408"]
path = Drivers/BSP/Components/spfd5408
url = https://github.com/STMicroelectronics/stm32-spfd5408.git
branch = main
[submodule "Drivers/BSP/Components/st7735"]
path = Drivers/BSP/Components/st7735
url = https://github.com/STMicroelectronics/stm32-st7735.git
branch = main
[submodule "Drivers/BSP/Components/stlm75"]
path = Drivers/BSP/Components/stlm75
url = https://github.com/STMicroelectronics/stm32-stlm75.git
branch = main
[submodule "Drivers/BSP/Components/stmpe811"]
path = Drivers/BSP/Components/stmpe811
url = https://github.com/STMicroelectronics/stm32-stmpe811.git
branch = main

View File

@ -1,24 +1,40 @@
## Contributing guide
This document serves as a checklist before contributing to this repository.
It includes links to read up on if topics are unclear to you.
# Contributing guide
This guide mainly focuses on the proper use of Git.
This guide serves as a checklist before contributing to this repository. It mainly focuses on the steps to follow to submit an issue or a pull-request.
### 1. Before opening an issue
To report a bug/request please file an issue in the right repository
(example for [STM32CubeF1](https://github.com/STMicroelectronics/STM32CubeF1/issues/new/choose)).
But check the following boxes before posting an issue:
## 1. Issues
- [ ] `Make sure you are using the latest commit (major releases are Tagged, but corrections are available as new commits).`
- [ ] `Your issue is NOT a question/feedback/suggestions related to the software provided in this repo.` This should be discussed on the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus)
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous Issue.` Don't forget to browse into the **Closed** Issues
### 1.1 Before opening an issue
Please check the following points before posting an issue:
* Make sure you are using the latest commit (major releases are tagged, but corrections are available as new commits).
* Make sure your issue is a question/feedback/suggestions **related to** the software provided in this repository. Otherwise, please refer to section [3](CONTRIBUTING.md#3-support-requests-and-questions) below.
* Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue. Do not forget to browse into the **closed** issues.
### 2. Posting the issue
When you have checked the previous boxes. You will find two templates Issues (Bug Report or Other Issue) available in the **Issues** tab of the repo
### 1.2 Posting the issue
### 3. Pull Requests
For the moment, the Pull Request feature is not deployed. STMicrolectronics is working on a Contributor License Agreement procedure
When you have checked the previous points, create a new report from the **Issues** tab of this repository. A template is available [here](../../issues/new/choose) to help you report the issue you are facing or the enhancement you would like to propose.
## 2. Pull Requests
### 2.1 Before opening a pull-request
STMicrolectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure.
* If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an Individual [CLA](https://cla.st.com).
* If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a Corporate [CLA](https://cla.st.com) mentioning your GitHub account name.
* If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check the [CLA](https://cla.st.com) dedicated page.
Please note that:
* The Corporate CLA will always take precedence over the Individual CLA.
* One CLA submission is sufficient, for any project proposed by STMicroelectronics.
### 2.2 How to proceed
* We recommend to engage first a communication thru an issue, in order to present your proposal, just to confirm that it corresponds to STMicroelectronics' domain or scope.
* Then fork the project to your GitHub account to further develop your contribution. Please use the latest commit version.
* Please, submit one pull-request per new feature or proposal. This will ease the analysis and the final merge if accepted.
## 3. Support requests and questions
For support requests or any other question related to the product, the tools, the environment, you can submit a post to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog).

@ -0,0 +1 @@
Subproject commit 1e18c5afdf1f5971a35c8e2f88b6a21e5568ed92

View File

@ -1,759 +0,0 @@
<!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 BSP Components Common 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 BSP Components Common&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: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.0.1 / 21-July-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;"></span><span style="font-size: 10pt; font-family: Verdana;">tsensor.h: Fix compilation issue on TSENSOR_InitTypeDef</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: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.0.0 / 22-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>
<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;">accelero.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">ACCELERO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">audio.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">AUDIO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">idd.h:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">Shunt0StabDelay, Shunt1StabDelay, Shunt2StabDelay, Shunt3StabDelay, Shunt4StabDelay and ShuntNbOnBoard </span></span><span style="font-size: 10pt; font-family: Verdana;">fields in <span style="font-style: italic;">IDD_ConfigTypeDef</span>&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">rename <span style="font-style: italic;">ShuntNumber</span> field to <span style="font-style: italic;">ShuntNbUsed</span> in </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li></ul><li><span style="font-size: 10pt; font-family: Verdana;">magneto.h: add <span style="font-style: italic;">*DeInit</span> field in <span style="font-style: italic;">MAGNETO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold;">Important Note:</span>&nbsp; this release V4.0.0 is not backward compatible with V3.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: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V3.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-size: 10pt; font-family: Verdana;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">accelero.h:&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">*LowPower</span> field in <span style="font-style: italic;">ACCELERO_DrvTypeDef</span> structure</span><span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">magneto.h:&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">*LowPower</span> field in <span style="font-style: italic;">MAGNETO_DrvTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">gyro.h: add <span style="font-style: italic;">*DeInit</span> and <span style="font-style: italic;">*LowPower</span> fields in <span style="font-style: italic;">GYRO_DrvTypeDef</span> structure<br></span></li><li><span style="font-size: 10pt; font-family: Verdana;">camera.h: add <span style="font-style: italic;">CAMERA_COLOR_EFFECT_NONE</span> define</span></li><li><span style="font-size: 10pt; font-family: Verdana;">idd.h:&nbsp;</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add <span style="font-style: italic;">MeasureNb</span>, <span style="font-style: italic;">DeltaDelayUnit</span> and <span style="font-style: italic;">DeltaDelayValue</span> fields in <span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li><li><span style="font-size: 10pt; font-family: Verdana;">rename <span style="font-style: italic;">PreDelay</span> field to <span style="font-style: italic;">PreDelayUnit</span> in </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">IDD_ConfigTypeDef</span> structure</span></li></ul>
<li><span style="font-size: 10pt; font-family: Verdana;"><span style="font-weight: bold;">Important Note:</span>&nbsp; this release V3.0.0 is not backward compatible with V2.2.0<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: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.2.0 / 09-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>
<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;">Magnetometer </span><span style="font-size: 10pt; font-family: Verdana;">driver function prototypes added (magneto.h file)</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Update "idd.h" file to provide DeInit() and WakeUp() services in IDD current measurement driver</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: 210px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V2.1.0 / 06-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>
<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;">IDD current measurement </span><span style="font-size: 10pt; font-family: Verdana;">driver function prototypes added (idd.h file)</span></li><li><span style="font-size: 10pt; font-family: Verdana;">io.h: add new typedef enum IO_PinState with IO_PIN_RESET and IO_PIN_SET values<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: 210px;"><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>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-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.h" file to support MFX (Multi Function eXpander) device available on some STM32 boards</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">add new entries for IO_ModeTypedef enumeration structure</span><span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">update the IO_DrvTypeDef structure</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update all return values and function parameters to uint32_t</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Add a return value for Config field</span></li></ul></ul><li style="font-family: Verdana;"><small><span style="font-weight: bold;">Important Note</span>: &nbsp;this version V2.0.0 is not backward compatible with V1.2.1</small></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.2.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>
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">gyro.h: change &#8220;__GIRO_H&#8221; by &#8220;__GYRO_H&#8221; to fix compilation issue under Mac OS</span><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.2.0 / 18-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;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">EPD (</span><span style="font-size: 10pt; font-family: Verdana;">E Paper Display)&nbsp; driver function prototype added (epd.h file)<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.1.0 / 21-March-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;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Temperature Sensor driver function prototype added</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.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 with &nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">Accelerometer, </span><span style="font-size: 10pt; font-family: Verdana;">Audio, Camera, Gyroscope, IO, LCD and Touch Screen drivers function prototypes </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>

View File

@ -1,143 +0,0 @@
/**
******************************************************************************
* @file accelero.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the functions prototypes for the Accelerometer driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,122 +0,0 @@
/**
******************************************************************************
* @file audio.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the common defines and functions prototypes
* for the Audio driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,141 +0,0 @@
/**
******************************************************************************
* @file camera.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the common defines and functions prototypes
* for the camera driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,115 +0,0 @@
/**
******************************************************************************
* @file epd.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This file contains all the functions prototypes for the
* EPD (E Paper Display) driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,145 +0,0 @@
/**
******************************************************************************
* @file gyro.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the functions prototypes for the gyroscope driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,168 +0,0 @@
/**
******************************************************************************
* @file idd.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This file contains all the functions prototypes for the IDD driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,150 +0,0 @@
/**
******************************************************************************
* @file io.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This file contains all the functions prototypes for the IO driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,114 +0,0 @@
/**
******************************************************************************
* @file lcd.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This file contains all the functions prototypes for the LCD driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,125 +0,0 @@
/**
******************************************************************************
* @file magneto.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the functions prototypes for the MAGNETO driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,107 +0,0 @@
/**
******************************************************************************
* @file ts.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This file contains all the functions prototypes for the Touch Screen driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,118 +0,0 @@
/**
******************************************************************************
* @file tsensor.h
* @author MCD Application Team
* @version V4.0.1
* @date 21-July-2015
* @brief This header file contains the functions prototypes for the
* Temperature Sensor driver.
******************************************************************************
* @attention
*
* <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****/

@ -0,0 +1 @@
Subproject commit ca1d875d09049a161002efa8b07e4d8965aa7fd8

View File

@ -1,315 +0,0 @@
<!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 AK4343 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 AK4343 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
2016 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.0 / 11-April-2016 <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><li><span style="font-family: Verdana; font-size: 10pt;">ak4343.c: </span>
</li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Align ak4343_drv with BSP Common driver V4.0.1 (Stub DeInit function)</span></li></ul></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.1 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.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</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>

View File

@ -1,504 +0,0 @@
/**
******************************************************************************
* @file ak4343.c
* @author MCD Application Team
* @version V2.0.0
* @date 11-April-2016
* @brief This file provides the AK4343 Audio Codec driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "ak4343.h"
/* Private variables ---------------------------------------------------------*/
/* Local variable to determine whether the audio Codec is driven by: */
/* - I2S master clock: value different of "0", */
/* equivalent to I2S_MCLKOUTPUT_ENABLE */
/* - its own internal PLL from I2S_CK: value equal to "0", */
/* equivalent to I2S_MCLKOUTPUT_DISABLE */
uint8_t ak4343_i2s_mclk_output = 1; /* Default setting: master clock required */
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ak4343
* @brief This file provides a set of functions needed to drive the
* CS43l22 audio codec.
* @{
*/
/** @defgroup AK4343_Private_Types
* @{
*/
/**
* @}
*/
/** @defgroup AK4343_Private_Defines
* @{
*/
/* Uncomment this line to enable verifying data sent to codec after each write
operation (for debug purpose) */
#if !defined (VERIFY_WRITTENDATA)
/* #define VERIFY_WRITTENDATA */
#endif /* VERIFY_WRITTENDATA */
/**
* @}
*/
/** @defgroup AK4343_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup AK4343_Private_Variables
* @{
*/
/* Audio codec driver structure initialization */
AUDIO_DrvTypeDef ak4343_drv =
{
ak4343_Init,
0, /* On some other codec audio devices: DeInit */
0, /* On some other codec audio devices: ReadID */
ak4343_Play,
ak4343_Pause,
ak4343_Resume,
ak4343_Stop,
0, /* On some other codec audio devices: SetFrequency */
ak4343_SetVolume,
ak4343_SetMute,
ak4343_SetOutputMode,
0, /* On some other codec audio devices: Reset */
};
static uint8_t Is_ak4343_Stop = 1;
/**
* @}
*/
/** @defgroup AK4343_Function_Prototypes
* @{
*/
static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
/**
* @}
*/
/** @defgroup AK4343_Private_Functions
* @{
*/
/**
* @brief Initializes the audio codec and the control interface.
* Note: I2S standard is fixed to standard Philips.
* @param DeviceAddr: Device address on communication Bus.
* @param OutputDevice: can be OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
* OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO .
* @param Volume: Initial volume level (from 0 (Mute) to 100 (Max))
* @param AudioFreq: Audio frequency used to play the audio stream.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
{
uint32_t counter = 0;
uint32_t Standard = 0;
uint32_t PLLMode =0;
/* Initialize the Control interface of the Audio Codec */
AUDIO_IO_Init();
/* I2S standard fixed to standard Philips */
/* (Corresponding to I2S init parameter standard = I2S_STANDARD_PHILIPS) */
Standard = AK4343_I2S_STANDARD_PHILIPS;
/* PLL Slave SD/WS reference mode ----------------------*/
if (ak4343_i2s_mclk_output == 0) /* I2S_MCLKOUTPUT_DISABLE */
{
/* set the PLLMode variable */
PLLMode = 0x1;
/* Set I2S standard */
counter += CODEC_IO_Write(DeviceAddr, 0x04, (Standard | 0x20));
/* MCKI input frequency = 256.Fs */
counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x03);
/* VCOM Power up (PMVCM bit)*/
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x40);
/* Enable PLL*/
counter += CODEC_IO_Write(DeviceAddr, 0x01, 0x01);
}
/* Ext Slave mode with no PLL --------------------------*/
else
{
/* Reset the PLL mode variable */
PLLMode = 0;
/* Set I2S standard */
counter += CODEC_IO_Write(DeviceAddr, 0x04, Standard);
/* MCKI input frequency = 256.Fs */
counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x00);
/* VCOM Power up (PMVCM bit)*/
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x40);
}
/* Left Channel Digital Volume control */
counter += CODEC_IO_Write(DeviceAddr, 0x0A, VOLUME_CONVERT(Volume));
/* Right Channel Digital Volume control */
counter += CODEC_IO_Write(DeviceAddr, 0x0D, VOLUME_CONVERT(Volume));
/* Extra Configuration (of the ALC) */
counter += CODEC_IO_Write(DeviceAddr, 0x06, 0x3C );
counter += CODEC_IO_Write(DeviceAddr, 0x08, 0xE1 );
counter += CODEC_IO_Write(DeviceAddr, 0x0B, 0x00 );
counter += CODEC_IO_Write(DeviceAddr, 0x07, 0x20 );
counter += CODEC_IO_Write(DeviceAddr, 0x09, 0xC1 );
counter += CODEC_IO_Write(DeviceAddr, 0x0C, 0xC1 );
/* Uncomment these lines and set the correct filters values to use the */
/* codec digital filters (for more details refer to the codec datasheet) */
/* Filter 1 programming as High Pass filter (Fc=500Hz, Fs=8KHz, K=20, A=1, B=1) */
/*
counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x80);
counter += CODEC_IO_Write(DeviceAddr, 0x1E, 0xA0);
counter += CODEC_IO_Write(DeviceAddr, 0x1F, 0x0B);
*/
/* Filter 3 programming as Low Pass filter (Fc=20KHz, Fs=8KHz, K=40, A=1, B=1) */
/*
counter += CODEC_IO_Write(DeviceAddr, 0x1C, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x1D, 0x00);
counter += CODEC_IO_Write(DeviceAddr, 0x1E, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x1F, 0x01);
*/
/* Equilizer programming BP filter (Fc1=20Hz, Fc2=2.5KHz, Fs=44.1KHz, K=40, A=?, B=?, C=?) */
/*
counter += CODEC_IO_Write(DeviceAddr, 0x16, 0x00);
counter += CODEC_IO_Write(DeviceAddr, 0x17, 0x75);
counter += CODEC_IO_Write(DeviceAddr, 0x18, 0x00);
counter += CODEC_IO_Write(DeviceAddr, 0x19, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x1A, 0x00);
counter += CODEC_IO_Write(DeviceAddr, 0x1B, 0x51);
*/
/* HEADPHONE codec configuration */
if ((OutputDevice & OUTPUT_DEVICE_HEADPHONE) != 0)
{
/* MCKI is 256.Fs with no PLL */
counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x00 );
/* Switch control from DAC to Headphone */
counter += CODEC_IO_Write(DeviceAddr, 0x0F, 0x09 );
/* Bass Boost and Demphasis enable */
counter += CODEC_IO_Write(DeviceAddr, 0x0E, 0x18 );
/* Power up MIN and DAC (PMMIN and PMDAC bits) */
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x74);
/* Enable Slave mode and Left/Right HP lines*/
counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x30 | PLLMode));
/* Exit HP mute mode */
counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x70 | PLLMode));
}
/* SPEAKER codec configuration */
if ((OutputDevice & OUTPUT_DEVICE_SPEAKER) != 0)
{
/* ReSelect the MCKI frequency (FS0-1 bits): 256.Fs */
counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x02 );
/* Set up the path "DAC->Speaker-Amp" with no power save (DACS and SPPSN bits) */
counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x20 );
/* Speaker Gain (SPKG0-1 bits): Gain=+10.65dB(ALC off)/+12.65(ALC on) */
counter += CODEC_IO_Write(DeviceAddr, 0x03, 0x10);
/* Power up Speaker and DAC (PMSPK and PMDAC bits) */
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x54);
/* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */
counter += CODEC_IO_Write(DeviceAddr, 0x02, 0xA0 /*0xA1*/);
}
/* Return communication control value */
return counter;
}
/**
* @brief Start the audio Codec play feature.
* @note For this codec no Play options are required.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size)
{
uint32_t counter = 0;
if(Is_ak4343_Stop == 1)
{
/* Enable Output device */
counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
Is_ak4343_Stop = 0;
}
/* Return communication control value */
return counter;
}
/**
* @brief Pauses playing on the audio codec.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_Pause(uint16_t DeviceAddr)
{
uint32_t counter = 0;
/* Pause the audio file playing */
/* Mute the output first */
counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_ON);
return counter;
}
/**
* @brief Resumes playing on the audio codec.
* @param DeviceAddr: Device address on communication Bus.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_Resume(uint16_t DeviceAddr)
{
uint32_t counter = 0;
/* Unmute the output */
counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_OFF);
return counter;
}
/**
* @brief Stops audio Codec playing. It powers down the codec.
* @param DeviceAddr: Device address on communication Bus.
* @param CodecPdwnMode: selects the power down mode.
* - CODEC_PDWN_HW: Physically power down the codec. When resuming from this
* mode, the codec is set to default configuration
* (user should re-Initialize the codec in order to
* play again the audio stream).
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
{
uint32_t counter = 0;
/* Mute the output first */
counter += ak4343_SetMute(DeviceAddr, AUDIO_MUTE_ON);
/* Power down the DAC and the speaker (PMDAC and PMSPK bits)*/
counter += CODEC_IO_Write(DeviceAddr, 0x02, 0x9F);
Is_ak4343_Stop = 1;
return counter;
}
/**
* @brief Sets higher or lower the codec volume level.
* @param DeviceAddr: Device address on communication Bus.
* @param Volume: a byte value from 0 to 255 (refer to codec registers
* description for more details).
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_SetVolume(uint16_t DeviceAddr, uint8_t Volume)
{
uint32_t counter = 0;
uint8_t convertedvol = VOLUME_CONVERT(Volume);
/* Left Channel Digital Volume control */
counter += CODEC_IO_Write(DeviceAddr, 0x0A, convertedvol);
/* Right Channel Digital Volume control */
counter += CODEC_IO_Write(DeviceAddr, 0x0D, convertedvol);
return counter;
}
/**
* @brief Enables or disables the mute feature on the audio codec.
* @param DeviceAddr: Device address on communication Bus.
* @param Cmd: AUDIO_MUTE_ON to enable the mute or AUDIO_MUTE_OFF to disable the
* mute mode.
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_SetMute(uint16_t DeviceAddr, uint32_t Cmd)
{
uint32_t counter = 0;
uint32_t tmp = 0;
/* Read the current value of the config register number 0x0E */
tmp = AUDIO_IO_Read(DeviceAddr, 0x0E);
/* Set the Mute mode */
if(Cmd == AUDIO_MUTE_ON)
{
counter += CODEC_IO_Write(DeviceAddr, 0x0E, (tmp | 0x20));
}
else /* AUDIO_MUTE_OFF Disable the Mute */
{
counter += CODEC_IO_Write(DeviceAddr, 0x0E, (tmp & 0xD1));
}
return counter;
}
/**
* @brief Switch dynamically (while audio file is played) the output target
* (speaker or headphone).
* @param DeviceAddr: Device address on communication Bus.
* @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER,
* OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH
* @retval 0 if correct communication, else wrong communication
*/
uint32_t ak4343_SetOutputMode(uint16_t DeviceAddr, uint8_t Output)
{
uint32_t counter = 0;
uint32_t tmp_reg = 0;
switch (Output)
{
case OUTPUT_DEVICE_SPEAKER: /* SPK always OFF & HP always ON */
/* Turn-off headset */
/* Disable Left/Right HP lines*/
tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x01, tmp_reg &~ 0x70);
/* Turn-on speaker */
/* Power up Speaker and DAC (PMSPK and PMDAC bits) */
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x54);
/* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */
counter += CODEC_IO_Write(DeviceAddr, 0x02, 0xA0 /*0xA1*/);
break;
case OUTPUT_DEVICE_HEADPHONE: /* SPK always ON & HP always OFF */
/* Turn-on headset */
/* Power up MIN and DAC (PMMIN and PMDAC bits) */
counter += CODEC_IO_Write(DeviceAddr, 0x00, 0x74);
/* Enable Slave mode and Left/Right HP lines*/
counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x30 | 0x00));
/* Exit HP mute mode */
counter += CODEC_IO_Write(DeviceAddr, 0x01, (0x70 | 0x00));
/* Turn-off speaker */
/* Set up the path "DAC -> Speaker-Amp" with power save (SPPSN bit) */
tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x02);
counter += CODEC_IO_Write(DeviceAddr, 0x02, tmp_reg &~ 0x80);
break;
default:
case OUTPUT_DEVICE_BOTH: /* SPK always ON & HP always ON */
/* Turn-on headset */
/* Enable Slave mode and Left/Right HP lines*/
tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x01);
counter += CODEC_IO_Write(DeviceAddr, 0x01, tmp_reg | 0x70);
/* Turn-on speaker */
/* Set up the path "DAC -> Speaker-Amp" with no power save (SPPSN bit) */
tmp_reg = AUDIO_IO_Read(DeviceAddr, 0x02);
counter += CODEC_IO_Write(DeviceAddr, 0x02, tmp_reg | 0x80);
break;
}
return counter;
}
/**
* @brief Enables or disables the requirement of I2S master clock
* (supplied by I2S master device)
* @param I2S_MCLKOutput: I2S initialisation parameter "MCLKOutput" determines
* whether the audio Codec is driven by:
* - I2S master clock: value different of "0",
* equivalent to I2S_MCLKOUTPUT_ENABLE
* - its own internal PLL from I2S_CK: value equal to "0",
* equivalent to I2S_MCLKOUTPUT_DISABLE
* @retval None
*/
void ak4343_MCLKOutput(uint32_t I2S_MCLKOutput)
{
/* Update private variable */
ak4343_i2s_mclk_output = I2S_MCLKOutput;
}
/**
* @brief Writes/Read a single data.
* @param Addr: I2C address
* @param Reg: Reg address
* @param Value: Data to be written
* @retval None
*/
static uint8_t CODEC_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value)
{
uint32_t result = 0;
AUDIO_IO_Write(Addr, Reg, Value);
#ifdef VERIFY_WRITTENDATA
/* Verify that the data has been correctly written */
result = (AUDIO_IO_Read(Addr, Reg) == Value)? 0:1;
#endif /* VERIFY_WRITTENDATA */
return result;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,164 +0,0 @@
/**
******************************************************************************
* @file ak4343.h
* @author MCD Application Team
* @version V2.0.0
* @date 11-April-2016
* @brief This file contains all the functions prototypes for the ak4343.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __AK4343_H
#define __AK4343_H
/* Includes ------------------------------------------------------------------*/
#include "../Common/audio.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Component
* @{
*/
/** @addtogroup AK4343
* @{
*/
/** @defgroup AK4343_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup AK4343_Exported_Constants
* @{
*/
/******************************************************************************/
/*************************** Codec User defines ******************************/
/******************************************************************************/
/* Codec output DEVICE */
#define OUTPUT_DEVICE_SPEAKER 0x01
#define OUTPUT_DEVICE_HEADPHONE 0x02
#define OUTPUT_DEVICE_BOTH (OUTPUT_DEVICE_SPEAKER | OUTPUT_DEVICE_HEADPHONE)
/* Volume Levels values */
#define DEFAULT_VOLMIN 0x00
#define DEFAULT_VOLMAX 0xFF
#define DEFAULT_VOLSTEP 0x04
#define AUDIO_PAUSE 0
#define AUDIO_RESUME 1
/* Codec POWER DOWN modes */
#define CODEC_PDWN_HW 1
#define CODEC_PDWN_SW 2
/* MUTE commands */
#define AUDIO_MUTE_ON 1
#define AUDIO_MUTE_OFF 0
/******************************************************************************/
/****************************** REGISTER MAPPING ******************************/
/******************************************************************************/
/**
* @brief AK4343 registers definitions
*/
#define AK4343_MODE_CONTROL_1 0x04
#define AK4343_I2S_STANDARD_PHILIPS 0x03
#define AK4343_I2S_STANDARD_MSB 0x02
#define AK4343_I2S_STANDARD_LSB 0x01
/**
* @}
*/
/** @defgroup AK4343_Exported_Macros
* @{
*/
/* Conversion of volume from user scale [0:100] to audio codec AK4343 scale [255:0] */
#define VOLUME_CONVERT(Volume) (((Volume) > 100) ? 255 : ((uint8_t)(255 - ((255*(Volume))/100))))
/**
* @}
*/
/** @defgroup AK4343_Exported_Functions
* @{
*/
/*------------------------------------------------------------------------------
Audio Codec functions
------------------------------------------------------------------------------*/
/* High Layer codec functions */
uint32_t ak4343_Init(uint16_t DeviceAddr, uint16_t OutputDevice, uint8_t Volume, uint32_t I2S_MCLKOutput);
uint32_t ak4343_Play(uint16_t DeviceAddr, uint16_t* pBuffer, uint16_t Size);
uint32_t ak4343_Pause(uint16_t DeviceAddr);
uint32_t ak4343_Resume(uint16_t DeviceAddr);
uint32_t ak4343_Stop(uint16_t DeviceAddr, uint32_t Cmd);
uint32_t ak4343_SetVolume(uint16_t DeviceAddr, uint8_t Volume);
uint32_t ak4343_SetMute(uint16_t DeviceAddr, uint32_t Cmd);
uint32_t ak4343_SetOutputMode(uint16_t DeviceAddr, uint8_t Output);
/* AUDIO IO functions */
void AUDIO_IO_Init(void);
void ak4343_MCLKOutput(uint32_t I2S_MCLKOutput);
void AUDIO_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
uint8_t AUDIO_IO_Read(uint8_t Addr, uint8_t Reg);
/* Audio driver structure */
extern AUDIO_DrvTypeDef ak4343_drv;
#endif /* __AK4343_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 7dfa7f82b9286fbcd7cec7f8129ac2439304cb01

View File

@ -1,659 +0,0 @@
<!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>

View File

@ -1,494 +0,0 @@
/**
******************************************************************************
* @file cs43l22.c
* @author MCD Application Team
* @version V2.0.2
* @date 06-October-2015
* @brief This file provides the CS43L22 Audio Codec driver.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,228 +0,0 @@
/**
******************************************************************************
* @file cs43l22.h
* @author MCD Application Team
* @version V2.0.2
* @date 06-October-2015
* @brief This file contains all the functions prototypes for the cs43l22.c driver.
******************************************************************************
* @attention
*
* <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****/

@ -0,0 +1 @@
Subproject commit c4af83ef9605a14b0fbd2401bec36561c23128a1

View File

@ -1,175 +0,0 @@
<!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 HX8347D 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 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.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></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;">hx8347d.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; width: 180px; margin-right: 500pt;"><span style="font-family: Arial; color: white; font-size: 10pt;">V1.1.0 / 11-July-2014
<o:p></o:p></span></h3>
<p style="margin: 4.5pt 0cm 4.5pt 18pt;" class="MsoNormal"><b><u><span style="font-family: Verdana; color: black; font-size: 10pt;">Main
Changes<o:p></o:p></span></u></b></p><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span>
<ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">Beta release of </span><span style="font-family: Verdana; font-size: 10pt;">HX8347D LCD Component</span><span style="font-family: Verdana; font-size: 10pt;"> driver in order to harmonize all
LCD controllers Link usage (Change LCD_IO_WriteData to
LCD_IO_WriteMultipleData) </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
/ 06-May-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;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of </span><span style="font-size: 10pt; font-family: Verdana;">HX8347D LCD 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>

View File

@ -1,506 +0,0 @@
/**
******************************************************************************
* @file hx8347d.c
* @author MCD Application Team
* @version V1.1.1
* @date 24-November-2014
* @brief This file includes the LCD driver for HX8347D LCD.
******************************************************************************
* @attention
*
* <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 "hx8347d.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup HX8347D
* @brief This file provides a set of functions needed to drive the
* HX8347D LCD.
* @{
*/
/** @defgroup HX8347D_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Variables
* @{
*/
LCD_DrvTypeDef hx8347d_drv =
{
hx8347d_Init,
hx8347d_ReadID,
hx8347d_DisplayOn,
hx8347d_DisplayOff,
hx8347d_SetCursor,
hx8347d_WritePixel,
hx8347d_ReadPixel,
hx8347d_SetDisplayWindow,
hx8347d_DrawHLine,
hx8347d_DrawVLine,
hx8347d_GetLcdPixelWidth,
hx8347d_GetLcdPixelHeight,
hx8347d_DrawBitmap,
};
static uint8_t Is_hx8347d_Initialized = 0;
static uint16_t ArrayRGB[320] = {0};
/**
* @}
*/
/** @defgroup HX8347D_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Private_Functions
* @{
*/
/**
* @brief Initialise the HX8347D LCD Component.
* @param None
* @retval None
*/
void hx8347d_Init(void)
{
if(Is_hx8347d_Initialized == 0)
{
Is_hx8347d_Initialized = 1;
/* Initialise HX8347D low level bus layer --------------------------------*/
LCD_IO_Init();
/* Driving ability setting */
hx8347d_WriteReg(LCD_REG_234, 0x00);
hx8347d_WriteReg(LCD_REG_235, 0x20);
hx8347d_WriteReg(LCD_REG_236, 0x0C);
hx8347d_WriteReg(LCD_REG_237, 0xC4);
hx8347d_WriteReg(LCD_REG_232, 0x40);
hx8347d_WriteReg(LCD_REG_233, 0x38);
hx8347d_WriteReg(LCD_REG_241, 0x01);
hx8347d_WriteReg(LCD_REG_242, 0x10);
hx8347d_WriteReg(LCD_REG_39, 0xA3);
/* Adjust the Gamma Curve */
hx8347d_WriteReg(LCD_REG_64, 0x01);
hx8347d_WriteReg(LCD_REG_65, 0x00);
hx8347d_WriteReg(LCD_REG_66, 0x00);
hx8347d_WriteReg(LCD_REG_67, 0x10);
hx8347d_WriteReg(LCD_REG_68, 0x0E);
hx8347d_WriteReg(LCD_REG_69, 0x24);
hx8347d_WriteReg(LCD_REG_70, 0x04);
hx8347d_WriteReg(LCD_REG_71, 0x50);
hx8347d_WriteReg(LCD_REG_72, 0x02);
hx8347d_WriteReg(LCD_REG_73, 0x13);
hx8347d_WriteReg(LCD_REG_74, 0x19);
hx8347d_WriteReg(LCD_REG_75, 0x19);
hx8347d_WriteReg(LCD_REG_76, 0x16);
hx8347d_WriteReg(LCD_REG_80, 0x1B);
hx8347d_WriteReg(LCD_REG_81, 0x31);
hx8347d_WriteReg(LCD_REG_82, 0x2F);
hx8347d_WriteReg(LCD_REG_83, 0x3F);
hx8347d_WriteReg(LCD_REG_84, 0x3F);
hx8347d_WriteReg(LCD_REG_85, 0x3E);
hx8347d_WriteReg(LCD_REG_86, 0x2F);
hx8347d_WriteReg(LCD_REG_87, 0x7B);
hx8347d_WriteReg(LCD_REG_88, 0x09);
hx8347d_WriteReg(LCD_REG_89, 0x06);
hx8347d_WriteReg(LCD_REG_90, 0x06);
hx8347d_WriteReg(LCD_REG_91, 0x0C);
hx8347d_WriteReg(LCD_REG_92, 0x1D);
hx8347d_WriteReg(LCD_REG_93, 0xCC);
/* Power voltage setting */
hx8347d_WriteReg(LCD_REG_27, 0x1B);
hx8347d_WriteReg(LCD_REG_26, 0x01);
hx8347d_WriteReg(LCD_REG_36, 0x2F);
hx8347d_WriteReg(LCD_REG_37, 0x57);
/*****VCOM offset ****/
hx8347d_WriteReg(LCD_REG_35, 0x86);
/* Power on setting up flow */
hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_29, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
hx8347d_WriteReg(LCD_REG_39, 1); /* REF = 1 */
LCD_Delay(10);
/* 262k/65k color selection */
hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
/* SET PANEL */
hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display ON flow */
hx8347d_WriteReg(LCD_REG_40, 0x38); /* GON=1, DTE=1, D=10 */
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x3C); /* GON=1, DTE=1, D=11 */
/* Set GRAM Area - Partial Display Control */
hx8347d_WriteReg(LCD_REG_1, 0x00); /* DP_STB = 0, DP_STB_S = 0, SCROLL = 0, */
hx8347d_WriteReg(LCD_REG_2, 0x00); /* Column address start 2 */
hx8347d_WriteReg(LCD_REG_3, 0x00); /* Column address start 1 */
hx8347d_WriteReg(LCD_REG_4, 0x01); /* Column address end 2 */
hx8347d_WriteReg(LCD_REG_5, 0x3F); /* Column address end 1 */
hx8347d_WriteReg(LCD_REG_6, 0x00); /* Row address start 2 */
hx8347d_WriteReg(LCD_REG_7, 0x00); /* Row address start 2 */
hx8347d_WriteReg(LCD_REG_8, 0x00); /* Row address end 2 */
hx8347d_WriteReg(LCD_REG_9, 0xEF); /* Row address end 1 */
hx8347d_WriteReg(LCD_REG_22, 0xE0); /* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
}
/* Set the Cursor */
hx8347d_SetCursor(0, 0);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
}
/**
* @brief Enables the Display.
* @param None
* @retval None
*/
void hx8347d_DisplayOn(void)
{
/* Power On sequence ---------------------------------------------------------*/
hx8347d_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
LCD_Delay(10);
/* 262k/65k color selection */
hx8347d_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
/* SET PANEL */
hx8347d_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display On */
hx8347d_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x3C);
}
/**
* @brief Disables the Display.
* @param None
* @retval None
*/
void hx8347d_DisplayOff(void)
{
/* Power Off sequence ---------------------------------------------------------*/
hx8347d_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */
hx8347d_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */
hx8347d_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */
hx8347d_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */
hx8347d_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
hx8347d_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display Off */
hx8347d_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
hx8347d_WriteReg(LCD_REG_40, 0x04);
}
/**
* @brief Get the LCD pixel Width.
* @param None
* @retval The Lcd Pixel Width
*/
uint16_t hx8347d_GetLcdPixelWidth(void)
{
return (uint16_t)HX8347D_LCD_PIXEL_WIDTH;
}
/**
* @brief Get the LCD pixel Height.
* @param None
* @retval The Lcd Pixel Height
*/
uint16_t hx8347d_GetLcdPixelHeight(void)
{
return (uint16_t)HX8347D_LCD_PIXEL_HEIGHT;
}
/**
* @brief Get the HX8347D ID.
* @param None
* @retval The HX8347D ID
*/
uint16_t hx8347d_ReadID(void)
{
if(Is_hx8347d_Initialized == 0)
{
hx8347d_Init();
Is_hx8347d_Initialized = 1;
}
return (hx8347d_ReadReg(0x00));
}
/**
* @brief Set Cursor position.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @retval None
*/
void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
hx8347d_WriteReg(LCD_REG_6, 0x00);
hx8347d_WriteReg(LCD_REG_7, Xpos);
hx8347d_WriteReg(LCD_REG_2, Ypos >> 8);
hx8347d_WriteReg(LCD_REG_3, Ypos & 0xFF);
}
/**
* @brief Write pixel.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param RGBCode: the RGB pixel color
* @retval None
*/
void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
}
/**
* @brief Read pixel.
* @param None
* @retval the RGB pixel color
*/
uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Dummy read */
LCD_IO_ReadData(LCD_REG_34);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCD_REG_34));
}
/**
* @brief Writes to the selected LCD register.
* @param LCDReg: address of the selected register.
* @param LCDRegValue: value to write to the selected register.
* @retval None
*/
void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
{
LCD_IO_WriteReg(LCDReg);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
}
/**
* @brief Reads the selected LCD Register.
* @param LCDReg: address of the selected register.
* @retval LCD Register Value.
*/
uint16_t hx8347d_ReadReg(uint8_t LCDReg)
{
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCDReg));
}
/**
* @brief Sets a display window
* @param Xpos: specifies the X bottom left position.
* @param Ypos: specifies the Y bottom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
/* Horizontal GRAM Start Address */
hx8347d_WriteReg(LCD_REG_6, (Xpos) >> 8); /* SP */
hx8347d_WriteReg(LCD_REG_7, (Xpos) & 0xFF); /* SP */
/* Horizontal GRAM End Address */
hx8347d_WriteReg(LCD_REG_8, (Xpos + Height - 1) >> 8); /* EP */
hx8347d_WriteReg(LCD_REG_9, (Xpos + Height - 1) & 0xFF); /* EP */
/* Vertical GRAM Start Address */
hx8347d_WriteReg(LCD_REG_2, (Ypos) >> 8); /* SC */
hx8347d_WriteReg(LCD_REG_3, (Ypos) & 0xFF); /* SC */
/* Vertical GRAM End Address */
hx8347d_WriteReg(LCD_REG_4, (Ypos + Width - 1) >> 8); /* EC */
hx8347d_WriteReg(LCD_REG_5, (Ypos + Width - 1) & 0xFF); /* EC */
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint32_t i = 0;
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Sent a complete line */
for(i = 0; i < Length; i++)
{
ArrayRGB[i] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Fill a complete vertical line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Displays a bitmap picture loaded in the internal Flash.
* @param BmpAddress: Bmp picture address in the internal Flash.
* @retval None
*/
void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
{
uint32_t index = 0, size = 0;
/* Read bitmap size */
size = *(volatile uint16_t *) (pbmp + 2);
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
/* Get bitmap data address offset */
index = *(volatile uint16_t *) (pbmp + 10);
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
size = (size - index)/2;
pbmp += index;
/* Set GRAM write direction and BGR = 0 */
/* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
hx8347d_WriteReg(LCD_REG_22, 0xA0);
/* Set Cursor */
hx8347d_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
/* Set GRAM write direction and BGR = 0 */
/* Memory access control: MY = 1, MX = 1, MV = 1, ML = 0 */
hx8347d_WriteReg(LCD_REG_22, 0xE0);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,278 +0,0 @@
/**
******************************************************************************
* @file hx8347d.h
* @author MCD Application Team
* @version V1.1.1
* @date 24-November-2014
* @brief This file contains all the functions prototypes for the hx8347d.c
* driver.
******************************************************************************
* @attention
*
* <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 __HX8347D_H
#define __HX8347D_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup HX8347D
* @{
*/
/** @defgroup HX8347D_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup HX8347D_Exported_Constants
* @{
*/
/**
* @brief HX8347D ID
*/
#define HX8347D_ID 0x0047
/**
* @brief HX8347D Size
*/
#define HX8347D_LCD_PIXEL_WIDTH ((uint16_t)320)
#define HX8347D_LCD_PIXEL_HEIGHT ((uint16_t)240)
/**
* @brief HX8347D Registers
*/
#define LCD_REG_0 0x00
#define LCD_REG_1 0x01
#define LCD_REG_2 0x02
#define LCD_REG_3 0x03
#define LCD_REG_4 0x04
#define LCD_REG_5 0x05
#define LCD_REG_6 0x06
#define LCD_REG_7 0x07
#define LCD_REG_8 0x08
#define LCD_REG_9 0x09
#define LCD_REG_10 0x0A
#define LCD_REG_12 0x0C
#define LCD_REG_13 0x0D
#define LCD_REG_14 0x0E
#define LCD_REG_15 0x0F
#define LCD_REG_16 0x10
#define LCD_REG_17 0x11
#define LCD_REG_18 0x12
#define LCD_REG_19 0x13
#define LCD_REG_20 0x14
#define LCD_REG_21 0x15
#define LCD_REG_22 0x16
#define LCD_REG_23 0x17
#define LCD_REG_24 0x18
#define LCD_REG_25 0x19
#define LCD_REG_26 0x1A
#define LCD_REG_27 0x1B
#define LCD_REG_28 0x1C
#define LCD_REG_29 0x1D
#define LCD_REG_30 0x1E
#define LCD_REG_31 0x1F
#define LCD_REG_32 0x20
#define LCD_REG_33 0x21
#define LCD_REG_34 0x22
#define LCD_REG_35 0x23
#define LCD_REG_36 0x24
#define LCD_REG_37 0x25
#define LCD_REG_39 0x27
#define LCD_REG_40 0x28
#define LCD_REG_41 0x29
#define LCD_REG_43 0x2B
#define LCD_REG_45 0x2D
#define LCD_REG_48 0x30
#define LCD_REG_49 0x31
#define LCD_REG_50 0x32
#define LCD_REG_51 0x33
#define LCD_REG_52 0x34
#define LCD_REG_53 0x35
#define LCD_REG_54 0x36
#define LCD_REG_55 0x37
#define LCD_REG_56 0x38
#define LCD_REG_57 0x39
#define LCD_REG_59 0x3B
#define LCD_REG_60 0x3C
#define LCD_REG_61 0x3D
#define LCD_REG_62 0x3E
#define LCD_REG_63 0x3F
#define LCD_REG_64 0x40
#define LCD_REG_65 0x41
#define LCD_REG_66 0x42
#define LCD_REG_67 0x43
#define LCD_REG_68 0x44
#define LCD_REG_69 0x45
#define LCD_REG_70 0x46
#define LCD_REG_71 0x47
#define LCD_REG_72 0x48
#define LCD_REG_73 0x49
#define LCD_REG_74 0x4A
#define LCD_REG_75 0x4B
#define LCD_REG_76 0x4C
#define LCD_REG_77 0x4D
#define LCD_REG_78 0x4E
#define LCD_REG_79 0x4F
#define LCD_REG_80 0x50
#define LCD_REG_81 0x51
#define LCD_REG_82 0x52
#define LCD_REG_83 0x53
#define LCD_REG_84 0x54
#define LCD_REG_85 0x55
#define LCD_REG_86 0x56
#define LCD_REG_87 0x57
#define LCD_REG_88 0x58
#define LCD_REG_89 0x59
#define LCD_REG_90 0x5A
#define LCD_REG_91 0x5B
#define LCD_REG_92 0x5C
#define LCD_REG_93 0x5D
#define LCD_REG_96 0x60
#define LCD_REG_97 0x61
#define LCD_REG_106 0x6A
#define LCD_REG_118 0x76
#define LCD_REG_128 0x80
#define LCD_REG_129 0x81
#define LCD_REG_130 0x82
#define LCD_REG_131 0x83
#define LCD_REG_132 0x84
#define LCD_REG_133 0x85
#define LCD_REG_134 0x86
#define LCD_REG_135 0x87
#define LCD_REG_136 0x88
#define LCD_REG_137 0x89
#define LCD_REG_139 0x8B
#define LCD_REG_140 0x8C
#define LCD_REG_141 0x8D
#define LCD_REG_143 0x8F
#define LCD_REG_144 0x90
#define LCD_REG_145 0x91
#define LCD_REG_146 0x92
#define LCD_REG_147 0x93
#define LCD_REG_148 0x94
#define LCD_REG_149 0x95
#define LCD_REG_150 0x96
#define LCD_REG_151 0x97
#define LCD_REG_152 0x98
#define LCD_REG_153 0x99
#define LCD_REG_154 0x9A
#define LCD_REG_157 0x9D
#define LCD_REG_192 0xC0
#define LCD_REG_193 0xC1
#define LCD_REG_227 0xE3
#define LCD_REG_229 0xE5
#define LCD_REG_231 0xE7
#define LCD_REG_239 0xEF
#define LCD_REG_232 0xE8
#define LCD_REG_233 0xE9
#define LCD_REG_234 0xEA
#define LCD_REG_235 0xEB
#define LCD_REG_236 0xEC
#define LCD_REG_237 0xED
#define LCD_REG_241 0xF1
#define LCD_REG_242 0xF2
/**
* @}
*/
/** @defgroup HX8347D_Exported_Functions
* @{
*/
void hx8347d_Init(void);
uint16_t hx8347d_ReadID(void);
void hx8347d_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
uint16_t hx8347d_ReadReg(uint8_t LCDReg);
void hx8347d_DisplayOn(void);
void hx8347d_DisplayOff(void);
void hx8347d_SetCursor(uint16_t Xpos, uint16_t Ypos);
void hx8347d_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
uint16_t hx8347d_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void hx8347d_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void hx8347d_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void hx8347d_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
void hx8347d_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
uint16_t hx8347d_GetLcdPixelWidth(void);
uint16_t hx8347d_GetLcdPixelHeight(void);
/* LCD driver structure */
extern LCD_DrvTypeDef hx8347d_drv;
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t Reg);
uint16_t LCD_IO_ReadData(uint16_t Reg);
void LCD_Delay (uint32_t delay);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __HX8347D_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 7a844fe9fca8eb3ace5c773a59afd556610fd86c

View File

@ -1,499 +0,0 @@
<!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 ILI9320 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 ILI9320 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;">V1.2.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>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">Official Final Release for Linux compilation compliancy</span><br><span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;ili9320.h : change "\" by "/" in the include path to fix compilation issue under Linux</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.2.1 / 10-November-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Official Final Release for LCD Controllers harmonization<br>&nbsp; &nbsp; &nbsp;Replace LCD_IO_WriteData by LCD_IO_WriteMultipleData to be compliant with SPI interface <br>&nbsp; &nbsp; &nbsp;Warning : break compatibility with old BSP common files - done for STM3210C-EVAL board&nbsp;</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 / 5-September-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Official Final Release for LCD Controllers harmonization</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.0 / 11-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Beta Release to change the usage of LCD_IO_ReadData</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.0 / 13-March-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>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;First official release</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>
<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>

View File

@ -1,534 +0,0 @@
/**
******************************************************************************
* @file ili9320.c
* @author MCD Application Team
* @version V1.2.2
* @date 02-December-2014
* @brief This file includes the LCD driver for ILI9320 LCD.
******************************************************************************
* @attention
*
* <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 "ili9320.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ili9320
* @brief This file provides a set of functions needed to drive the
* ILI9320 LCD.
* @{
*/
/** @defgroup ILI9320_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup ILI9320_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup ILI9320_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup ILI9320_Private_Variables
* @{
*/
LCD_DrvTypeDef ili9320_drv =
{
ili9320_Init,
ili9320_ReadID,
ili9320_DisplayOn,
ili9320_DisplayOff,
ili9320_SetCursor,
ili9320_WritePixel,
ili9320_ReadPixel,
ili9320_SetDisplayWindow,
ili9320_DrawHLine,
ili9320_DrawVLine,
ili9320_GetLcdPixelWidth,
ili9320_GetLcdPixelHeight,
ili9320_DrawBitmap,
ili9320_DrawRGBImage,
};
static uint8_t Is_ili9320_Initialized = 0;
static uint16_t ArrayRGB[320] = {0};
/**
* @}
*/
/** @defgroup ILI9320_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup ILI9320_Private_Functions
* @{
*/
/**
* @brief Initialise the ILI9320 LCD Component.
* @param None
* @retval None
*/
void ili9320_Init(void)
{
if(Is_ili9320_Initialized == 0)
{
Is_ili9320_Initialized = 1;
/* Initialise ILI9320 low level bus layer --------------------------------*/
LCD_IO_Init();
/* Start Initial Sequence ------------------------------------------------*/
ili9320_WriteReg(LCD_REG_229,0x8000); /* Set the internal vcore voltage */
ili9320_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */
ili9320_WriteReg(LCD_REG_1, 0x0100); /* set SS and SM bit */
ili9320_WriteReg(LCD_REG_2, 0x0700); /* set 1 line inversion */
ili9320_WriteReg(LCD_REG_3, 0x1030); /* set GRAM write direction and BGR=1. */
ili9320_WriteReg(LCD_REG_4, 0x0000); /* Resize register */
ili9320_WriteReg(LCD_REG_8, 0x0202); /* set the back porch and front porch */
ili9320_WriteReg(LCD_REG_9, 0x0000); /* set non-display area refresh cycle ISC[3:0] */
ili9320_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */
ili9320_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */
ili9320_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */
ili9320_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */
/* Power On sequence -----------------------------------------------------*/
ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
ili9320_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9320_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9320_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
ili9320_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
ili9320_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
ili9320_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
ili9320_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
/* Adjust the Gamma Curve ------------------------------------------------*/
ili9320_WriteReg(LCD_REG_48, 0x0007);
ili9320_WriteReg(LCD_REG_49, 0x0007);
ili9320_WriteReg(LCD_REG_50, 0x0007);
ili9320_WriteReg(LCD_REG_53, 0x0007);
ili9320_WriteReg(LCD_REG_54, 0x0007);
ili9320_WriteReg(LCD_REG_55, 0x0700);
ili9320_WriteReg(LCD_REG_56, 0x0700);
ili9320_WriteReg(LCD_REG_57, 0x0700);
ili9320_WriteReg(LCD_REG_60, 0x0700);
ili9320_WriteReg(LCD_REG_61, 0x1F00);
/* Set GRAM area ---------------------------------------------------------*/
ili9320_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
ili9320_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */
ili9320_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
ili9320_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */
ili9320_WriteReg(LCD_REG_96, 0x2700); /* Gate Scan Line */
ili9320_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
ili9320_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */
/* Partial Display Control -----------------------------------------------*/
ili9320_WriteReg(LCD_REG_128, 0x0000);
ili9320_WriteReg(LCD_REG_129, 0x0000);
ili9320_WriteReg(LCD_REG_130, 0x0000);
ili9320_WriteReg(LCD_REG_131, 0x0000);
ili9320_WriteReg(LCD_REG_132, 0x0000);
ili9320_WriteReg(LCD_REG_133, 0x0000);
/* Panel Control ---------------------------------------------------------*/
ili9320_WriteReg(LCD_REG_144, 0x0010);
ili9320_WriteReg(LCD_REG_146, 0x0000);
ili9320_WriteReg(LCD_REG_147, 0x0003);
ili9320_WriteReg(LCD_REG_149, 0x0110);
ili9320_WriteReg(LCD_REG_151, 0x0000);
ili9320_WriteReg(LCD_REG_152, 0x0000);
/* Set GRAM write direction and BGR = 1 */
/* I/D=01 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9320_WriteReg(LCD_REG_3, 0x1018);
ili9320_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */
}
/* Set the Cursor */
ili9320_SetCursor(0, 0);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
}
/**
* @brief Enables the Display.
* @param None
* @retval None
*/
void ili9320_DisplayOn(void)
{
/* Power On sequence ---------------------------------------------------------*/
ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
ili9320_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9320_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9320_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
ili9320_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
ili9320_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
/* Display On */
ili9320_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */
}
/**
* @brief Disables the Display.
* @param None
* @retval None
*/
void ili9320_DisplayOff(void)
{
/* Power Off sequence ---------------------------------------------------------*/
ili9320_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9320_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9320_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9320_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
ili9320_WriteReg(LCD_REG_41, 0x0000); /* VCM[4:0] for VCOMH */
/* Display Off */
ili9320_WriteReg(LCD_REG_7, 0x0);
}
/**
* @brief Get the LCD pixel Width.
* @param None
* @retval The Lcd Pixel Width
*/
uint16_t ili9320_GetLcdPixelWidth(void)
{
return (uint16_t)320;
}
/**
* @brief Get the LCD pixel Height.
* @param None
* @retval The Lcd Pixel Height
*/
uint16_t ili9320_GetLcdPixelHeight(void)
{
return (uint16_t)240;
}
/**
* @brief Get the ILI9320 ID.
* @param None
* @retval The ILI9320 ID
*/
uint16_t ili9320_ReadID(void)
{
if(Is_ili9320_Initialized == 0)
{
ili9320_Init();
}
return (ili9320_ReadReg(0x00));
}
/**
* @brief Set Cursor position.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @retval None
*/
void ili9320_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
ili9320_WriteReg(LCD_REG_32, Ypos);
ili9320_WriteReg(LCD_REG_33, (ILI9320_LCD_PIXEL_WIDTH - 1 - Xpos));
}
/**
* @brief Write pixel.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param RGBCode: the RGB pixel color
* @retval None
*/
void ili9320_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
}
/**
* @brief Read pixel.
* @param None
* @retval the RGB pixel color
*/
uint16_t ili9320_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Dummy read */
LCD_IO_ReadData(0x00);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(0x00));
}
/**
* @brief Writes to the selected LCD register.
* @param LCDReg: address of the selected register.
* @param LCDRegValue: value to write to the selected register.
* @retval None
*/
void ili9320_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
{
LCD_IO_WriteReg(LCDReg);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
}
/**
* @brief Reads the selected LCD Register.
* @param LCDReg: address of the selected register.
* @retval LCD Register Value.
*/
uint16_t ili9320_ReadReg(uint8_t LCDReg)
{
/* Write 16-bit Index (then Read Reg) */
LCD_IO_WriteReg(LCDReg);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(0x00));
}
/**
* @brief Sets a display window
* @param Xpos: specifies the X bottom left position.
* @param Ypos: specifies the Y bottom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void ili9320_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
/* Horizontal GRAM Start Address */
ili9320_WriteReg(LCD_REG_80, (Ypos));
/* Horizontal GRAM End Address */
ili9320_WriteReg(LCD_REG_81, (Ypos + Height - 1));
/* Vertical GRAM Start Address */
ili9320_WriteReg(LCD_REG_82, ILI9320_LCD_PIXEL_WIDTH - Xpos - Width);
/* Vertical GRAM End Address */
ili9320_WriteReg(LCD_REG_83, ILI9320_LCD_PIXEL_WIDTH - Xpos - 1);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void ili9320_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Sent a complete line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void ili9320_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9320_WriteReg(LCD_REG_3, 0x1010);
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Fill a complete vertical line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9320_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @brief Displays a bitmap picture..
* @param BmpAddress: Bmp picture address.
* @param Xpos: Bmp X position in the LCD
* @param Ypos: Bmp Y position in the LCD
* @retval None
*/
void ili9320_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
{
uint32_t index = 0, size = 0;
/* Read bitmap size */
size = *(volatile uint16_t *) (pbmp + 2);
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
/* Get bitmap data address offset */
index = *(volatile uint16_t *) (pbmp + 10);
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
size = (size - index)/2;
pbmp += index;
/* Set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : decrement, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9320_WriteReg(LCD_REG_3, 0x1008);
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
/* Set GRAM write direction and BGR = 1 */
/* I/D = 01 (Horizontal : increment, Vertical : decrement) */
/* AM = 1 (address is updated in vertical writing direction) */
ili9320_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @brief Displays picture..
* @param pdata: picture address.
* @param Xpos: Image X position in the LCD
* @param Ypos: Image Y position in the LCD
* @param Xsize: Image X size in the LCD
* @param Ysize: Image Y size in the LCD
* @retval None
*/
void ili9320_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
{
uint32_t size = 0;
size = (Xsize * Ysize);
/* Set Cursor */
ili9320_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pdata, size*2);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,256 +0,0 @@
/**
******************************************************************************
* @file ili9320.h
* @author MCD Application Team
* @version V1.2.2
* @date 02-December-2014
* @brief This file contains all the functions prototypes for the ili9320.c
* driver.
******************************************************************************
* @attention
*
* <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 __ILI9320_H
#define __ILI9320_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup ili9320
* @{
*/
/** @defgroup ILI9320_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup ILI9320_Exported_Constants
* @{
*/
/**
* @brief ILI9320 ID
*/
#define ILI9320_ID 0x9320
/**
* @brief ILI9320 Size
*/
#define ILI9320_LCD_PIXEL_WIDTH ((uint16_t)320)
#define ILI9320_LCD_PIXEL_HEIGHT ((uint16_t)240)
/**
* @brief ILI9320 Registers
*/
#define LCD_REG_0 0x00
#define LCD_REG_1 0x01
#define LCD_REG_2 0x02
#define LCD_REG_3 0x03
#define LCD_REG_4 0x04
#define LCD_REG_5 0x05
#define LCD_REG_6 0x06
#define LCD_REG_7 0x07
#define LCD_REG_8 0x08
#define LCD_REG_9 0x09
#define LCD_REG_10 0x0A
#define LCD_REG_12 0x0C
#define LCD_REG_13 0x0D
#define LCD_REG_14 0x0E
#define LCD_REG_15 0x0F
#define LCD_REG_16 0x10
#define LCD_REG_17 0x11
#define LCD_REG_18 0x12
#define LCD_REG_19 0x13
#define LCD_REG_20 0x14
#define LCD_REG_21 0x15
#define LCD_REG_22 0x16
#define LCD_REG_23 0x17
#define LCD_REG_24 0x18
#define LCD_REG_25 0x19
#define LCD_REG_26 0x1A
#define LCD_REG_27 0x1B
#define LCD_REG_28 0x1C
#define LCD_REG_29 0x1D
#define LCD_REG_30 0x1E
#define LCD_REG_31 0x1F
#define LCD_REG_32 0x20
#define LCD_REG_33 0x21
#define LCD_REG_34 0x22
#define LCD_REG_36 0x24
#define LCD_REG_37 0x25
#define LCD_REG_40 0x28
#define LCD_REG_41 0x29
#define LCD_REG_43 0x2B
#define LCD_REG_45 0x2D
#define LCD_REG_48 0x30
#define LCD_REG_49 0x31
#define LCD_REG_50 0x32
#define LCD_REG_51 0x33
#define LCD_REG_52 0x34
#define LCD_REG_53 0x35
#define LCD_REG_54 0x36
#define LCD_REG_55 0x37
#define LCD_REG_56 0x38
#define LCD_REG_57 0x39
#define LCD_REG_58 0x3A
#define LCD_REG_59 0x3B
#define LCD_REG_60 0x3C
#define LCD_REG_61 0x3D
#define LCD_REG_62 0x3E
#define LCD_REG_63 0x3F
#define LCD_REG_64 0x40
#define LCD_REG_65 0x41
#define LCD_REG_66 0x42
#define LCD_REG_67 0x43
#define LCD_REG_68 0x44
#define LCD_REG_69 0x45
#define LCD_REG_70 0x46
#define LCD_REG_71 0x47
#define LCD_REG_72 0x48
#define LCD_REG_73 0x49
#define LCD_REG_74 0x4A
#define LCD_REG_75 0x4B
#define LCD_REG_76 0x4C
#define LCD_REG_77 0x4D
#define LCD_REG_78 0x4E
#define LCD_REG_79 0x4F
#define LCD_REG_80 0x50
#define LCD_REG_81 0x51
#define LCD_REG_82 0x52
#define LCD_REG_83 0x53
#define LCD_REG_96 0x60
#define LCD_REG_97 0x61
#define LCD_REG_106 0x6A
#define LCD_REG_118 0x76
#define LCD_REG_128 0x80
#define LCD_REG_129 0x81
#define LCD_REG_130 0x82
#define LCD_REG_131 0x83
#define LCD_REG_132 0x84
#define LCD_REG_133 0x85
#define LCD_REG_134 0x86
#define LCD_REG_135 0x87
#define LCD_REG_136 0x88
#define LCD_REG_137 0x89
#define LCD_REG_139 0x8B
#define LCD_REG_140 0x8C
#define LCD_REG_141 0x8D
#define LCD_REG_143 0x8F
#define LCD_REG_144 0x90
#define LCD_REG_145 0x91
#define LCD_REG_146 0x92
#define LCD_REG_147 0x93
#define LCD_REG_148 0x94
#define LCD_REG_149 0x95
#define LCD_REG_150 0x96
#define LCD_REG_151 0x97
#define LCD_REG_152 0x98
#define LCD_REG_153 0x99
#define LCD_REG_154 0x9A
#define LCD_REG_157 0x9D
#define LCD_REG_192 0xC0
#define LCD_REG_193 0xC1
#define LCD_REG_229 0xE5
/**
* @}
*/
/** @defgroup ILI9320_Exported_Functions
* @{
*/
void ili9320_Init(void);
uint16_t ili9320_ReadID(void);
void ili9320_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
uint16_t ili9320_ReadReg(uint8_t LCDReg);
void ili9320_DisplayOn(void);
void ili9320_DisplayOff(void);
void ili9320_SetCursor(uint16_t Xpos, uint16_t Ypos);
void ili9320_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGB_Code);
uint16_t ili9320_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void ili9320_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void ili9320_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void ili9320_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
void ili9320_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata);
void ili9320_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
uint16_t ili9320_GetLcdPixelWidth(void);
uint16_t ili9320_GetLcdPixelHeight(void);
/* LCD driver structure */
extern LCD_DrvTypeDef ili9320_drv;
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t Reg);
uint16_t LCD_IO_ReadData(uint16_t Reg);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __ILI9320_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 29e24e2114f926b04f29b576311a575a5a4e34b2

View File

@ -1,756 +0,0 @@
<!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
2016 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;">V1.2.3 / 03-May-2016 <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;">ili9325.c: alignment with&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">BSP</span><span style="font-size: 10pt; font-family: Verdana;"> </span><span style="font-size: 10pt; font-family: Verdana;">STM32446E_EVAL&nbsp; V1.1.2 and BSP STM324xG_EVAL V2.2.2</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update&nbsp;ili9325_ReadPixel() and ili9325_ReadReg() to support the new LCD_IO_ReadData() API</span><br><span style="font-size: 10pt; font-family: Arial; color: white;"></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.2.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;">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: 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.2.1 / 10-November-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Official Final Release for LCD Controllers harmonization<br>&nbsp; &nbsp; &nbsp;Replace LCD_IO_WriteData() by LCD_IO_WriteMultipleData() to be compliant with SPI interface <br>&nbsp; &nbsp; &nbsp;Warning : break compatibility with old BSP common files - done for STM3210C-EVAL board&nbsp;</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 / 5-September-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Final Official Release for LCD Controller harmonization</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.0 / 11-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>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;"></span>
<span style="font-size: 10pt; font-family: Verdana;">&nbsp; &nbsp; &nbsp;Beta Release to change the usage of LCD_IO_ReadData</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 / 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;">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: 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><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;"><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>

View File

@ -1,518 +0,0 @@
/**
******************************************************************************
* @file ili9325.c
* @author MCD Application Team
* @version V1.2.3
* @date 03-May-2016
* @brief This file includes the LCD driver for ILI9325 LCD.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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,
};
static uint16_t ArrayRGB[320] = {0};
/**
* @}
*/
/** @defgroup ILI9325_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup ILI9325_Private_Functions
* @{
*/
/**
* @brief Initialize the ILI9325 LCD Component.
* @param None
* @retval None
*/
void ili9325_Init(void)
{
/* Initialize ILI9325 low level bus layer ----------------------------------*/
LCD_IO_Init();
/* Start Initial Sequence --------------------------------------------------*/
ili9325_WriteReg(LCD_REG_0, 0x0001); /* Start internal OSC. */
ili9325_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
ili9325_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
ili9325_WriteReg(LCD_REG_3, 0x1018); /* Set GRAM write direction and BGR=1. */
ili9325_WriteReg(LCD_REG_4, 0x0000); /* Resize register */
ili9325_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
ili9325_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
ili9325_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */
ili9325_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */
ili9325_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */
ili9325_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */
/* Power On sequence -------------------------------------------------------*/
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
ili9325_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
ili9325_WriteReg(LCD_REG_33, 0x0000); /* GRAM Vertical Address */
/* Adjust the Gamma Curve (ILI9325) ----------------------------------------*/
ili9325_WriteReg(LCD_REG_48, 0x0007);
ili9325_WriteReg(LCD_REG_49, 0x0302);
ili9325_WriteReg(LCD_REG_50, 0x0105);
ili9325_WriteReg(LCD_REG_53, 0x0206);
ili9325_WriteReg(LCD_REG_54, 0x0808);
ili9325_WriteReg(LCD_REG_55, 0x0206);
ili9325_WriteReg(LCD_REG_56, 0x0504);
ili9325_WriteReg(LCD_REG_57, 0x0007);
ili9325_WriteReg(LCD_REG_60, 0x0105);
ili9325_WriteReg(LCD_REG_61, 0x0808);
/* Set GRAM area -----------------------------------------------------------*/
ili9325_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
ili9325_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */
ili9325_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
ili9325_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */
ili9325_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line(GS=1, scan direction is G320~G1) */
ili9325_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
ili9325_WriteReg(LCD_REG_106, 0x0000); /* set scrolling line */
/* Partial Display Control -------------------------------------------------*/
ili9325_WriteReg(LCD_REG_128, 0x0000);
ili9325_WriteReg(LCD_REG_129, 0x0000);
ili9325_WriteReg(LCD_REG_130, 0x0000);
ili9325_WriteReg(LCD_REG_131, 0x0000);
ili9325_WriteReg(LCD_REG_132, 0x0000);
ili9325_WriteReg(LCD_REG_133, 0x0000);
/* Panel Control -----------------------------------------------------------*/
ili9325_WriteReg(LCD_REG_144, 0x0010);
ili9325_WriteReg(LCD_REG_146, 0x0000);
ili9325_WriteReg(LCD_REG_147, 0x0003);
ili9325_WriteReg(LCD_REG_149, 0x0110);
ili9325_WriteReg(LCD_REG_151, 0x0000);
ili9325_WriteReg(LCD_REG_152, 0x0000);
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9325_WriteReg(LCD_REG_3, 0x1018);
/* 262K color and display ON */
ili9325_WriteReg(LCD_REG_7, 0x0173);
/* Set the Cursor */
ili9325_SetCursor(0, 0);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
}
/**
* @brief Enables the Display.
* @param None
* @retval None
*/
void ili9325_DisplayOn(void)
{
/* Power On sequence -------------------------------------------------------*/
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
ili9325_WriteReg(LCD_REG_16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9325_WriteReg(LCD_REG_17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9325_WriteReg(LCD_REG_18, 0x0139); /* VREG1OUT voltage */
ili9325_WriteReg(LCD_REG_19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
ili9325_WriteReg(LCD_REG_41, 0x0013); /* VCM[4:0] for VCOMH */
/* Display On */
ili9325_WriteReg(LCD_REG_7, 0x0173); /* 262K color and display ON */
}
/**
* @brief Disables the Display.
* @param None
* @retval None
*/
void ili9325_DisplayOff(void)
{
/* Power Off sequence ------------------------------------------------------*/
ili9325_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
ili9325_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
ili9325_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
ili9325_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude*/
ili9325_WriteReg(LCD_REG_41, 0x0000); /* VCM[4:0] for VCOMH */
/* Display Off */
ili9325_WriteReg(LCD_REG_7, 0x0);
}
/**
* @brief Get the LCD pixel Width.
* @param None
* @retval The Lcd Pixel Width
*/
uint16_t ili9325_GetLcdPixelWidth(void)
{
return (uint16_t)320;
}
/**
* @brief Get the LCD pixel Height.
* @param None
* @retval The Lcd Pixel Height
*/
uint16_t ili9325_GetLcdPixelHeight(void)
{
return (uint16_t)240;
}
/**
* @brief Get the ILI9325 ID.
* @param None
* @retval The ILI9325 ID
*/
uint16_t ili9325_ReadID(void)
{
LCD_IO_Init();
return (ili9325_ReadReg(0x00));
}
/**
* @brief Set Cursor position.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @retval None
*/
void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
ili9325_WriteReg(LCD_REG_32, Ypos);
ili9325_WriteReg(LCD_REG_33, (ILI9325_LCD_PIXEL_WIDTH - 1 - Xpos));
}
/**
* @brief Write pixel.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param RGBCode: the RGB pixel color
* @retval None
*/
void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
}
/**
* @brief Read pixel.
* @param None
* @retval The RGB pixel color
*/
uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCD_REG_34));
}
/**
* @brief Writes to the selected LCD register.
* @param LCDReg: Address of the selected register.
* @param LCDRegValue: Value to write to the selected register.
* @retval None
*/
void ili9325_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
{
LCD_IO_WriteReg(LCDReg);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
}
/**
* @brief Reads the selected LCD Register.
* @param LCDReg: address of the selected register.
* @retval LCD Register Value.
*/
uint16_t ili9325_ReadReg(uint8_t LCDReg)
{
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCDReg));
}
/**
* @brief Sets a display window
* @param Xpos: specifies the X bottom left position.
* @param Ypos: specifies the Y bottom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
/* Horizontal GRAM Start Address */
ili9325_WriteReg(LCD_REG_80, (Ypos));
/* Horizontal GRAM End Address */
ili9325_WriteReg(LCD_REG_81, (Ypos + Height - 1));
/* Vertical GRAM Start Address */
ili9325_WriteReg(LCD_REG_82, ILI9325_LCD_PIXEL_WIDTH - Xpos - Width);
/* Vertical GRAM End Address */
ili9325_WriteReg(LCD_REG_83, ILI9325_LCD_PIXEL_WIDTH - Xpos - 1);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Sent a complete line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9325_WriteReg(LCD_REG_3, 0x1010);
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Fill a complete vertical line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9325_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @brief Displays a bitmap picture.
* @param BmpAddress: Bmp picture address.
* @param Xpos: Bmp X position in the LCD
* @param Ypos: Bmp Y position in the LCD
* @retval None
*/
void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
{
uint32_t index = 0, size = 0;
/* Read bitmap size */
size = *(volatile uint16_t *) (pbmp + 2);
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
/* Get bitmap data address offset */
index = *(volatile uint16_t *) (pbmp + 10);
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
size = (size - index)/2;
pbmp += index;
/* Set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : decrement, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
ili9325_WriteReg(LCD_REG_3, 0x1008);
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
/* Set GRAM write direction and BGR = 1 */
/* I/D = 01 (Horizontal : increment, Vertical : decrement) */
/* AM = 1 (address is updated in vertical writing direction) */
ili9325_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @brief Displays picture.
* @param pdata: picture address.
* @param Xpos: Image X position in the LCD
* @param Ypos: Image Y position in the LCD
* @param Xsize: Image X size in the LCD
* @param Ysize: Image Y size in the LCD
* @retval None
*/
void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
{
uint32_t size = 0;
size = (Xsize * Ysize);
/* Set Cursor */
ili9325_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pdata, size*2);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,256 +0,0 @@
/**
******************************************************************************
* @file ili9325.h
* @author MCD Application Team
* @version V1.2.3
* @date 04-May-2016
* @brief This file contains all the functions prototypes for the ili9325.c
* driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 LCDReg, uint16_t LCDRegValue);
uint16_t ili9325_ReadReg(uint8_t LCDReg);
void ili9325_DisplayOn(void);
void ili9325_DisplayOff(void);
void ili9325_SetCursor(uint16_t Xpos, uint16_t Ypos);
void ili9325_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
uint16_t ili9325_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void ili9325_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void ili9325_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void ili9325_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
void ili9325_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata);
void ili9325_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
uint16_t ili9325_GetLcdPixelWidth(void);
uint16_t ili9325_GetLcdPixelHeight(void);
/* LCD driver structure */
extern LCD_DrvTypeDef ili9325_drv;
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t Reg);
uint16_t LCD_IO_ReadData(uint16_t Reg);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __ILI9325_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 39e195f3f5013f09b9610c752d9a7ddb8f4339c8

View File

@ -1,510 +0,0 @@
<!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>

View File

@ -1,423 +0,0 @@
/**
******************************************************************************
* @file lis302dl.c
* @author MCD Application Team
* @version V2.0.0
* @date 03-August-2015
* @brief This file provides a set of functions needed to manage the LIS302DL
* MEMS accelerometer.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,720 +0,0 @@
/**
******************************************************************************
* @file lis302dl.h
* @author MCD Application Team
* @version V2.0.0
* @date 03-August-2015
* @brief This file contains all the functions prototypes for the lis302dl.c
* firmware driver.
******************************************************************************
* @attention
*
* <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****/

@ -0,0 +1 @@
Subproject commit 0d42749f086108e82aef4401e1cccc7f2da4d552

View File

@ -1,178 +0,0 @@
<!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 SPFD5408 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 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.1.1
/ 26-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>
<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;">spfd5408.h</span><span style="font-size: 11pt; font-family: &quot;Calibri&quot;,&quot;sans-serif&quot;;">: change "\" by "/" in the include
path to fix compilation issues under Linux</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><h3 style="background: rgb(51, 102, 255) none repeat scroll 0% 50%; width: 180px; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; margin-right: 500pt;"><span style="font-family: Arial; color: white; font-size: 10pt;">V1.1.0 / 11-July-2014
<o:p></o:p></span></h3>
<p style="margin: 4.5pt 0cm 4.5pt 18pt;" class="MsoNormal"><b><u><span style="font-family: Verdana; color: black; font-size: 10pt;">Main
Changes<o:p></o:p></span></u></b></p><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana; font-size: 10pt;"></span>
<ul style="list-style-type: square;"><li><span style="font-family: Verdana; font-size: 10pt;"></span><span style="font-family: Verdana;"></span><span style="font-family: Verdana; font-size: 10pt;">Beta release of
SPFD5408</span><span style="font-family: Verdana; font-size: 10pt;"> LCD
Component</span><span style="font-family: Verdana; font-size: 10pt;"> driver in
order to harmonize all LCD controllers Link usage (Change LCD_IO_WriteData to
LCD_IO_WriteMultipleData) </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
/ 06-May-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;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">SPFD5408 LCD 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 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>

View File

@ -1,496 +0,0 @@
/**
******************************************************************************
* @file spfd5408.c
* @author MCD Application Team
* @version V1.1.1
* @date 26-November-2014
* @brief This file includes the LCD driver for SPFD5408 LCD.
******************************************************************************
* @attention
*
* <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 "spfd5408.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup SPFD5408
* @brief This file provides a set of functions needed to drive the
* SPFD5408 LCD.
* @{
*/
/** @defgroup SPFD5408_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup SPFD5408_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup SPFD5408_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup SPFD5408_Private_Variables
* @{
*/
LCD_DrvTypeDef spfd5408_drv =
{
spfd5408_Init,
spfd5408_ReadID,
spfd5408_DisplayOn,
spfd5408_DisplayOff,
spfd5408_SetCursor,
spfd5408_WritePixel,
spfd5408_ReadPixel,
spfd5408_SetDisplayWindow,
spfd5408_DrawHLine,
spfd5408_DrawVLine,
spfd5408_GetLcdPixelWidth,
spfd5408_GetLcdPixelHeight,
spfd5408_DrawBitmap,
};
static uint8_t Is_spfd5408_Initialized = 0;
static uint16_t ArrayRGB[320] = {0};
/**
* @}
*/
/** @defgroup SPFD5408_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup SPFD5408_Private_Functions
* @{
*/
/**
* @brief Initialise the SPFD5408 LCD Component.
* @param None
* @retval None
*/
void spfd5408_Init(void)
{
if(Is_spfd5408_Initialized == 0)
{
Is_spfd5408_Initialized = 1;
/* Initialise SPFD5408 low level bus layer --------------------------------*/
LCD_IO_Init();
/* Start Initial Sequence --------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_227, 0x3008); /* Set internal timing */
spfd5408_WriteReg(LCD_REG_231, 0x0012); /* Set internal timing */
spfd5408_WriteReg(LCD_REG_239, 0x1231); /* Set internal timing */
spfd5408_WriteReg(LCD_REG_1, 0x0100); /* Set SS and SM bit */
spfd5408_WriteReg(LCD_REG_2, 0x0700); /* Set 1 line inversion */
spfd5408_WriteReg(LCD_REG_3, 0x1030); /* Set GRAM write direction and BGR=1. */
spfd5408_WriteReg(LCD_REG_4, 0x0000); /* Resize register */
spfd5408_WriteReg(LCD_REG_8, 0x0202); /* Set the back porch and front porch */
spfd5408_WriteReg(LCD_REG_9, 0x0000); /* Set non-display area refresh cycle ISC[3:0] */
spfd5408_WriteReg(LCD_REG_10, 0x0000); /* FMARK function */
spfd5408_WriteReg(LCD_REG_12, 0x0000); /* RGB interface setting */
spfd5408_WriteReg(LCD_REG_13, 0x0000); /* Frame marker Position */
spfd5408_WriteReg(LCD_REG_15, 0x0000); /* RGB interface polarity */
/* Power On sequence -------------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
spfd5408_WriteReg(LCD_REG_17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
spfd5408_WriteReg(LCD_REG_18, 0x0000); /* VREG1OUT voltage */
spfd5408_WriteReg(LCD_REG_19, 0x0000); /* VDV[4:0] for VCOM amplitude */
LCD_Delay(200); /* Dis-charge capacitor power voltage (200ms) */
spfd5408_WriteReg(LCD_REG_17, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */
LCD_Delay(50); /* Delay 50 ms */
spfd5408_WriteReg(LCD_REG_16, 0x12B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
LCD_Delay(50); /* Delay 50 ms */
spfd5408_WriteReg(LCD_REG_18, 0x01BD); /* External reference voltage= Vci */
LCD_Delay(50); /* Delay 50 ms */
spfd5408_WriteReg(LCD_REG_19, 0x1400); /* VDV[4:0] for VCOM amplitude */
spfd5408_WriteReg(LCD_REG_41, 0x000E); /* VCM[4:0] for VCOMH */
LCD_Delay(50); /* Delay 50 ms */
spfd5408_WriteReg(LCD_REG_32, 0x0000); /* GRAM horizontal Address */
spfd5408_WriteReg(LCD_REG_33, 0x013F); /* GRAM Vertical Address */
/* Adjust the Gamma Curve --------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_48, 0x0007);
spfd5408_WriteReg(LCD_REG_49, 0x0302);
spfd5408_WriteReg(LCD_REG_50, 0x0105);
spfd5408_WriteReg(LCD_REG_53, 0x0206);
spfd5408_WriteReg(LCD_REG_54, 0x0808);
spfd5408_WriteReg(LCD_REG_55, 0x0206);
spfd5408_WriteReg(LCD_REG_56, 0x0504);
spfd5408_WriteReg(LCD_REG_57, 0x0007);
spfd5408_WriteReg(LCD_REG_60, 0x0105);
spfd5408_WriteReg(LCD_REG_61, 0x0808);
/* Set GRAM area -----------------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_80, 0x0000); /* Horizontal GRAM Start Address */
spfd5408_WriteReg(LCD_REG_81, 0x00EF); /* Horizontal GRAM End Address */
spfd5408_WriteReg(LCD_REG_82, 0x0000); /* Vertical GRAM Start Address */
spfd5408_WriteReg(LCD_REG_83, 0x013F); /* Vertical GRAM End Address */
spfd5408_WriteReg(LCD_REG_96, 0xA700); /* Gate Scan Line */
spfd5408_WriteReg(LCD_REG_97, 0x0001); /* NDL,VLE, REV */
spfd5408_WriteReg(LCD_REG_106, 0x0000); /* Set scrolling line */
/* Partial Display Control -------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_128, 0x0000);
spfd5408_WriteReg(LCD_REG_129, 0x0000);
spfd5408_WriteReg(LCD_REG_130, 0x0000);
spfd5408_WriteReg(LCD_REG_131, 0x0000);
spfd5408_WriteReg(LCD_REG_132, 0x0000);
spfd5408_WriteReg(LCD_REG_133, 0x0000);
/* Panel Control -----------------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_144, 0x0010);
spfd5408_WriteReg(LCD_REG_146, 0x0000);
spfd5408_WriteReg(LCD_REG_147, 0x0003);
spfd5408_WriteReg(LCD_REG_149, 0x0110);
spfd5408_WriteReg(LCD_REG_151, 0x0000);
spfd5408_WriteReg(LCD_REG_152, 0x0000);
/* Set GRAM write direction and BGR = 1
I/D=01 (Horizontal : increment, Vertical : decrement)
AM=1 (address is updated in vertical writing direction) */
spfd5408_WriteReg(LCD_REG_3, 0x1018);
spfd5408_WriteReg(LCD_REG_7, 0x0112); /* 262K color and display ON */
}
/* Set the Cursor */
spfd5408_SetCursor(0, 0);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
}
/**
* @brief Enables the Display.
* @param None
* @retval None
*/
void spfd5408_DisplayOn(void)
{
/* Power On sequence ---------------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
spfd5408_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
spfd5408_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
spfd5408_WriteReg(LCD_REG_31,0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
LCD_Delay(10);
/* 262k/65k color selection */
spfd5408_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
/* SET PANEL */
spfd5408_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display On */
spfd5408_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
spfd5408_WriteReg(LCD_REG_40, 0x3C);
}
/**
* @brief Disables the Display.
* @param None
* @retval None
*/
void spfd5408_DisplayOff(void)
{
/* Power Off sequence ---------------------------------------------------------*/
spfd5408_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */
spfd5408_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */
spfd5408_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */
spfd5408_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */
spfd5408_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
spfd5408_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
/* Display Off */
spfd5408_WriteReg(LCD_REG_40, 0x38);
LCD_Delay(60);
spfd5408_WriteReg(LCD_REG_40, 0x04);
}
/**
* @brief Get the LCD pixel Width.
* @param None
* @retval The Lcd Pixel Width
*/
uint16_t spfd5408_GetLcdPixelWidth(void)
{
return (uint16_t)SPFD5408_LCD_PIXEL_WIDTH;
}
/**
* @brief Get the LCD pixel Height.
* @param None
* @retval The Lcd Pixel Height
*/
uint16_t spfd5408_GetLcdPixelHeight(void)
{
return (uint16_t)SPFD5408_LCD_PIXEL_HEIGHT;
}
/**
* @brief Get the SPFD5408 ID.
* @param None
* @retval The SPFD5408 ID
*/
uint16_t spfd5408_ReadID(void)
{
LCD_IO_Init();
return (spfd5408_ReadReg(0x00));
}
/**
* @brief Set Cursor position.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @retval None
*/
void spfd5408_SetCursor(uint16_t Xpos, uint16_t Ypos)
{
spfd5408_WriteReg(LCD_REG_32, Xpos);
spfd5408_WriteReg(LCD_REG_33, 319-Ypos);
}
/**
* @brief Write pixel.
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param RGBCode: the RGB pixel color
* @retval None
*/
void spfd5408_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
/* Set Cursor */
spfd5408_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
}
/**
* @brief Read pixel.
* @param None
* @retval the RGB pixel color
*/
uint16_t spfd5408_ReadPixel(uint16_t Xpos, uint16_t Ypos)
{
/* Set Cursor */
spfd5408_SetCursor(Xpos, Ypos);
/* Dummy read */
LCD_IO_ReadData(LCD_REG_34);
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCD_REG_34));
}
/**
* @brief Writes to the selected LCD register.
* @param LCDReg: address of the selected register.
* @param LCDRegValue: value to write to the selected register.
* @retval None
*/
void spfd5408_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
{
LCD_IO_WriteReg(LCDReg);
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
}
/**
* @brief Reads the selected LCD Register.
* @param LCDReg: address of the selected register.
* @retval LCD Register Value.
*/
uint16_t spfd5408_ReadReg(uint8_t LCDReg)
{
/* Read 16-bit Reg */
return (LCD_IO_ReadData(LCDReg));
}
/**
* @brief Sets a display window
* @param Xpos: specifies the X bottom left position.
* @param Ypos: specifies the Y bottom left position.
* @param Height: display window height.
* @param Width: display window width.
* @retval None
*/
void spfd5408_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
{
/* Horizontal GRAM Start Address */
spfd5408_WriteReg(LCD_REG_80, Xpos);
/* Horizontal GRAM End Address */
spfd5408_WriteReg(LCD_REG_81, Xpos + Height - 1);
/* Vertical GRAM Start Address */
spfd5408_WriteReg(LCD_REG_82, (SPFD5408_LCD_PIXEL_WIDTH - Ypos - Width));
/* Vertical GRAM End Address */
spfd5408_WriteReg(LCD_REG_83, (SPFD5408_LCD_PIXEL_WIDTH - Ypos - 1));
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void spfd5408_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint32_t i = 0;
/* Set Cursor */
spfd5408_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Sent a complete line */
for(i = 0; i < Length; i++)
{
ArrayRGB[i] = RGBCode;
}
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
}
/**
* @brief Draw vertical line.
* @param RGBCode: Specifies the RGB color
* @param Xpos: specifies the X position.
* @param Ypos: specifies the Y position.
* @param Length: specifies the Line length.
* @retval None
*/
void spfd5408_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
{
uint16_t counter = 0;
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
spfd5408_WriteReg(LCD_REG_3, 0x1010);
/* Set Cursor */
spfd5408_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
/* Fill a complete vertical line */
for(counter = 0; counter < Length; counter++)
{
ArrayRGB[counter] = RGBCode;
}
/* Write 16-bit GRAM Reg */
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
/* set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
spfd5408_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @brief Displays a bitmap picture loaded in the internal Flash.
* @param BmpAddress: Bmp picture address in the internal Flash.
* @retval None
*/
void spfd5408_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
{
uint32_t index = 0, size = 0;
/* Read bitmap size */
size = *(volatile uint16_t *) (pbmp + 2);
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
/* Get bitmap data address offset */
index = *(volatile uint16_t *) (pbmp + 10);
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
size = (size - index)/2;
pbmp += index;
/* Set GRAM write direction and BGR = 1 */
/* I/D=00 (Horizontal : decrement, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
spfd5408_WriteReg(LCD_REG_3, 0x1008);
/* Set Cursor */
spfd5408_SetCursor(Xpos, Ypos);
/* Prepare to write GRAM */
LCD_IO_WriteReg(LCD_REG_34);
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
/* Set GRAM write direction and BGR = 1 */
/* I/D = 01 (Horizontal : increment, Vertical : decrement) */
/* AM = 1 (address is updated in vertical writing direction) */
spfd5408_WriteReg(LCD_REG_3, 0x1018);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,278 +0,0 @@
/**
******************************************************************************
* @file spfd5408.h
* @author MCD Application Team
* @version V1.1.1
* @date 26-November-2014
* @brief This file contains all the functions prototypes for the spfd5408.c
* driver.
******************************************************************************
* @attention
*
* <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 __SPFD5408_H
#define __SPFD5408_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/lcd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup SPFD5408
* @{
*/
/** @defgroup SPFD5408_Exported_Types
* @{
*/
/**
* @}
*/
/** @defgroup SPFD5408_Exported_Constants
* @{
*/
/**
* @brief SPFD5408 ID
*/
#define SPFD5408_ID 0x5408
/**
* @brief SPFD5408 Size
*/
#define SPFD5408_LCD_PIXEL_WIDTH ((uint16_t)320)
#define SPFD5408_LCD_PIXEL_HEIGHT ((uint16_t)240)
/**
* @brief SPFD5408 Registers
*/
#define LCD_REG_0 0x00
#define LCD_REG_1 0x01
#define LCD_REG_2 0x02
#define LCD_REG_3 0x03
#define LCD_REG_4 0x04
#define LCD_REG_5 0x05
#define LCD_REG_6 0x06
#define LCD_REG_7 0x07
#define LCD_REG_8 0x08
#define LCD_REG_9 0x09
#define LCD_REG_10 0x0A
#define LCD_REG_12 0x0C
#define LCD_REG_13 0x0D
#define LCD_REG_14 0x0E
#define LCD_REG_15 0x0F
#define LCD_REG_16 0x10
#define LCD_REG_17 0x11
#define LCD_REG_18 0x12
#define LCD_REG_19 0x13
#define LCD_REG_20 0x14
#define LCD_REG_21 0x15
#define LCD_REG_22 0x16
#define LCD_REG_23 0x17
#define LCD_REG_24 0x18
#define LCD_REG_25 0x19
#define LCD_REG_26 0x1A
#define LCD_REG_27 0x1B
#define LCD_REG_28 0x1C
#define LCD_REG_29 0x1D
#define LCD_REG_30 0x1E
#define LCD_REG_31 0x1F
#define LCD_REG_32 0x20
#define LCD_REG_33 0x21
#define LCD_REG_34 0x22
#define LCD_REG_35 0x23
#define LCD_REG_36 0x24
#define LCD_REG_37 0x25
#define LCD_REG_39 0x27
#define LCD_REG_40 0x28
#define LCD_REG_41 0x29
#define LCD_REG_43 0x2B
#define LCD_REG_45 0x2D
#define LCD_REG_48 0x30
#define LCD_REG_49 0x31
#define LCD_REG_50 0x32
#define LCD_REG_51 0x33
#define LCD_REG_52 0x34
#define LCD_REG_53 0x35
#define LCD_REG_54 0x36
#define LCD_REG_55 0x37
#define LCD_REG_56 0x38
#define LCD_REG_57 0x39
#define LCD_REG_59 0x3B
#define LCD_REG_60 0x3C
#define LCD_REG_61 0x3D
#define LCD_REG_62 0x3E
#define LCD_REG_63 0x3F
#define LCD_REG_64 0x40
#define LCD_REG_65 0x41
#define LCD_REG_66 0x42
#define LCD_REG_67 0x43
#define LCD_REG_68 0x44
#define LCD_REG_69 0x45
#define LCD_REG_70 0x46
#define LCD_REG_71 0x47
#define LCD_REG_72 0x48
#define LCD_REG_73 0x49
#define LCD_REG_74 0x4A
#define LCD_REG_75 0x4B
#define LCD_REG_76 0x4C
#define LCD_REG_77 0x4D
#define LCD_REG_78 0x4E
#define LCD_REG_79 0x4F
#define LCD_REG_80 0x50
#define LCD_REG_81 0x51
#define LCD_REG_82 0x52
#define LCD_REG_83 0x53
#define LCD_REG_84 0x54
#define LCD_REG_85 0x55
#define LCD_REG_86 0x56
#define LCD_REG_87 0x57
#define LCD_REG_88 0x58
#define LCD_REG_89 0x59
#define LCD_REG_90 0x5A
#define LCD_REG_91 0x5B
#define LCD_REG_92 0x5C
#define LCD_REG_93 0x5D
#define LCD_REG_96 0x60
#define LCD_REG_97 0x61
#define LCD_REG_106 0x6A
#define LCD_REG_118 0x76
#define LCD_REG_128 0x80
#define LCD_REG_129 0x81
#define LCD_REG_130 0x82
#define LCD_REG_131 0x83
#define LCD_REG_132 0x84
#define LCD_REG_133 0x85
#define LCD_REG_134 0x86
#define LCD_REG_135 0x87
#define LCD_REG_136 0x88
#define LCD_REG_137 0x89
#define LCD_REG_139 0x8B
#define LCD_REG_140 0x8C
#define LCD_REG_141 0x8D
#define LCD_REG_143 0x8F
#define LCD_REG_144 0x90
#define LCD_REG_145 0x91
#define LCD_REG_146 0x92
#define LCD_REG_147 0x93
#define LCD_REG_148 0x94
#define LCD_REG_149 0x95
#define LCD_REG_150 0x96
#define LCD_REG_151 0x97
#define LCD_REG_152 0x98
#define LCD_REG_153 0x99
#define LCD_REG_154 0x9A
#define LCD_REG_157 0x9D
#define LCD_REG_192 0xC0
#define LCD_REG_193 0xC1
#define LCD_REG_227 0xE3
#define LCD_REG_229 0xE5
#define LCD_REG_231 0xE7
#define LCD_REG_239 0xEF
#define LCD_REG_232 0xE8
#define LCD_REG_233 0xE9
#define LCD_REG_234 0xEA
#define LCD_REG_235 0xEB
#define LCD_REG_236 0xEC
#define LCD_REG_237 0xED
#define LCD_REG_241 0xF1
#define LCD_REG_242 0xF2
/**
* @}
*/
/** @defgroup SPFD5408_Exported_Functions
* @{
*/
void spfd5408_Init(void);
uint16_t spfd5408_ReadID(void);
void spfd5408_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
uint16_t spfd5408_ReadReg(uint8_t LCDReg);
void spfd5408_DisplayOn(void);
void spfd5408_DisplayOff(void);
void spfd5408_SetCursor(uint16_t Xpos, uint16_t Ypos);
void spfd5408_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
uint16_t spfd5408_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void spfd5408_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void spfd5408_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void spfd5408_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
void spfd5408_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
uint16_t spfd5408_GetLcdPixelWidth(void);
uint16_t spfd5408_GetLcdPixelHeight(void);
/* LCD driver structure */
extern LCD_DrvTypeDef spfd5408_drv;
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t Reg);
uint16_t LCD_IO_ReadData(uint16_t Reg);
void LCD_Delay (uint32_t delay);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __SPFD5408_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 678861b68f4b3acf4f4afd9ef98dd6e728db781c

View File

@ -1,307 +0,0 @@
<!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>

View File

@ -1,471 +0,0 @@
/**
******************************************************************************
* @file st7735.c
* @author MCD Application Team
* @version V1.1.1
* @date 24-November-2014
* @brief This file includes the driver for ST7735 LCD mounted on the Adafruit
* 1.8" TFT LCD shield (reference ID 802).
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,214 +0,0 @@
/**
******************************************************************************
* @file st7735.h
* @author MCD Application Team
* @version V1.1.1
* @date 24-November-2014
* @brief This file contains all the functions prototypes for the st7735.c
* driver.
******************************************************************************
* @attention
*
* <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****/

@ -0,0 +1 @@
Subproject commit 683def4e7a67e98107a6f33c7694de2f4a1eb776

View File

@ -1,181 +0,0 @@
<!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 STLM75 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 STLM75 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 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.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></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;">stlm75.h: change&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">"\" by&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">"/" in the include path to fix compilation issue 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.0.0
/ 06-May-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;"></span><span style="font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">First official release of STLM75 Temperature Sensor Component driver</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"></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>

View File

@ -1,198 +0,0 @@
/**
******************************************************************************
* @file stlm75.c
* @author MCD Application Team
* @version V1.0.1
* @date 24-November-2014
* @brief This file provides a set of functions needed to manage the STLM75
* Temperature Sensor.
******************************************************************************
* @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 "stlm75.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @defgroup STLM75
* @brief This file provides a set of functions needed to drive the
* STLM75 Temperature Sensor.
* @{
*/
/** @defgroup STLM75_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @defgroup STLM75_Private_Defines
* @{
*/
/**
* @}
*/
/** @defgroup STLM75_Private_Macros
* @{
*/
/**
* @}
*/
/** @defgroup STLM75_Private_Variables
* @{
*/
TSENSOR_DrvTypeDef Stlm75Drv =
{
STLM75_Init,
STLM75_IsReady,
STLM75_ReadStatus,
STLM75_ReadTemp,
};
/**
* @}
*/
/** @defgroup STLM75_Private_FunctionPrototypes
* @{
*/
/**
* @}
*/
/** @defgroup STLM75_Private_Functions
* @{
*/
/**
* @brief Set STLM75 Initialization.
* @param DeviceAddr : Device ID address.
* @param pInitStruct: pointer to a STLM75_InitTypeDef structure
* that contains the configuration setting for the STLM75.
* @retval None
*/
void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct)
{
uint8_t confreg = 0;
uint16_t tempreg = 0;
/* Set the Configuration Register */
confreg = (uint8_t)(pInitStruct->AlertMode | pInitStruct->ConversionMode);
TSENSOR_IO_Write(DeviceAddr, &confreg, LM75_REG_CONF, 1);
/* Set the Temperature Registers */
/* Keep the sign bit and shift the temperature value (as given value is integer, the 0.5 digit is not set) */
tempreg = (((pInitStruct->TemperatureLimitHigh & 0x007F) << 8) | (pInitStruct->TemperatureLimitHigh & 0x8000));
TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TOS, 2);
tempreg = (((pInitStruct->TemperatureLimitLow & 0x007F) << 8) | (pInitStruct->TemperatureLimitLow & 0x8000));
TSENSOR_IO_Write(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_THYS, 2);
}
/**
* @brief Read ID address of STLM75
* @param DeviceAddr : Device ID address.
* @param Trials: Number of trials
* @retval ID name
*/
uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials)
{
/* Configure the low level interface ---------------------------------------*/
TSENSOR_IO_Init();
/* Check is Temperature Sensor is Ready to use */
return TSENSOR_IO_IsDeviceReady(DeviceAddr, Trials);
}
/**
* @brief Read The Temperature Sensor Status
* @param DeviceAddr : Device ID address.
* @retval Status
*/
uint8_t STLM75_ReadStatus(uint16_t DeviceAddr)
{
uint8_t tmp = 0;
/* Read Status register */
TSENSOR_IO_Read(DeviceAddr, &tmp, LM75_REG_CONF, 1);
/* Return Temperature Sensor Status */
return (uint8_t)(tmp);
}
/**
* @brief Read ID address of STLM75
* @param DeviceAddr : Device ID address.
* @retval ID name
*/
uint16_t STLM75_ReadTemp(uint16_t DeviceAddr)
{
uint16_t tempreg = 0;
uint16_t tmp = 0;
/* Read Temperature registers */
TSENSOR_IO_Read(DeviceAddr, (uint8_t*)(&tempreg), LM75_REG_TEMP, 2);
tmp = ((tempreg & 0x00FF) << 8) | ((tempreg & 0xFF00) >> 8);
tempreg = (((tmp & 0x7F80) >> 7) | (tmp & 0x8000));
/* Return Temperature value */
return (tempreg);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,144 +0,0 @@
/**
******************************************************************************
* @file stlm75.h
* @author MCD Application Team
* @version V1.0.1
* @date 24-November-2014
* @brief This file contains all the functions prototypes for the stlm75.c
* temperature sensor 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 __STLM75_H
#define __STLM75_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "../Common/tsensor.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup Components
* @{
*/
/** @addtogroup STLM75
* @{
*/
/** @defgroup STLM75_Exported_Constants
* @{
*/
/******************************************************************************/
/*************************** START REGISTER MAPPING **************************/
/******************************************************************************/
/***************************** Read Access Only *******************************/
#define LM75_REG_TEMP 0x00 /*!< Temperature Register of LM75 */
/***************************** Read/Write Access ******************************/
#define LM75_REG_CONF 0x01 /*!< Configuration Register of LM75 */
#define LM75_REG_THYS 0x02 /*!< Temperature Register of LM75 */
#define LM75_REG_TOS 0x03 /*!< Over-temp Shutdown threshold Register of LM75 */
/******************************************************************************/
/**************************** END REGISTER MAPPING ***************************/
/******************************************************************************/
/** @defgroup Conversion_Mode_Selection
* @{
*/
#define STLM75_CONTINUOUS_MODE ((uint8_t)0x00)
#define STLM75_ONE_SHOT_MODE ((uint8_t)0x01)
/**
* @}
*/
/** @defgroup Operation_Mode
* @{
*/
#define STLM75_COMPARATOR_MODE ((uint8_t)0x00)
#define STLM75_INTERRUPT_MODE ((uint8_t)0x02)
/**
* @}
*/
/**
* @}
*/
/** @defgroup STLM75_Exported_Functions
* @{
*/
/* Sensor Configuration Functions */
void STLM75_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
uint8_t STLM75_IsReady(uint16_t DeviceAddr, uint32_t Trials);
/* Sensor Request Functions */
uint8_t STLM75_ReadStatus(uint16_t DeviceAddr);
uint16_t STLM75_ReadTemp(uint16_t DeviceAddr);
/* Temperature Sensor driver structure */
extern TSENSOR_DrvTypeDef Stlm75Drv;
/* Temperature Sensor IO functions */
void TSENSOR_IO_Init(void);
void TSENSOR_IO_Write(uint16_t DevAddress, uint8_t* pBuffer, uint8_t WriteAddr, uint16_t Length);
void TSENSOR_IO_Read(uint16_t DevAddress, uint8_t* pBuffer, uint8_t ReadAddr, uint16_t Length);
uint16_t TSENSOR_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STTS751_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit e99670f7266e86bf0e65dad3ce4b47660dac7a10

View File

@ -1,378 +0,0 @@
<!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>

View File

@ -1,977 +0,0 @@
/**
******************************************************************************
* @file stmpe811.c
* @author MCD Application Team
* @version V2.0.0
* @date 15-December-2014
* @brief This file provides a set of functions needed to manage the STMPE811
* IO Expander devices.
******************************************************************************
* @attention
*
* <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****/

View File

@ -1,291 +0,0 @@
/**
******************************************************************************
* @file stmpe811.h
* @author MCD Application Team
* @version V2.0.0
* @date 15-December-2014
* @brief This file contains all the functions prototypes for the
* stmpe811.c IO expander driver.
******************************************************************************
* @attention
*
* <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****/

@ -0,0 +1 @@
Subproject commit bb1cf1963243e58f4c99401e0aa28e7505298968

View File

@ -1,558 +0,0 @@
<!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 STM3210C_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 STM3210C_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
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/logo.bmp" 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;"><span style="font-size: 12pt; color: white;">Contents<o:p></o:p></span></h2>
<ol style="margin-top: 0cm;" start="1" type="1">
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#History">STM3210C_EVAL Evaluation Board Drivers
update History</a><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#License">License</a><o:p></o:p></span></li>
</ol>
<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;">STM3210C_EVAL Evaluation Board Drivers 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;">V6.1.0 / 14-April-2017 <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>
<span style="font-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;">Add STM3210C_EVAL_BSP_User_Manual.chm file</span></li><li><span style="font-family: Verdana; font-size: 10pt;">stm3210c_eval.c/.h:</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Update SPI/SD I/O low level API to support SD high capacity card (&gt; 2Gbytes)</span></li><li><span style="font-family: Verdana; font-size: 10pt;">SD_IO_Init(): remove SD pin detecting NVIC configuration</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Up to user application to configure the SD detecting pin with or without interrupt.<br></span></li></ul></ul><li><span style="font-size: 10pt; font-family: Verdana;">stm3210c</span><span style="font-family: Verdana; font-size: 10pt;">_eval_sd.c/.h:</span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update BSP SD APIs&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">to support&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">SD high capacity card (&gt; 2Gbytes)</span></li></ul><li><span style="font-size: 10pt; font-family: Verdana;">stm3210c</span><span style="font-family: Verdana; font-size: 10pt;">_eval_audio.c/.h:</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Add BSP_AUDIO_OUT_MspInit() and </span><span style="font-family: Verdana; font-size: 10pt;">BSP_AUDIO_OUT_MspDeInit()&nbsp;as weak&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">APIs to manage audio hardware resources initialization/de-initialization.</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;">V6.0.2 / 29-April-2016</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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>Add AUDIO_IO_DeInit for compatibility with comon V4.0.1.</li><li>Set the NVIC priority to the lowest possible to not interfere with user settings.</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;">V6.0.1 / 18-December-2015</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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>Rename GPIO_SPEED_HIGH to GPIO_SPEED_FREQ_HIGH for compatibility with STM32F1xx HAL Drivers V1.0.2.</li><li>Rename GPIO_SPEED_MEDIUM to GPIO_SPEED_FREQ_MEDIUM for compatibility with STM32F1xx HAL Drivers V1.0.2.</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;">V6.0.0 / 16-December-2014</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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;">Major update
based on STM32Cube specification: drivers architecture and APIs
modified vs. V5.1.0 and thus the 2 versions are not compatible.<br>
</span></li><li style="font-weight: bold;"><span style="font-size: 10pt; font-family: Verdana;">This version has to be used only with </span><span style="font-size: 10pt; font-family: Verdana;">STM32CubeF1</span><span style="font-size: 10pt; font-family: Verdana;"> based development</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V5.1.0 / 8-January-2013<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>
<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;">stm3210e_eval_lcd.c: update to support new LCD <span style="font-style: italic;">AM240320LGTNQW00H </span>(<span style="font-style: italic;">controller HX8347-D</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V5.0.1 / 05-March-2012<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>
<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;">All source files:&nbsp;license disclaimer text update and add link to the License file on ST Internet.</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;">V5.0.0 / 03-February-2012<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>
<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;"></span><span style="font-size: 10pt; font-family: Verdana;">All source files: update disclaimer to add reference to the&nbsp;new license agreement</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update STM32 Evaluation Board Drivers architecture and folder organization,&nbsp;<span style="font-weight: bold; font-style: italic;">full&nbsp;API compatibility maintained vs. V4.6.2</span></span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">All the HW&nbsp;drivers required for each board are&nbsp;provided within this board folder</span><span style="font-size: 10pt; font-family: Verdana;">. The concerned drivers are:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c\.h:</span>&nbsp;I2C M24Cxx EEPROM memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_tsensor.c\.h:</span>&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">I2C </span><span style="font-size: 10pt; font-family: Verdana;">LM75 temperature sensor driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_spi_flash.c\.h:</span> SPI M25Pxxx FLASH memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_sdio_sd.c\.h:</span> SDIO SD Card memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_spi_sd.c\.h:</span>&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">SPI SD Card memory driver&nbsp;</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">These drivers were&nbsp;moved from </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\Common</span> to </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\STM32XXX_EVAL</span> folder(s)</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\Common&nbsp;</span></span><span style="font-size: 10pt; font-family: Verdana;">folder contains only drivers for the fonts and log module used by the LCD driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval.c\.h</span> files removed, <span style="font-style: italic; text-decoration: underline;">as consequence you need to perform the following update on your project configuration&nbsp; (based on EVAL drivers V4.6.2):</span></span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">In the&nbsp;project files, add your EVAL board driver source&nbsp;file&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">"</span></span><span style="font-size: 10pt; font-family: Verdana; font-style: italic;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">_eval.c"</span>&nbsp;instead of <span style="font-style: italic;">"stm32_eval.c"</span></span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Include your EVAL board driver header file&nbsp;<span style="font-style: italic;">#include "</span></span><span style="font-size: 10pt; font-family: Verdana; font-style: italic;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">_eval.h"</span>&nbsp;instead of <span style="font-style: italic;">#include "stm32_eval.h"</span></span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">If
you are&nbsp;using the EVAL board's LCD, you need to add the include of
the LCD header file&nbsp;#include "</span><span style="font-size: 10pt; font-family: Verdana;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;">_eval_lcd.h"</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">If
you are using the LCD log module, after copying it to the application
folder you have to edit it and update the name of the LCD header file. For more details, refer to the <span style="font-style: italic;">lcd_log_conf_template.h</span> driver description.</span></li></ul></ul></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_lcd.c</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Remove &#8220;static&#8221; from&nbsp;<span style="font-style: italic;">TextColor</span> and&nbsp;<span style="font-style: italic;">BackColor</span> variables declaration (need to be changed from other application modules)&nbsp;</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.h/.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">change value of&nbsp;<span style="font-style: italic;">&#8220;SDIO_TRANSFER_CLK_DIV&#8221;</span> define from 0 to 1 to achieve SD max frequency at 24MHz.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Remove <span style="font-style: italic;">SD_DMAEndOfTransferStatus()</span> function as now the DMA transfer is tracked using DMA End of transfer interrupt.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">SD_LowLevel_DMA_TxConfig()</span> and <span style="font-style: italic;">SD_LowLevel_DMA_RxConfig()</span> functions to enable the DMA transfer complete IT</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_sdio_sd.h/.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new function <span style="font-style: italic;">SD_ProcessDMAIRQ()</span> to be called from the DMA end of transfer interrupt.&nbsp;</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add some improvements by handling SDIO errors and adding timeout for different loops.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update to support SDHC memory cards with capacity greater than 4 GB</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">SD_CardInfo</span> structure, define <span style="font-style: italic;">CardCapacity </span>variable as 64-bit long (instead of 32-bit)</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Declare <span style="font-style: italic;">ReadAddr</span> and <span style="font-style: italic;">WriteAddr</span> parameters in <span style="font-style: italic;">SD_ReadBlock()</span>,<span style="font-style: italic;">SD_WriteBlock()</span>, <span style="font-style: italic;">SD_ReadMultiBlocks() </span>and <span style="font-style: italic;">SD_WriteMultiBlocks()</span> as 64-bit long (instead of 32-bit)<br></span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Refer to the driver header file's comments for more information on how to use the provided API.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">NOR_ProgramBuffer()</span> function: remove this comment "This function must be used only with S29GL128P NOR memory."&nbsp;&nbsp;</span><br><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><br></span></li></ul></ul><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: 175px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.2 /&nbsp;22-July-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210C_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_lcd.c: update to support new LCD AM240320D5TOQW01H (controller ILI9325)</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM322xG-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval.h: fix value of the SDIO clock divider (<span style="font-style: italic;">SDIO_TRANSFER_CLK_DIV</span> constant) to 2 instead of 0</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval_lcd.c: increase FSMC<span style="font-style: italic;"> AddressSetupTime</span> value from 1 to 3 to be compliant with some&nbsp;LCD access timing</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval_audio_codec.c: update <span style="font-style: italic;">Codec_CtrlInterface_Init(</span>) and <span style="font-style: italic;">Codec_GPIO_Init(</span>) functions to not reconfigure the I2C peripheral if it's&nbsp;already </span><span style="font-size: 10pt; font-family: Verdana;">enabled and </span><span style="font-size: 10pt; font-family: Verdana;">configured&nbsp;(to
avoid configuring the I2C twice when using both&nbsp;Audio codec and IO
Expander drivers in the same application).</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.1 / 18-April-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">some</span><span style="font-size: 10pt; font-family: Verdana;"> <span style="font-weight: bold; font-style: italic;">STM322xG_EVAL</span> drivers (no change on the API) to fix&nbsp;warnings wit<span style="font-weight: bold; font-style: italic;"></span>h TASKING C compiler.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Change the Release Notes name to <span style="font-weight: bold; font-style: italic;">STM32 Evaluation Board Drivers </span><br></span></li><li style="font-style: italic;" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SD_LowLevel_Init(): change&nbsp;SDIO pins speed configuration to&nbsp;"GPIO_Speed_25MHz"</span></li></ul></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><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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.0 / 11-March-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Official version supporting <span style="font-weight: bold; font-style: italic;">STM322xG_EVAL</span> evaluation board RevB (for <span style="font-weight: bold; font-style: italic;">STM32F2xx</span> devices).</span></li><li style="font-style: italic;" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Common</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new LCD log utility drivers: The LCD Log module allows to automatically
set a header and footer on any application using the LCD display and
allows to dump user, debug and error messages by using the following
macros: LCD_ErrLog(),&nbsp;&nbsp;&nbsp; LCD_UsrLog() and LCD_DbgLog().</span></li></ul></ul><div style="margin-left: 40px;"><span style="font-size: 10pt; font-family: Verdana;"><span style="text-decoration: underline; font-style: italic;">Note</span><span style="font-style: italic;">:</span> the <span style="font-style: italic;">STM322xG_EVAL</span> board RevA was wrongly named <span style="font-style: italic;">STM3220F_EVAL</span></span><br></div><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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.5.0 / 07-March-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.c\.h: driver improvement</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SD Clock increased to 24MHz to improve the data transfer performance.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new functions to check the SDIO peripheral and SD Card status at any
time:&nbsp;SD_WaitReadOperation(), SD_WaitWriteOperation(). The
software sequence is little bit changed&nbsp;but without any impact on
driver API. For more details, refer to the stm32_eval_sdio_sd.c
driver&nbsp;description.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new structure containing the SD Status register parameters. This
structure is called by the
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;SD_SendSDStatus() function.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Transfers mode updated</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Read/Write Block using Polling and DMA modes</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Read/Write Multi Blocks using DMA mode only</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Interrupt mode removed</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Data transfer functions are managing only fixed Block size (512-byte)&nbsp;</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100B-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval_cec.c: fix some strict ANSI-C errors</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100E-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_cec.c: fix some strict ANSI-C errors<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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.4.0 / 31-December-2010<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new directory for STM32L152-EVAL board containing the following files:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32l152_eval.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32l152</span><span style="font-size: 10pt; font-family: Verdana;">_eval_lcd.h/.c, stm32l152_eval_glass_lcd.h</span><span style="font-size: 10pt; font-family: Verdana;">/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32l152_eval_i2c_ee</span><span style="font-size: 10pt; font-family: Verdana;">.h/.c</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add support for the STM32100E-EVAL Rev B: SPI FLASH CS pin "sFLASH_CS_PIN" changed from PB.02 to PE.06.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_lcd.h/.c: Add support for "LCD_ILI9325" LCD controller.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_fsmc_onenand.h/.c driver updated to correct asynchronous and synchronous read operations procedures.<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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.3.0
- 10/15/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">I2C EEPROM,&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">Temperature Sensor and&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">IOE Expander</span><span style="font-size: 10pt; font-family: Verdana;"> drivers&nbsp;updated to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">use the DMA for read/write transfer and add more robustness</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">SD Card (SDIO) driver updated to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">add more robustness</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">SPI Flash and </span><span style="font-size: 10pt; font-family: Verdana;">SD Card (SPI) drivers: SPI MISO pin configuration changed to Input Floating&nbsp;</span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="circle"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new directory for STM32100E-EVAL board containing the following files:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval.h/.c,
stm32100e_eval_lcd.h/.c, stm32100e_eval_cec.h/.c,
stm32100e_eval_fsmc_onenand.h/.c, stm32100e_eval_fsmc_sram.h/.c,
stm32100e_eval_ioe.h/.c</span><br>
<span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span></span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Common</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.c:
Update the DMA End of Transfer Check loop inside the SD_ReadBlock(),
SD_WriteBlock(), SD_ReadMultiBlocks() and SD_Write MultiBlocks().</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c/.h</span> <br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced sEE_WaitEepromStandbyState() function for more robustness.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced Read and Write operations to manage I2C limitations.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
critical sections user callbacks allowing to disable then enable
interrupts when I2C operation require to be not interrupted.</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_tsensor.c/.h</span> <br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced I2C communication functions by using DMA for registers Read and Write operations.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li></ul></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100B_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210B_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210b_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210b_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210C_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval.h: Add EEPROM driver Timeout define.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_i2c_ioe.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced I2C communication functions by using DMA for registers Read and Write operations.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">change IOE_I2C_SPEED from "400000" to "300000".</span></li></ul></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">STM3210E_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.c: change "void SD_WaitForDMAEndOfTransfer(void)" to "uint32_t SD_DMAEndOfTransferStatus(void)".</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.h: remove "NAND_CMD_AREA_TRUE1" define.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.c: Update FSMC timing in NAND_Init() function to be aligned with AN2784 application note.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">NOR</span><span style="font-size: 10pt; font-family: Verdana;">_Init()&nbsp;function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_sram.c<br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update FSMC timing in SRAM_Init() function to be aligned with AN2784 application note.</span><br>
<span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SRAM_Init()&nbsp;function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_lcd.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">LCD_FSMCConfig() function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.2.0
- 04/16/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">I2C EEPROM driver
update to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">use the DMA to
perform&nbsp;data transfer&nbsp;to/from EEPROM memory.</span><span style="font-size: 10pt; font-family: Verdana;"> </span><span style="font-size: 10pt;"><o:p></o:p></span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><i><u><span style="font-size: 10pt; font-family: Verdana;">STM32_EVAL</span></u></i><u><span style="font-size: 10pt;"><o:p></o:p></span></u></li></ul>
<ul style="margin-top: 0in;" type="disc"><ul style="margin-top: 0in;" type="circle"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c</span>:
updated to use the DMA to perform&nbsp;data transfer&nbsp;to/from
EEPROM memory. For more details, refer to the description provided
within this file.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210c_eval.c</span>: add low level
functions to configure the DMA (needed for I2C EEPROM driver)<br>
</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210c_eval_ioe.c</span>: add a delay
in&nbsp;IOE_TS_GetState() function to wait till the end of ADC
conversion</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210e_eval_fsmc_nor.c</span>: add </span><span style="font-size: 10pt; font-family: Verdana;">PD6 pin </span><span style="font-size: 10pt; font-family: Verdana;">configuration&nbsp;in
NOR_Init() function</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210b_eval_lcd.c</span>: remove the
second ";" from "static void PutPixel(int16_t x, int16_t y);;"&nbsp;</span><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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.1.0
- 03/01/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add support
for&nbsp;<b>STM32 Low-density Value line (STM32F100x4/6) and
Medium-density Value line (STM32F100x8/B) devices</b>.</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add support for the
STMicroelectronics STM32100B-EVAL evaluation board. </span><span style="font-size: 10pt;"><o:p></o:p></span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><i><u><span style="font-size: 10pt; font-family: Verdana;">STM32_EVAL</span></u></i><u><span style="font-size: 10pt;"><o:p></o:p></span></u></li></ul>
<ul style="margin-top: 0in;" type="circle"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Add new directory
"Common" containing a common drivers for all STM32 evaluation boards:
fonts.h/.c, stm32_eval_i2c_ee.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_spi_flash.h/.c,
</span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_i2c_tsensor.h/.c,
</span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_spi_sd.h/.c
and </span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.h/.c</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add new driver for the
STM32100B-EVAL managing Leds, push button and COM ports.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">New HDMI CEC High level
driver.</span><br>
</li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span>For all LCD drivers new fonts has
been added.</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">New FSMC memories
drivers for STM3210E-EVAL board: stm3210e_eval_fsmc_sram.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.h/.c
and </span><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.h/.c.</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;"><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-size: 10pt; color: black; font-family: 'Verdana','sans-serif';"></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; color: black; font-family: 'Verdana','sans-serif';">For
complete documentation on </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif';">STM32<span style="color: black;"> Microcontrollers visit&nbsp;</span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><u><span style="color: blue;"></span></u></span><u><a href="http://www.st.com/STM32" target="_blank">www.st.com/STM32</a></u></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>

File diff suppressed because it is too large Load Diff

View File

@ -1,488 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains definitions for STM3210C_EVAL's LEDs,
* push-buttons and COM ports hardware resources.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_COMMON
* @{
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM3210C_EVAL_H
#define __STM3210C_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
#ifdef HAL_I2C_MODULE_ENABLED
#include "stm3210c_eval_io.h"
#endif /* HAL_I2C_MODULE_ENABLED */
/** @defgroup STM3210C_EVAL_Exported_Types STM3210C EVAL Exported Types
* @{
*/
/**
* @brief LED Types Definition
*/
typedef enum
{
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3,
LED_GREEN = LED1,
LED_ORANGE = LED2,
LED_RED = LED3,
LED_BLUE = LED4
} Led_TypeDef;
/**
* @brief BUTTON Types Definition
*/
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;
/**
* @brief JOYSTICK Types Definition
*/
typedef enum
{
JOY_SEL = 0,
JOY_LEFT = 1,
JOY_RIGHT = 2,
JOY_DOWN = 3,
JOY_UP = 4,
JOY_NONE = 5
}JOYState_TypeDef;
typedef enum
{
JOY_MODE_GPIO = 0,
JOY_MODE_EXTI = 1
}JOYMode_TypeDef;
/**
* @brief COM Types Definition
*/
typedef enum
{
COM1 = 0,
COM2 = 1
} COM_TypeDef;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_Exported_Constants STM3210C EVAL Exported Constants
* @{
*/
/**
* @brief Define for STM3210C_EVAL board
*/
#if !defined (USE_STM3210C_EVAL)
#define USE_STM3210C_EVAL
#endif
/** @addtogroup STM3210C_EVAL_LED STM3210C EVAL LED
* @{
*/
#define LEDn 4
#define LED1_PIN GPIO_PIN_7 /* PD.07*/
#define LED1_GPIO_PORT GPIOD
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define LED2_PIN GPIO_PIN_13 /* PD.13*/
#define LED2_GPIO_PORT GPIOD
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define LED3_PIN GPIO_PIN_3 /* PD.03*/
#define LED3_GPIO_PORT GPIOD
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define LED4_PIN GPIO_PIN_4 /* PD.04*/
#define LED4_GPIO_PORT GPIOD
#define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define LEDx_GPIO_CLK_ENABLE(__LED__) do { if ((__LED__) == LED1) LED1_GPIO_CLK_ENABLE(); else \
if ((__LED__) == LED2) LED2_GPIO_CLK_ENABLE(); else \
if ((__LED__) == LED3) LED3_GPIO_CLK_ENABLE(); else \
if ((__LED__) == LED4) LED4_GPIO_CLK_ENABLE();} while(0)
#define LEDx_GPIO_CLK_DISABLE(__LED__) (((__LED__) == LED1) ? LED1_GPIO_CLK_DISABLE() :\
((__LED__) == LED2) ? LED2_GPIO_CLK_DISABLE() :\
((__LED__) == LED3) ? LED3_GPIO_CLK_DISABLE() :\
((__LED__) == LED4) ? LED4_GPIO_CLK_DISABLE() : 0 )
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_BUTTON STM3210C EVAL BUTTON
* @{
*/
#define BUTTONn 3
/**
* @brief Tamper push-button
*/
#define TAMPER_BUTTON_PIN GPIO_PIN_13 /* PC.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_9 /* PB.09*/
#define KEY_BUTTON_GPIO_PORT GPIOB
#define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define KEY_BUTTON_EXTI_IRQn EXTI9_5_IRQn
/**
* @brief Wake-up push-button
*/
#define WAKEUP_BUTTON_PIN GPIO_PIN_0 /* PA.00*/
#define WAKEUP_BUTTON_GPIO_PORT GPIOA
#define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn
#define BUTTONx_GPIO_CLK_ENABLE(__BUTTON__) do { if ((__BUTTON__) == BUTTON_TAMPER) TAMPER_BUTTON_GPIO_CLK_ENABLE() ; else \
if ((__BUTTON__) == BUTTON_KEY) KEY_BUTTON_GPIO_CLK_ENABLE() ; else \
if ((__BUTTON__) == BUTTON_WAKEUP) WAKEUP_BUTTON_GPIO_CLK_ENABLE();} while(0)
#define BUTTONx_GPIO_CLK_DISABLE(__BUTTON__) (((__BUTTON__) == BUTTON_TAMPER) TAMPER_BUTTON_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_KEY) KEY_BUTTON_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_WAKEUP) WAKEUP_BUTTON_GPIO_CLK_DISABLE() : 0 )
/**
* @brief IO Pins definition
*/
/* Joystick */
#define JOY_SEL_PIN (IO2_PIN_7) /* IO_Expander_2 */
#define JOY_DOWN_PIN (IO2_PIN_6) /* IO_Expander_2 */
#define JOY_LEFT_PIN (IO2_PIN_5) /* IO_Expander_2 */
#define JOY_RIGHT_PIN (IO2_PIN_4) /* IO_Expander_2 */
#define JOY_UP_PIN (IO2_PIN_3) /* IO_Expander_2 */
#define JOY_NONE_PIN JOY_ALL_PINS
#define JOY_ALL_PINS (JOY_SEL_PIN | JOY_DOWN_PIN | JOY_LEFT_PIN | JOY_RIGHT_PIN | JOY_UP_PIN)
/* MEMS */
#define MEMS_INT1_PIN (IO1_PIN_3) /* IO_Expander_1 */ /* Input */
#define MEMS_INT2_PIN (IO1_PIN_2) /* IO_Expander_1 */ /* Input */
#define MEMS_ALL_PINS (MEMS_INT1_PIN | MEMS_INT2_PIN)
#define AUDIO_RESET_PIN (IO2_PIN_2) /* IO_Expander_2 */ /* Output */
#define MII_INT_PIN (IO2_PIN_0) /* IO_Expander_2 */ /* Output */
#define VBAT_DIV_PIN (IO1_PIN_0) /* IO_Expander_1 */ /* Output */
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_COM STM3210C EVAL COM
* @{
*/
#define COMn 1
/**
* @brief Definition for COM port1, connected to USART2
*/
#define EVAL_COM1 USART2
#define EVAL_COM1_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE()
#define EVAL_COM1_CLK_DISABLE() __HAL_RCC_USART2_CLK_DISABLE()
#define AFIOCOM1_CLK_ENABLE() __HAL_RCC_AFIO_CLK_ENABLE()
#define AFIOCOM1_CLK_DISABLE() __HAL_RCC_AFIO_CLK_DISABLE()
#define EVAL_COM1_TX_PIN GPIO_PIN_5 /* PD.05*/
#define EVAL_COM1_TX_GPIO_PORT GPIOD
#define EVAL_COM1_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define EVAL_COM1_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define EVAL_COM1_RX_PIN GPIO_PIN_6 /* PD.06*/
#define EVAL_COM1_RX_GPIO_PORT GPIOD
#define EVAL_COM1_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define EVAL_COM1_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define EVAL_COM1_IRQn USART2_IRQn
#define COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_CLK_ENABLE();} while(0)
#define COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_CLK_DISABLE() : 0)
#define AFIOCOMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) AFIOCOM1_CLK_ENABLE();} while(0)
#define AFIOCOMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? AFIOCOM1_CLK_DISABLE() : 0)
#define AFIOCOMx_REMAP(__INDEX__) (((__INDEX__) == COM1) ? (AFIO->MAPR |= (AFIO_MAPR_USART2_REMAP)) : 0)
#define COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_TX_GPIO_CLK_ENABLE();} while(0)
#define COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() : 0)
#define COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_RX_GPIO_CLK_ENABLE();} while(0)
#define COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() : 0)
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_BUS STM3210C EVAL BUS
* @{
*/
/**
* @brief IO Expander Interrupt line on EXTI
*/
#define IOE_IT_PIN GPIO_PIN_14
#define IOE_IT_GPIO_PORT GPIOB
#define IOE_IT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define IOE_IT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
#define IOE_IT_EXTI_IRQn EXTI15_10_IRQn
#define IOE_IT_EXTI_IRQHANDLER EXTI15_10_IRQHandler
/* Exported constant IO ------------------------------------------------------*/
#define IO1_I2C_ADDRESS 0x82
#define IO2_I2C_ADDRESS 0x88
#define TS_I2C_ADDRESS 0x82
/*The Slave ADdress (SAD) associated to the LIS302DL is 001110xb. SDO pad can be used
to modify less significant bit of the device address. If SDO pad is connected to voltage
supply LSb is 1 (address 0011101b) else if SDO pad is connected to ground LSb value is
0 (address 0011100b).*/
#define L1S302DL_I2C_ADDRESS 0x38
/*##################### ACCELEROMETER ##########################*/
/* Read/Write command */
#define READWRITE_CMD ((uint8_t)0x80)
/* Multiple byte read/write command */
#define MULTIPLEBYTE_CMD ((uint8_t)0x40)
/*##################### I2Cx ###################################*/
/* User can use this section to tailor I2Cx instance used and associated
resources */
/* Definition for I2Cx Pins */
#define EVAL_I2Cx_SCL_PIN GPIO_PIN_6 /* PB.06*/
#define EVAL_I2Cx_SCL_GPIO_PORT GPIOB
#define EVAL_I2Cx_SDA_PIN GPIO_PIN_7 /* PB.07*/
#define EVAL_I2Cx_SDA_GPIO_PORT GPIOB
/* Definition for I2Cx clock resources */
#define EVAL_I2Cx I2C1
#define EVAL_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
#define EVAL_I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define EVAL_I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define EVAL_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
#define EVAL_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
/* Definition for I2Cx's NVIC */
#define EVAL_I2Cx_EV_IRQn I2C1_EV_IRQn
#define EVAL_I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
#define EVAL_I2Cx_ER_IRQn I2C1_ER_IRQn
#define EVAL_I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
/* I2C clock speed configuration (in Hz) */
#ifndef BSP_I2C_SPEED
#define BSP_I2C_SPEED 400000
#endif /* I2C_SPEED */
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the I2C communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define EVAL_I2Cx_TIMEOUT_MAX 3000
/*##################### SPI3 ###################################*/
#define EVAL_SPIx SPI3
#define EVAL_SPIx_CLK_ENABLE() __HAL_RCC_SPI3_CLK_ENABLE()
#define EVAL_SPIx_SCK_GPIO_PORT GPIOC /* PC.10*/
#define EVAL_SPIx_SCK_PIN GPIO_PIN_10
#define EVAL_SPIx_SCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define EVAL_SPIx_SCK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#define EVAL_SPIx_MISO_MOSI_GPIO_PORT GPIOC
#define EVAL_SPIx_MISO_MOSI_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define EVAL_SPIx_MISO_MOSI_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#define EVAL_SPIx_MISO_PIN GPIO_PIN_11 /* PC.11*/
#define EVAL_SPIx_MOSI_PIN GPIO_PIN_12 /* PC.12*/
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the SPI communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define EVAL_SPIx_TIMEOUT_MAX 1000
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_COMPONENT STM3210C EVAL COMPONENT
* @{
*/
/*##################### LCD ###################################*/
/* Chip Select macro definition */
#define LCD_CS_LOW() HAL_GPIO_WritePin(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, GPIO_PIN_RESET)
#define LCD_CS_HIGH() HAL_GPIO_WritePin(LCD_NCS_GPIO_PORT, LCD_NCS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Interface pins
*/
#define LCD_NCS_PIN GPIO_PIN_2 /* PB.02*/
#define LCD_NCS_GPIO_PORT GPIOB
#define LCD_NCS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LCD_NCS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/*##################### SD ###################################*/
/* Chip Select macro definition */
#define SD_CS_LOW() HAL_GPIO_WritePin(SD_CS_GPIO_PORT, SD_CS_PIN, GPIO_PIN_RESET)
#define SD_CS_HIGH() HAL_GPIO_WritePin(SD_CS_GPIO_PORT, SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief SD Control Interface pins
*/
#define SD_CS_PIN GPIO_PIN_4 /* PA.04*/
#define SD_CS_GPIO_PORT GPIOA
#define SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
/**
* @brief SD Detect Interface pins
*/
#define SD_DETECT_PIN GPIO_PIN_0
#define SD_DETECT_GPIO_PORT GPIOE
#define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOE_CLK_ENABLE()
#define SD_DETECT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOE_CLK_DISABLE()
#define SD_DETECT_EXTI_IRQn EXTI0_IRQn
/*##################### AUDIO ##########################*/
/**
* @brief AUDIO I2C Interface pins
*/
#define AUDIO_I2C_ADDRESS 0x94
/**
* @}
*/
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_Exported_Functions
* @{
*/
uint32_t BSP_GetVersion(void);
void BSP_LED_Init(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 Button_Mode);
uint32_t BSP_PB_GetState(Button_TypeDef Button);
#ifdef HAL_UART_MODULE_ENABLED
void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef* huart);
#endif /* HAL_UART_MODULE_ENABLED */
#ifdef HAL_I2C_MODULE_ENABLED
uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode);
JOYState_TypeDef BSP_JOY_GetState(void);
#endif /* HAL_I2C_MODULE_ENABLED */
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,213 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_accelerometer.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage the ACCELEROMETER
* MEMS accelerometer available on STM3210C_EVAL board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210c_eval_accelerometer.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_ACCELEROMETER STM3210C EVAL ACCELEROMETER
* @brief This file includes the motion sensor driver for ACCELEROMETER motion sensor
* devices.
* @{
*/
/** @defgroup STM3210C_EVAL_ACCELEROMETER_Private_Variables STM3210C EVAL ACCELEROMETER Private Variables
* @{
*/
static ACCELERO_DrvTypeDef *AcceleroDrv;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_ACCELEROMETER_Exported_Functions STM3210C EVAL ACCELEROMETER Exported Functions
* @{
*/
/**
* @brief Set ACCELEROMETER Initialization.
*/
uint8_t BSP_ACCELERO_Init(void)
{
uint8_t ret = ACCELERO_ERROR;
uint16_t ctrl = 0x0000;
LIS302DL_InitTypeDef lis302dl_initstruct;
LIS302DL_FilterConfigTypeDef lis302dl_filter={0,0,0};
if(Lis302dlDrv.ReadID() == I_AM_LIS302DL)
{
/* Initialize the gyroscope driver structure */
AcceleroDrv = &Lis302dlDrv;
/* Set configuration of LIS302DL MEMS Accelerometer *********************/
lis302dl_initstruct.Power_Mode = LIS302DL_LOWPOWERMODE_ACTIVE;
lis302dl_initstruct.Output_DataRate = LIS302DL_DATARATE_100;
lis302dl_initstruct.Axes_Enable = LIS302DL_XYZ_ENABLE;
lis302dl_initstruct.Full_Scale = LIS302DL_FULLSCALE_2_3;
lis302dl_initstruct.Self_Test = LIS302DL_SELFTEST_NORMAL;
/* Configure MEMS: data rate, power mode, full scale, self test and axes */
ctrl = (uint16_t) (lis302dl_initstruct.Output_DataRate | lis302dl_initstruct.Power_Mode | \
lis302dl_initstruct.Full_Scale | lis302dl_initstruct.Self_Test | \
lis302dl_initstruct.Axes_Enable);
/* Configure the accelerometer main parameters */
AcceleroDrv->Init(ctrl);
/* MEMS High Pass Filter configuration */
lis302dl_filter.HighPassFilter_Data_Selection = LIS302DL_FILTEREDDATASELECTION_OUTPUTREGISTER;
lis302dl_filter.HighPassFilter_CutOff_Frequency = LIS302DL_HIGHPASSFILTER_LEVEL_1;
lis302dl_filter.HighPassFilter_Interrupt = LIS302DL_HIGHPASSFILTERINTERRUPT_1_2;
/* Configure MEMS high pass filter cut-off level, interrupt and data selection bits */
ctrl = (uint8_t)(lis302dl_filter.HighPassFilter_Data_Selection | \
lis302dl_filter.HighPassFilter_CutOff_Frequency | \
lis302dl_filter.HighPassFilter_Interrupt);
/* Configure the accelerometer LPF main parameters */
AcceleroDrv->FilterConfig(ctrl);
ret = ACCELERO_OK;
}
else
{
ret = ACCELERO_ERROR;
}
return ret;
}
/**
* @brief Read ID of Accelerometer component
* @retval ID
*/
uint8_t BSP_ACCELERO_ReadID(void)
{
uint8_t id = 0x00;
if(AcceleroDrv->ReadID != NULL)
{
id = AcceleroDrv->ReadID();
}
return id;
}
/**
* @brief Reboot memory content of ACCELEROMETER
*/
void BSP_ACCELERO_Reset(void)
{
if(AcceleroDrv->Reset != NULL)
{
AcceleroDrv->Reset();
}
}
/**
* @brief Config Accelerometer click IT
*/
void BSP_ACCELERO_Click_ITConfig(void)
{
if(AcceleroDrv->ConfigIT!= NULL)
{
AcceleroDrv->ConfigIT();
}
}
/**
* @brief Clear Accelerometer click IT
*/
void BSP_ACCELERO_Click_ITClear(void)
{
if(AcceleroDrv->ClearIT!= NULL)
{
AcceleroDrv->ClearIT();
}
}
/**
* @brief Get XYZ acceleration
* @param pDataXYZ: angular acceleration on X/Y/Z axis
*/
void BSP_ACCELERO_GetXYZ(int16_t *pDataXYZ)
{
int16_t SwitchXY = 0;
if(AcceleroDrv->GetXYZ!= NULL)
{
AcceleroDrv->GetXYZ(pDataXYZ);
/* Switch X and Y Axis in case of MEMS LIS302DL */
if(AcceleroDrv == &Lis302dlDrv)
{
SwitchXY = pDataXYZ[0];
pDataXYZ[0] = pDataXYZ[1];
/* Invert Y Axis to be conpliant with LIS3DSH */
pDataXYZ[1] = -SwitchXY;
}
}
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

View File

@ -1,109 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_accelerometer.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains all the functions prototypes for the stm3210c_eval_accelerometer.c
* firmware driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_ACCELEROMETER_H
#define __STM3210C_EVAL_ACCELEROMETER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
/* Include Accelerometer component driver */
#include "../Components/lis302dl/lis302dl.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_ACCELEROMETER
* @{
*/
/** @defgroup STM3210C_EVAL_ACCELEROMETER_Exported_Types STM3210C EVAL ACCELEROMETER Exported Types
* @{
*/
typedef enum
{
ACCELERO_OK = 0,
ACCELERO_ERROR = 1,
ACCELERO_TIMEOUT = 2
}
ACCELERO_StatusTypeDef;
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_ACCELEROMETER_Exported_Functions
* @{
*/
/* Acc functions */
uint8_t BSP_ACCELERO_Init(void);
uint8_t BSP_ACCELERO_ReadID(void);
void BSP_ACCELERO_Reset(void);
void BSP_ACCELERO_Click_ITConfig(void);
void BSP_ACCELERO_Click_ITClear(void);
void BSP_ACCELERO_GetXYZ(int16_t *pDataXYZ);
#endif /* __STM3210C_EVAL_ACCELEROMETER_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

View File

@ -1,627 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_audio.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file provides the Audio driver for the STM3210C-Eval
* board.
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
(#) This driver supports STM32F107xC devices on STM3210C-Eval Kit:
(++) to play an audio file (all functions names start by BSP_AUDIO_OUT_xxx)
[..]
(#) PLAY A FILE:
(++) Call the function BSP_AUDIO_OUT_Init(
OutputDevice: physical output mode (OUTPUT_DEVICE_SPEAKER,
OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_AUTO 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, I2S, GPIOs, DMA and interrupt if needed). This function returns 0
if configuration is OK.
If the returned value is different from 0 or the function is stuck then the
communication with the codec (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_AUTO: Selection of output device is made through external
switch (implemented into the audio jack on the evaluation board).
When the Headphone is connected it is used as output.
When the headphone is disconnected from the audio jack, the output is
automatically switched to Speaker.
(+++) OUTPUT_DEVICE_BOTH: both Speaker and Headphone are used as outputs
for the audio stream at the same time.
(++) Call the function BSP_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 BSP_AUDIO_OUT_XXXCallBack() and only
their prototypes are declared in the stm3210c_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 or to mute,
use the functions BSP_AUDIO_OUT_Stop(), BSP_AUDIO_OUT_SetVolume(),
AUDIO_OUT_SetFrequency() BSP_AUDIO_OUT_SetOutputMode and BSP_AUDIO_OUT_SetMute().
(++) The driver API and the callback functions are at the end of the
stm3210c_eval_audio.h file.
(++) This driver provide the High Audio Layer: consists of the function API
exported in the stm3210c_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 stm3210c_eval_audio.c file (I2SOUT_Init()...)
[..]
##### Known Limitations #####
==============================================================================
(#) When using the Speaker, if the audio file quality is not high enough, the
speaker output may produce high and uncomfortable noise level. To avoid
this issue, to use speaker output properly, try to increase audio file
sampling rate (typically higher than 48KHz).
This operation will lead to larger file size.
(#) Communication with the audio codec (through I2C) may be corrupted if it
is interrupted by some user interrupt routines (in this case, interrupts
could be disabled just before the start of communication then re-enabled
when it is over). Note that this communication is only done at the
configuration phase (BSP_AUDIO_OUT_Init() or BSP_AUDIO_OUT_Stop())
and when Volume control modification is performed (BSP_AUDIO_OUT_SetVolume()
or BSP_AUDIO_OUT_SetMute()or BSP_AUDIO_OUT_SetOutputMode()).
When the audio data is played, no communication is required with the audio codec.
(#) 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.
(#) Mono audio streaming is not supported (in order to play mono audio streams,
each data should be sent twice on the I2S or should be duplicated on the
source buffer. Or convert the stream in stereo before playing).
(#) Supports only 16-bit audio data size.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210c_eval_audio.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_AUDIO STM3210C EVAL AUDIO
* @brief This file includes the low layer audio driver available on STM3210C-Eval
* eval board.
* @{
*/
/** @defgroup STM3210C_EVAL_AUDIO_Private_Variables STM3210C EVAL AUDIO Private Variables
* @{
*/
/*### PLAY ###*/
static AUDIO_DrvTypeDef *pAudioDrv;
I2S_HandleTypeDef hAudioOutI2s;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_AUDIO_Private_Function_Prototypes STM3210C EVAL AUDIO Private Function Prototypes
* @{
*/
static void I2SOUT_Init(uint32_t AudioFreq);
static void I2SOUT_DeInit(void);
/**
* @}
*/
/** @defgroup STM3210C_EVAL_AUDIO_OUT_Exported_Functions STM3210C EVAL AUDIO OUT Exported Functions
* @{
*/
/**
* @brief Configure the audio peripherals.
* @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
* OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO .
* @param Volume: Initial volume level (from 0 (Mute) to 100 (Max))
* @param AudioFreq: Audio frequency used to play the audio stream.
* @retval 0 if correct communication, else wrong communication
*/
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
{
uint8_t ret = AUDIO_ERROR;
/* Disable I2S */
I2SOUT_DeInit();
/* I2S data transfer preparation:
Prepare the Media to be used for the audio transfer from memory to I2S peripheral */
hAudioOutI2s.Instance = I2SOUT;
if(HAL_I2S_GetState(&hAudioOutI2s) == HAL_I2S_STATE_RESET)
{
/* Init the I2S MSP: this __weak function can be redefined by the application*/
BSP_AUDIO_OUT_MspInit(&hAudioOutI2s, NULL);
}
/* Configure the I2S peripheral */
I2SOUT_Init(AudioFreq);
if(((cs43l22_drv.ReadID(AUDIO_I2C_ADDRESS)) & CS43L22_ID_MASK) == CS43L22_ID)
{
/* Initialize the audio driver structure */
pAudioDrv = &cs43l22_drv;
ret = AUDIO_OK;
}
else
{
ret = AUDIO_ERROR;
}
if(ret == AUDIO_OK)
{
pAudioDrv->Init(AUDIO_I2C_ADDRESS, OutputDevice, Volume, AudioFreq);
}
return ret;
}
/**
* @brief De-initialize the audio peripherals.
*/
void BSP_AUDIO_OUT_DeInit(void)
{
I2SOUT_DeInit();
/* DeInit the I2S MSP : this __weak function can be rewritten by the application */
BSP_AUDIO_OUT_MspDeInit(&hAudioOutI2s, NULL);
}
/**
* @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(pAudioDrv->Play(AUDIO_I2C_ADDRESS, pBuffer, Size) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Update the Media layer and enable it for play */
HAL_I2S_Transmit_DMA(&hAudioOutI2s, pBuffer, DMA_MAX(Size));
return AUDIO_OK;
}
}
/**
* @brief Sends n-Bytes on the I2S interface.
* @param pData: pointer on data address
* @param Size: number of data to be written
*/
void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size)
{
HAL_I2S_Transmit_DMA(&hAudioOutI2s, pData, Size);
}
/**
* @brief This function Pauses the audio file stream. In case
* of using DMA, the DMA Pause feature is used.
* @note 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(pAudioDrv->Pause(AUDIO_I2C_ADDRESS) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Call the Media layer pause function */
HAL_I2S_DMAPause(&hAudioOutI2s);
/* Return AUDIO_OK if all operations are OK */
return AUDIO_OK;
}
}
/**
* @brief This function Resumes the audio file stream.
* @note 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(pAudioDrv->Resume(AUDIO_I2C_ADDRESS) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Call the Media layer resume function */
HAL_I2S_DMAResume(&hAudioOutI2s);
/* Return AUDIO_OK if all operations are OK */
return AUDIO_OK;
}
}
/**
* @brief Stops audio playing and Power down the Audio Codec.
* @param Option: could be one of the following parameters
* - 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 DMA Stop to disable DMA stream before stopping codec */
HAL_I2S_DMAStop(&hAudioOutI2s);
/* Call Audio Codec Stop function */
if(pAudioDrv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
{
return AUDIO_ERROR;
}
else
{
if(Option == CODEC_PDWN_HW)
{
/* Wait at least 100us */
HAL_Delay(1);
/* Power Down the codec */
BSP_IO_WritePin(AUDIO_RESET_PIN, GPIO_PIN_RESET);
}
/* 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(pAudioDrv->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(pAudioDrv->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).
* @note This function modifies a global variable of the audio codec driver: OutputDev.
* @param Output: specifies the audio output target: OUTPUT_DEVICE_SPEAKER,
* OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_BOTH or OUTPUT_DEVICE_AUTO
* @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(pAudioDrv->SetOutputMode(AUDIO_I2C_ADDRESS, Output) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Return AUDIO_OK when all operations are correctly done */
return AUDIO_OK;
}
}
/**
* @brief Update 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.
*/
void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq)
{
/* Update the I2S audio frequency configuration */
I2SOUT_Init(AudioFreq);
}
/**
* @brief Initializes BSP_AUDIO_OUT MSP.
* @param hi2s: I2S handle
* @param Params
*/
__weak void BSP_AUDIO_OUT_MspInit(I2S_HandleTypeDef *hi2s, void *Params)
{
static DMA_HandleTypeDef hdma_i2stx;
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable I2SOUT clock */
I2SOUT_CLK_ENABLE();
/*** Configure the GPIOs ***/
/* Enable I2S GPIO clocks */
I2SOUT_SCK_SD_CLK_ENABLE();
I2SOUT_WS_CLK_ENABLE();
/* I2SOUT pins configuration: WS, SCK and SD pins -----------------------------*/
gpioinitstruct.Pin = I2SOUT_SCK_PIN | I2SOUT_SD_PIN;
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(I2SOUT_SCK_SD_GPIO_PORT, &gpioinitstruct);
gpioinitstruct.Pin = I2SOUT_WS_PIN ;
HAL_GPIO_Init(I2SOUT_WS_GPIO_PORT, &gpioinitstruct);
/* I2SOUT pins configuration: MCK pin */
I2SOUT_MCK_CLK_ENABLE();
gpioinitstruct.Pin = I2SOUT_MCK_PIN;
HAL_GPIO_Init(I2SOUT_MCK_GPIO_PORT, &gpioinitstruct);
/* Enable the I2S DMA clock */
I2SOUT_DMAx_CLK_ENABLE();
if(hi2s->Instance == I2SOUT)
{
/* Configure the hdma_i2stx handle parameters */
hdma_i2stx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_i2stx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_i2stx.Init.MemInc = DMA_MINC_ENABLE;
hdma_i2stx.Init.PeriphDataAlignment = I2SOUT_DMAx_PERIPH_DATA_SIZE;
hdma_i2stx.Init.MemDataAlignment = I2SOUT_DMAx_MEM_DATA_SIZE;
hdma_i2stx.Init.Mode = DMA_NORMAL;
hdma_i2stx.Init.Priority = DMA_PRIORITY_HIGH;
hdma_i2stx.Instance = I2SOUT_DMAx_CHANNEL;
/* Associate the DMA handle */
__HAL_LINKDMA(hi2s, hdmatx, hdma_i2stx);
/* Deinitialize the Channel for new transfer */
HAL_DMA_DeInit(&hdma_i2stx);
/* Configure the DMA Channel */
HAL_DMA_Init(&hdma_i2stx);
}
/* I2S DMA IRQ Channel configuration */
HAL_NVIC_SetPriority(I2SOUT_DMAx_IRQ, AUDIO_OUT_IRQ_PREPRIO, 0);
HAL_NVIC_EnableIRQ(I2SOUT_DMAx_IRQ);
}
/**
* @brief De-Initializes BSP_AUDIO_OUT MSP.
* @param hi2s: I2S handle
* @param Params
*/
__weak void BSP_AUDIO_OUT_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params)
{
GPIO_InitTypeDef gpioinitstruct;
/* Disable I2S clock */
I2SOUT_CLK_DISABLE();
/* CODEC_I2S pins configuration: WS, SCK and SD pins */
gpioinitstruct.Pin = I2SOUT_WS_PIN | I2SOUT_SCK_PIN | I2SOUT_SD_PIN;
HAL_GPIO_DeInit(I2SOUT_SCK_SD_GPIO_PORT, gpioinitstruct.Pin);
/* CODEC_I2S pins configuration: MCK pin */
gpioinitstruct.Pin = I2SOUT_MCK_PIN;
HAL_GPIO_DeInit(I2SOUT_MCK_GPIO_PORT, gpioinitstruct.Pin);
}
/**
* @brief Tx Transfer completed callbacks
* @param hi2s: I2S handle
*/
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
if(hi2s->Instance == I2SOUT)
{
/* Manage the remaining file size and new address offset: This function
should be coded by user (its prototype is already declared in stm3210c_eval_audio.h) */
BSP_AUDIO_OUT_TransferComplete_CallBack();
}
}
/**
* @brief Tx Transfer Half completed callbacks
* @param hi2s: I2S handle
*/
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{
if(hi2s->Instance == I2SOUT)
{
/* Manage the remaining file size and new address offset: This function
should be coded by user (its prototype is already declared in stm3210c_eval_audio.h) */
BSP_AUDIO_OUT_HalfTransfer_CallBack();
}
}
/**
* @brief I2S error callbacks
* @param hi2s: I2S handle
*/
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 stm3210c_eval_audio.h) */
if(hi2s->Instance == I2SOUT)
{
BSP_AUDIO_OUT_Error_CallBack();
}
}
/**
* @brief Manages the DMA full Transfer complete event.
*/
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
{
}
/**
* @brief Manages the DMA Half Transfer complete event.
*/
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack(void)
{
}
/**
* @brief Manages the DMA FIFO error event.
*/
__weak void BSP_AUDIO_OUT_Error_CallBack(void)
{
}
/******************************************************************************
Static Function
*******************************************************************************/
/**
* @brief Initializes the Audio Codec audio interface (I2S)
* @param AudioFreq: Audio frequency to be configured for the I2S peripheral.
*/
static void I2SOUT_Init(uint32_t AudioFreq)
{
/* Initialize the hAudioOutI2s Instance parameter */
hAudioOutI2s.Instance = I2SOUT;
/* Disable I2S block */
__HAL_I2S_DISABLE(&hAudioOutI2s);
/* I2SOUT peripheral configuration */
hAudioOutI2s.Init.AudioFreq = AudioFreq;
hAudioOutI2s.Init.CPOL = I2S_CPOL_LOW;
hAudioOutI2s.Init.DataFormat = I2S_DATAFORMAT_16B;
hAudioOutI2s.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
hAudioOutI2s.Init.Mode = I2S_MODE_MASTER_TX;
hAudioOutI2s.Init.Standard = I2S_STANDARD;
/* Initialize the I2S peripheral with the structure above */
HAL_I2S_Init(&hAudioOutI2s);
}
/**
* @brief Deinitialize the Audio Codec audio interface (I2S).
*/
static void I2SOUT_DeInit(void)
{
/* Initialize the hAudioOutI2s Instance parameter */
hAudioOutI2s.Instance = I2SOUT;
/* Disable I2S peripheral */
__HAL_I2S_DISABLE(&hAudioOutI2s);
HAL_I2S_DeInit(&hAudioOutI2s);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,186 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_audio.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* stm3210c_eval_audio.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_AUDIO_H
#define __STM3210C_EVAL_AUDIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Include audio component Driver */
#include "../Components/cs43l22/cs43l22.h"
#include "stm3210c_eval.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_AUDIO
* @{
*/
/** @defgroup STM3210C_EVAL_AUDIO_OUT_Exported_Constants STM3210C EVAL AUDIO OUT Exported Constants
* @{
*/
/*------------------------------------------------------------------------------
AUDIO OUT CONFIGURATION
------------------------------------------------------------------------------*/
/* I2S peripheral configuration defines */
#define I2SOUT SPI2
#define I2SOUT_CLK_ENABLE() __HAL_RCC_SPI2_CLK_ENABLE()
#define I2SOUT_CLK_DISABLE() __HAL_RCC_SPI2_CLK_DISABLE()
#define I2SOUT_SCK_SD_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define I2SOUT_MCK_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define I2SOUT_WS_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define I2SOUT_WS_PIN GPIO_PIN_12 /* PB.12*/
#define I2SOUT_SCK_PIN GPIO_PIN_13 /* PB.13*/
#define I2SOUT_SD_PIN GPIO_PIN_15 /* PB.15*/
#define I2SOUT_MCK_PIN GPIO_PIN_6 /* PC.06*/
#define I2SOUT_SCK_SD_GPIO_PORT GPIOB
#define I2SOUT_WS_GPIO_PORT GPIOB
#define I2SOUT_MCK_GPIO_PORT GPIOC
/* I2S DMA Channel definitions */
#define I2SOUT_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
#define I2SOUT_DMAx_CHANNEL DMA1_Channel5
#define I2SOUT_DMAx_IRQ DMA1_Channel5_IRQn
#define I2SOUT_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD
#define I2SOUT_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD
#define DMA_MAX_SZE 0xFFFF
#define I2SOUT_IRQHandler DMA1_Channel5_IRQHandler
/* Select the interrupt preemption priority and subpriority for the DMA interrupt */
#define AUDIO_OUT_IRQ_PREPRIO 0xE /* Select the preemption priority level(0 is the highest) */
/*------------------------------------------------------------------------------
CONFIGURATION: Audio Driver Configuration parameters
------------------------------------------------------------------------------*/
/* Audio status definition */
#define AUDIO_OK 0
#define AUDIO_ERROR 1
#define AUDIO_TIMEOUT 2
/* PDM buffer input size */
#define INTERNAL_BUFF_SIZE 128*DEFAULT_AUDIO_IN_FREQ/16000*DEFAULT_AUDIO_IN_CHANNEL_NBR
/*------------------------------------------------------------------------------
OPTIONAL Configuration defines parameters
------------------------------------------------------------------------------*/
/**
* @}
*/
/** @defgroup STM3210C_EVAL_AUDIO_Exported_Macros STM3210C EVAL AUDIO Exported Macros
* @{
*/
#define DMA_MAX(_X_) (((_X_) <= DMA_MAX_SZE)? (_X_):DMA_MAX_SZE)
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_AUDIO_OUT_Exported_Functions
* @{
*/
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
void BSP_AUDIO_OUT_DeInit(void);
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);
uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Command);
uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output);
/* 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
need to be changed for specific application needs */
void BSP_AUDIO_OUT_MspInit(I2S_HandleTypeDef *hi2s, void *Params);
void BSP_AUDIO_OUT_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_AUDIO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,519 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_eeprom.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage a M24C64
* I2C EEPROM memory.
*
* ===================================================================
* Notes:
* - This driver is intended for STM32F1xx families devices only.
* - The I2C EEPROM memory (M24CXX) is available directly
* on STM3210C EVAL board.
* ===================================================================
*
* It implements a high level communication layer for read and write
* from/to this memory. The needed STM32F10x hardware resources (I2C
* and GPIO) are defined in stm3210c_eval.h file,
* and the initialization is performed
* in EEPROM_I2C_IO_Init() functions
* declared in stm3210c_eval.c file.
* You can easily tailor this driver to any other development board,
* by just adapting the defines for hardware resources and
* EEPROM_I2C_IO_Init() functions.
*
* @note In this driver, basic read and write functions
* (BSP_EEPROM_ReadBuffer() and BSP_EEPROM_WriteBuffer())
* use Polling mode to perform the data transfer to/from EEPROM memories.
* +-----------------------------------------------------------------+
* | Pin assignment for M24CXX EEPROM |
* +---------------------------------------+-----------+-------------+
* | STM32F1xx I2C Pins | EEPROM | Pin |
* +---------------------------------------+-----------+-------------+
* | EEPROM_I2C_SDA_PIN/ SDA | SDA | 5 |
* | EEPROM_I2C_SCL_PIN/ SCL | SCL | 6 |
* | . | VDD | 7 (3.3V) |
* | . | GND | 8 (0 V) |
* +---------------------------------------+-----------+-------------+
*
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210c_eval_eeprom.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_EEPROM STM3210C EVAL EEPROM
* @brief This file includes the I2C and SPI EEPROM driver
* of STM3210C-EVAL board.
* @{
*/
/** @defgroup STM3210C_EVAL_EEPROM_Private_Variables STM3210C EVAL EEPROM Private Variables
* @{
*/
__IO uint16_t EEPROMAddress = 0;
__IO uint16_t EEPROMPageSize = 0;
__IO uint16_t EEPROMDataRead = 0;
__IO uint8_t EEPROMDataWrite = 0;
static EEPROM_DrvTypeDef *EEPROM_SelectedDevice = 0;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_EEPROM_Private_Function_Prototypes STM3210C EVAL EEPROM Private Function Prototypes
* @{
*/
static uint32_t EEPROM_I2C_Init(void);
static uint32_t EEPROM_I2C_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint32_t* NumByteToRead);
static uint32_t EEPROM_I2C_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint32_t* NumByteToWrite);
static uint32_t EEPROM_I2C_WaitEepromStandbyState(void);
/* EEPROM I2C driver typedef */
EEPROM_DrvTypeDef EEPROM_I2C_Drv =
{
EEPROM_I2C_Init,
EEPROM_I2C_ReadBuffer,
EEPROM_I2C_WritePage
};
/**
* @}
*/
/** @defgroup STM3210C_EVAL_EEPROM_Exported_Functions STM3210C EVAL EEPROM Exported Functions
* @{
*/
/**
* @brief Initializes peripherals used by the EEPROM device selected.
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
* different from EEPROM_OK (0)
*/
uint32_t BSP_EEPROM_Init(void)
{
if(EEPROM_SelectedDevice->Init != 0)
{
return (EEPROM_SelectedDevice->Init());
}
else
{
return EEPROM_FAIL;
}
}
/**
* @brief Select the EEPROM device to communicate.
* @param DeviceID: Specifies the EEPROM device to be selected.
* This parameter can be one of following parameters:
* @arg BSP_EEPROM_M24C64_32
* @arg BSP_EEPROM_M24C08
*
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
* different from EEPROM_OK (0)
*/
void BSP_EEPROM_SelectDevice(uint8_t DeviceID)
{
switch(DeviceID)
{
case BSP_EEPROM_M24C64_32:
case BSP_EEPROM_M24C08:
EEPROM_SelectedDevice = &EEPROM_I2C_Drv;
break;
default:
break;
}
}
/**
* @brief Reads a block of data from the EEPROM device selected.
* @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, uint32_t* NumByteToRead)
{
if(EEPROM_SelectedDevice->ReadBuffer != 0)
{
return (EEPROM_SelectedDevice->ReadBuffer(pBuffer, ReadAddr, NumByteToRead));
}
else
{
return EEPROM_FAIL;
}
}
/**
* @brief Writes buffer of data to the EEPROM device selected.
* @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, uint32_t NumByteToWrite)
{
uint16_t numofpage = 0, numofsingle = 0, count = 0;
uint16_t addr = 0;
uint32_t dataindex = 0;
uint32_t status = EEPROM_OK;
addr = WriteAddr % EEPROMPageSize;
count = EEPROMPageSize - addr;
numofpage = NumByteToWrite / EEPROMPageSize;
numofsingle = NumByteToWrite % EEPROMPageSize;
if(EEPROM_SelectedDevice->WritePage == 0)
{
return EEPROM_FAIL;
}
/*!< 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 = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
}
/*!< If NumByteToWrite > EEPROM_PAGESIZE */
else
{
while(numofpage--)
{
/* Store the number of data to be written */
dataindex = EEPROMPageSize;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
WriteAddr += EEPROMPageSize;
pBuffer += EEPROMPageSize;
}
if(numofsingle!=0)
{
/* Store the number of data to be written */
dataindex = numofsingle;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_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 = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_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 = EEPROM_SelectedDevice->WritePage((uint8_t*)(pBuffer + count), (WriteAddr + count), (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
}
else
{
/* Store the number of data to be written */
dataindex = numofsingle;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
}
}
/*!< If NumByteToWrite > EEPROM_PAGESIZE */
else
{
NumByteToWrite -= count;
numofpage = NumByteToWrite / EEPROMPageSize;
numofsingle = NumByteToWrite % EEPROMPageSize;
if(count != 0)
{
/* Store the number of data to be written */
dataindex = count;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
WriteAddr += count;
pBuffer += count;
}
while(numofpage--)
{
/* Store the number of data to be written */
dataindex = EEPROMPageSize;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
WriteAddr += EEPROMPageSize;
pBuffer += EEPROMPageSize;
}
if(numofsingle != 0)
{
/* Store the number of data to be written */
dataindex = numofsingle;
status = EEPROM_SelectedDevice->WritePage(pBuffer, WriteAddr, (uint32_t*)(&dataindex));
if (status != EEPROM_OK)
{
return status;
}
}
}
}
/* If all operations OK, return EEPROM_OK (0) */
return EEPROM_OK;
}
/**
* @brief Basic management of the timeout situation.
* @retval None.
*/
__weak void BSP_EEPROM_TIMEOUT_UserCallback(void)
{
}
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_EEPROM_Private_Function_Prototypes
* @{
*/
/**
* @brief Initializes peripherals used by the I2C EEPROM driver.
* @note There are 2 different versions of M24CXX (08 or 32 or 64).
* 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)
*/
static uint32_t EEPROM_I2C_Init(void)
{
EEPROM_I2C_IO_Init();
/*Select the EEPROM address for M24C32 or M24C64 and check if OK*/
EEPROMAddress = EEPROM_ADDRESS_M24C64_32;
EEPROMPageSize = EEPROM_PAGESIZE_M24C64_32;
if (EEPROM_I2C_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
{
EEPROMPageSize = EEPROM_PAGESIZE_M24C08;
/*Select the EEPROM address for M24C08 (BLOCK0) and check if OK*/
EEPROMAddress = EEPROM_ADDRESS_M24C08_BLOCK0;
if (EEPROM_I2C_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
{
/*Select the EEPROM address for M24C08 (BLOCK1) and check if OK*/
EEPROMAddress = EEPROM_ADDRESS_M24C08_BLOCK1;
if (EEPROM_I2C_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
{
/*Select the EEPROM address for M24C08 (BLOCK2) and check if OK*/
EEPROMAddress = EEPROM_ADDRESS_M24C08_BLOCK2;
if (EEPROM_I2C_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
{
/*Select the EEPROM address for M24C08 (BLOCK3) and check if OK*/
EEPROMAddress = EEPROM_ADDRESS_M24C08_BLOCK3;
if (EEPROM_I2C_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
{
return EEPROM_FAIL;
}
}
}
}
}
return EEPROM_OK;
}
/**
* @brief Reads a block of data from the I2C 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.
*
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
* different from EEPROM_OK (0) or the timeout user callback.
*/
static uint32_t EEPROM_I2C_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint32_t* NumByteToRead)
{
uint32_t buffersize = *NumByteToRead;
if (EEPROM_I2C_IO_ReadData(EEPROMAddress, ReadAddr, pBuffer, buffersize) != HAL_OK)
{
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 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.
*
*
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
* different from EEPROM_OK (0) or the timeout user callback.
*/
static uint32_t EEPROM_I2C_WritePage(uint8_t* pBuffer, uint16_t WriteAddr, uint32_t* NumByteToWrite)
{
uint32_t buffersize = *NumByteToWrite;
if (EEPROM_I2C_IO_WriteData(EEPROMAddress, WriteAddr, pBuffer, buffersize) != HAL_OK)
{
return EEPROM_FAIL;
}
/* Wait for EEPROM Standby state */
if (EEPROM_I2C_WaitEepromStandbyState() != EEPROM_OK)
{
return EEPROM_FAIL;
}
return EEPROM_OK;
}
/**
* @brief Wait for EEPROM I2C 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.
*
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
* different from EEPROM_OK (0) or the timeout user callback.
*/
static uint32_t EEPROM_I2C_WaitEepromStandbyState(void)
{
/* Check if the maximum allowed number of trials has bee reached */
if (EEPROM_I2C_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;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,148 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_eeprom.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains all the functions prototypes for
* the stm3210c_eval_eeprom.c firmware driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_EEPROM_H
#define __STM3210C_EVAL_EEPROM_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_EEPROM
* @{
*/
/** @defgroup STM3210C_EVAL_EEPROM_Exported_Types STM3210C EVAL EEPROM Exported Types
* @{
*/
typedef struct
{
uint32_t (*Init)(void);
uint32_t (*ReadBuffer)(uint8_t* , uint16_t , uint32_t* );
uint32_t (*WritePage)(uint8_t* , uint16_t , uint32_t* );
}EEPROM_DrvTypeDef;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_EEPROM_Exported_Constants STM3210C EVAL EEPROM Exported Constants
* @{
*/
/* EEPROMs hardware address and page size */
#define EEPROM_ADDRESS_M24C64_32 0xA0 /* Support the devices: M24C32 and M24C64 */
/* The M24C08W contains 4 blocks (128byte each) with the adresses below: E2 = 0
EEPROM Addresses defines */
#define EEPROM_ADDRESS_M24C08_BLOCK0 0xA0
#define EEPROM_ADDRESS_M24C08_BLOCK1 0xA2
#define EEPROM_ADDRESS_M24C08_BLOCK2 0xA4
#define EEPROM_ADDRESS_M24C08_BLOCK3 0xA6
#define EEPROM_PAGESIZE_M24C64_32 32 /* Support the devices: M24C32 and M24C64 */
#define EEPROM_PAGESIZE_M24C08 16 /* Support the device: M24C08. */
/* EEPROM BSP return values */
#define EEPROM_OK 0
#define EEPROM_FAIL 1
#define EEPROM_TIMEOUT 2
/* EEPROM BSP devices definition list supported */
#define BSP_EEPROM_M24C64_32 1 /* RF I2C EEPROM M24C32 and M24C64 */
#define BSP_EEPROM_M24C08 2 /* RF I2C EEPROM M24C08 */
/* Maximum number of trials for EEPROM_I2C_WaitEepromStandbyState() function */
#define EEPROM_MAX_TRIALS 300
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_EEPROM_Exported_Functions
* @{
*/
uint32_t BSP_EEPROM_Init(void);
void BSP_EEPROM_SelectDevice(uint8_t DeviceID);
uint32_t BSP_EEPROM_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint32_t* NumByteToRead);
uint32_t BSP_EEPROM_WriteBuffer(uint8_t* pBuffer, uint16_t WriteAddr, uint32_t NumByteToWrite);
/* 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
occure during communication (waiting on an event that doesn't occur, bus
errors, busy devices ...). */
void BSP_EEPROM_TIMEOUT_UserCallback(void);
/* Link functions for I2C EEPROM peripheral */
void EEPROM_I2C_IO_Init(void);
HAL_StatusTypeDef EEPROM_I2C_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
HAL_StatusTypeDef EEPROM_I2C_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
HAL_StatusTypeDef EEPROM_I2C_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_EEPROM_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,354 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_io.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage the IO pins
* on STM3210C-EVAL evaluation board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 STM3210C-EVAL evaluation
board.
- The STMPE811 IO expander device component driver must be included with this
driver in order to run the IO functionalities commanded by the IO expander
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 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 "stm3210c_eval_io.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_IO STM3210C EVAL IO Expander
* @{
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_IO_Private_Variables STM3210C EVAL IO Private Variables
* @{
*/
static IO_DrvTypeDef *io1_driver;
static IO_DrvTypeDef *io2_driver;
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_IO_Exported_Functions STM3210C EVAL IO Exported Functions
* @{
*/
/**
* @brief Initializes and configures the IO functionalities and configures all
* necessary hardware resources (GPIOs, clocks..).
* @note BSP_IO_Init() is using HAL_Delay() function to ensure that stmpe811
* 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.
* @retval IO_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_IO_Init(void)
{
uint8_t ret = IO_ERROR;
/* Initialize IO Expander 1*/
if(stmpe811_io_drv.ReadID(IO1_I2C_ADDRESS) == STMPE811_ID)
{
/* Initialize the IO Expander 1 driver structure */
io1_driver = &stmpe811_io_drv;
io1_driver->Init(IO1_I2C_ADDRESS);
io1_driver->Start(IO1_I2C_ADDRESS, IO1_PIN_ALL >> IO1_PIN_OFFSET);
ret = IO_OK;
}
/* Initialize IO Expander 2*/
if(stmpe811_io_drv.ReadID(IO2_I2C_ADDRESS) == STMPE811_ID)
{
/* Initialize the IO Expander 2 driver structure */
io2_driver = &stmpe811_io_drv;
io2_driver->Init(IO2_I2C_ADDRESS);
io2_driver->Start(IO2_I2C_ADDRESS, IO2_PIN_ALL >> IO2_PIN_OFFSET);
ret = IO_OK;
}
return ret;
}
/**
* @brief Gets the selected pins IT status.
* @param IO_Pin: Selected pins to check the status.
* This parameter can be any combination of the IO pins.
* @retval Status of the checked IO pin(s).
*/
uint32_t BSP_IO_ITGetStatus(uint32_t IO_Pin)
{
uint32_t status = 0;
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Return the IO Expander 1 Pin IT status */
status |= (io1_driver->ITStatus(IO1_I2C_ADDRESS, io1_pin)) << IO1_PIN_OFFSET;
}
if (io2_pin != 0)
{
/* Return the IO Expander 2 Pin IT status */
status |= (io2_driver->ITStatus(IO2_I2C_ADDRESS, io2_pin)) << IO2_PIN_OFFSET;
}
return status;
}
/**
* @brief Clears the selected IO IT pending bit.
* @param IO_Pin: Selected pins to check the status.
* This parameter can be any combination of the IO pins.
*/
void BSP_IO_ITClear(uint32_t IO_Pin)
{
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Clears the selected IO Expander 1 pin(s) mode */
io1_driver->ClearIT(IO1_I2C_ADDRESS, io1_pin);
}
if (io2_pin != 0)
{
/* Clears the selected IO Expander 2 pin(s) mode */
io2_driver->ClearIT(IO2_I2C_ADDRESS, io2_pin);
}
}
/**
* @brief Configures the IO pin(s) according to IO mode structure value.
* @param IO_Pin: Output pin to be set or reset.
* This parameter can be any combination of the IO pins.
* @param IO_Mode: 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
* @retval IO_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_IO_ConfigPin(uint32_t IO_Pin, IO_ModeTypedef IO_Mode)
{
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Configure the selected IO Expander 1 pin(s) mode */
io1_driver->Config(IO1_I2C_ADDRESS, io1_pin, IO_Mode);
}
if (io2_pin != 0)
{
/* Configure the selected IO Expander 2 pin(s) mode */
io2_driver->Config(IO2_I2C_ADDRESS, io2_pin, IO_Mode);
}
return IO_OK;
}
/**
* @brief Sets the selected pins state.
* @param IO_Pin: Selected pins to write.
* This parameter can be any combination of the IO pins.
* @param PinState: New pins state to write
*/
void BSP_IO_WritePin(uint32_t IO_Pin, uint8_t PinState)
{
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Sets the IO Expander 1 selected pins state */
io1_driver->WritePin(IO1_I2C_ADDRESS, io1_pin, PinState);
}
if (io2_pin != 0)
{
/* Sets the IO Expander 2 selected pins state */
io2_driver->WritePin(IO2_I2C_ADDRESS, io2_pin, PinState);
}
}
/**
* @brief Gets the selected pins current state.
* @param IO_Pin: 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 IO_Pin)
{
uint32_t pin_state = 0;
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Gets the IO Expander 1 selected pins current state */
pin_state |= (io1_driver->ReadPin(IO1_I2C_ADDRESS, io1_pin)) << IO1_PIN_OFFSET;
}
if (io2_pin != 0)
{
/* Gets the IO Expander 2 selected pins current state */
pin_state |= (io2_driver->ReadPin(IO2_I2C_ADDRESS, io2_pin)) << IO2_PIN_OFFSET;
}
return pin_state;
}
/**
* @brief Toggles the selected pins state
* @param IO_Pin: Selected pins to toggle.
* This parameter can be any combination of the IO pins.
*/
void BSP_IO_TogglePin(uint32_t IO_Pin)
{
uint32_t io1_pin = 0;
uint32_t io2_pin = 0;
io1_pin = (IO_Pin & IO1_PIN_ALL) >> IO1_PIN_OFFSET;
io2_pin = (IO_Pin & IO2_PIN_ALL) >> IO2_PIN_OFFSET;
if (io1_pin != 0)
{
/* Toggles the IO Expander 1 selected pins state */
if(io1_driver->ReadPin(IO1_I2C_ADDRESS, io1_pin) == RESET) /* Set */
{
BSP_IO_WritePin(io1_pin, GPIO_PIN_SET); /* Reset */
}
else
{
BSP_IO_WritePin(io1_pin, GPIO_PIN_RESET); /* Set */
}
}
if (io2_pin != 0)
{
/* Toggles the IO Expander 2 selected pins state */
if(io2_driver->ReadPin(IO2_I2C_ADDRESS, io2_pin) == RESET) /* Set */
{
BSP_IO_WritePin(io2_pin, GPIO_PIN_SET); /* Reset */
}
else
{
BSP_IO_WritePin(io2_pin, GPIO_PIN_RESET); /* Set */
}
}
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,149 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_io.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210c_eval_io.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_IO_H
#define __STM3210C_EVAL_IO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
#include "../Components/stmpe811/stmpe811.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_IO
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_IO_Exported_Types STM3210C EVAL IO Exported Types
* @{
*/
typedef enum
{
IO_OK = 0x00,
IO_ERROR = 0x01,
IO_TIMEOUT = 0x02
}IO_StatusTypeDef;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_IO_Exported_Constants STM3210C EVAL IO Exported Constants
* @{
*/
/* Virtual pin offset STMPE811, IOExpander1 */
#define IO1_PIN_OFFSET 0
/* Virtual pin offset STMPE811, IOExpander2 */
#define IO2_PIN_OFFSET 8
/* Pins definition STMPE811, IOExpander1 */
#define IO1_PIN_0 (uint32_t)(0x00000001 << IO1_PIN_OFFSET)
#define IO1_PIN_1 (uint32_t)(0x00000002 << IO1_PIN_OFFSET)
#define IO1_PIN_2 (uint32_t)(0x00000004 << IO1_PIN_OFFSET)
#define IO1_PIN_3 (uint32_t)(0x00000008 << IO1_PIN_OFFSET)
#define IO1_PIN_4 (uint32_t)(0x00000010 << IO1_PIN_OFFSET)
#define IO1_PIN_5 (uint32_t)(0x00000020 << IO1_PIN_OFFSET)
#define IO1_PIN_6 (uint32_t)(0x00000040 << IO1_PIN_OFFSET)
#define IO1_PIN_7 (uint32_t)(0x00000080 << IO1_PIN_OFFSET)
#define IO1_PIN_ALL (uint32_t)(0x000000FF << IO1_PIN_OFFSET)
/* Pins definition STMPE16000, IOExpander2 */
#define IO2_PIN_0 (uint32_t)(0x00000001 << IO2_PIN_OFFSET)
#define IO2_PIN_1 (uint32_t)(0x00000002 << IO2_PIN_OFFSET)
#define IO2_PIN_2 (uint32_t)(0x00000004 << IO2_PIN_OFFSET)
#define IO2_PIN_3 (uint32_t)(0x00000008 << IO2_PIN_OFFSET)
#define IO2_PIN_4 (uint32_t)(0x00000010 << IO2_PIN_OFFSET)
#define IO2_PIN_5 (uint32_t)(0x00000020 << IO2_PIN_OFFSET)
#define IO2_PIN_6 (uint32_t)(0x00000040 << IO2_PIN_OFFSET)
#define IO2_PIN_7 (uint32_t)(0x00000080 << IO2_PIN_OFFSET)
#define IO2_PIN_ALL (uint32_t)(0x000000FF << IO2_PIN_OFFSET)
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210C_EVAL_IO_Exported_Functions
* @{
*/
uint8_t BSP_IO_Init(void);
void BSP_IO_ITClear(uint32_t IO_Pin);
uint32_t BSP_IO_ITGetStatus(uint32_t IO_Pin);
uint8_t BSP_IO_ConfigPin(uint32_t IO_Pin, IO_ModeTypedef IO_Mode);
void BSP_IO_WritePin(uint32_t IO_Pin, uint8_t PinState);
uint32_t BSP_IO_ReadPin(uint32_t IO_Pin);
void BSP_IO_TogglePin(uint32_t IO_Pin);
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_IO_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,931 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_lcd.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file includes the driver for Liquid Crystal Display (LCD) module
* mounted on STM3210C-EVAL evaluation board.
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
(#) This driver is used to drive indirectly an LCD TFT.
(#) This driver supports the AM-240320L8TNQW00H (LCD_ILI9320) and AM240320D5TOQW01H
(LCD_ILI9325) LCD mounted on MB785 daughter board
(#) The ILI9320 and ILI9325 components driver MUST be included with this driver.
(#) Initialization steps:
(++) Initialize the LCD using the BSP_LCD_Init() function.
(#) Display on LCD
(++) Clear the hole LCD using yhe BSP_LCD_Clear() function or only one specified
string line using the BSP_LCD_ClearStringLine() function.
(++) 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.
(++) Display a string line on the specified position (x,y in pixel) and align mode
using the BSP_LCD_DisplayStringAtLine() function.
(++) Draw and fill a basic shapes (dot, line, rectangle, circle, ellipse, .. bitmap, raw picture)
on LCD using a set of functions.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210c_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 STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_LCD STM3210C EVAL LCD
* @{
*/
/** @defgroup STM3210C_EVAL_LCD_Private_Defines STM3210C EVAL LCD Private Defines
* @{
*/
#define POLY_X(Z) ((int32_t)((Points + (Z))->X))
#define POLY_Y(Z) ((int32_t)((Points + (Z))->Y))
#define MAX_HEIGHT_FONT 17
#define MAX_WIDTH_FONT 24
#define OFFSET_BITMAP 54
/**
* @}
*/
/** @defgroup STM3210C_EVAL_LCD_Private_Macros STM3210C EVAL LCD Private Macros
* @{
*/
#define ABS(X) ((X) > 0 ? (X) : -(X))
/**
* @}
*/
/** @defgroup STM3210C_EVAL_LCD_Private_Variables STM3210C EVAL 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 STM3210C_EVAL_LCD_Private_Functions STM3210C EVAL LCD Private Functions
* @{
*/
static void LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
static void LCD_DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c);
static void LCD_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
/**
* @}
*/
/** @defgroup STM3210C_EVAL_LCD_Exported_Functions STM3210C EVAL LCD Exported Functions
* @{
*/
/**
* @brief Initializes the LCD.
* @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(ili9320_drv.ReadID() == ILI9320_ID)
{
lcd_drv = &ili9320_drv;
/* LCD Init */
lcd_drv->Init();
/* Initialize the font */
BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
ret = LCD_OK;
}
else if(ili9325_drv.ReadID() == ILI9325_ID)
{
lcd_drv = &ili9325_drv;
/* LCD Init */
lcd_drv->Init();
/* Initialize the font */
BSP_LCD_SetFont(&LCD_DEFAULT_FONT);
ret = LCD_OK;
}
return ret;
}
/**
* @brief Gets the LCD X size.
* @retval Used LCD X size
*/
uint32_t BSP_LCD_GetXSize(void)
{
return(lcd_drv->GetLcdPixelWidth());
}
/**
* @brief Gets the LCD Y size.
* @retval Used LCD Y size
*/
uint32_t BSP_LCD_GetYSize(void)
{
return(lcd_drv->GetLcdPixelHeight());
}
/**
* @brief Gets the LCD text color.
* @retval Used text color.
*/
uint16_t BSP_LCD_GetTextColor(void)
{
return DrawProp.TextColor;
}
/**
* @brief Gets the LCD background color.
* @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)
*/
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)
*/
void BSP_LCD_SetBackColor(uint16_t Color)
{
DrawProp.BackColor = Color;
}
/**
* @brief Sets the LCD text font.
* @param pFonts: Font to be used
*/
void BSP_LCD_SetFont(sFONT *pFonts)
{
DrawProp.pFont = pFonts;
}
/**
* @brief Gets the LCD text font.
* @retval Used font
*/
sFONT *BSP_LCD_GetFont(void)
{
return DrawProp.pFont;
}
/**
* @brief Clears the hole LCD.
* @param Color: Color of the background
*/
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
*/
void BSP_LCD_ClearStringLine(uint16_t Line)
{
uint32_t colorbackup = 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 = colorbackup;
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
*/
void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii)
{
LCD_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 pText: 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
*/
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *pText, Line_ModeTypdef Mode)
{
uint16_t refcolumn = 1, counter = 0;
uint32_t size = 0, xsize = 0;
uint8_t *ptr = pText;
/* 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 ((*pText != 0) & (((BSP_LCD_GetXSize() - (counter*DrawProp.pFont->Width)) & 0xFFFF) >= DrawProp.pFont->Width))
{
/* Display one character on LCD */
BSP_LCD_DisplayChar(refcolumn, Ypos, *pText);
/* Decrement the column position by 16 */
refcolumn += DrawProp.pFont->Width;
/* Point on the next character */
pText++;
counter++;
}
}
/**
* @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 pText: Pointer to string to display on LCD
*/
void BSP_LCD_DisplayStringAtLine(uint16_t Line, uint8_t *pText)
{
BSP_LCD_DisplayStringAt(0, LINE(Line),pText, 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(lcd_drv->ReadPixel != NULL)
{
ret = lcd_drv->ReadPixel(Xpos, Ypos);
}
return ret;
}
/**
* @brief Draws an horizontal line.
* @param Xpos: X position
* @param Ypos: Y position
* @param Length: Line length
*/
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++)
{
LCD_DrawPixel((Xpos + index), Ypos, DrawProp.TextColor);
}
}
}
/**
* @brief Draws a vertical line.
* @param Xpos: X position
* @param Ypos: Y position
* @param Length: Line length
*/
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++)
{
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
*/
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++)
{
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
*/
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
*/
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)
{
LCD_DrawPixel((Xpos + CurX), (Ypos - CurY), DrawProp.TextColor);
LCD_DrawPixel((Xpos - CurX), (Ypos - CurY), DrawProp.TextColor);
LCD_DrawPixel((Xpos + CurY), (Ypos - CurX), DrawProp.TextColor);
LCD_DrawPixel((Xpos - CurY), (Ypos - CurX), DrawProp.TextColor);
LCD_DrawPixel((Xpos + CurX), (Ypos + CurY), DrawProp.TextColor);
LCD_DrawPixel((Xpos - CurX), (Ypos + CurY), DrawProp.TextColor);
LCD_DrawPixel((Xpos + CurY), (Ypos + CurX), DrawProp.TextColor);
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
*/
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
*/
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 {
LCD_DrawPixel((Xpos-(uint16_t)(x/K)), (Ypos+y), DrawProp.TextColor);
LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos+y), DrawProp.TextColor);
LCD_DrawPixel((Xpos+(uint16_t)(x/K)), (Ypos-y), DrawProp.TextColor);
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.
*/
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;
LCD_SetDisplayWindow(Xpos, Ypos, width, height);
if(lcd_drv->DrawBitmap != NULL)
{
lcd_drv->DrawBitmap(Xpos, Ypos, pbmp);
}
LCD_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.
*/
void BSP_LCD_DrawRGBImage(uint16_t Xpos, uint16_t Ypos, uint16_t Xsize, uint16_t Ysize, uint8_t *pdata)
{
LCD_SetDisplayWindow(Xpos, Ypos, Xsize, Ysize);
if(lcd_drv->DrawRGBImage != NULL)
{
lcd_drv->DrawRGBImage(Xpos, Ypos, Xsize, Ysize, pdata);
}
LCD_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
*/
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
*/
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 ellipse.
* @param Xpos: X position
* @param Ypos: Y position
* @param XRadius: Ellipse X radius
* @param YRadius: Ellipse Y radius
*/
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.
*/
void BSP_LCD_DisplayOn(void)
{
lcd_drv->DisplayOn();
}
/**
* @brief Disables the display.
*/
void BSP_LCD_DisplayOff(void)
{
lcd_drv->DisplayOff();
}
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_LCD_Private_Functions
* @{
*/
/******************************************************************************
Static Function
*******************************************************************************/
/**
* @brief Draws a pixel on LCD.
* @param Xpos: X position
* @param Ypos: Y position
* @param RGBCode: Pixel color in RGB mode (5-6-5)
*/
static void LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
{
if(lcd_drv->WritePixel != NULL)
{
lcd_drv->WritePixel(Xpos, Ypos, RGBCode);
}
}
/**
* @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
*/
static void LCD_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 Sets display window.
* @param Xpos: LCD X position
* @param Ypos: LCD Y position
* @param Width: LCD window width
* @param Height: LCD window height
*/
static void LCD_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****/

View File

@ -1,203 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_lcd.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210c_eval_lcd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_LCD_H
#define __STM3210C_EVAL_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
#include "../Components/ili9325/ili9325.h"
#include "../Components/ili9320/ili9320.h"
#include "../../../Utilities/Fonts/fonts.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_LCD
* @{
*/
/** @defgroup STM3210C_EVAL_LCD_Exported_Types STM3210C EVAL LCD Exported Types
* @{
*/
typedef struct
{
uint32_t TextColor;
uint32_t BackColor;
sFONT *pFont;
}LCD_DrawPropTypeDef;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_LCD_Exported_Constants STM3210C EVAL LCD Exported Constants
* @{
*/
/**
* @brief LCD status structure definition
*/
#define LCD_OK 0x00
#define LCD_ERROR 0x01
#define LCD_TIMEOUT 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 0x001F
#define LCD_COLOR_GREEN 0x07E0
#define LCD_COLOR_RED 0xF800
#define LCD_COLOR_CYAN 0x07FF
#define LCD_COLOR_MAGENTA 0xF81F
#define LCD_COLOR_YELLOW 0xFFE0
#define LCD_COLOR_LIGHTBLUE 0x841F
#define LCD_COLOR_LIGHTGREEN 0x87F0
#define LCD_COLOR_LIGHTRED 0xFC10
#define LCD_COLOR_LIGHTCYAN 0x87FF
#define LCD_COLOR_LIGHTMAGENTA 0xFC1F
#define LCD_COLOR_LIGHTYELLOW 0xFFF0
#define LCD_COLOR_DARKBLUE 0x0010
#define LCD_COLOR_DARKGREEN 0x0400
#define LCD_COLOR_DARKRED 0x8000
#define LCD_COLOR_DARKCYAN 0x0410
#define LCD_COLOR_DARKMAGENTA 0x8010
#define LCD_COLOR_DARKYELLOW 0x8400
#define LCD_COLOR_WHITE 0xFFFF
#define LCD_COLOR_LIGHTGRAY 0xD69A
#define LCD_COLOR_GRAY 0x8410
#define LCD_COLOR_DARKGRAY 0x4208
#define LCD_COLOR_BLACK 0x0000
#define LCD_COLOR_BROWN 0xA145
#define LCD_COLOR_ORANGE 0xFD20
/**
* @brief LCD default font
*/
#define LCD_DEFAULT_FONT Font24
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_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);
uint16_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
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_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
void BSP_LCD_DisplayOff(void);
void BSP_LCD_DisplayOn(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_LCD_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

View File

@ -1,245 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_sd.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210c_eval_sd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_SD_H
#define __STM3210C_EVAL_SD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_SD
* @{
*/
/** @defgroup STM3210C_EVAL_SD_Exported_Types STM3210C EVAL 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 */
uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
} SD_CardInfo;
/**
* @}
*/
/** @defgroup STM3210C_EVAL_SPI_SD_Exported_Constants STM3210C EVAL SPI SD Exported Constants
* @{
*/
/**
* @brief SD detection on its memory slot
*/
#define SD_PRESENT ((uint8_t)0x01)
#define SD_NOT_PRESENT ((uint8_t)0x00)
#define SD_DATATIMEOUT 100000000U
/**
* @brief SD Card information structure
*/
#define BSP_SD_CardInfo SD_CardInfo
/**
* @brief SD transfer state definition
*/
#define SD_TRANSFER_OK ((uint8_t)0x00)
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
/**
* @}
*/
/** @addtogroup STM3210C_EVAL_SD_Exported_Functions
* @{
*/
uint8_t BSP_SD_Init(void);
uint8_t BSP_SD_IsDetected(void);
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
uint8_t BSP_SD_GetCardState(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);
void SD_IO_WriteData(const uint8_t *Data, uint16_t DataLength);
void SD_IO_ReadData(const uint8_t *Data, 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 /* __STM3210C_EVAL_SD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,236 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_ts.c
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage the touch
* screen on STM3210C_EVAL evaluation board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 touch screen module of the STM3210C-EVAL
evaluation board on the ILI9325 LCD mounted on MB785 daughter board .
- The STMPE811 IO expander device component driver must be included with this
driver in order to run the TS module commanded by the IO expander device
mounted on the evaluation board.
2. Driver description:
---------------------
+ Initialization steps:
o Initialize the TS module using the BSP_TS_Init() function. This
function includes the MSP layer hardware resources initialization and the
communication layer configuration to start the TS use. The LCD size properties
(x and y) are passed as parameters.
o If TS interrupt mode is desired, you must configure the TS interrupt mode
by calling the function BSP_TS_ITConfig(). The TS interrupt mode is generated
as an external interrupt whenever a touch is detected.
+ Touch screen use
o The touch screen state is captured whenever the function BSP_TS_GetState() is
used. This function returns information about the last LCD touch occurred
in the TS_StateTypeDef structure.
o If TS interrupt mode is used, the function BSP_TS_ITGetStatus() is needed to get
the interrupt status. To clear the IT pending bits, you should call the
function BSP_TS_ITClear().
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.
------------------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval_ts.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @defgroup STM3210C_EVAL_TS STM3210C EVAL Touch Screen
* @{
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_TS_Private_Variables STM3210C EVAL TS Private Variables
* @{
*/
static TS_DrvTypeDef *ts_driver;
static uint16_t ts_x_boundary, ts_y_boundary;
static uint8_t ts_orientation;
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_TS_Exported_Functions STM3210C EVAL TS Exported Functions
* @{
*/
/**
* @brief Initializes and configures the touch screen functionalities and
* configures all necessary hardware resources (GPIOs, clocks..).
* @param xSize: Maximum X size of the TS area on LCD
* @param ySize: Maximum Y size of the TS area on LCD
* @retval TS_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_TS_Init(uint16_t xSize, uint16_t ySize)
{
uint8_t ret = TS_ERROR;
if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID)
{
/* Initialize the TS driver structure */
ts_driver = &stmpe811_ts_drv;
/* Initialize x and y positions boundaries */
ts_x_boundary = xSize;
ts_y_boundary = ySize;
ts_orientation = TS_SWAP_XY;
ret = TS_OK;
}
if(ret == TS_OK)
{
/* Initialize the LL TS Driver */
ts_driver->Reset(TS_I2C_ADDRESS);
ts_driver->Init(TS_I2C_ADDRESS);
ts_driver->Start(TS_I2C_ADDRESS);
}
return ret;
}
/**
* @brief Configures and enables the touch screen interrupts.
* @retval TS_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_TS_ITConfig(void)
{
/* Call component driver to enable TS ITs */
ts_driver->EnableIT(TS_I2C_ADDRESS);
return TS_OK;
}
/**
* @brief Gets the touch screen interrupt status.
* @retval TS_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_TS_ITGetStatus(void)
{
/* Call component driver to enable TS ITs */
return (ts_driver->GetITStatus(TS_I2C_ADDRESS));
}
/**
* @brief Returns status and positions of the touch screen.
* @param TS_State: Pointer to touch screen current state structure
* @retval TS_OK: if all initializations are OK. Other value if error.
*/
uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State)
{
static uint32_t _x = 0, _y = 0;
uint16_t xDiff, yDiff , x , y;
uint16_t swap;
TS_State->TouchDetected = ts_driver->DetectTouch(TS_I2C_ADDRESS);
if(TS_State->TouchDetected)
{
ts_driver->GetXY(TS_I2C_ADDRESS, &x, &y);
if(ts_orientation & TS_SWAP_X)
{
x = 4096 - x;
}
if(ts_orientation & TS_SWAP_Y)
{
y = 4096 - y;
}
if(ts_orientation & TS_SWAP_XY)
{
swap = y;
y = x;
x = swap;
}
xDiff = x > _x? (x - _x): (_x - x);
yDiff = y > _y? (y - _y): (_y - y);
if (xDiff + yDiff > 5)
{
_x = x;
_y = y;
}
TS_State->x = (ts_x_boundary * _x) >> 12;
TS_State->y = (ts_y_boundary * _y) >> 12;
}
return TS_OK;
}
/**
* @brief Clears all touch screen interrupts.
*/
void BSP_TS_ITClear(void)
{
ts_driver->ClearIT(TS_I2C_ADDRESS);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,137 +0,0 @@
/**
******************************************************************************
* @file stm3210c_eval_ts.h
* @author MCD Application Team
* @version V6.1.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210c_eval_ts.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210C_EVAL_TS_H
#define __STM3210C_EVAL_TS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210c_eval.h"
#include "../Components/stmpe811/stmpe811.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210C_EVAL
* @{
*/
/** @addtogroup STM3210C_EVAL_TS
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_TS_Exported_Types STM3210C EVAL TS Exported Types
* @{
*/
typedef struct
{
uint16_t TouchDetected;
uint16_t x;
uint16_t y;
uint16_t z;
}TS_StateTypeDef;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STM3210C_EVAL_TS_Exported_Constants STM3210C EVAL TS Exported Constants
* @{
*/
#define TS_SWAP_NONE 0x00
#define TS_SWAP_X 0x01
#define TS_SWAP_Y 0x02
#define TS_SWAP_XY 0x04
typedef enum
{
TS_OK = 0x00,
TS_ERROR = 0x01,
TS_TIMEOUT = 0x02
}TS_StatusTypeDef;
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210C_EVAL_TS_Exported_Functions
* @{
*/
uint8_t BSP_TS_Init(uint16_t xSize, uint16_t ySize);
uint8_t BSP_TS_GetState(TS_StateTypeDef *TS_State);
uint8_t BSP_TS_ITConfig(void);
uint8_t BSP_TS_ITGetStatus(void);
void BSP_TS_ITClear(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM3210C_EVAL_TS_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 6b36c9912e39594ef9fba24d1e218b8dc3e62a2d

View File

@ -1,559 +0,0 @@
<!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 STM3210E_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 STM3210E_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
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/logo.bmp" 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;"><span style="font-size: 12pt; color: white;">Contents<o:p></o:p></span></h2>
<ol style="margin-top: 0cm;" start="1" type="1">
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#History">STM3210E_EVAL Evaluation Board Drivers
update History</a><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#License">License</a><o:p></o:p></span></li>
</ol>
<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;">STM3210E_EVAL Evaluation Board Drivers 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;">V7.0.0 / 14-April-2017 <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-family: Verdana; font-size: 10pt;">Add STM3210E_EVAL_BSP_User_Manual.chm file</span><span style="font-size: 10pt; font-family: Verdana;"></span></li><li><span style="font-size: 10pt; font-family: Verdana;">stm3210e</span><span style="font-family: Verdana; font-size: 10pt;">_eval_sd.c/.h:<span style="font-style: italic; font-weight: bold; text-decoration: underline;"></span></span></li><ul><li><span style="font-size: 10pt; font-family: Verdana;">Update BSP SD APIs </span><span style="font-family: Verdana; font-size: 10pt;">following new HAL SD drivers implementation</span></li><li><span style="font-size: 10pt; font-family: Verdana;">Fix BlockSize to 512 bytes</span></li></ul><li><span style="font-size: 10pt; font-family: Verdana;">stm3210e</span><span style="font-family: Verdana; font-size: 10pt;">_eval_audio.c/.h:</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">Add BSP_AUDIO_OUT_MspInit() and </span><span style="font-family: Verdana; font-size: 10pt;">BSP_AUDIO_OUT_MspDeInit()&nbsp;as weak&nbsp;</span><span style="font-family: Verdana; font-size: 10pt;">APIs to manage audio hardware resources initialization/de-initialization.</span></li></ul><li><span style="font-family: Verdana; font-size: 10pt;"><span style="font-style: italic; font-weight: bold; text-decoration: underline;">Notes:</span> <br>
</span></li><ul><li><span style="font-family: Verdana; font-size: 10pt;">These</span><span style="font-family: Verdana; font-size: 10pt;"> BSP drivers</span><span style="font-family: Verdana; font-size: 10pt;"> break the compatibility with previous versions.</span></li></ul><ul><li><span style="font-family: Verdana; font-size: 10pt;">If FatFs is required, </span><span style="font-family: Verdana; font-size: 10pt; font-style: italic;">"FatFS R0.11<span class="Apple-converted-space"> </span> </span><span style="font-family: Verdana; font-size: 10pt;"><span style="font-style: italic;">ST modified 20170214"</span><span style="color: red;"><span style="color: black;"></span></span></span><span style="font-family: Verdana; font-size: 10pt;"> must be used with </span><span style="font-family: Verdana; font-size: 10pt;">this version of BSP drivers.</span><br><span style="font-size: 10pt; font-family: Arial; color: white;"></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;">V6.0.2 / 29-April-2016</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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>Add AUDIO_IO_DeInit for compatibility with comon V4.0.1.</li><li>Set the NVIC priority to the lowest possible to not interfere with user settings.</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;">V6.0.1 / 18-December-2015</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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>Rename GPIO_SPEED_HIGH to GPIO_SPEED_FREQ_HIGH for compatibility with STM32F1xx HAL Drivers V1.0.2.</li><li>Rename GPIO_SPEED_MEDIUM to GPIO_SPEED_FREQ_MEDIUM for compatibility with STM32F1xx HAL Drivers V1.0.2.</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;">V6.0.0 / 16-December-2014</span></h3><b style=""><u><span style="font-size: 10pt; font-family: Verdana; color: black;"></span></u></b><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;">Major update
based on STM32Cube specification: drivers architecture and APIs
modified vs. V5.1.0 and thus the 2 versions are not compatible.<br>
</span></li><li style="font-weight: bold;"><span style="font-size: 10pt; font-family: Verdana;">This version has to be used only with </span><span style="font-size: 10pt; font-family: Verdana;">STM32CubeF1</span><span style="font-size: 10pt; font-family: Verdana;"> based development</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V5.1.0 / 8-January-2013<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>
<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;">stm3210e_eval_lcd.c: update to support new LCD <span style="font-style: italic;">AM240320LGTNQW00H </span>(<span style="font-style: italic;">controller HX8347-D</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V5.0.1 / 05-March-2012<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>
<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;">All source files:&nbsp;license disclaimer text update and add link to the License file on ST Internet.</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;">V5.0.0 / 03-February-2012<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>
<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;"></span><span style="font-size: 10pt; font-family: Verdana;">All source files: update disclaimer to add reference to the&nbsp;new license agreement</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update STM32 Evaluation Board Drivers architecture and folder organization,&nbsp;<span style="font-weight: bold; font-style: italic;">full&nbsp;API compatibility maintained vs. V4.6.2</span></span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">All the HW&nbsp;drivers required for each board are&nbsp;provided within this board folder</span><span style="font-size: 10pt; font-family: Verdana;">. The concerned drivers are:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c\.h:</span>&nbsp;I2C M24Cxx EEPROM memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_tsensor.c\.h:</span>&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">I2C </span><span style="font-size: 10pt; font-family: Verdana;">LM75 temperature sensor driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_spi_flash.c\.h:</span> SPI M25Pxxx FLASH memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_sdio_sd.c\.h:</span> SDIO SD Card memory driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_spi_sd.c\.h:</span>&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">SPI SD Card memory driver&nbsp;</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">These drivers were&nbsp;moved from </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\Common</span> to </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\STM32XXX_EVAL</span> folder(s)</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">\Common&nbsp;</span></span><span style="font-size: 10pt; font-family: Verdana;">folder contains only drivers for the fonts and log module used by the LCD driver</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval.c\.h</span> files removed, <span style="font-style: italic; text-decoration: underline;">as consequence you need to perform the following update on your project configuration&nbsp; (based on EVAL drivers V4.6.2):</span></span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">In the&nbsp;project files, add your EVAL board driver source&nbsp;file&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">"</span></span><span style="font-size: 10pt; font-family: Verdana; font-style: italic;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">_eval.c"</span>&nbsp;instead of <span style="font-style: italic;">"stm32_eval.c"</span></span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Include your EVAL board driver header file&nbsp;<span style="font-style: italic;">#include "</span></span><span style="font-size: 10pt; font-family: Verdana; font-style: italic;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">_eval.h"</span>&nbsp;instead of <span style="font-style: italic;">#include "stm32_eval.h"</span></span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">If
you are&nbsp;using the EVAL board's LCD, you need to add the include of
the LCD header file&nbsp;#include "</span><span style="font-size: 10pt; font-family: Verdana;">stm3210e</span><span style="font-size: 10pt; font-family: Verdana;">_eval_lcd.h"</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">If
you are using the LCD log module, after copying it to the application
folder you have to edit it and update the name of the LCD header file. For more details, refer to the <span style="font-style: italic;">lcd_log_conf_template.h</span> driver description.</span></li></ul></ul></ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_lcd.c</span></li><ul><li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Remove &#8220;static&#8221; from&nbsp;<span style="font-style: italic;">TextColor</span> and&nbsp;<span style="font-style: italic;">BackColor</span> variables declaration (need to be changed from other application modules)&nbsp;</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.h/.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">change value of&nbsp;<span style="font-style: italic;">&#8220;SDIO_TRANSFER_CLK_DIV&#8221;</span> define from 0 to 1 to achieve SD max frequency at 24MHz.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Remove <span style="font-style: italic;">SD_DMAEndOfTransferStatus()</span> function as now the DMA transfer is tracked using DMA End of transfer interrupt.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update </span><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">SD_LowLevel_DMA_TxConfig()</span> and <span style="font-style: italic;">SD_LowLevel_DMA_RxConfig()</span> functions to enable the DMA transfer complete IT</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_sdio_sd.h/.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new function <span style="font-style: italic;">SD_ProcessDMAIRQ()</span> to be called from the DMA end of transfer interrupt.&nbsp;</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add some improvements by handling SDIO errors and adding timeout for different loops.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update to support SDHC memory cards with capacity greater than 4 GB</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">SD_CardInfo</span> structure, define <span style="font-style: italic;">CardCapacity </span>variable as 64-bit long (instead of 32-bit)</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Declare <span style="font-style: italic;">ReadAddr</span> and <span style="font-style: italic;">WriteAddr</span> parameters in <span style="font-style: italic;">SD_ReadBlock()</span>,<span style="font-style: italic;">SD_WriteBlock()</span>, <span style="font-style: italic;">SD_ReadMultiBlocks() </span>and <span style="font-style: italic;">SD_WriteMultiBlocks()</span> as 64-bit long (instead of 32-bit)<br></span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Refer to the driver header file's comments for more information on how to use the provided API.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">NOR_ProgramBuffer()</span> function: remove this comment "This function must be used only with S29GL128P NOR memory."&nbsp;&nbsp;</span><br><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"><br></span></li></ul></ul><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: 175px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.2 /&nbsp;22-July-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210C_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_lcd.c: update to support new LCD AM240320D5TOQW01H (controller ILI9325)</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM322xG-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval.h: fix value of the SDIO clock divider (<span style="font-style: italic;">SDIO_TRANSFER_CLK_DIV</span> constant) to 2 instead of 0</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval_lcd.c: increase FSMC<span style="font-style: italic;"> AddressSetupTime</span> value from 1 to 3 to be compliant with some&nbsp;LCD access timing</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval_audio_codec.c: update <span style="font-style: italic;">Codec_CtrlInterface_Init(</span>) and <span style="font-style: italic;">Codec_GPIO_Init(</span>) functions to not reconfigure the I2C peripheral if it's&nbsp;already </span><span style="font-size: 10pt; font-family: Verdana;">enabled and </span><span style="font-size: 10pt; font-family: Verdana;">configured&nbsp;(to
avoid configuring the I2C twice when using both&nbsp;Audio codec and IO
Expander drivers in the same application).</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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.1 / 18-April-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">some</span><span style="font-size: 10pt; font-family: Verdana;"> <span style="font-weight: bold; font-style: italic;">STM322xG_EVAL</span> drivers (no change on the API) to fix&nbsp;warnings wit<span style="font-weight: bold; font-style: italic;"></span>h TASKING C compiler.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Change the Release Notes name to <span style="font-weight: bold; font-style: italic;">STM32 Evaluation Board Drivers </span><br></span></li><li style="font-style: italic;" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm322xg_eval.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SD_LowLevel_Init(): change&nbsp;SDIO pins speed configuration to&nbsp;"GPIO_Speed_25MHz"</span></li></ul></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><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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.6.0 / 11-March-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Official version supporting <span style="font-weight: bold; font-style: italic;">STM322xG_EVAL</span> evaluation board RevB (for <span style="font-weight: bold; font-style: italic;">STM32F2xx</span> devices).</span></li><li style="font-style: italic;" class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Common</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new LCD log utility drivers: The LCD Log module allows to automatically
set a header and footer on any application using the LCD display and
allows to dump user, debug and error messages by using the following
macros: LCD_ErrLog(),&nbsp;&nbsp;&nbsp; LCD_UsrLog() and LCD_DbgLog().</span></li></ul></ul><div style="margin-left: 40px;"><span style="font-size: 10pt; font-family: Verdana;"><span style="text-decoration: underline; font-style: italic;">Note</span><span style="font-style: italic;">:</span> the <span style="font-style: italic;">STM322xG_EVAL</span> board RevA was wrongly named <span style="font-style: italic;">STM3220F_EVAL</span></span><br></div><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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.5.0 / 07-March-2011<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.c\.h: driver improvement</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SD Clock increased to 24MHz to improve the data transfer performance.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new functions to check the SDIO peripheral and SD Card status at any
time:&nbsp;SD_WaitReadOperation(), SD_WaitWriteOperation(). The
software sequence is little bit changed&nbsp;but without any impact on
driver API. For more details, refer to the stm32_eval_sdio_sd.c
driver&nbsp;description.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
new structure containing the SD Status register parameters. This
structure is called by the
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;SD_SendSDStatus() function.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Transfers mode updated</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Read/Write Block using Polling and DMA modes</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Read/Write Multi Blocks using DMA mode only</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Interrupt mode removed</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Data transfer functions are managing only fixed Block size (512-byte)&nbsp;</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100B-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval_cec.c: fix some strict ANSI-C errors</span><span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100E-EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_cec.c: fix some strict ANSI-C errors<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: 167px;"><span style="font-size: 10pt; font-family: Arial; color: white;">V4.4.0 / 31-December-2010<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>
<ul style="margin-top: 0cm;" type="square"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new directory for STM32L152-EVAL board containing the following files:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32l152_eval.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32l152</span><span style="font-size: 10pt; font-family: Verdana;">_eval_lcd.h/.c, stm32l152_eval_glass_lcd.h</span><span style="font-size: 10pt; font-family: Verdana;">/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32l152_eval_i2c_ee</span><span style="font-size: 10pt; font-family: Verdana;">.h/.c</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add support for the STM32100E-EVAL Rev B: SPI FLASH CS pin "sFLASH_CS_PIN" changed from PB.02 to PE.06.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_lcd.h/.c: Add support for "LCD_ILI9325" LCD controller.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval_fsmc_onenand.h/.c driver updated to correct asynchronous and synchronous read operations procedures.<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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.3.0
- 10/15/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">I2C EEPROM,&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">Temperature Sensor and&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">IOE Expander</span><span style="font-size: 10pt; font-family: Verdana;"> drivers&nbsp;updated to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">use the DMA for read/write transfer and add more robustness</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">SD Card (SDIO) driver updated to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">add more robustness</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">SPI Flash and </span><span style="font-size: 10pt; font-family: Verdana;">SD Card (SPI) drivers: SPI MISO pin configuration changed to Input Floating&nbsp;</span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="circle"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add new directory for STM32100E-EVAL board containing the following files:</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100e_eval.h/.c,
stm32100e_eval_lcd.h/.c, stm32100e_eval_cec.h/.c,
stm32100e_eval_fsmc_onenand.h/.c, stm32100e_eval_fsmc_sram.h/.c,
stm32100e_eval_ioe.h/.c</span><br>
<span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span></span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Common</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.c:
Update the DMA End of Transfer Check loop inside the SD_ReadBlock(),
SD_WriteBlock(), SD_ReadMultiBlocks() and SD_Write MultiBlocks().</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c/.h</span> <br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced sEE_WaitEepromStandbyState() function for more robustness.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced Read and Write operations to manage I2C limitations.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add
critical sections user callbacks allowing to disable then enable
interrupts when I2C operation require to be not interrupted.</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_tsensor.c/.h</span> <br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced I2C communication functions by using DMA for registers Read and Write operations.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li></ul></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM32100B_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm32100b_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210B_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210b_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210b_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">STM3210C_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval.h: Add EEPROM driver Timeout define.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_lcd.c: </span><span style="font-size: 10pt; font-family: Verdana;">Change "SPI_FLASH" by "sFLASH" in LCD_DrawBMP() function.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210c_eval_i2c_ioe.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Enhanced I2C communication functions by using DMA for registers Read and Write operations.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Add Timeout management with user callback implementation which allows recovering from I2C bus errors.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">change IOE_I2C_SPEED from "400000" to "300000".</span></li></ul></ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">STM3210E_EVAL</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.c: change "void SD_WaitForDMAEndOfTransfer(void)" to "uint32_t SD_DMAEndOfTransferStatus(void)".</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval.h: Add LM75 DMA defines.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.h: remove "NAND_CMD_AREA_TRUE1" define.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.c: Update FSMC timing in NAND_Init() function to be aligned with AN2784 application note.</span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">NOR</span><span style="font-size: 10pt; font-family: Verdana;">_Init()&nbsp;function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_sram.c<br>
</span></li></ul><ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">Update FSMC timing in SRAM_Init() function to be aligned with AN2784 application note.</span><br>
<span style="font-size: 10pt; font-family: Verdana;"></span></li></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">SRAM_Init()&nbsp;function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></ul><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_lcd.c</span></li><ul><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">LCD_FSMCConfig() function: add FSMC_AsynchronousWait&nbsp;field&nbsp;to FSMC_NORSRAMInitStructure&nbsp;</span></li></ul></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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.2.0
- 04/16/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">I2C EEPROM driver
update to&nbsp;</span><span style="font-size: 10pt; font-family: Verdana;">use the DMA to
perform&nbsp;data transfer&nbsp;to/from EEPROM memory.</span><span style="font-size: 10pt; font-family: Verdana;"> </span><span style="font-size: 10pt;"><o:p></o:p></span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><i><u><span style="font-size: 10pt; font-family: Verdana;">STM32_EVAL</span></u></i><u><span style="font-size: 10pt;"><o:p></o:p></span></u></li></ul>
<ul style="margin-top: 0in;" type="disc"><ul style="margin-top: 0in;" type="circle"><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm32_eval_i2c_ee.c</span>:
updated to use the DMA to perform&nbsp;data transfer&nbsp;to/from
EEPROM memory. For more details, refer to the description provided
within this file.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210c_eval.c</span>: add low level
functions to configure the DMA (needed for I2C EEPROM driver)<br>
</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210c_eval_ioe.c</span>: add a delay
in&nbsp;IOE_TS_GetState() function to wait till the end of ADC
conversion</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210e_eval_fsmc_nor.c</span>: add </span><span style="font-size: 10pt; font-family: Verdana;">PD6 pin </span><span style="font-size: 10pt; font-family: Verdana;">configuration&nbsp;in
NOR_Init() function</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;">stm3210b_eval_lcd.c</span>: remove the
second ";" from "static void PutPixel(int16_t x, int16_t y);;"&nbsp;</span><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: 558.05pt;"><span style="font-size: 10pt; font-family: Arial; color: white;">4.1.0
- 03/01/2010</span></h3>
<ol style="margin-top: 0in;" start="1" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">General</span></i></b><i><span style="font-size: 10pt; font-family: Verdana;"> </span></i><i><span style="font-size: 10pt;"><o:p></o:p></span></i></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add support
for&nbsp;<b>STM32 Low-density Value line (STM32F100x4/6) and
Medium-density Value line (STM32F100x8/B) devices</b>.</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add support for the
STMicroelectronics STM32100B-EVAL evaluation board. </span><span style="font-size: 10pt;"><o:p></o:p></span></li></ul>
<ol style="margin-top: 0in;" start="2" type="1"><li class="MsoNormal" style=""><b><i><span style="font-size: 10pt; font-family: Verdana;">Utilities</span></i></b><b><i><span style="font-size: 10pt;"><o:p></o:p></span></i></b></li></ol>
<ul style="margin-top: 0in;" type="disc"><li class="MsoNormal" style=""><i><u><span style="font-size: 10pt; font-family: Verdana;">STM32_EVAL</span></u></i><u><span style="font-size: 10pt;"><o:p></o:p></span></u></li></ul>
<ul style="margin-top: 0in;" type="circle"><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;"></span><span style="font-size: 10pt; font-family: Verdana;">Add new directory
"Common" containing a common drivers for all STM32 evaluation boards:
fonts.h/.c, stm32_eval_i2c_ee.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_spi_flash.h/.c,
</span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_i2c_tsensor.h/.c,
</span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_spi_sd.h/.c
and </span><span style="font-size: 10pt; font-family: Verdana;">stm32_eval_sdio_sd.h/.c</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">Add new driver for the
STM32100B-EVAL managing Leds, push button and COM ports.</span></li><li class="MsoNormal"><span style="font-size: 10pt; font-family: Verdana;">New HDMI CEC High level
driver.</span><br>
</li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;"><span style="font-style: italic;"></span>For all LCD drivers new fonts has
been added.</span></li><li class="MsoNormal" style=""><span style="font-size: 10pt; font-family: Verdana;">New FSMC memories
drivers for STM3210E-EVAL board: stm3210e_eval_fsmc_sram.h/.c, </span><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nor.h/.c
and </span><span style="font-size: 10pt; font-family: Verdana;">stm3210e_eval_fsmc_nand.h/.c.</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;"><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-size: 10pt; color: black; font-family: 'Verdana','sans-serif';"></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; color: black; font-family: 'Verdana','sans-serif';">For
complete documentation on </span><span style="font-size: 10pt; font-family: 'Verdana','sans-serif';">STM32<span style="color: black;"> Microcontrollers visit&nbsp;</span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><u><span style="color: blue;"></span></u></span><u><a href="http://www.st.com/STM32" target="_blank">www.st.com/STM32</a></u></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>

File diff suppressed because it is too large Load Diff

View File

@ -1,542 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains definitions for STM3210E_EVAL's LEDs,
* push-buttons and COM ports hardware resources.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_H
#define __STM3210E_EVAL_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup STM3210E_EVAL_Common
* @{
*/
/** @defgroup STM3210E_EVAL_Exported_Types STM3210E EVAL Exported Types
* @{
*/
/**
* @brief LED Types Definition
*/
typedef enum
{
LED1 = 0,
LED2 = 1,
LED3 = 2,
LED4 = 3,
LED_GREEN = LED1,
LED_ORANGE = LED2,
LED_RED = LED3,
LED_BLUE = LED4
} Led_TypeDef;
/**
* @brief BUTTON Types Definition
*/
typedef enum
{
BUTTON_WAKEUP = 0,
BUTTON_TAMPER = 1,
BUTTON_KEY = 2,
BUTTON_SEL = 3,
BUTTON_LEFT = 4,
BUTTON_RIGHT = 5,
BUTTON_DOWN = 6,
BUTTON_UP = 7,
} Button_TypeDef;
typedef enum
{
BUTTON_MODE_GPIO = 0,
BUTTON_MODE_EXTI = 1,
BUTTON_MODE_EVT = 2
} ButtonMode_TypeDef;
/**
* @brief JOYSTICK Types Definition
*/
typedef enum
{
JOY_SEL = 0,
JOY_LEFT = 1,
JOY_RIGHT = 2,
JOY_DOWN = 3,
JOY_UP = 4,
JOY_NONE = 5
}JOYState_TypeDef;
typedef enum
{
JOY_MODE_GPIO = 0,
JOY_MODE_EXTI = 1
}JOYMode_TypeDef;
/**
* @brief COM Types Definition
*/
typedef enum
{
COM1 = 0,
COM2 = 1
} COM_TypeDef;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_Exported_Constants STM3210E EVAL Exported Constants
* @{
*/
/**
* @brief Define for STM3210E_EVAL board
*/
#if !defined (USE_STM3210E_EVAL)
#define USE_STM3210E_EVAL
#endif
/** @defgroup STM3210E_EVAL_LED STM3210E EVAL LED
* @{
*/
#define LEDn 4
#define LED1_PIN GPIO_PIN_6 /* PF.06*/
#define LED1_GPIO_PORT GPIOF
#define LED1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define LED1_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define LED2_PIN GPIO_PIN_7 /* PF.07*/
#define LED2_GPIO_PORT GPIOF
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define LED3_PIN GPIO_PIN_8 /* PF.08*/
#define LED3_GPIO_PORT GPIOF
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define LED4_PIN GPIO_PIN_9 /* PF.09*/
#define LED4_GPIO_PORT GPIOF
#define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
#define LEDx_GPIO_CLK_ENABLE(__LED__) do { if ((__LED__) == LED1) LED1_GPIO_CLK_ENABLE(); else\
if ((__LED__) == LED2) LED2_GPIO_CLK_ENABLE(); else \
if ((__LED__) == LED3) LED3_GPIO_CLK_ENABLE(); else\
if ((__LED__) == LED4) LED4_GPIO_CLK_ENABLE();} while(0)
#define LEDx_GPIO_CLK_DISABLE(__LED__) (((__LED__) == LED1) ? LED1_GPIO_CLK_DISABLE() :\
((__LED__) == LED2) ? LED2_GPIO_CLK_DISABLE() :\
((__LED__) == LED3) ? LED3_GPIO_CLK_DISABLE() :\
((__LED__) == LED4) ? LED4_GPIO_CLK_DISABLE() : 0 )
/**
* @}
*/
/** @defgroup STM3210E_EVAL_BUTTON STM3210E EVAL BUTTON
* @{
*/
#define JOYn 5
#define BUTTONn 3 + JOYn
/**
* @brief Tamper push-button
*/
#define TAMPER_BUTTON_PIN GPIO_PIN_13 /* PC.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_8 /* PG.08*/
#define KEY_BUTTON_GPIO_PORT GPIOG
#define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#define KEY_BUTTON_EXTI_IRQn EXTI9_5_IRQn
/**
* @brief Wake-up push-button
*/
#define WAKEUP_BUTTON_PIN GPIO_PIN_0 /* PA.00*/
#define WAKEUP_BUTTON_GPIO_PORT GPIOA
#define WAKEUP_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define WAKEUP_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn
/**
* @brief Joystick Right push-button
*/
#define RIGHT_JOY_PIN GPIO_PIN_13 /* PG.13*/
#define RIGHT_JOY_GPIO_PORT GPIOG
#define RIGHT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define RIGHT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#define RIGHT_JOY_EXTI_IRQn EXTI15_10_IRQn
/**
* @brief Joystick Left push-button
*/
#define LEFT_JOY_PIN GPIO_PIN_14 /* PG.14*/
#define LEFT_JOY_GPIO_PORT GPIOG
#define LEFT_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define LEFT_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#define LEFT_JOY_EXTI_IRQn EXTI15_10_IRQn
/**
* @brief Joystick Up push-button
*/
#define UP_JOY_PIN GPIO_PIN_15 /* PG.15*/
#define UP_JOY_GPIO_PORT GPIOG
#define UP_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define UP_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#define UP_JOY_EXTI_IRQn EXTI15_10_IRQn
/**
* @brief Joystick Down push-button
*/
#define DOWN_JOY_PIN GPIO_PIN_3 /* PD.03*/
#define DOWN_JOY_GPIO_PORT GPIOD
#define DOWN_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
#define DOWN_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
#define DOWN_JOY_EXTI_IRQn EXTI3_IRQn
/**
* @brief Joystick Sel push-button
*/
#define SEL_JOY_PIN GPIO_PIN_7 /* PG.07*/
#define SEL_JOY_GPIO_PORT GPIOG
#define SEL_JOY_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define SEL_JOY_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
#define SEL_JOY_EXTI_IRQn EXTI9_5_IRQn
#define BUTTONx_GPIO_CLK_ENABLE(__BUTTON__) do { if ((__BUTTON__) == BUTTON_TAMPER) TAMPER_BUTTON_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_KEY) KEY_BUTTON_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_WAKEUP) WAKEUP_BUTTON_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_SEL) SEL_JOY_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_LEFT) LEFT_JOY_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_RIGHT) RIGHT_JOY_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_DOWN) DOWN_JOY_GPIO_CLK_ENABLE(); else\
if ((__BUTTON__) == BUTTON_UP) UP_JOY_GPIO_CLK_ENABLE();} while(0)
#define BUTTONx_GPIO_CLK_DISABLE(__BUTTON__) (((__BUTTON__) == BUTTON_TAMPER) ? TAMPER_BUTTON_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_KEY) ? KEY_BUTTON_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_WAKEUP) ? WAKEUP_BUTTON_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_SEL) ? SEL_JOY_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_LEFT) ? LEFT_JOY_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_RIGHT) ? RIGHT_JOY_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_DOWN) ? DOWN_JOY_GPIO_CLK_DISABLE() :\
((__BUTTON__) == BUTTON_UP) ? UP_JOY_GPIO_CLK_DISABLE() : 0 )
#define JOYx_GPIO_CLK_ENABLE(__JOY__) do { if ((__JOY__) == JOY_SEL) SEL_JOY_GPIO_CLK_ENABLE(); else\
if ((__JOY__) == JOY_LEFT) LEFT_JOY_GPIO_CLK_ENABLE(); else\
if ((__JOY__) == JOY_RIGHT) RIGHT_JOY_GPIO_CLK_ENABLE(); else\
if ((__JOY__) == JOY_DOWN) DOWN_JOY_GPIO_CLK_ENABLE(); else\
if ((__JOY__) == JOY_UP) UP_JOY_GPIO_CLK_ENABLE();} while(0)
#define JOYx_GPIO_CLK_DISABLE(__JOY__) (((__JOY__) == JOY_SEL) ? SEL_JOY_GPIO_CLK_DISABLE() :\
((__JOY__) == JOY_LEFT) ? LEFT_JOY_GPIO_CLK_DISABLE() :\
((__JOY__) == JOY_RIGHT) ? RIGHT_JOY_GPIO_CLK_DISABLE() :\
((__JOY__) == JOY_DOWN) ? DOWN_JOY_GPIO_CLK_DISABLE() :\
((__JOY__) == JOY_UP) ? UP_JOY_GPIO_CLK_DISABLE() : 0 )
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_COM
* @{
*/
#define COMn 2
/**
* @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 /* PA.09*/
#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_RX_PIN GPIO_PIN_10 /* PA.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_IRQn USART1_IRQn
/**
* @brief Definition for COM port2, connected to USART2
*/
#define EVAL_COM2 USART2
#define EVAL_COM2_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE()
#define EVAL_COM2_CLK_DISABLE() __HAL_RCC_USART2_CLK_DISABLE()
#define EVAL_COM2_TX_PIN GPIO_PIN_2 /* PA.02*/
#define EVAL_COM2_TX_GPIO_PORT GPIOA
#define EVAL_COM2_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define EVAL_COM2_TX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define EVAL_COM2_RX_PIN GPIO_PIN_3 /* PA.03*/
#define EVAL_COM2_RX_GPIO_PORT GPIOA
#define EVAL_COM2_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define EVAL_COM2_RX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define EVAL_COM2_IRQn USART2_IRQn
#define COMx_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_CLK_ENABLE(); else\
if((__INDEX__) == COM2) EVAL_COM2_CLK_ENABLE();} while(0)
#define COMx_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_CLK_DISABLE() :\
((__INDEX__) == COM2) ? EVAL_COM2_CLK_DISABLE() : 0)
#define COMx_TX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_TX_GPIO_CLK_ENABLE(); else\
if((__INDEX__) == COM2) EVAL_COM2_TX_GPIO_CLK_ENABLE();} while(0)
#define COMx_TX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_TX_GPIO_CLK_DISABLE() :\
((__INDEX__) == COM2) ? EVAL_COM2_TX_GPIO_CLK_DISABLE() : 0)
#define COMx_RX_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == COM1) EVAL_COM1_RX_GPIO_CLK_ENABLE(); else\
if((__INDEX__) == COM2) EVAL_COM2_RX_GPIO_CLK_ENABLE();} while(0)
#define COMx_RX_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == COM1) ? EVAL_COM1_RX_GPIO_CLK_DISABLE() :\
((__INDEX__) == COM2) ? EVAL_COM2_RX_GPIO_CLK_DISABLE() : 0)
/**
* @}
*/
/** @defgroup STM3210E_EVAL_BUS STM3210E EVAL BUS
* @{
*/
/* Exported constant IO ------------------------------------------------------*/
/*##################### I2Cx ###################################*/
/* User can use this section to tailor I2Cx instance used and associated
resources */
/* Definition for I2Cx Pins */
#define EVAL_I2Cx_SCL_PIN GPIO_PIN_6 /* PB.06*/
#define EVAL_I2Cx_SCL_GPIO_PORT GPIOB
#define EVAL_I2Cx_SDA_PIN GPIO_PIN_7 /* PB.07*/
#define EVAL_I2Cx_SDA_GPIO_PORT GPIOB
/* Definition for I2Cx clock resources */
#define EVAL_I2Cx I2C1
#define EVAL_I2Cx_CLK_ENABLE() __HAL_RCC_I2C1_CLK_ENABLE()
#define EVAL_I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define EVAL_I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define EVAL_I2Cx_FORCE_RESET() __HAL_RCC_I2C1_FORCE_RESET()
#define EVAL_I2Cx_RELEASE_RESET() __HAL_RCC_I2C1_RELEASE_RESET()
/* Definition for I2Cx's NVIC */
#define EVAL_I2Cx_EV_IRQn I2C1_EV_IRQn
#define EVAL_I2Cx_EV_IRQHandler I2C1_EV_IRQHandler
#define EVAL_I2Cx_ER_IRQn I2C1_ER_IRQn
#define EVAL_I2Cx_ER_IRQHandler I2C1_ER_IRQHandler
/* I2C clock speed configuration (in Hz)
WARNING:
Make sure that this define is not already declared in other files (ie.
stm3210e_eval.h file). It can be used in parallel by other modules. */
#ifndef BSP_I2C_SPEED
#define BSP_I2C_SPEED 100000
#endif /* I2C_SPEED */
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the I2C communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define EVAL_I2Cx_TIMEOUT_MAX 3000
/*##################### SPIx ###################################*/
#define EVAL_SPIx SPI1
#define EVAL_SPIx_CLK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
#define EVAL_SPIx_SCK_GPIO_PORT GPIOA /* PA.05*/
#define EVAL_SPIx_SCK_PIN GPIO_PIN_5
#define EVAL_SPIx_SCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define EVAL_SPIx_SCK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define EVAL_SPIx_MISO_MOSI_GPIO_PORT GPIOA
#define EVAL_SPIx_MISO_MOSI_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define EVAL_SPIx_MISO_MOSI_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define EVAL_SPIx_MISO_PIN GPIO_PIN_6 /* PA.06*/
#define EVAL_SPIx_MOSI_PIN GPIO_PIN_7 /* PA.07*/
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the SPI communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define EVAL_SPIx_TIMEOUT_MAX 1000
/**
* @}
*/
/** @defgroup STM3210E_EVAL_COMPONENT STM3210E EVAL COMPONENT
* @{
*/
/*##################### FLASH SPI ###################################*/
/**
* @brief M25P FLASH SPI Chip Select macro definition
*/
#define FLASH_SPI_CS_LOW() HAL_GPIO_WritePin(FLASH_SPI_CS_GPIO_PORT, FLASH_SPI_CS_PIN, GPIO_PIN_RESET)
#define FLASH_SPI_CS_HIGH() HAL_GPIO_WritePin(FLASH_SPI_CS_GPIO_PORT, FLASH_SPI_CS_PIN, GPIO_PIN_SET)
/**
* @brief M25P FLASH SPI Control Interface pins
*/
#define FLASH_SPI_CS_PIN GPIO_PIN_2 /* PB.02*/
#define FLASH_SPI_CS_GPIO_PORT GPIOB
#define FLASH_SPI_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define FLASH_SPI_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief M25P FLASH SPI supported commands
*/
#define FLASH_SPI_CMD_WRITE 0x02 /*!< Write to Memory instruction */
#define FLASH_SPI_CMD_WRSR 0x01 /*!< Write Status Register instruction */
#define FLASH_SPI_CMD_WREN 0x06 /*!< Write enable instruction */
#define FLASH_SPI_CMD_READ 0x03 /*!< Read from Memory instruction */
#define FLASH_SPI_CMD_RDSR 0x05 /*!< Read Status Register instruction */
#define FLASH_SPI_CMD_RDID 0x9F /*!< Read identification */
#define FLASH_SPI_CMD_SE 0xD8 /*!< Sector Erase instruction */
#define FLASH_SPI_CMD_BE 0xC7 /*!< Bulk Erase instruction */
#define FLASH_SPI_WIP_FLAG 0x01 /*!< Write In Progress (WIP) flag */
#define FLASH_SPI_DUMMY_BYTE 0xA5
#define FLASH_SPI_PAGESIZE 0x100
#define FLASH_SPI_M25P128_ID 0x202018
#define FLASH_SPI_M25P64_ID 0x202017
/*##################### AUDIO ##########################*/
/**
* @brief AUDIO I2C Interface pins
*/
#define AUDIO_I2C_ADDRESS 0x27
/* Audio Reset Pin definition */
#define AUDIO_RESET_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
#define AUDIO_RESET_PIN GPIO_PIN_11
#define AUDIO_RESET_GPIO GPIOG
/**
* @}
*/
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_Exported_Functions
* @{
*/
uint32_t BSP_GetVersion(void);
void BSP_LED_Init(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 Button_Mode);
uint32_t BSP_PB_GetState(Button_TypeDef Button);
#ifdef HAL_UART_MODULE_ENABLED
void BSP_COM_Init(COM_TypeDef COM, UART_HandleTypeDef* huart);
#endif /* HAL_UART_MODULE_ENABLED */
uint8_t BSP_JOY_Init(JOYMode_TypeDef Joy_Mode);
JOYState_TypeDef BSP_JOY_GetState(void);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,725 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_audio.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file provides the Audio driver for the STM3210E-Eval
* board.
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
(#) This driver supports STM32F103xE devices on STM3210E-Eval Kit:
(++) to play an audio file (all functions names start by BSP_AUDIO_OUT_xxx)
[..]
(#) PLAY A FILE:
(++) Call the function BSP_AUDIO_OUT_Init(
OutputDevice: physical output mode (OUTPUT_DEVICE_SPEAKER,
OUTPUT_DEVICE_HEADPHONE, 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, I2S, GPIOs, DMA and interrupt if needed). This function returns 0
if configuration is OK.
If the returned value is different from 0 or the function is stuck then the
communication with the codec (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.
(++) Call the function BSP_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 BSP_AUDIO_OUT_XXXCallBack() and only
their prototypes are declared in the stm3210e_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 or to mute,
use the functions BSP_AUDIO_OUT_Stop(), BSP_AUDIO_OUT_SetVolume(),
AUDIO_OUT_SetFrequency() BSP_AUDIO_OUT_SetOutputMode and BSP_AUDIO_OUT_SetMute().
(++) The driver API and the callback functions are at the end of the
stm3210e_eval_audio.h file.
(++) This driver provide the High Audio Layer: consists of the function API
exported in the stm3210e_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 stm3210e_eval_audio.c file (I2SOUT_Init()...)
[..]
##### Known Limitations #####
==============================================================================
(#) When using the Speaker, if the audio file quality is not high enough, the
speaker output may produce high and uncomfortable noise level. To avoid
this issue, to use speaker output properly, try to increase audio file
sampling rate (typically higher than 48KHz).
This operation will lead to larger file size.
(#) Communication with the audio codec (through I2C) may be corrupted if it
is interrupted by some user interrupt routines (in this case, interrupts
could be disabled just before the start of communication then re-enabled
when it is over). Note that this communication is only done at the
configuration phase (BSP_AUDIO_OUT_Init() or BSP_AUDIO_OUT_Stop())
and when Volume control modification is performed (BSP_AUDIO_OUT_SetVolume()
or BSP_AUDIO_OUT_SetMute()or BSP_AUDIO_OUT_SetOutputMode()).
When the audio data is played, no communication is required with the audio codec.
(#) 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.
(#) Mono audio streaming is not supported (in order to play mono audio streams,
each data should be sent twice on the I2S or should be duplicated on the
source buffer. Or convert the stream in stereo before playing).
(#) Supports only 16-bit audio data size.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm32f1xx_hal.h" /* Include HAL driver definitions to have access to I2S literals in audio driver */
#include "stm3210e_eval_audio.h"
/* Private variables ---------------------------------------------------------*/
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_AUDIO STM3210E EVAL AUDIO
* @brief This file includes the low layer audio driver available on STM3210E-Eval
* eval board.
* @{
*/
/** @defgroup STM3210E_EVAL_AUDIO_Private_Macros STM3210E EVAL AUDIO Private Macros
* @{
*/
/**
* @}
*/
/** @defgroup STM3210E_EVAL_AUDIO_Private_Variables STM3210E EVAL AUDIO Private Variables
* @{
*/
#define AUDIO_SAMPLE_SENDDUMMYDATA_SIZE 8
const uint16_t audio_sample_SendDummyData[] =
{0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
static __IO uint32_t SendDummyData = DISABLE; /* Variable to switch between sending dummy data or audio data on bus I2S */
/*### PLAY ###*/
static AUDIO_DrvTypeDef *pAudioDrv;
I2S_HandleTypeDef hAudioOutI2s;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_AUDIO_Private_Function_Prototypes STM3210E EVAL AUDIO Private Function Prototypes
* @{
*/
static void I2SOUT_Init(uint32_t AudioFreq);
static void I2SOUT_DeInit(void);
static uint8_t I2SOUT_SendDummyData_Start(uint16_t* pBuffer, uint32_t Size);
static uint8_t I2SOUT_SendDummyData_Stop(void);
/**
* @}
*/
/** @defgroup STM3210E_EVAL_AUDIO_OUT_Exported_Functions STM3210E EVAL AUDIO OUT Exported Functions
* @{
*/
/**
* @brief Configure the audio peripherals.
* @param OutputDevice: OUTPUT_DEVICE_SPEAKER, OUTPUT_DEVICE_HEADPHONE,
* OUTPUT_DEVICE_BOTH.
* @param Volume: Initial volume level (from 0 (Mute) to 100 (Max))
* @param AudioFreq: Audio frequency used to play the audio stream.
* @retval 0 if correct communication, else wrong communication
*/
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
{
uint8_t ret = AUDIO_ERROR;
/* Disable I2S */
I2SOUT_DeInit();
/* I2S data transfer preparation:
Prepare the Media to be used for the audio transfer from memory to I2S peripheral */
hAudioOutI2s.Instance = I2SOUT;
if(HAL_I2S_GetState(&hAudioOutI2s) == HAL_I2S_STATE_RESET)
{
/* Init the I2S MSP: this __weak function can be redefined by the application*/
BSP_AUDIO_OUT_MspInit(&hAudioOutI2s, NULL);
}
/* I2S data transfer preparation: */
/* Prepare the Media to be used for the audio transfer from memory to I2S */
/* peripheral. */
/* Note: This function must be called before audio codec init because */
/* I2S initialisation parameter "MCLKOutput" determines whether the */
/* audio Codec is driven by I2S clock (I2S_MCLKOUTPUT_ENABLE) */
/* or by its own internal PLL (I2S_MCLKOUTPUT_DISABLE). */
/* Configure the I2S peripheral */
/* Switch to send dummy data on bus I2S (switch used in I2SOUT_Init() */
SendDummyData = ENABLE;
I2SOUT_Init(AudioFreq);
/* Assign value to codec driver parameter I2S_MCLKOutput in function of */
/* I2S initialisation parameter "MCLKOutput". */
if (hAudioOutI2s.Init.MCLKOutput == I2S_MCLKOUTPUT_DISABLE)
{
ak4343_MCLKOutput(0);
}
else
{
ak4343_MCLKOutput(1);
}
/* Initialize the audio driver structure */
pAudioDrv = &ak4343_drv;
/* Generate I2S master clock MCK */
/* (Start the audio player to send dummy data on I2S bus) */
if(I2SOUT_SendDummyData_Start((uint16_t *)audio_sample_SendDummyData, AUDIO_SAMPLE_SENDDUMMYDATA_SIZE) == 0)
{
if (pAudioDrv->Init(AUDIO_I2C_ADDRESS, OutputDevice, Volume, AudioFreq) == 0)
{
ret = AUDIO_OK;
}
else
{
ret = AUDIO_ERROR;
}
I2SOUT_SendDummyData_Stop();
/* Switch to send audio data on bus I2S */
SendDummyData = DISABLE;
I2SOUT_Init(AudioFreq);
}
else
{
ret = AUDIO_ERROR;
}
return ret;
}
/**
* @brief De-initialize the audio peripherals.
*/
void BSP_AUDIO_OUT_DeInit(void)
{
I2SOUT_DeInit();
/* DeInit the I2S MSP : this __weak function can be rewritten by the application */
BSP_AUDIO_OUT_MspDeInit(&hAudioOutI2s, NULL);
}
/**
* @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(pAudioDrv->Play(AUDIO_I2C_ADDRESS, pBuffer, Size) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Update the Media layer and enable it for play */
HAL_I2S_Transmit_DMA(&hAudioOutI2s, pBuffer, DMA_MAX(Size));
return AUDIO_OK;
}
}
/**
* @brief Sends n-Bytes on the I2S interface.
* @param pData: pointer on data address
* @param Size: number of data to be written
*/
void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size)
{
HAL_I2S_Transmit_DMA(&hAudioOutI2s, pData, Size);
}
/**
* @brief This function Pauses the audio file stream. In case
* of using DMA, the DMA Pause feature is used.
* @note 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(pAudioDrv->Pause(AUDIO_I2C_ADDRESS) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Call the Media layer pause function */
HAL_I2S_DMAPause(&hAudioOutI2s);
/* Return AUDIO_OK if all operations are OK */
return AUDIO_OK;
}
}
/**
* @brief This function Resumes the audio file stream.
* @note 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(pAudioDrv->Resume(AUDIO_I2C_ADDRESS) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Call the Media layer resume function */
HAL_I2S_DMAResume(&hAudioOutI2s);
/* Return AUDIO_OK if all operations are OK */
return AUDIO_OK;
}
}
/**
* @brief Stops audio playing and Power down the Audio Codec.
* @param Option: could be one of the following parameters
* - 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 DMA Stop to disable DMA stream before stopping codec */
HAL_I2S_DMAStop(&hAudioOutI2s);
/* Call Audio Codec Stop function */
if(pAudioDrv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
{
return AUDIO_ERROR;
}
else
{
if(Option == CODEC_PDWN_HW)
{
/* Wait at least 100us */
HAL_Delay(1);
/* Power Down the codec */
HAL_GPIO_WritePin(AUDIO_RESET_GPIO, AUDIO_RESET_PIN, GPIO_PIN_RESET);
}
/* 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(pAudioDrv->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(pAudioDrv->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: specifies the audio output target: OUTPUT_DEVICE_SPEAKER,
* OUTPUT_DEVICE_HEADPHONE, 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(pAudioDrv->SetOutputMode(AUDIO_I2C_ADDRESS, Output) != 0)
{
return AUDIO_ERROR;
}
else
{
/* Return AUDIO_OK when all operations are correctly done */
return AUDIO_OK;
}
}
/**
* @brief Update the audio frequency.
* @param AudioFreq: Audio frequency used to play the audio stream.
* @retval None
* @note This API should be called after the BSP_AUDIO_OUT_Init() to adjust the
* audio frequency.
*/
void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq)
{
/* Update the I2S audio frequency configuration */
I2SOUT_Init(AudioFreq);
}
/**
* @brief Initializes BSP_AUDIO_OUT MSP.
* @param hi2s: I2S handle
* @param Params
*/
__weak void BSP_AUDIO_OUT_MspInit(I2S_HandleTypeDef *hi2s, void *Params)
{
static DMA_HandleTypeDef hdma_i2stx;
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable I2SOUT clock */
I2SOUT_CLK_ENABLE();
/*** Configure the GPIOs ***/
/* Enable I2S GPIO clocks */
I2SOUT_SCK_SD_CLK_ENABLE();
I2SOUT_WS_CLK_ENABLE();
/* I2SOUT pins configuration: WS, SCK and SD pins -----------------------------*/
gpioinitstruct.Pin = I2SOUT_SCK_PIN | I2SOUT_SD_PIN;
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(I2SOUT_SCK_SD_GPIO_PORT, &gpioinitstruct);
gpioinitstruct.Pin = I2SOUT_WS_PIN ;
HAL_GPIO_Init(I2SOUT_WS_GPIO_PORT, &gpioinitstruct);
/* I2SOUT pins configuration: MCK pin */
I2SOUT_MCK_CLK_ENABLE();
gpioinitstruct.Pin = I2SOUT_MCK_PIN;
HAL_GPIO_Init(I2SOUT_MCK_GPIO_PORT, &gpioinitstruct);
/* Enable the I2S DMA clock */
I2SOUT_DMAx_CLK_ENABLE();
if(hi2s->Instance == I2SOUT)
{
/* Configure the hdma_i2stx handle parameters */
hdma_i2stx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_i2stx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_i2stx.Init.MemInc = DMA_MINC_ENABLE;
hdma_i2stx.Init.PeriphDataAlignment = I2SOUT_DMAx_PERIPH_DATA_SIZE;
hdma_i2stx.Init.MemDataAlignment = I2SOUT_DMAx_MEM_DATA_SIZE;
/* Configuration change depending on sending dummy data or audio data on bus I2S */
if (SendDummyData != ENABLE)
{
hdma_i2stx.Init.Mode = DMA_NORMAL;
}
else
{
hdma_i2stx.Init.Mode = DMA_CIRCULAR;
}
hdma_i2stx.Init.Priority = DMA_PRIORITY_HIGH;
hdma_i2stx.Instance = I2SOUT_DMAx_CHANNEL;
/* Associate the DMA handle */
__HAL_LINKDMA(hi2s, hdmatx, hdma_i2stx);
/* Deinitialize the Channel for new transfer */
HAL_DMA_DeInit(&hdma_i2stx);
/* Configure the DMA Channel */
HAL_DMA_Init(&hdma_i2stx);
}
/* I2S DMA IRQ Channel configuration */
HAL_NVIC_SetPriority(I2SOUT_DMAx_IRQ, AUDIO_OUT_IRQ_PREPRIO, 0);
HAL_NVIC_EnableIRQ(I2SOUT_DMAx_IRQ);
}
/**
* @brief De-Initializes BSP_AUDIO_OUT MSP.
* @param hi2s: I2S handle
* @param Params
*/
__weak void BSP_AUDIO_OUT_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params)
{
GPIO_InitTypeDef gpioinitstruct;
/* Disable I2S clock */
I2SOUT_CLK_DISABLE();
/* CODEC_I2S pins configuration: WS, SCK and SD pins */
gpioinitstruct.Pin = I2SOUT_WS_PIN | I2SOUT_SCK_PIN | I2SOUT_SD_PIN;
HAL_GPIO_DeInit(I2SOUT_SCK_SD_GPIO_PORT, gpioinitstruct.Pin);
/* CODEC_I2S pins configuration: MCK pin */
gpioinitstruct.Pin = I2SOUT_MCK_PIN;
HAL_GPIO_DeInit(I2SOUT_MCK_GPIO_PORT, gpioinitstruct.Pin);
}
/**
* @brief Tx Transfer completed callbacks
* @param hi2s: I2S handle
*/
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
{
if(hi2s->Instance == I2SOUT)
{
/* Configuration change depending on sending dummy data or audio data on bus I2S */
if (SendDummyData != ENABLE)
{
/* Call the user function which will manage directly transfer complete */
BSP_AUDIO_OUT_TransferComplete_CallBack();
}
else
{
/* No action */
}
}
}
/**
* @brief Tx Transfer Half completed callbacks
* @param hi2s: I2S handle
*/
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
{
if(hi2s->Instance == I2SOUT)
{
/* Manage the remaining file size and new address offset: This function
should be coded by user (its prototype is already declared in stm3210e_eval_audio.h) */
BSP_AUDIO_OUT_HalfTransfer_CallBack();
}
}
/**
* @brief I2S error callbacks
* @param hi2s: I2S handle
*/
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 stm3210e_eval_audio.h) */
if(hi2s->Instance == I2SOUT)
{
BSP_AUDIO_OUT_Error_CallBack();
}
}
/**
* @brief Manages the DMA full Transfer complete event.
*/
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
{
}
/**
* @brief Manages the DMA Half Transfer complete event.
*/
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack(void)
{
}
/**
* @brief Manages the DMA FIFO error event.
*/
__weak void BSP_AUDIO_OUT_Error_CallBack(void)
{
}
/******************************************************************************
Static Function
*******************************************************************************/
/**
* @brief Initializes the Audio Codec audio interface (I2S)
* @param AudioFreq: Audio frequency to be configured for the I2S peripheral.
*/
static void I2SOUT_Init(uint32_t AudioFreq)
{
/* Initialize the hAudioOutI2s Instance parameter */
hAudioOutI2s.Instance = I2SOUT;
/* Disable I2S block */
__HAL_I2S_DISABLE(&hAudioOutI2s);
/* I2SOUT peripheral configuration */
hAudioOutI2s.Init.AudioFreq = AudioFreq;
hAudioOutI2s.Init.CPOL = I2S_CPOL_LOW;
hAudioOutI2s.Init.DataFormat = I2S_DATAFORMAT_16B;
hAudioOutI2s.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
hAudioOutI2s.Init.Mode = I2S_MODE_MASTER_TX;
hAudioOutI2s.Init.Standard = I2S_STANDARD;
/* Initialize the I2S peripheral with the structure above */
HAL_I2S_Init(&hAudioOutI2s);
}
/**
* @brief Deinitialize the Audio Codec audio interface (I2S).
*/
static void I2SOUT_DeInit(void)
{
/* Initialize the hAudioOutI2s Instance parameter */
hAudioOutI2s.Instance = I2SOUT;
/* Disable I2S peripheral */
__HAL_I2S_DISABLE(&hAudioOutI2s);
HAL_I2S_DeInit(&hAudioOutI2s);
}
/**
* @brief Starts sending dummy data as audio stream: function used to
generate I2S master clock MCK for audio codec device.
* @param pBuffer: Pointer to the buffer
* @param Size: Number of audio data BYTES.
* @retval AUDIO_OK if correct communication, else wrong communication
*/
static uint8_t I2SOUT_SendDummyData_Start(uint16_t* pBuffer, uint32_t Size)
{
/* Update the Media layer and enable it for play */
HAL_I2S_Transmit_DMA(&hAudioOutI2s, pBuffer, DMA_MAX(Size));
return AUDIO_OK;
}
/**
* @brief Stops sending dummy data as audio stream: function used to stop to
generate I2S master clock MCK for audio codec device.
* @retval AUDIO_OK if correct communication, else wrong communication
*/
static uint8_t I2SOUT_SendDummyData_Stop(void)
{
/* Call DMA Stop to disable DMA stream before stopping codec */
HAL_I2S_DMAStop(&hAudioOutI2s);
return AUDIO_OK;
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,184 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_audio.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* stm3210e_eval_audio.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_AUDIO_H
#define __STM3210E_EVAL_AUDIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Include audio component Driver */
#include "../Components/ak4343/ak4343.h"
#include "stm3210e_eval.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_AUDIO
* @{
*/
/** @defgroup STM3210E_EVAL_AUDIO_OUT_Exported_Constants STM3210E EVAL AUDIO OUT Exported Constants
* @{
*/
/*------------------------------------------------------------------------------
AUDIO OUT CONFIGURATION
------------------------------------------------------------------------------*/
/* I2S peripheral configuration defines */
#define I2SOUT SPI2
#define I2SOUT_CLK_ENABLE() __HAL_RCC_SPI2_CLK_ENABLE()
#define I2SOUT_CLK_DISABLE() __HAL_RCC_SPI2_CLK_DISABLE()
#define I2SOUT_SCK_SD_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define I2SOUT_MCK_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define I2SOUT_WS_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define I2SOUT_WS_PIN GPIO_PIN_12 /* PB.12*/
#define I2SOUT_SCK_PIN GPIO_PIN_13 /* PB.13*/
#define I2SOUT_SD_PIN GPIO_PIN_15 /* PB.15*/
#define I2SOUT_MCK_PIN GPIO_PIN_6 /* PC.06*/
#define I2SOUT_SCK_SD_GPIO_PORT GPIOB
#define I2SOUT_WS_GPIO_PORT GPIOB
#define I2SOUT_MCK_GPIO_PORT GPIOC
/* I2S DMA Channel definitions */
#define I2SOUT_DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
#define I2SOUT_DMAx_CHANNEL DMA1_Channel5
#define I2SOUT_DMAx_IRQ DMA1_Channel5_IRQn
#define I2SOUT_DMAx_PERIPH_DATA_SIZE DMA_PDATAALIGN_HALFWORD
#define I2SOUT_DMAx_MEM_DATA_SIZE DMA_MDATAALIGN_HALFWORD
#define DMA_MAX_SZE 0xFFFF
#define I2SOUT_IRQHandler DMA1_Channel5_IRQHandler
/* Select the interrupt preemption priority and subpriority for the DMA interrupt */
#define AUDIO_OUT_IRQ_PREPRIO 0xE /* Select the preemption priority level(0 is the highest) */
/*------------------------------------------------------------------------------
CONFIGURATION: Audio Driver Configuration parameters
------------------------------------------------------------------------------*/
/* Audio status definition */
#define AUDIO_OK 0
#define AUDIO_ERROR 1
#define AUDIO_TIMEOUT 2
/*------------------------------------------------------------------------------
OPTIONAL Configuration defines parameters
------------------------------------------------------------------------------*/
/**
* @}
*/
/** @defgroup STM3210E_EVAL_AUDIO_Exported_Macros STM3210E EVAL AUDIO Exported Macros
* @{
*/
#define DMA_MAX(_X_) (((_X_) <= DMA_MAX_SZE)? (_X_):DMA_MAX_SZE)
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_AUDIO_OUT_Exported_Functions
* @{
*/
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq);
void BSP_AUDIO_OUT_DeInit(void);
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);
uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Command);
uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output);
/* 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 need to be changed for specific
application needs */
void BSP_AUDIO_OUT_MspInit(I2S_HandleTypeDef *hi2s, void *Params);
void BSP_AUDIO_OUT_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_AUDIO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

File diff suppressed because it is too large Load Diff

View File

@ -1,210 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_lcd.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210e_eval_lcd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 STM3210E_EVAL
* @{
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM3210E_EVAL_LCD_H
#define __STM3210E_EVAL_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval.h"
#include "../Components/hx8347d/hx8347d.h"
#include "../Components/spfd5408/spfd5408.h"
#include "../Components/ili9320/ili9320.h"
#include "../../../Utilities/Fonts/fonts.h"
/** @addtogroup STM3210E_EVAL_LCD
* @{
*/
/** @defgroup STM3210E_EVAL_LCD_Exported_Types STM3210E EVAL LCD Exported Types
* @{
*/
typedef struct
{
uint32_t TextColor;
uint32_t BackColor;
sFONT *pFont;
}LCD_DrawPropTypeDef;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_LCD_Exported_Constants STM3210E EVAL LCD Exported Constants
* @{
*/
/**
* @brief LCD status structure definition
*/
#define LCD_OK 0x00
#define LCD_ERROR 0x01
#define LCD_TIMEOUT 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_LIGHTCYAN (uint16_t)0x87FF
#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
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_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);
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_FillTriangle(uint16_t X1, uint16_t X2, uint16_t X3, uint16_t Y1, uint16_t Y2, uint16_t Y3);
void BSP_LCD_FillPolygon(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_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
void BSP_LCD_DisplayOff(void);
void BSP_LCD_DisplayOn(void);
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_LCD_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,283 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_nand.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file includes a standard driver for the NAND512W3A2CN6E NAND flash memory
* device mounted on STM3210E-EVAL evaluation board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 NAND512W3A2CN6E NAND flash external memory mounted
on STM3210E-EVAL evaluation board.
- This driver does not need a specific component driver for the NAND device
to be included with.
2. Driver description:
---------------------
+ Initialization steps:
o Initialize the NAND external memory using the BSP_NAND_Init() function. This
function includes the MSP layer hardware resources initialization and the
FMC controller configuration to interface with the external NAND memory.
+ NAND flash operations
o NAND external 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_NAND_ReadData()/BSP_NAND_WriteData(). The BSP_NAND_WriteData() performs write operation
of an amount of data by unit (halfword).
o The function BSP_NAND_Read_ID() returns the chip IDs stored in the structure
"NAND_IDTypeDef". (see the NAND IDs in the memory data sheet)
o Perform erase block operation using the function BSP_NAND_Erase_Block() and by
specifying the block address.
------------------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval_nand.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_NAND STM3210E EVAL NAND
* @{
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NAND_Private_Variables STM3210E EVAL NAND Private Variables
* @{
*/
static NAND_HandleTypeDef nandHandle;
static FSMC_NAND_PCC_TimingTypeDef Timing;
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup STM3210E_EVAL_NAND_Private_Function_Prototypes STM3210E EVAL NAND Private Function Prototypes
* @{
*/
static void NAND_MspInit(void);
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NAND_Exported_Functions STM3210E EVAL NAND Exported Functions
* @{
*/
/**
* @brief Initializes the NAND device.
* @retval NAND memory status
*/
uint8_t BSP_NAND_Init(void)
{
nandHandle.Instance = FSMC_NAND_DEVICE;
/*NAND Configuration */
Timing.SetupTime = 0U;
Timing.WaitSetupTime = 2U;
Timing.HoldSetupTime = 1U;
Timing.HiZSetupTime = 0U;
nandHandle.Init.NandBank = FSMC_NAND_BANK2;
nandHandle.Init.Waitfeature = FSMC_NAND_PCC_WAIT_FEATURE_ENABLE;
nandHandle.Init.MemoryDataWidth = FSMC_NAND_PCC_MEM_BUS_WIDTH_8;
nandHandle.Init.EccComputation = FSMC_NAND_ECC_ENABLE;
nandHandle.Init.ECCPageSize = FSMC_NAND_ECC_PAGE_SIZE_512BYTE;
nandHandle.Init.TCLRSetupTime = 0U;
nandHandle.Init.TARSetupTime = 0U;
nandHandle.Config.BlockNbr = NAND_MAX_PLANE;
nandHandle.Config.BlockSize = NAND_BLOCK_SIZE;
nandHandle.Config.PlaneSize = NAND_PLANE_SIZE;
nandHandle.Config.PageSize = NAND_PAGE_SIZE;
nandHandle.Config.SpareAreaSize = NAND_SPARE_AREA_SIZE;
/* NAND controller initialization */
NAND_MspInit();
if(HAL_NAND_Init(&nandHandle, &Timing, &Timing) != HAL_OK)
{
return NAND_ERROR;
}
else
{
return NAND_OK;
}
}
/**
* @brief Reads an amount of data from the NAND device.
* @param BlockAddress: Block address to Read
* @param pData: Pointer to data to be read
* @param uwNumPage: Number of Pages to read to Block
* @retval NAND memory status
*/
uint8_t BSP_NAND_ReadData(NAND_AddressTypeDef BlockAddress, uint8_t* pData, uint32_t uwNumPage)
{
/* Read data from NAND */
if (HAL_NAND_Read_Page_8b(&nandHandle, &BlockAddress, pData, uwNumPage) != HAL_OK)
{
return NAND_ERROR;
}
return NAND_OK;
}
/**
* @brief Writes an amount of data to the NAND device.
* @param BlockAddress: Block address to Write
* @param pData: Pointer to data to be written
* @param uwNumPage: Number of Pages to write to Block
* @retval NAND memory status
*/
uint8_t BSP_NAND_WriteData(NAND_AddressTypeDef BlockAddress, uint8_t* pData, uint32_t uwNumPage)
{
/* Write data to NAND */
if (HAL_NAND_Write_Page_8b(&nandHandle, &BlockAddress, pData, uwNumPage) != HAL_OK)
{
return NAND_ERROR;
}
return NAND_OK;
}
/**
* @brief Erases the specified block of the NAND device.
* @param BlockAddress: Block address to Erase
* @retval NAND memory status
*/
uint8_t BSP_NAND_Erase_Block(NAND_AddressTypeDef BlockAddress)
{
/* Send NAND erase block operation */
if (HAL_NAND_Erase_Block(&nandHandle, &BlockAddress) != HAL_OK)
{
return NAND_ERROR;
}
return NAND_OK;
}
/**
* @brief Reads NAND flash IDs.
* @param pNAND_ID : Pointer to NAND ID structure
* @retval NAND memory status
*/
uint8_t BSP_NAND_Read_ID(NAND_IDTypeDef *pNAND_ID)
{
if(HAL_NAND_Read_ID(&nandHandle, pNAND_ID) != HAL_OK)
{
return NAND_ERROR;
}
else
{
return NAND_OK;
}
}
/**
* @brief Initializes the NAND MSP.
*/
static void NAND_MspInit(void)
{
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable FSMC clock */
__HAL_RCC_FSMC_CLK_ENABLE();
/* Enable GPIOs clock */
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
/* Common GPIO configuration */
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
/*-- GPIO Configuration ------------------------------------------------------*/
/*!< CLE, ALE, D0->D3, NOE, NWE and NCE2 NAND pin configuration */
gpioinitstruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_14 | GPIO_PIN_15 |
GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 |
GPIO_PIN_7;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/*!< D4->D7 NAND pin configuration */
gpioinitstruct.Pin = GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10;
HAL_GPIO_Init(GPIOE, &gpioinitstruct);
/*!< NWAIT NAND pin configuration */
gpioinitstruct.Pin = GPIO_PIN_6;
gpioinitstruct.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/*!< INT2 NAND pin configuration */
gpioinitstruct.Pin = GPIO_PIN_6;
HAL_GPIO_Init(GPIOG, &gpioinitstruct);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,122 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_nand.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210e_eval_nand.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2017 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 __STM3210E_EVAL_NAND_H
#define __STM3210E_EVAL_NAND_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_NAND
* @{
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NAND_Exported_Constants STM3210E EVAL NAND Exported Constants
* @{
*/
/**
* @brief NAND status structure definition
*/
#define NAND_OK 0x00U
#define NAND_DEVICE_ADDR ((uint32_t)NAND_DEVICE1)
/**
* @brief FSMC NAND memory parameters
*/
#define NAND_PAGE_SIZE ((uint16_t)0x0200) /* 512 bytes per page w/o Spare Area */
#define NAND_BLOCK_SIZE ((uint16_t)0x0020) /* 32x512 bytes pages per block */
#define NAND_PLANE_SIZE ((uint16_t)0x0400) /* 1024 Block per plane */
#define NAND_SPARE_AREA_SIZE ((uint16_t)0x0010) /* last 16 bytes as spare area */
#define NAND_MAX_PLANE ((uint16_t)0x1000) /* 4 planes of 1024 block */
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210E_EVAL_NAND_Exported_Functions
* @{
*/
uint8_t BSP_NAND_Init(void);
uint8_t BSP_NAND_ReadData(NAND_AddressTypeDef BlockAddress, uint8_t *pData, uint32_t uwDataSize);
uint8_t BSP_NAND_WriteData(NAND_AddressTypeDef BlockAddress, uint8_t *pData, uint32_t uwDataSize);
uint8_t BSP_NAND_Erase_Block(NAND_AddressTypeDef BlockAddress);
uint8_t BSP_NAND_Erase_Chip(void);
uint8_t BSP_NAND_Read_ID(NAND_IDTypeDef *pNAND_ID);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_NAND_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,405 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_nor.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file includes a standard driver for the M29W128GL70ZA6E NOR flash memory
* device mounted on STM3210E-EVAL evaluation board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 M29W128GL NOR flash external memory mounted
on STM3210E-EVAL evaluation board.
- This driver does not need a specific component driver for the NOR device
to be included with.
2. Driver description:
---------------------
+ Initialization steps:
o Initialize the NOR external memory using the BSP_NOR_Init() function. This
function includes the MSP layer hardware resources initialization and the
FSMC controller configuration to interface with the external NOR memory.
+ NOR flash operations
o NOR external 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_NOR_ReadData()/BSP_NOR_WriteData(). The BSP_NOR_WriteData() performs write operation
of an amount of data by unit (halfword). You can also perform a program data
operation of an amount of data using the function BSP_NOR_ProgramData().
o The function BSP_NOR_Read_ID() returns the chip IDs stored in the structure
"NOR_IDTypeDef". (see the NOR IDs in the memory data sheet)
o Perform erase block operation using the function BSP_NOR_Erase_Block() and by
specifying the block address. You can perform an erase operation of the whole
chip by calling the function BSP_NOR_Erase_Chip().
o After other operations, the function BSP_NOR_ReturnToReadMode() allows the NOR
flash to return to read mode to perform read operations on it.
------------------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval_nor.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_NOR STM3210E EVAL NOR
* @{
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NOR_Private_Variables STM3210E EVAL NOR Private Variables
* @{
*/
static NOR_HandleTypeDef norHandle;
static FSMC_NORSRAM_TimingTypeDef Timing;
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup STM3210E_EVAL_NOR_Private_Function_Prototypes STM3210E EVAL NOR Private Function Prototypes
* @{
*/
static void NOR_MspInit(void);
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NOR_Exported_Functions STM3210E EVAL NOR Exported Functions
* @{
*/
/**
* @brief Initializes the NOR device.
* @retval NOR memory status
*/
uint8_t BSP_NOR_Init(void)
{
norHandle.Instance = FSMC_NORSRAM_DEVICE;
norHandle.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
/* NOR device configuration */
Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 1;
Timing.DataSetupTime = 5;
Timing.BusTurnAroundDuration = 0;
Timing.CLKDivision = 2;
Timing.DataLatency = 2;
Timing.AccessMode = FSMC_ACCESS_MODE_B;
norHandle.Init.NSBank = FSMC_NORSRAM_BANK2;
norHandle.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
norHandle.Init.MemoryType = FSMC_MEMORY_TYPE_NOR;
norHandle.Init.MemoryDataWidth = NOR_MEMORY_WIDTH;
norHandle.Init.BurstAccessMode = NOR_BURSTACCESS;
norHandle.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
norHandle.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
norHandle.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
norHandle.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
norHandle.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
norHandle.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
norHandle.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
norHandle.Init.WriteBurst = NOR_WRITEBURST;
/* NOR controller initialization */
NOR_MspInit();
if(HAL_NOR_Init(&norHandle, &Timing, &Timing) != HAL_OK)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Reads an amount of data from the NOR device.
* @param uwStartAddress: Read start address
* @param pData: Pointer to data to be read
* @param uwDataSize: Size of data to read
* @retval NOR memory status
*/
uint8_t BSP_NOR_ReadData(uint32_t uwStartAddress, uint16_t* pData, uint32_t uwDataSize)
{
if(HAL_NOR_ReadBuffer(&norHandle, NOR_DEVICE_ADDR + uwStartAddress, pData, uwDataSize) != HAL_OK)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Returns the NOR memory to read mode.
*/
void BSP_NOR_ReturnToReadMode(void)
{
HAL_NOR_ReturnToReadMode(&norHandle);
}
/**
* @brief Writes an amount of data to the NOR device.
* @param uwStartAddress: Write start address
* @param pData: Pointer to data to be written
* @param uwDataSize: Size of data to write
* @retval NOR memory status
*/
uint8_t BSP_NOR_WriteData(uint32_t uwStartAddress, uint16_t* pData, uint32_t uwDataSize)
{
uint32_t index = uwDataSize;
while(index > 0)
{
/* Write data to NOR */
HAL_NOR_Program(&norHandle, (uint32_t *)(NOR_DEVICE_ADDR + uwStartAddress), pData);
/* Read NOR device status */
if(HAL_NOR_GetStatus(&norHandle, NOR_DEVICE_ADDR, PROGRAM_TIMEOUT) != HAL_NOR_STATUS_SUCCESS)
{
return NOR_STATUS_ERROR;
}
/* Update the counters */
index--;
uwStartAddress += 2;
pData++;
}
return NOR_STATUS_OK;
}
/**
* @brief Programs an amount of data to the NOR device.
* @param uwStartAddress: Write start address
* @param pData: Pointer to data to be written
* @param uwDataSize: Size of data to write
* @retval NOR memory status
*/
uint8_t BSP_NOR_ProgramData(uint32_t uwStartAddress, uint16_t* pData, uint32_t uwDataSize)
{
/* Send NOR program buffer operation */
HAL_NOR_ProgramBuffer(&norHandle, uwStartAddress, pData, uwDataSize);
/* Return the NOR memory status */
if(HAL_NOR_GetStatus(&norHandle, NOR_DEVICE_ADDR, PROGRAM_TIMEOUT) != HAL_NOR_STATUS_SUCCESS)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Erases the specified block of the NOR device.
* @param BlockAddress: Block address to erase
* @retval NOR memory status
*/
uint8_t BSP_NOR_Erase_Block(uint32_t BlockAddress)
{
/* Send NOR erase block operation */
HAL_NOR_Erase_Block(&norHandle, BlockAddress, NOR_DEVICE_ADDR);
/* Return the NOR memory status */
if(HAL_NOR_GetStatus(&norHandle, NOR_DEVICE_ADDR, BLOCKERASE_TIMEOUT) != HAL_NOR_STATUS_SUCCESS)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Erases the entire NOR chip.
* @retval NOR memory status
*/
uint8_t BSP_NOR_Erase_Chip(void)
{
/* Send NOR Erase chip operation */
HAL_NOR_Erase_Chip(&norHandle, NOR_DEVICE_ADDR);
/* Return the NOR memory status */
if(HAL_NOR_GetStatus(&norHandle, NOR_DEVICE_ADDR, CHIPERASE_TIMEOUT) != HAL_NOR_STATUS_SUCCESS)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Reads NOR flash IDs.
* @param pNOR_ID : Pointer to NOR ID structure
* @retval NOR memory status
*/
uint8_t BSP_NOR_Read_ID(NOR_IDTypeDef *pNOR_ID)
{
if(HAL_NOR_Read_ID(&norHandle, pNOR_ID) != HAL_OK)
{
return NOR_STATUS_ERROR;
}
else
{
return NOR_STATUS_OK;
}
}
/**
* @brief Initializes the NOR MSP.
*/
static void NOR_MspInit(void)
{
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable FSMC clock */
__HAL_RCC_FSMC_CLK_ENABLE();
/* Enable GPIOs clock */
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
/* Common GPIO configuration */
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
/*-- GPIO Configuration ------------------------------------------------------*/
/*!< NOR Data lines configuration */
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_8 | GPIO_PIN_9 |
GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
gpioinitstruct.Pin = 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, &gpioinitstruct);
/*!< NOR Address lines configuration */
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 |
GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 |
GPIO_PIN_14 | GPIO_PIN_15;
HAL_GPIO_Init(GPIOF, &gpioinitstruct);
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 |
GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOG, &gpioinitstruct);
gpioinitstruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
gpioinitstruct.Pin = GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6;
HAL_GPIO_Init(GPIOE, &gpioinitstruct);
/*!< NOE and NWE configuration */
gpioinitstruct.Pin = GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/*!< NE2 configuration */
gpioinitstruct.Pin = GPIO_PIN_9 | GPIO_PIN_12;
HAL_GPIO_Init(GPIOG, &gpioinitstruct);
/*!< Configure PD6 for NOR memory Ready/Busy signal */
gpioinitstruct.Pin = GPIO_PIN_6;
gpioinitstruct.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
}
/**
* @brief NOR BSP Wait for Ready/Busy signal.
* @param hnor: Pointer to NOR handle
* @param Timeout: Timeout duration
*/
void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout)
{
uint32_t timeout = Timeout;
/* Polling on Ready/Busy signal */
while((HAL_GPIO_ReadPin(NOR_READY_BUSY_GPIO, NOR_READY_BUSY_PIN) != NOR_BUSY_STATE) && (timeout > 0))
{
timeout--;
}
timeout = Timeout;
/* Polling on Ready/Busy signal */
while((HAL_GPIO_ReadPin(NOR_READY_BUSY_GPIO, NOR_READY_BUSY_PIN) != NOR_READY_STATE) && (timeout > 0))
{
timeout--;
}
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,136 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_nor.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210e_eval_nor.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_NOR_H
#define __STM3210E_EVAL_NOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_NOR
* @{
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_NOR_Exported_Constants STM3210E EVAL NOR Exported Constants
* @{
*/
/**
* @brief NOR status structure definition
*/
#define NOR_STATUS_OK 0x00
#define NOR_STATUS_ERROR 0x01
#define NOR_DEVICE_ADDR ((uint32_t)0x64000000)
/* #define NOR_MEMORY_WIDTH FSMC_NORSRAM_MEM_BUS_WIDTH_8 */
#define NOR_MEMORY_WIDTH FSMC_NORSRAM_MEM_BUS_WIDTH_16
#define NOR_BURSTACCESS FSMC_BURST_ACCESS_MODE_DISABLE
/* #define NOR_BURSTACCESS FSMC_BURST_ACCESS_MODE_ENABLE*/
#define NOR_WRITEBURST FSMC_WRITE_BURST_DISABLE
/* #define NOR_WRITEBURST FSMC_WRITE_BURST_ENABLE */
/* NOR operations Timeout definitions */
#define BLOCKERASE_TIMEOUT ((uint32_t)0x00A00000) /* NOR block erase timeout */
#define CHIPERASE_TIMEOUT ((uint32_t)0x30000000) /* NOR chip erase timeout */
#define PROGRAM_TIMEOUT ((uint32_t)0x00004400) /* NOR program timeout */
/* NOR Ready/Busy signal GPIO definitions */
#define NOR_READY_BUSY_PIN GPIO_PIN_6
#define NOR_READY_BUSY_GPIO GPIOD
#define NOR_READY_STATE GPIO_PIN_SET
#define NOR_BUSY_STATE GPIO_PIN_RESET
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210E_EVAL_NOR_Exported_Functions
* @{
*/
uint8_t BSP_NOR_Init(void);
uint8_t BSP_NOR_ReadData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_NOR_WriteData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_NOR_ProgramData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_NOR_Erase_Block(uint32_t BlockAddress);
uint8_t BSP_NOR_Erase_Chip(void);
uint8_t BSP_NOR_Read_ID(NOR_IDTypeDef *pNOR_ID);
void BSP_NOR_ReturnToReadMode(void);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_NOR_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,583 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_sd.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file includes the uSD card driver.
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
(#) This driver is used to drive the micro SD external card mounted on STM3210E-EVAL
evaluation board.
(#) This driver does not need a specific component driver for the micro SD device
to be included with.
(#) Initialization steps:
(++) 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.
(++) To check the SD card presence you can use the function BSP_SD_IsDetected() which
returns the detection status
(++) 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 handeled 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().
(++) 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
(++) The micro SD card can be accessed with read/write block(s) operations once
it is reay for access. The access cand 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()
(++) The DMA transfer complete is used with interrupt mode. Once the SD transfer
is complete, the SD interrupt is handeled using the function BSP_SD_IRQHandler(),
the DMA Tx/Rx transfer complete are handeled 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.
(++) The SD erase block(s) is performed using the function BSP_SD_Erase() with specifying
the number of blocks to erase.
(++) The SD runtime status is returned when calling the function BSP_SD_GetCardState().
[..]
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210e_eval_sd.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_SD STM3210E EVAL SD
* @{
*/
/** @defgroup STM3210E_EVAL_SD_Private_Variables STM3210E EVAL SD Private Variables
* @{
*/
SD_HandleTypeDef uSdHandle;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_SD_Private_Functions STM3210E EVAL SD Private Functions
* @{
*/
uint8_t SD_DMAConfigRx(SD_HandleTypeDef *hsd);
uint8_t SD_DMAConfigTx(SD_HandleTypeDef *hsd);
/**
* @}
*/
/** @defgroup STM3210E_EVAL_SD_Exported_Functions STM3210E EVAL SD Exported Functions
* @{
*/
/**
* @brief Initializes the SD card device.
* @retval SD status.
*/
uint8_t BSP_SD_Init(void)
{
uint8_t 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_DISABLE;
uSdHandle.Init.ClockDiv = SDIO_TRANSFER_CLK_DIV;
/* Check if the SD card is plugged in the slot */
if(BSP_SD_IsDetected() != SD_PRESENT)
{
return MSD_ERROR;
}
/* Msp SD initialization */
BSP_SD_MspInit(NULL);
if(HAL_SD_Init(&uSdHandle) != HAL_OK)
{
state = MSD_ERROR;
}
/* Configure SD Bus width */
if(state == MSD_OK)
{
/* Enable wide operation */
if(HAL_SD_ConfigWideBusOperation(&uSdHandle, SDIO_BUS_WIDE_4B) != HAL_OK)
{
state = MSD_ERROR;
}
else
{
state = MSD_OK;
}
}
return state;
}
/**
* @brief Configures Interrupt mode for SD detection pin.
* @retval Returns 0
*/
uint8_t BSP_SD_ITConfig(void)
{
GPIO_InitTypeDef gpioinitstruct = {0};
/* Configure Interrupt mode for SD detection pin */
gpioinitstruct.Mode = GPIO_MODE_IT_RISING_FALLING;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
gpioinitstruct.Pin = SD_DETECT_PIN;
HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpioinitstruct);
/* NVIC configuration for SDIO interrupts */
HAL_NVIC_SetPriority(SD_DETECT_IRQn, 0xE, 0);
HAL_NVIC_EnableIRQ(SD_DETECT_IRQn);
return 0;
}
/**
* @brief Detects if SD card is correctly plugged in the memory slot or not.
* @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(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != GPIO_PIN_RESET)
{
status = SD_NOT_PRESENT;
}
return status;
}
/** @brief SD detect IT treatment
*/
void BSP_SD_DetectIT(void)
{
/* SD detect IT callback */
BSP_SD_DetectCallback();
}
/** @brief SD detect IT detection callback
*/
__weak void BSP_SD_DetectCallback(void)
{
/* NOTE: This function Should not be modified, when the callback is needed,
the BSP_SD_DetectCallback could be implemented in the user file
*/
}
/**
* @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 NumOfBlocks: Number of SD blocks to read
* @param Timeout: Timeout for read operation
* @retval SD status
*/
uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
{
if(HAL_SD_ReadBlocks(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_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 NumOfBlocks: Number of SD blocks to write
* @param Timeout: Timeout for write operation
* @retval SD status
*/
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
{
if(HAL_SD_WriteBlocks(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks, Timeout) != HAL_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 NumOfBlocks: Number of SD blocks to read
* @retval SD status
*/
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
{
uint8_t state = MSD_OK;
/* Invalidate the dma tx handle*/
uSdHandle.hdmatx = NULL;
/* Prepare the dma channel for a read operation */
state = ((SD_DMAConfigRx(&uSdHandle) == MSD_OK) ? MSD_OK : MSD_ERROR);
if(state == MSD_OK)
{
/* Read block(s) in DMA transfer mode */
state = ((HAL_SD_ReadBlocks_DMA(&uSdHandle, (uint8_t *)pData, ReadAddr, NumOfBlocks) == HAL_OK) ? MSD_OK : MSD_ERROR);
}
return 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 NumOfBlocks: Number of SD blocks to write
* @retval SD status
*/
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
{
uint8_t state = MSD_OK;
/* Invalidate the dma rx handle*/
uSdHandle.hdmarx = NULL;
/* Prepare the dma channel for a read operation */
state = ((SD_DMAConfigTx(&uSdHandle) == MSD_OK) ? MSD_OK : MSD_ERROR);
if(state == MSD_OK)
{
/* Write block(s) in DMA transfer mode */
state = ((HAL_SD_WriteBlocks_DMA(&uSdHandle, (uint8_t *)pData, WriteAddr, NumOfBlocks) == HAL_OK) ? MSD_OK : MSD_ERROR);
}
return 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(uint32_t StartAddr, uint32_t EndAddr)
{
if(HAL_SD_Erase(&uSdHandle, StartAddr, EndAddr) != HAL_OK)
{
return MSD_ERROR;
}
else
{
return MSD_OK;
}
}
/**
* @brief Gets the current SD card data status.
* @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
*/
uint8_t BSP_SD_GetCardState(void)
{
return((HAL_SD_GetCardState(&uSdHandle) == HAL_SD_CARD_TRANSFER ) ? SD_TRANSFER_OK : SD_TRANSFER_BUSY);
}
/**
* @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_GetCardInfo(&uSdHandle, CardInfo);
}
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_SD_Private_Functions
* @{
*/
/**
* @brief Initializes the SD MSP.
* @param Params : pointer on additional configuration parameters, can be NULL.
*/
__weak void BSP_SD_MspInit(void *Params)
{
GPIO_InitTypeDef gpioinitstruct = {0};
/* 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();
__SD_DETECT_GPIO_CLK_ENABLE();
/* Common GPIO configuration */
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
/* GPIOC configuration */
gpioinitstruct.Pin = GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
HAL_GPIO_Init(GPIOC, &gpioinitstruct);
/* GPIOD configuration */
gpioinitstruct.Pin = GPIO_PIN_2;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/* SD Card detect pin configuration */
gpioinitstruct.Mode = GPIO_MODE_INPUT;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
gpioinitstruct.Pin = SD_DETECT_PIN;
HAL_GPIO_Init(SD_DETECT_GPIO_PORT, &gpioinitstruct);
/* NVIC configuration for SDIO interrupts */
HAL_NVIC_SetPriority(SDIO_IRQn, 0xC, 0);
HAL_NVIC_EnableIRQ(SDIO_IRQn);
/* DMA initialization should be done here but , as there is only one channel for RX and TX it is configured and done directly when required*/
}
/**
* @brief SD_DMAConfigRx
* @par Function Description
* This function configure the DMA to receive data from the SD card
* @retval
* SD_ERROR or SD_OK
*/
uint8_t SD_DMAConfigRx(SD_HandleTypeDef *hsd)
{
static DMA_HandleTypeDef hdma_rx;
HAL_StatusTypeDef status = HAL_ERROR;
if(hsd->hdmarx == NULL)
{
/* Configure DMA Rx parameters */
hdma_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_rx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_rx.Init.MemInc = DMA_MINC_ENABLE;
hdma_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_rx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_rx.Instance = SD_DMAx_Rx_INSTANCE;
/* Associate the DMA handle */
__HAL_LINKDMA(hsd, hdmarx, hdma_rx);
/* Stop any ongoing transfer and reset the state*/
HAL_DMA_Abort(&hdma_rx);
/* Deinitialize the Channel for new transfer */
HAL_DMA_DeInit(&hdma_rx);
/* Configure the DMA Channel */
status = HAL_DMA_Init(&hdma_rx);
/* NVIC configuration for DMA transfer complete interrupt */
HAL_NVIC_SetPriority(SD_DMAx_Rx_IRQn, 0xD, 0);
HAL_NVIC_EnableIRQ(SD_DMAx_Rx_IRQn);
}
else
{
status = HAL_OK;
}
return (status != HAL_OK? MSD_ERROR : MSD_OK);
}
/**
* @brief SD_DMAConfigTx
* @par Function Description
* This function configure the DMA to transmit data to the SD card
* @retval
* SD_ERROR or SD_OK
*/
uint8_t SD_DMAConfigTx(SD_HandleTypeDef *hsd)
{
static DMA_HandleTypeDef hdma_tx;
HAL_StatusTypeDef status;
if(hsd->hdmatx == NULL)
{
/* Configure DMA Tx parameters */
hdma_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_tx.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_tx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
hdma_tx.Instance = SD_DMAx_Tx_INSTANCE;
/* Associate the DMA handle */
__HAL_LINKDMA(hsd, hdmatx, hdma_tx);
/* Stop any ongoing transfer and reset the state*/
HAL_DMA_Abort(&hdma_tx);
/* Deinitialize the Channel for new transfer */
HAL_DMA_DeInit(&hdma_tx);
/* Configure the DMA Channel */
status = HAL_DMA_Init(&hdma_tx);
/* NVIC configuration for DMA transfer complete interrupt */
HAL_NVIC_SetPriority(SD_DMAx_Tx_IRQn, 0xD, 0);
HAL_NVIC_EnableIRQ(SD_DMAx_Tx_IRQn);
}
else
{
status = HAL_OK;
}
return (status != HAL_OK? MSD_ERROR : MSD_OK);
}
/**
* @brief SD Abort callbacks
* @param hsd: SD handle
* @retval None
*/
void HAL_SD_AbortCallback(SD_HandleTypeDef *hsd)
{
BSP_SD_AbortCallback();
}
/**
* @brief Tx Transfer completed callbacks
* @param hsd: SD handle
* @retval None
*/
void HAL_SD_TxCpltCallback(SD_HandleTypeDef *hsd)
{
BSP_SD_WriteCpltCallback();
}
/**
* @brief Rx Transfer completed callbacks
* @param hsd: SD handle
* @retval None
*/
void HAL_SD_RxCpltCallback(SD_HandleTypeDef *hsd)
{
BSP_SD_ReadCpltCallback();
}
/**
* @brief BSP SD Abort callbacks
* @retval None
*/
__weak void BSP_SD_AbortCallback(void)
{
}
/**
* @brief BSP Tx Transfer completed callbacks
* @retval None
*/
__weak void BSP_SD_WriteCpltCallback(void)
{
}
/**
* @brief BSP Rx Transfer completed callbacks
* @retval None
*/
__weak void BSP_SD_ReadCpltCallback(void)
{
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,165 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_sd.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file includes the uSD card driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_SD_H
#define __STM3210E_EVAL_SD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_SD
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_SD_Exported_Types STM3210E EVAL SD Exported Types
* @{
*/
/**
* @brief SD Card information structure
*/
#define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
/**
* @brief SD status structure definition
*/
#define MSD_OK ((uint8_t)0x00)
#define MSD_ERROR ((uint8_t)0x01)
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_SD_Exported_Constants STM3210E EVAL SD Exported Constants
* @{
*/
/**
* @brief SD transfer state definition
*/
#define SD_TRANSFER_OK ((uint8_t)0x00)
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
#define SD_DETECT_PIN GPIO_PIN_11
#define SD_DETECT_GPIO_PORT GPIOF
#define __SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
#define SD_DETECT_IRQn EXTI15_10_IRQn
#define SD_DATATIMEOUT 100000000U
#define SD_PRESENT ((uint8_t)0x01)
#define SD_NOT_PRESENT ((uint8_t)0x00)
/* DMA definitions for SD DMA transfer */
#define __DMAx_TxRx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE
#define SD_DMAx_Tx_INSTANCE DMA2_Channel4
#define SD_DMAx_Rx_INSTANCE DMA2_Channel4
#define SD_DMAx_Tx_IRQn DMA2_Channel4_5_IRQn
#define SD_DMAx_Rx_IRQn DMA2_Channel4_5_IRQn
#define BSP_SD_IRQHandler SDIO_IRQHandler
#define SD_DMAx_Tx_IRQHandler DMA2_Channel4_5_IRQHandler
#define SD_DMAx_Rx_IRQHandler DMA2_Channel4_5_IRQHandler
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210E_EVAL_SD_Exported_Functions
* @{
*/
uint8_t BSP_SD_Init(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, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
uint8_t BSP_SD_GetCardState(void);
void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
uint8_t BSP_SD_IsDetected(void);
/* These functions can be modified in case the current settings
need to be changed for specific application needs */
void BSP_SD_MspInit(void *Params);
void BSP_SD_AbortCallback(void);
void BSP_SD_WriteCpltCallback(void);
void BSP_SD_ReadCpltCallback(void);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_SD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,341 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_serialflash.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage the SPI M25Pxx
* FLASH memory mounted on STM3210E_EVAL board.
* It implements a high level communication layer for read and write
* from/to this memory. The needed STM32 hardware resources (SPI and
* GPIO) are defined in stm3210e_eval.h file, and the initialization is
* performed in FLASH_SPI_IO_Init() function declared in stm3210e_eval.c
* file.
* You can easily tailor this driver to any other development board,
* by just adapting the defines for hardware resources and
* FLASH_SPI_IO_Init() function.
*
* +---------------------------------------------------------------------+
* | Pin assignment |
* +---------------------------------------+---------------+-------------+
* | STM32 SPI Pins | BSP_FLASH | Pin |
* +---------------------------------------+---------------+-------------+
* | BSP_SERIAL_FLASH_CS_PIN | ChipSelect(/S)| 1 |
* | BSP_SERIAL_FLASH_SPI_MISO_PIN / MISO | DataOut(Q) | 2 |
* | | VCC | 3 (3.3 V)|
* | | GND | 4 (0 V) |
* | BSP_SERIAL_FLASH_SPI_MOSI_PIN / MOSI | DataIn(D) | 5 |
* | BSP_SERIAL_FLASH_SPI_SCK_PIN / SCLK | Clock(C) | 6 |
* | | VCC | 7 (3.3 V)|
* | | VCC | 8 (3.3 V)|
* +---------------------------------------+---------------+-------------+
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210e_eval_serialflash.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_SERIAL_FLASH STM3210E EVAL Serial FLASH
* @brief This file includes the M25Pxxx SPI FLASH driver of
* STM3210E-EVAL board.
* @{
*/
/** @defgroup STM3210E_EVAL_SERIAL_FLASH_Exported_Functions STM3210E EVAL SERIAL FLASH Exported Functions
* @{
*/
/**
* @brief Initializes peripherals used by the Serial FLASH device.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_Init(void)
{
if(FLASH_SPI_IO_Init() != HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Erases the specified FLASH sector.
* @param SectorAddr: address of the sector to erase.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_EraseSector(uint32_t SectorAddr)
{
/*!< Sector Erase */
/*!< Select the FLASH and send "Write Enable" instruction */
FLASH_SPI_IO_WriteEnable();
/*!< Send Sector Erase instruction */
FLASH_SPI_IO_WriteByte(FLASH_SPI_CMD_SE);
/*!< Send SectorAddr high nibble address byte */
FLASH_SPI_IO_WriteByte((SectorAddr & 0xFF0000) >> 16);
/*!< Send SectorAddr medium nibble address byte */
FLASH_SPI_IO_WriteByte((SectorAddr & 0xFF00) >> 8);
/*!< Send SectorAddr low nibble address byte */
FLASH_SPI_IO_WriteByte(SectorAddr & 0xFF);
/*!< Wait the end of Flash writing and Deselect the FLASH*/
if(FLASH_SPI_IO_WaitForWriteEnd()!= HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Erases the entire FLASH.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_EraseBulk(void)
{
/*!< Bulk Erase */
/*!< Select the FLASH and send "Write Enable" instruction */
FLASH_SPI_IO_WriteEnable();
/*!< Send Bulk Erase instruction */
FLASH_SPI_IO_WriteByte(FLASH_SPI_CMD_BE);
/*!< Wait the end of Flash writing and Deselect the FLASH*/
if(FLASH_SPI_IO_WaitForWriteEnd()!= HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Writes more than one byte to the FLASH with a single WRITE cycle
* (Page WRITE sequence).
* @note The number of byte can't exceed the FLASH page size (FLASH_SPI_PAGESIZE).
* @param pData: pointer to the buffer containing the data to be written
* to the FLASH.
* @param uwStartAddress: FLASH's internal address to write to.
* @param uwDataSize: number of bytes to write to the FLASH, must be equal
* or less than "FLASH_SPI_PAGESIZE" value.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_WritePage(uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize)
{
/*!< Select the FLASH and send "Write Enable" instruction */
FLASH_SPI_IO_WriteEnable();
/*!< Send "Write to Memory " instruction */
FLASH_SPI_IO_WriteByte(FLASH_SPI_CMD_WRITE);
/*!< Send uwStartAddress high nibble address byte to write to */
FLASH_SPI_IO_WriteByte((uwStartAddress & 0xFF0000) >> 16);
/*!< Send uwStartAddress medium nibble address byte to write to */
FLASH_SPI_IO_WriteByte((uwStartAddress & 0xFF00) >> 8);
/*!< Send uwStartAddress low nibble address byte to write to */
FLASH_SPI_IO_WriteByte(uwStartAddress & 0xFF);
/*!< while there is data to be written on the FLASH */
while (uwDataSize--)
{
/*!< Send the current byte */
FLASH_SPI_IO_WriteByte(*pData);
/*!< Point on the next byte to be written */
pData++;
}
/*!< Wait the end of Flash writing */
if (FLASH_SPI_IO_WaitForWriteEnd()!= HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Writes block of data to the FLASH. In this function, the number of
* WRITE cycles are reduced, using Page WRITE sequence.
* @param pData: pointer to the buffer containing the data to be written
* to the FLASH.
* @param uwStartAddress: FLASH's internal address to write to.
* @param uwDataSize: number of bytes to write to the FLASH.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_WriteData(uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize)
{
uint8_t NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0, status = 0;
Addr = uwStartAddress % FLASH_SPI_PAGESIZE;
count = FLASH_SPI_PAGESIZE - Addr;
NumOfPage = uwDataSize / FLASH_SPI_PAGESIZE;
NumOfSingle = uwDataSize % FLASH_SPI_PAGESIZE;
if (Addr == 0) /*!< uwStartAddress is FLASH_SPI_PAGESIZE aligned */
{
if (NumOfPage == 0) /*!< uwDataSize < FLASH_SPI_PAGESIZE */
{
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, uwDataSize);
}
else /*!< uwDataSize > FLASH_SPI_PAGESIZE */
{
while (NumOfPage--)
{
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, FLASH_SPI_PAGESIZE);
uwStartAddress += FLASH_SPI_PAGESIZE;
pData += FLASH_SPI_PAGESIZE;
}
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, NumOfSingle);
}
}
else /*!< uwStartAddress is not FLASH_SPI_PAGESIZE aligned */
{
if (NumOfPage == 0) /*!< uwDataSize < FLASH_SPI_PAGESIZE */
{
if (NumOfSingle > count) /*!< (uwDataSize + uwStartAddress) > FLASH_SPI_PAGESIZE */
{
temp = NumOfSingle - count;
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, count);
uwStartAddress += count;
pData += count;
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, temp);
}
else
{
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, uwDataSize);
}
}
else /*!< uwDataSize > BSP_SERIAL_FLASH_PAGESIZE */
{
uwDataSize -= count;
NumOfPage = uwDataSize / FLASH_SPI_PAGESIZE;
NumOfSingle = uwDataSize % FLASH_SPI_PAGESIZE;
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, count);
uwStartAddress += count;
pData += count;
while (NumOfPage--)
{
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, FLASH_SPI_PAGESIZE);
uwStartAddress += FLASH_SPI_PAGESIZE;
pData += FLASH_SPI_PAGESIZE;
}
if (NumOfSingle != 0)
{
status = BSP_SERIAL_FLASH_WritePage(uwStartAddress, pData, NumOfSingle);
}
}
}
if (status!= HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Reads a block of data from the FLASH.
* @param pData: pointer to the buffer that receives the data read from the FLASH.
* @param uwStartAddress: FLASH's internal address to read from.
* @param uwDataSize: number of bytes to read from the FLASH.
* @retval FLASH_OK (0x00) if operation is correctly performed, else
* return FLASH_ERROR (0x01).
*/
uint8_t BSP_SERIAL_FLASH_ReadData(uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize)
{
if(FLASH_SPI_IO_ReadData(uwStartAddress, pData, uwDataSize)!= HAL_OK)
{
return FLASH_ERROR;
}
else
{
return FLASH_OK;
}
}
/**
* @brief Reads FLASH identification.
* @retval FLASH identification
*/
uint32_t BSP_SERIAL_FLASH_ReadID(void)
{
return(FLASH_SPI_IO_ReadID());
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,112 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_serialflash.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210e_eval_flash driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_SERIAL_FLASH_H
#define __STM3210E_EVAL_SERIAL_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_SERIAL_FLASH
* @{
*/
/** @defgroup STM3210E_EVAL_SERIAL_FLASH_Exported_Constants STM3210E EVAL SERIAL FLASH Exported Constants
* @{
*/
#define FLASH_OK 0x00
#define FLASH_ERROR 0x01
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_SERIAL_FLASH_Exported_Functions
* @{
*/
uint8_t BSP_SERIAL_FLASH_Init(void);
uint8_t BSP_SERIAL_FLASH_EraseSector(uint32_t SectorAddr);
uint8_t BSP_SERIAL_FLASH_EraseBulk(void);
uint8_t BSP_SERIAL_FLASH_WritePage(uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize);
uint8_t BSP_SERIAL_FLASH_WriteData(uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize);
uint8_t BSP_SERIAL_FLASH_ReadData( uint32_t uwStartAddress, uint8_t* pData, uint32_t uwDataSize);
uint32_t BSP_SERIAL_FLASH_ReadID(void);
/* Link function for EEPROM peripheral over SPI */
HAL_StatusTypeDef FLASH_SPI_IO_Init(void);
uint8_t FLASH_SPI_IO_WriteByte(uint8_t Data);
uint8_t FLASH_SPI_IO_ReadByte(void);
HAL_StatusTypeDef FLASH_SPI_IO_ReadData(uint32_t MemAddress, uint8_t* pBuffer, uint32_t BufferSize);
void FLASH_SPI_IO_WriteEnable(void);
HAL_StatusTypeDef FLASH_SPI_IO_WaitForWriteEnd(void);
uint32_t FLASH_SPI_IO_ReadID(void);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_SERIAL_FLASH_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,347 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_sram.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file includes the SRAM driver for the IS61WV51216BLL-10M memory
* device mounted on STM3210E-EVAL evaluation board.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 IS61WV51216BLL-10M SRAM external memory mounted
on STM3210E-EVAL evaluation board.
- This driver does not need a specific component driver for the SRAM device
to be included with.
2. Driver description:
---------------------
+ Initialization steps:
o Initialize the SRAM external memory using the BSP_SRAM_Init() function. This
function includes the MSP layer hardware resources initialization and the
FSMC controller configuration to interface with the external SRAM memory.
+ SRAM read/write operations
o SRAM external 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_SRAM_ReadData()/BSP_SRAM_WriteData(), or by DMA transfer using the functions
BSP_SRAM_ReadData_DMA()/BSP_SRAM_WriteData_DMA().
o The AHB access is performed with 16-bit width transaction, the DMA transfer
configuration is fixed at single (no burst) halfword transfer
(see the SRAM_MspInit() static function).
o User can implement his own functions for read/write access with his desired
configurations.
o If interrupt mode is used for DMA transfer, the function BSP_SRAM_DMA_IRQHandler()
is called in IRQ handler file, to serve the generated interrupt once the DMA
transfer is complete.
------------------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval_sram.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_SRAM STM3210E EVAL SRAM
* @{
*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_SRAM_Private_Variables STM3210E EVAL SRAM Private Variables
* @{
*/
SRAM_HandleTypeDef sramHandle;
static FSMC_NORSRAM_TimingTypeDef Timing;
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup STM3210E_EVAL_SRAM_Private_Function_Prototypes STM3210E EVAL SRAM Private Function Prototypes
* @{
*/
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_SRAM_Exported_Functions STM3210E EVAL SRAM Exported Functions
* @{
*/
/**
* @brief Initializes the SRAM device.
* @retval SRAM status
*/
uint8_t BSP_SRAM_Init(void)
{
sramHandle.Instance = FSMC_NORSRAM_DEVICE;
sramHandle.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
/* SRAM device configuration */
Timing.AddressSetupTime = 2;
Timing.AddressHoldTime = 1;
Timing.DataSetupTime = 2;
Timing.BusTurnAroundDuration = 1;
Timing.CLKDivision = 2;
Timing.DataLatency = 2;
Timing.AccessMode = FSMC_ACCESS_MODE_A;
sramHandle.Init.NSBank = FSMC_NORSRAM_BANK3;
sramHandle.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
sramHandle.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
sramHandle.Init.MemoryDataWidth = SRAM_MEMORY_WIDTH;
sramHandle.Init.BurstAccessMode = SRAM_BURSTACCESS;
sramHandle.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW;
sramHandle.Init.WrapMode = FSMC_WRAP_MODE_DISABLE;
sramHandle.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS;
sramHandle.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE;
sramHandle.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE;
sramHandle.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE;
sramHandle.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE;
sramHandle.Init.WriteBurst = SRAM_WRITEBURST;
/* SRAM controller initialization */
BSP_SRAM_MspInit();
if(HAL_SRAM_Init(&sramHandle, &Timing, &Timing) != HAL_OK)
{
return SRAM_ERROR;
}
else
{
return SRAM_OK;
}
}
/**
* @brief Reads an amount of data from the SRAM device in polling mode.
* @param uwStartAddress: Read start address
* @param pData: Pointer to data to be read
* @param uwDataSize: Size of read data from the memory
* @retval SRAM status
*/
uint8_t BSP_SRAM_ReadData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize)
{
if(HAL_SRAM_Read_16b(&sramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
{
return SRAM_ERROR;
}
else
{
return SRAM_OK;
}
}
/**
* @brief Reads an amount of data from the SRAM device in DMA mode.
* @param uwStartAddress: Read start address
* @param pData: Pointer to data to be read
* @param uwDataSize: Size of read data from the memory
* @retval SRAM status
*/
uint8_t BSP_SRAM_ReadData_DMA(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize)
{
if(HAL_SRAM_Read_DMA(&sramHandle, (uint32_t *)uwStartAddress, (uint32_t *)pData, uwDataSize) != HAL_OK)
{
return SRAM_ERROR;
}
else
{
return SRAM_OK;
}
}
/**
* @brief Writes an amount of data from the SRAM device in polling mode.
* @param uwStartAddress: Write start address
* @param pData: Pointer to data to be written
* @param uwDataSize: Size of written data from the memory
* @retval SRAM status
*/
uint8_t BSP_SRAM_WriteData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize)
{
if(HAL_SRAM_Write_16b(&sramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
{
return SRAM_ERROR;
}
else
{
return SRAM_OK;
}
}
/**
* @brief Writes an amount of data from the SRAM device in DMA mode.
* @param uwStartAddress: Write start address
* @param pData: Pointer to data to be written
* @param uwDataSize: Size of written data from the memory
* @retval SRAM status
*/
uint8_t BSP_SRAM_WriteData_DMA(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize)
{
if(HAL_SRAM_Write_DMA(&sramHandle, (uint32_t *)uwStartAddress, (uint32_t *)pData, uwDataSize) != HAL_OK)
{
return SRAM_ERROR;
}
else
{
return SRAM_OK;
}
}
/**
* @brief Handles SRAM DMA transfer interrupt request.
* @retval None
*/
void BSP_SRAM_DMA_IRQHandler(void)
{
HAL_DMA_IRQHandler(sramHandle.hdma);
}
/**
* @brief Initializes SRAM MSP.
* @retval None
*/
__weak void BSP_SRAM_MspInit(void)
{
static DMA_HandleTypeDef hdma1;
GPIO_InitTypeDef gpioinitstruct = {0};
/* Enable FSMC clock */
__HAL_RCC_FSMC_CLK_ENABLE();
/* Enable DMA1 and DMA2 clocks */
__HAL_RCC_DMA1_CLK_ENABLE();
/* Enable GPIOs clock */
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
/* Common GPIO configuration */
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
/*-- GPIO Configuration ------------------------------------------------------*/
/*!< SRAM Data lines configuration */
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_8 | GPIO_PIN_9 |
GPIO_PIN_10 | GPIO_PIN_14 | GPIO_PIN_15;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
gpioinitstruct.Pin = 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, &gpioinitstruct);
/*!< SRAM Address lines configuration */
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 |
GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_12 | GPIO_PIN_13 |
GPIO_PIN_14 | GPIO_PIN_15;
HAL_GPIO_Init(GPIOF, &gpioinitstruct);
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 |
GPIO_PIN_4 | GPIO_PIN_5;
HAL_GPIO_Init(GPIOG, &gpioinitstruct);
gpioinitstruct.Pin = GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/*!< NOE and NWE configuration */
gpioinitstruct.Pin = GPIO_PIN_4 |GPIO_PIN_5;
HAL_GPIO_Init(GPIOD, &gpioinitstruct);
/*!< NE3 configuration */
gpioinitstruct.Pin = GPIO_PIN_10 |GPIO_PIN_12;
HAL_GPIO_Init(GPIOG, &gpioinitstruct);
/*!< NBL0, NBL1 configuration */
gpioinitstruct.Pin = GPIO_PIN_0 | GPIO_PIN_1;
HAL_GPIO_Init(GPIOE, &gpioinitstruct);
/* Configure common DMA parameters */
hdma1.Init.Direction = DMA_MEMORY_TO_MEMORY;
hdma1.Init.PeriphInc = DMA_PINC_ENABLE;
hdma1.Init.MemInc = DMA_MINC_ENABLE;
hdma1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
hdma1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
hdma1.Init.Mode = DMA_NORMAL;
hdma1.Init.Priority = DMA_PRIORITY_HIGH;
hdma1.Instance = DMA1_Channel1;
/* Deinitialize the Stream for new transfer */
HAL_DMA_DeInit(&hdma1);
/* Configure the DMA Stream */
HAL_DMA_Init(&hdma1);
/* Associate the DMA handle to the FSMC SRAM one */
sramHandle.hdma = &hdma1;
/* NVIC configuration for DMA transfer complete interrupt */
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0xC, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,131 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_sram.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains the common defines and functions prototypes for
* the stm3210e_eval_sram.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_SRAM_H
#define __STM3210e_EVAL_SRAM_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_SRAM
* @{
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup STM3210E_EVAL_SRAM_Exported_Constants STM3210E EVAL SRAM Exported Constants
* @{
*/
/**
* @brief SRAM status structure definition
*/
#define SRAM_OK 0x00
#define SRAM_ERROR 0x01
#define SRAM_DEVICE_ADDR ((uint32_t)0x68000000)
#define SRAM_DEVICE_SIZE ((uint32_t)0x200000) /* SRAM device size in MBytes */
/* #define SRAM_MEMORY_WIDTH FSMC_NORSRAM_MEM_BUS_WIDTH_8 */
#define SRAM_MEMORY_WIDTH FSMC_NORSRAM_MEM_BUS_WIDTH_16
#define SRAM_BURSTACCESS FSMC_BURST_ACCESS_MODE_DISABLE
/* #define SRAM_BURSTACCESS FSMC_BURST_ACCESS_MODE_ENABLE*/
#define SRAM_WRITEBURST FSMC_WRITE_BURST_DISABLE
/* #define SRAM_WRITEBURST FSMC_WRITE_BURST_ENABLE */
/* DMA definitions for SRAM DMA transfer */
#define __SRAM_DMAx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE
#define SRAM_DMAx_STREAM DMA2_Channel1
#define SRAM_DMAx_IRQn DMA2_Channel1_IRQn
#define SRAM_DMAx_IRQHandler DMA2_Channel1_IRQHandler
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup STM3210E_EVAL_SRAM_Exported_Functions
* @{
*/
uint8_t BSP_SRAM_Init(void);
uint8_t BSP_SRAM_ReadData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_SRAM_ReadData_DMA(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_SRAM_WriteData(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
uint8_t BSP_SRAM_WriteData_DMA(uint32_t uwStartAddress, uint16_t *pData, uint32_t uwDataSize);
void BSP_SRAM_DMA_IRQHandler(void);
void BSP_SRAM_MspInit(void);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_SRAM_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,184 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_tsensor.c
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file provides a set of functions needed to manage the I2C STLM75
* temperature sensor mounted on STM3210E_EVAL board .
* It implements a high level communication layer for read and write
* from/to this sensor. The needed STM32L152xD hardware resources (I2C and
* GPIO) are defined in stm3210e_eval.h file, and the initialization is
* performed in TSENSOR_IO_Init() function declared in stm3210e_eval.c
* file.
* You can easily tailor this driver to any other development board,
* by just adapting the defines for hardware resources and
* TSENSOR_IO_Init() function.
*
* +--------------------------------------------------------------------+
* | Pin assignment |
* +----------------------------------------+--------------+------------+
* | STM3210E I2C Pins | STLM75 | Pin |
* +----------------------------------------+--------------+------------+
* | EVAL_I2C2_SDA_PIN | SDA | 1 |
* | EVAL_I2C2_SCL_PIN | SCL | 2 |
* | EVAL_I2C2_SMBUS_PIN | OS/INT | 3 |
* | . | GND | 4 (0V) |
* | . | A2 | 5 |
* | . | A1 | 6 |
* | . | A0 | 7 |
* | . | VDD | 8 (3.3V)|
* +----------------------------------------+--------------+------------+
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm3210e_eval_tsensor.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @defgroup STM3210E_EVAL_TSENSOR STM3210E EVAL TSENSOR
* @brief This file includes the STLM75 Temperature Sensor driver of
* STM3210E_EVAL board.
* @{
*/
/** @defgroup STM3210E_EVAL_TSENSOR_Private_Variables STM3210E EVAL TSENSOR Private Variables
* @{
*/
static TSENSOR_DrvTypeDef *tsensor_drv;
__IO uint16_t TSENSORAddress = 0;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_I2C_TSENSOR_Exported_Functions STM3210E EVAL I2C TSENSOR Exported Functions
* @{
*/
/**
* @brief Initializes peripherals used by the I2C Temperature Sensor driver.
* @retval TSENSOR status
*/
uint32_t BSP_TSENSOR_Init(void)
{
uint8_t ret = TSENSOR_ERROR;
TSENSOR_InitTypeDef tsensor_initstruct = {0};
/* Temperature Sensor Initialization */
if(Stlm75Drv.IsReady(TSENSOR_I2C_ADDRESS_A01, TSENSOR_MAX_TRIALS) == HAL_OK)
{
/* Initialize the temperature sensor driver structure */
TSENSORAddress = TSENSOR_I2C_ADDRESS_A01;
tsensor_drv = &Stlm75Drv;
ret = TSENSOR_OK;
}
else
{
if(Stlm75Drv.IsReady(TSENSOR_I2C_ADDRESS_A02, TSENSOR_MAX_TRIALS) == HAL_OK)
{
/* Initialize the temperature sensor driver structure */
TSENSORAddress = TSENSOR_I2C_ADDRESS_A02;
tsensor_drv = &Stlm75Drv;
ret = TSENSOR_OK;
}
else
{
ret = TSENSOR_ERROR;
}
}
if (ret == TSENSOR_OK)
{
/* Configure Temperature Sensor : Conversion 9 bits in continuous mode */
/* Alert outside range Limit Temperature 12° <-> 24°c */
tsensor_initstruct.AlertMode = STLM75_INTERRUPT_MODE;
tsensor_initstruct.ConversionMode = STLM75_CONTINUOUS_MODE;
tsensor_initstruct.TemperatureLimitHigh = 24;
tsensor_initstruct.TemperatureLimitLow = 12;
/* TSENSOR Init */
tsensor_drv->Init(TSENSORAddress, &tsensor_initstruct);
ret = TSENSOR_OK;
}
return ret;
}
/**
* @brief Returns the Temperature Sensor status.
* @retval The Temperature Sensor status.
*/
uint8_t BSP_TSENSOR_ReadStatus(void)
{
return (tsensor_drv->ReadStatus(TSENSORAddress));
}
/**
* @brief Read Temperature register of STLM75.
* @retval STLM75 measured temperature value.
*/
uint16_t BSP_TSENSOR_ReadTemp(void)
{
return tsensor_drv->ReadTemp(TSENSORAddress);
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,122 +0,0 @@
/**
******************************************************************************
* @file stm3210e_eval_tsensor.h
* @author MCD Application Team
* @version V7.0.0
* @date 14-April-2017
* @brief This file contains all the functions prototypes for the
* stm3210e_tsensor.c firmware driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM3210E_EVAL_TSENSOR_H
#define __STM3210E_EVAL_TSENSOR_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm3210e_eval.h"
#include "../Components/stlm75/stlm75.h"
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM3210E_EVAL
* @{
*/
/** @addtogroup STM3210E_EVAL_TSENSOR
* @{
*/
/** @defgroup STM3210E_EVAL_TSENSOR_Exported_Types STM3210E EVAL TSENSOR Exported Types
* @{
*/
/**
* @brief TSENSOR Status
*/
typedef enum
{
TSENSOR_OK = 0,
TSENSOR_ERROR
}TSENSOR_Status_TypDef;
/**
* @}
*/
/** @defgroup STM3210E_EVAL_TSENSOR_Exported_Constants STM3210E EVAL TSENSOR Exported Constants
* @{
*/
/* Temperature Sensor hardware I2C address */
#define TSENSOR_I2C_ADDRESS_A01 0x90
#define TSENSOR_I2C_ADDRESS_A02 0x92
/* Maximum number of trials use for STLM75_IsReady function */
#define TSENSOR_MAX_TRIALS 50
/**
* @}
*/
/** @addtogroup STM3210E_EVAL_I2C_TSENSOR_Exported_Functions
* @{
*/
uint32_t BSP_TSENSOR_Init(void);
uint8_t BSP_TSENSOR_ReadStatus(void);
uint16_t BSP_TSENSOR_ReadTemp(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM3210E_EVAL_TSENSOR_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -0,0 +1 @@
Subproject commit 7cf1eeded2cf3c8c441b685bb60f696544ba285a

View File

@ -1,497 +0,0 @@
<!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 STM32F1xx_Nucleo 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 STM32F1xx_Nucleo 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
2016 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/logo.bmp" 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;"><span style="font-size: 12pt; color: white;">Contents<o:p></o:p></span></h2>
<ol style="margin-top: 0cm;" start="1" type="1">
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#History">STM32F1xx_Nucleo Board Drivers
update History</a><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; margin-top: 4.5pt; margin-bottom: 4.5pt;"><span style="font-size: 10pt; font-family: Verdana;"><a href="#License">License</a><o:p></o:p></span></li>
</ol>
<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;">STM32F1xx_Nucleo Board Drivers 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.4 / 14-April-2017 <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-family: Verdana; font-size: 10pt;">Add STM32F1xx_Nucleo_BSP_User_Manual.chm file</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.3 / 29-April-2016 <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;">Add support for 4 Gb sd cards.</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 / 18-December-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>
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">Add an alias from BUTTON_KEY to BUTTON_USER for compatibility with STM32F4xx and STM32L0xx.</span></li><li>BSP_LED_Init: Configure the led in GPIO_NOPULL instead of GPIO_PULLUP to reduce power consumption.</li><li>Rename GPIO_SPEED_HIGH to GPIO_SPEED_FREQ_HIGH for compatibility with STM32F1xx HAL Drivers V1.0.2.</li><li>Rename GPIO_SPEED_MEDIUM to GPIO_SPEED_FREQ_MEDIUM for compatibility with STM32F1xx HAL Drivers V1.0.2.</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 / 31-July-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>
<ul style="list-style-type: square;"><li><span style="font-size: 10pt; font-family: Verdana;">Add ADC calibration for JoyStick management.</span></li><li>Improve the polling of ADC &nbsp;in BSP_JOY_GetState.</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 / 15-December-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 class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman';"><span style="font-size: 10pt; font-family: Verdana;">Official release<span style="font-style: italic;"></span><span style="font-weight: bold; font-style: italic;"><span class="Apple-converted-space">&nbsp;</span></span></span><span style="font-size: 10pt; font-family: Verdana;">for&nbsp;<span style="font-weight: bold; font-style: italic;">STM32F1xx_Nucleo</span><span class="Apple-converted-space"> </span>board RevC drivers for<span class="Apple-converted-space">&nbsp;</span><span style="font-weight: bold;">STM32Cube_FW_F1 project</span></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"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;">Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this&nbsp;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;">package</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"> except in compliance with the License. You may obtain a copy of the License at:<br><br></span></p><div style="text-align: center;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" href="http://www.st.com/software_license_agreement_liberty_v2">http://www.st.com/software_license_agreement_liberty_v2</a></span><br><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"></span></div><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; color: black;"><br>Unless
required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, <br>WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
the License for the specific language governing permissions and
limitations under the License.</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>

View File

@ -1,891 +0,0 @@
/**
******************************************************************************
* @file stm32f1xx_nucleo.c
* @author MCD Application Team
* @version V1.0.4
* @date 14-April-2017
* @brief This file provides set of firmware functions to manage:
* - LEDs and push-button available on STM32F1XX-Nucleo Kit
* from STMicroelectronics
* - LCD, joystick and microSD available on Adafruit 1.8" TFT LCD
* shield (reference ID 802)
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 "stm32f1xx_nucleo.h"
/** @addtogroup BSP
* @{
*/
/** @defgroup STM32F1XX_NUCLEO STM32F103RB Nucleo
* @brief This file provides set of firmware functions to manage Leds and push-button
* available on STM32F1XX-Nucleo Kit from STMicroelectronics.
* It provides also LCD, joystick and uSD functions to communicate with
* Adafruit 1.8" TFT LCD shield (reference ID 802)
* @{
*/
/** @defgroup STM32F1XX_NUCLEO_Private_Defines STM32F1XX NUCLEO Private Defines
* @{
*/
/**
* @brief STM32F103RB NUCLEO BSP Driver version
*/
#define __STM32F1XX_NUCLEO_BSP_VERSION_MAIN (0x01) /*!< [31:24] main version */
#define __STM32F1XX_NUCLEO_BSP_VERSION_SUB1 (0x00) /*!< [23:16] sub1 version */
#define __STM32F1XX_NUCLEO_BSP_VERSION_SUB2 (0x04) /*!< [15:8] sub2 version */
#define __STM32F1XX_NUCLEO_BSP_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F1XX_NUCLEO_BSP_VERSION ((__STM32F1XX_NUCLEO_BSP_VERSION_MAIN << 24)\
|(__STM32F1XX_NUCLEO_BSP_VERSION_SUB1 << 16)\
|(__STM32F1XX_NUCLEO_BSP_VERSION_SUB2 << 8 )\
|(__STM32F1XX_NUCLEO_BSP_VERSION_RC))
/**
* @brief LINK SD Card
*/
#define SD_DUMMY_BYTE 0xFF
#define SD_NO_RESPONSE_EXPECTED 0x80
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_Private_Variables STM32F1XX NUCLEO Private Variables
* @{
*/
GPIO_TypeDef* LED_PORT[LEDn] = {LED2_GPIO_PORT};
const uint16_t LED_PIN[LEDn] = {LED2_PIN};
GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT};
const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN};
const uint8_t BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn };
/**
* @brief BUS variables
*/
#ifdef HAL_SPI_MODULE_ENABLED
uint32_t SpixTimeout = NUCLEO_SPIx_TIMEOUT_MAX; /*<! Value of Timeout when SPI communication fails */
static SPI_HandleTypeDef hnucleo_Spi;
#endif /* HAL_SPI_MODULE_ENABLED */
#ifdef HAL_ADC_MODULE_ENABLED
static ADC_HandleTypeDef hnucleo_Adc;
/* ADC channel configuration structure declaration */
static ADC_ChannelConfTypeDef sConfig;
#endif /* HAL_ADC_MODULE_ENABLED */
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_Private_Functions STM32F1XX NUCLEO Private Functions
* @{
*/
#ifdef HAL_SPI_MODULE_ENABLED
static void SPIx_Init(void);
static void SPIx_Write(uint8_t Value);
static void SPIx_WriteData(uint8_t *DataIn, uint16_t DataLength);
static void SPIx_WriteReadData(const uint8_t *DataIn, uint8_t *DataOut, uint16_t DataLegnth);
static void SPIx_Error (void);
static void SPIx_MspInit(void);
/* SD IO functions */
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);
void SD_IO_ReadData(uint8_t *DataOut, uint16_t DataLength);
void SD_IO_WriteData(const uint8_t *Data, uint16_t DataLength);
uint8_t SD_IO_WriteByte(uint8_t Data);
uint8_t SD_IO_ReadByte(void);
/* LCD IO functions */
void LCD_IO_Init(void);
void LCD_IO_WriteData(uint8_t Data);
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
void LCD_IO_WriteReg(uint8_t LCDReg);
void LCD_Delay(uint32_t delay);
#endif /* HAL_SPI_MODULE_ENABLED */
#ifdef HAL_ADC_MODULE_ENABLED
static HAL_StatusTypeDef ADCx_Init(void);
static void ADCx_DeInit(void);
static void ADCx_MspInit(ADC_HandleTypeDef *hadc);
static void ADCx_MspDeInit(ADC_HandleTypeDef *hadc);
#endif /* HAL_ADC_MODULE_ENABLED */
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_Exported_Functions STM32F1XX NUCLEO Exported Functions
* @{
*/
/**
* @brief This method returns the STM32F1XX NUCLEO BSP Driver revision
* @retval version : 0xXYZR (8bits for each decimal, R for RC)
*/
uint32_t BSP_GetVersion(void)
{
return __STM32F1XX_NUCLEO_BSP_VERSION;
}
/** @defgroup STM32F1XX_NUCLEO_LED_Functions STM32F1XX NUCLEO LED Functions
* @{
*/
/**
* @brief Configures LED GPIO.
* @param Led: Led to be configured.
* This parameter can be one of the following values:
* @arg LED2
*/
void BSP_LED_Init(Led_TypeDef Led)
{
GPIO_InitTypeDef gpioinitstruct;
/* Enable the GPIO_LED Clock */
LEDx_GPIO_CLK_ENABLE(Led);
/* Configure the GPIO_LED pin */
gpioinitstruct.Pin = LED_PIN[Led];
gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(LED_PORT[Led], &gpioinitstruct);
/* Reset PIN to switch off the LED */
HAL_GPIO_WritePin(LED_PORT[Led],LED_PIN[Led], GPIO_PIN_RESET);
}
/**
* @brief DeInit LEDs.
* @param Led: LED to be de-init.
* This parameter can be one of the following values:
* @arg LED2
* @note Led DeInit does not disable the GPIO clock nor disable the Mfx
*/
void BSP_LED_DeInit(Led_TypeDef Led)
{
GPIO_InitTypeDef gpio_init_structure;
/* Turn off LED */
HAL_GPIO_WritePin(LED_PORT[Led],LED_PIN[Led], GPIO_PIN_RESET);
/* DeInit the GPIO_LED pin */
gpio_init_structure.Pin = LED_PIN[Led];
HAL_GPIO_DeInit(LED_PORT[Led], gpio_init_structure.Pin);
}
/**
* @brief Turns selected LED On.
* @param Led: Specifies the Led to be set on.
* This parameter can be one of following parameters:
* @arg LED2
*/
void BSP_LED_On(Led_TypeDef Led)
{
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_SET);
}
/**
* @brief Turns selected LED Off.
* @param Led: Specifies the Led to be set off.
* This parameter can be one of following parameters:
* @arg LED2
*/
void BSP_LED_Off(Led_TypeDef Led)
{
HAL_GPIO_WritePin(LED_PORT[Led], LED_PIN[Led], GPIO_PIN_RESET);
}
/**
* @brief Toggles the selected LED.
* @param Led: Specifies the Led to be toggled.
* This parameter can be one of following parameters:
* @arg LED2
*/
void BSP_LED_Toggle(Led_TypeDef Led)
{
HAL_GPIO_TogglePin(LED_PORT[Led], LED_PIN[Led]);
}
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_BUTTON_Functions STM32F1XX NUCLEO BUTTON Functions
* @{
*/
/**
* @brief Configures Button GPIO and EXTI Line.
* @param Button: Specifies the Button to be configured.
* This parameter should be: BUTTON_USER
* @param ButtonMode: Specifies Button mode.
* This parameter can be one of following parameters:
* @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
*/
void BSP_PB_Init(Button_TypeDef Button, ButtonMode_TypeDef ButtonMode)
{
GPIO_InitTypeDef gpioinitstruct;
/* Enable the BUTTON Clock */
BUTTONx_GPIO_CLK_ENABLE(Button);
gpioinitstruct.Pin = BUTTON_PIN[Button];
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
if (ButtonMode == BUTTON_MODE_GPIO)
{
/* Configure Button pin as input */
gpioinitstruct.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(BUTTON_PORT[Button], &gpioinitstruct);
}
if (ButtonMode == BUTTON_MODE_EXTI)
{
/* Configure Button pin as input with External interrupt */
gpioinitstruct.Mode = GPIO_MODE_IT_FALLING;
HAL_GPIO_Init(BUTTON_PORT[Button], &gpioinitstruct);
/* Enable and set Button EXTI Interrupt to the lowest priority */
HAL_NVIC_SetPriority((IRQn_Type)(BUTTON_IRQn[Button]), 0x0F, 0);
HAL_NVIC_EnableIRQ((IRQn_Type)(BUTTON_IRQn[Button]));
}
}
/**
* @brief Push Button DeInit.
* @param Button: Button to be configured
* This parameter should be: BUTTON_USER
* @note PB DeInit does not disable the GPIO clock
*/
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: Specifies the Button to be checked.
* This parameter should be: BUTTON_USER
* @retval Button state.
*/
uint32_t BSP_PB_GetState(Button_TypeDef Button)
{
return HAL_GPIO_ReadPin(BUTTON_PORT[Button], BUTTON_PIN[Button]);
}
/**
* @}
*/
/**
* @}
*/
/** @addtogroup STM32F1XX_NUCLEO_Private_Functions
* @{
*/
#ifdef HAL_SPI_MODULE_ENABLED
/******************************************************************************
BUS OPERATIONS
*******************************************************************************/
/**
* @brief Initialize SPI MSP.
*/
static void SPIx_MspInit(void)
{
GPIO_InitTypeDef gpioinitstruct = {0};
/*** Configure the GPIOs ***/
/* Enable GPIO clock */
NUCLEO_SPIx_SCK_GPIO_CLK_ENABLE();
NUCLEO_SPIx_MISO_MOSI_GPIO_CLK_ENABLE();
/* Configure SPI SCK */
gpioinitstruct.Pin = NUCLEO_SPIx_SCK_PIN;
gpioinitstruct.Mode = GPIO_MODE_AF_PP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(NUCLEO_SPIx_SCK_GPIO_PORT, &gpioinitstruct);
/* Configure SPI MISO and MOSI */
gpioinitstruct.Pin = NUCLEO_SPIx_MOSI_PIN;
HAL_GPIO_Init(NUCLEO_SPIx_MISO_MOSI_GPIO_PORT, &gpioinitstruct);
gpioinitstruct.Pin = NUCLEO_SPIx_MISO_PIN;
gpioinitstruct.Mode = GPIO_MODE_INPUT;
HAL_GPIO_Init(NUCLEO_SPIx_MISO_MOSI_GPIO_PORT, &gpioinitstruct);
/*** Configure the SPI peripheral ***/
/* Enable SPI clock */
NUCLEO_SPIx_CLK_ENABLE();
}
/**
* @brief Initialize SPI HAL.
*/
static void SPIx_Init(void)
{
if(HAL_SPI_GetState(&hnucleo_Spi) == HAL_SPI_STATE_RESET)
{
/* SPI Config */
hnucleo_Spi.Instance = NUCLEO_SPIx;
/* SPI baudrate is set to 8 MHz maximum (PCLK2/SPI_BaudRatePrescaler = 64/8 = 8 MHz)
to verify these constraints:
- ST7735 LCD SPI interface max baudrate is 15MHz for write and 6.66MHz for read
Since the provided driver doesn't use read capability from LCD, only constraint
on write baudrate is considered.
- SD card SPI interface max baudrate is 25MHz for write/read
- PCLK2 max frequency is 32 MHz
*/
hnucleo_Spi.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;
hnucleo_Spi.Init.Direction = SPI_DIRECTION_2LINES;
hnucleo_Spi.Init.CLKPhase = SPI_PHASE_1EDGE;
hnucleo_Spi.Init.CLKPolarity = SPI_POLARITY_LOW;
hnucleo_Spi.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
hnucleo_Spi.Init.CRCPolynomial = 7;
hnucleo_Spi.Init.DataSize = SPI_DATASIZE_8BIT;
hnucleo_Spi.Init.FirstBit = SPI_FIRSTBIT_MSB;
hnucleo_Spi.Init.NSS = SPI_NSS_SOFT;
hnucleo_Spi.Init.TIMode = SPI_TIMODE_DISABLE;
hnucleo_Spi.Init.Mode = SPI_MODE_MASTER;
SPIx_MspInit();
HAL_SPI_Init(&hnucleo_Spi);
}
}
/**
* @brief SPI Write a byte to device
* @param Value: value to be written
*/
static void SPIx_WriteReadData(const uint8_t *DataIn, uint8_t *DataOut, uint16_t DataLength)
{
HAL_StatusTypeDef status = HAL_OK;
status = HAL_SPI_TransmitReceive(&hnucleo_Spi, (uint8_t*) DataIn, DataOut, DataLength, SpixTimeout);
/* Check the communication status */
if(status != HAL_OK)
{
/* Execute user timeout callback */
SPIx_Error();
}
}
/**
* @brief SPI Write an amount of data to device
* @param Value: value to be written
* @param DataLength: number of bytes to write
*/
static void SPIx_WriteData(uint8_t *DataIn, uint16_t DataLength)
{
HAL_StatusTypeDef status = HAL_OK;
status = HAL_SPI_Transmit(&hnucleo_Spi, DataIn, DataLength, SpixTimeout);
/* Check the communication status */
if(status != HAL_OK)
{
/* Execute user timeout callback */
SPIx_Error();
}
}
/**
* @brief SPI Write a byte to device
* @param Value: value to be written
*/
static void SPIx_Write(uint8_t Value)
{
HAL_StatusTypeDef status = HAL_OK;
uint8_t data;
status = HAL_SPI_TransmitReceive(&hnucleo_Spi, (uint8_t*) &Value, &data, 1, SpixTimeout);
/* Check the communication status */
if(status != HAL_OK)
{
/* Execute user timeout callback */
SPIx_Error();
}
}
/**
* @brief SPI error treatment function
*/
static void SPIx_Error (void)
{
/* De-initialize the SPI communication BUS */
HAL_SPI_DeInit(&hnucleo_Spi);
/* Re-Initiaize the SPI communication BUS */
SPIx_Init();
}
/******************************************************************************
LINK OPERATIONS
*******************************************************************************/
/********************************* LINK SD ************************************/
/**
* @brief Initialize the SD Card and put it into StandBy State (Ready for
* data transfer).
*/
void SD_IO_Init(void)
{
GPIO_InitTypeDef gpioinitstruct = {0};
uint8_t counter = 0;
/* SD_CS_GPIO Periph clock enable */
SD_CS_GPIO_CLK_ENABLE();
/* Configure SD_CS_PIN pin: SD Card CS pin */
gpioinitstruct.Pin = SD_CS_PIN;
gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
gpioinitstruct.Pull = GPIO_PULLUP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(SD_CS_GPIO_PORT, &gpioinitstruct);
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
gpioinitstruct.Pin = LCD_CS_PIN;
gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(SD_CS_GPIO_PORT, &gpioinitstruct);
LCD_CS_HIGH();
/*------------Put SD in SPI mode--------------*/
/* SD SPI Config */
SPIx_Init();
/* SD chip select high */
SD_CS_HIGH();
/* Send dummy byte 0xFF, 10 times with CS high */
/* Rise CS and MOSI for 80 clocks cycles */
for (counter = 0; counter <= 9; counter++)
{
/* Send dummy byte 0xFF */
SD_IO_WriteByte(SD_DUMMY_BYTE);
}
}
/**
* @brief Set the SD_CS pin.
* @param pin value.
*/
void SD_IO_CSState(uint8_t val)
{
if(val == 1)
{
SD_CS_HIGH();
}
else
{
SD_CS_LOW();
}
}
/**
* @brief Write byte(s) on the SD
* @param DataIn: Pointer to data buffer to write
* @param DataOut: Pointer to data buffer for read data
* @param DataLength: number of bytes to write
*/
void SD_IO_WriteReadData(const uint8_t *DataIn, uint8_t *DataOut, uint16_t DataLength)
{
/* Send the byte */
SPIx_WriteReadData(DataIn, DataOut, DataLength);
}
/**
* @brief Write a byte on the SD.
* @param Data: byte to send.
* @retval Data written
*/
uint8_t SD_IO_WriteByte(uint8_t Data)
{
uint8_t tmp;
/* Send the byte */
SPIx_WriteReadData(&Data,&tmp,1);
return tmp;
}
/**
* @brief Write an amount of data on the SD.
* @param Data: byte to send.
* @param DataLength: number of bytes to write
*/
void SD_IO_ReadData(uint8_t *DataOut, uint16_t DataLength)
{
/* Send the byte */
SD_IO_WriteReadData(DataOut, DataOut, DataLength);
}
/**
* @brief Write an amount of data on the SD.
* @param Data: byte to send.
* @param DataLength: number of bytes to write
*/
void SD_IO_WriteData(const uint8_t *Data, uint16_t DataLength)
{
/* Send the byte */
SPIx_WriteData((uint8_t *)Data, DataLength);
}
/********************************* LINK LCD ***********************************/
/**
* @brief Initialize the LCD
*/
void LCD_IO_Init(void)
{
GPIO_InitTypeDef gpioinitstruct;
/* LCD_CS_GPIO and LCD_DC_GPIO Periph clock enable */
LCD_CS_GPIO_CLK_ENABLE();
LCD_DC_GPIO_CLK_ENABLE();
/* Configure LCD_CS_PIN pin: LCD Card CS pin */
gpioinitstruct.Pin = LCD_CS_PIN;
gpioinitstruct.Mode = GPIO_MODE_OUTPUT_PP;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(SD_CS_GPIO_PORT, &gpioinitstruct);
/* Configure LCD_DC_PIN pin: LCD Card DC pin */
gpioinitstruct.Pin = LCD_DC_PIN;
HAL_GPIO_Init(LCD_DC_GPIO_PORT, &gpioinitstruct);
/* LCD chip select high */
LCD_CS_HIGH();
/* LCD SPI Config */
SPIx_Init();
}
/**
* @brief Write command to select the LCD register.
* @param LCDReg: Address of the selected register.
* @retval None
*/
void LCD_IO_WriteReg(uint8_t LCDReg)
{
/* Reset LCD control line CS */
LCD_CS_LOW();
/* Set LCD data/command line DC to Low */
LCD_DC_LOW();
/* Send Command */
SPIx_Write(LCDReg);
/* Deselect : Chip Select high */
LCD_CS_HIGH();
}
/**
* @brief Write register value.
* @param pData Pointer on the register value
* @param Size Size of byte to transmit to the register
*/
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size)
{
uint32_t counter = 0;
/* Reset LCD control line CS */
LCD_CS_LOW();
/* Set LCD data/command line DC to High */
LCD_DC_HIGH();
if (Size == 1)
{
/* Only 1 byte to be sent to LCD - general interface can be used */
/* Send Data */
SPIx_Write(*pData);
}
else
{
/* Several data should be sent in a raw */
/* Direct SPI accesses for optimization */
for (counter = Size; counter != 0; counter--)
{
while(((hnucleo_Spi.Instance->SR) & SPI_FLAG_TXE) != SPI_FLAG_TXE)
{
}
/* Need to invert bytes for LCD*/
*((__IO uint8_t*)&hnucleo_Spi.Instance->DR) = *(pData+1);
while(((hnucleo_Spi.Instance->SR) & SPI_FLAG_TXE) != SPI_FLAG_TXE)
{
}
*((__IO uint8_t*)&hnucleo_Spi.Instance->DR) = *pData;
counter--;
pData += 2;
}
/* Wait until the bus is ready before releasing Chip select */
while(((hnucleo_Spi.Instance->SR) & SPI_FLAG_BSY) != RESET)
{
}
}
/* Deselect : Chip Select high */
LCD_CS_HIGH();
}
/**
* @brief Wait for loop in ms.
* @param Delay in ms.
* @retval None
*/
void LCD_Delay(uint32_t Delay)
{
HAL_Delay(Delay);
}
#endif /* HAL_SPI_MODULE_ENABLED */
#ifdef HAL_ADC_MODULE_ENABLED
/******************************* LINK JOYSTICK ********************************/
/**
* @brief Initialize ADC MSP.
*/
static void ADCx_MspInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef gpioinitstruct;
/*** Configure the GPIOs ***/
/* Enable GPIO clock */
NUCLEO_ADCx_GPIO_CLK_ENABLE();
/* Configure ADC1 Channel8 as analog input */
gpioinitstruct.Pin = NUCLEO_ADCx_GPIO_PIN ;
gpioinitstruct.Mode = GPIO_MODE_ANALOG;
gpioinitstruct.Pull = GPIO_NOPULL;
gpioinitstruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
HAL_GPIO_Init(NUCLEO_ADCx_GPIO_PORT, &gpioinitstruct);
/*** Configure the ADC peripheral ***/
/* Enable ADC clock */
NUCLEO_ADCx_CLK_ENABLE();
}
/**
* @brief DeInitializes ADC MSP.
* @note ADC DeInit does not disable the GPIO clock
*/
static void ADCx_MspDeInit(ADC_HandleTypeDef *hadc)
{
GPIO_InitTypeDef gpioinitstruct;
/*** DeInit the ADC peripheral ***/
/* Disable ADC clock */
NUCLEO_ADCx_CLK_DISABLE();
/* Configure the selected ADC Channel as analog input */
gpioinitstruct.Pin = NUCLEO_ADCx_GPIO_PIN ;
HAL_GPIO_DeInit(NUCLEO_ADCx_GPIO_PORT, gpioinitstruct.Pin);
/* Disable GPIO clock has to be done by the application*/
/* NUCLEO_ADCx_GPIO_CLK_DISABLE(); */
}
/**
* @brief Initializes ADC HAL.
*/
static HAL_StatusTypeDef ADCx_Init(void)
{
/* Set ADC instance */
hnucleo_Adc.Instance = NUCLEO_ADCx;
if(HAL_ADC_GetState(&hnucleo_Adc) == HAL_ADC_STATE_RESET)
{
/* ADC Config */
hnucleo_Adc.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hnucleo_Adc.Init.ScanConvMode = ADC_SCAN_DISABLE;
hnucleo_Adc.Init.ContinuousConvMode = DISABLE;
hnucleo_Adc.Init.NbrOfConversion = 1;
hnucleo_Adc.Init.DiscontinuousConvMode = DISABLE;
hnucleo_Adc.Init.NbrOfDiscConversion = 1;
hnucleo_Adc.Init.ExternalTrigConv = ADC_SOFTWARE_START;
/* Initialize MSP related to ADC */
ADCx_MspInit(&hnucleo_Adc);
/* Initialize ADC */
if (HAL_ADC_Init(&hnucleo_Adc) != HAL_OK)
{
return HAL_ERROR;
}
/* Run ADC calibration */
if (HAL_ADCEx_Calibration_Start(&hnucleo_Adc) != HAL_OK)
{
return HAL_ERROR;
}
}
return HAL_OK;
}
/**
* @brief Initializes ADC HAL.
*/
static void ADCx_DeInit(void)
{
hnucleo_Adc.Instance = NUCLEO_ADCx;
HAL_ADC_DeInit(&hnucleo_Adc);
ADCx_MspDeInit(&hnucleo_Adc);
}
/******************************* LINK JOYSTICK ********************************/
/**
* @brief Configures joystick available on adafruit 1.8" TFT shield
* managed through ADC to detect motion.
* @retval Joystickstatus (0=> success, 1=> fail)
*/
uint8_t BSP_JOY_Init(void)
{
if (ADCx_Init() != HAL_OK)
{
return (uint8_t) HAL_ERROR;
}
/* Select Channel 8 to be converted */
sConfig.Channel = ADC_CHANNEL_8;
sConfig.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
sConfig.Rank = 1;
/* Return Joystick initialization status */
return (uint8_t)HAL_ADC_ConfigChannel(&hnucleo_Adc, &sConfig);
}
/**
* @brief DeInit joystick GPIOs.
* @note JOY DeInit does not disable the Mfx, just set the Mfx pins in Off mode
*/
void BSP_JOY_DeInit(void)
{
ADCx_DeInit();
}
/**
* @brief Returns the Joystick key pressed.
* @note To know which Joystick key is pressed we need to detect the voltage
* level on each key output
* - None : 3.3 V / 4095
* - SEL : 1.055 V / 1308
* - DOWN : 0.71 V / 88
* - LEFT : 3.0 V / 3720
* - RIGHT : 0.595 V / 737
* - UP : 1.65 V / 2046
* @retval JOYState_TypeDef: Code of the Joystick key pressed.
*/
JOYState_TypeDef BSP_JOY_GetState(void)
{
JOYState_TypeDef state = JOY_NONE;
uint16_t keyconvertedvalue = 0;
/* Start the conversion process */
HAL_ADC_Start(&hnucleo_Adc);
/* Wait for the end of conversion */
if (HAL_ADC_PollForConversion(&hnucleo_Adc, 10) != HAL_TIMEOUT)
{
/* Get the converted value of regular channel */
keyconvertedvalue = HAL_ADC_GetValue(&hnucleo_Adc);
}
if((keyconvertedvalue > 1800) && (keyconvertedvalue < 2090))
{
state = JOY_UP;
}
else if((keyconvertedvalue > 500) && (keyconvertedvalue < 780))
{
state = JOY_RIGHT;
}
else if((keyconvertedvalue > 1200) && (keyconvertedvalue < 1350))
{
state = JOY_SEL;
}
else if((keyconvertedvalue > 10) && (keyconvertedvalue < 130))
{
state = JOY_DOWN;
}
else if((keyconvertedvalue > 3500) && (keyconvertedvalue < 3760))
{
state = JOY_LEFT;
}
else
{
state = JOY_NONE;
}
/* Return the code of the Joystick key pressed*/
return state;
}
#endif /* HAL_ADC_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@ -1,293 +0,0 @@
/**
******************************************************************************
* @file stm32f1xx_nucleo.h
* @author MCD Application Team
* @version V1.0.4
* @date 14-April-2017
* @brief This file contains definitions for:
* - LEDs and push-button available on STM32F1XX-Nucleo Kit
* from STMicroelectronics
* - LCD, joystick and microSD available on Adafruit 1.8" TFT LCD
* shield (reference ID 802)
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 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 __STM32F1XX_NUCLEO_H
#define __STM32F1XX_NUCLEO_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM32F1XX_NUCLEO
* @{
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/** @defgroup STM32F1XX_NUCLEO_Exported_Types STM32F1XX NUCLEO Exported Types
* @{
*/
typedef enum
{
LED2 = 0,
LED_GREEN = LED2
} Led_TypeDef;
typedef enum
{
BUTTON_USER = 0,
/* Alias */
BUTTON_KEY = BUTTON_USER
} Button_TypeDef;
typedef enum
{
BUTTON_MODE_GPIO = 0,
BUTTON_MODE_EXTI = 1
} ButtonMode_TypeDef;
typedef enum
{
JOY_NONE = 0,
JOY_SEL = 1,
JOY_DOWN = 2,
JOY_LEFT = 3,
JOY_RIGHT = 4,
JOY_UP = 5
} JOYState_TypeDef;
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_Exported_Constants STM32F1XX NUCLEO Exported Constants
* @{
*/
/**
* @brief Define for STM32F1xx_NUCLEO board
*/
#if !defined (USE_STM32F1xx_NUCLEO)
#define USE_STM32F1xx_NUCLEO
#endif
/** @defgroup STM32F1XX_NUCLEO_LED STM32F1XX NUCLEO LED
* @{
*/
#define LEDn 1
#define LED2_PIN GPIO_PIN_5
#define LED2_GPIO_PORT GPIOA
#define LED2_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define LED2_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define LEDx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) LED2_GPIO_CLK_ENABLE();} while(0)
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? LED2_GPIO_CLK_DISABLE() : 0)
/**
* @}
*/
/** @defgroup STM32F1XX_NUCLEO_BUTTON STM32F1XX NUCLEO BUTTON
* @{
*/
#define BUTTONn 1
/**
* @brief User push-button
*/
#define USER_BUTTON_PIN GPIO_PIN_13
#define USER_BUTTON_GPIO_PORT GPIOC
#define USER_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
#define USER_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
#define USER_BUTTON_EXTI_IRQn EXTI15_10_IRQn
/* Aliases */
#define KEY_BUTTON_PIN USER_BUTTON_PIN
#define KEY_BUTTON_GPIO_PORT USER_BUTTON_GPIO_PORT
#define KEY_BUTTON_GPIO_CLK_ENABLE() USER_BUTTON_GPIO_CLK_ENABLE()
#define KEY_BUTTON_GPIO_CLK_DISABLE() USER_BUTTON_GPIO_CLK_DISABLE()
#define KEY_BUTTON_EXTI_IRQn USER_BUTTON_EXTI_IRQn
#define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do { if((__INDEX__) == 0) USER_BUTTON_GPIO_CLK_ENABLE();} while(0)
#define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) (((__INDEX__) == 0) ? USER_BUTTON_GPIO_CLK_DISABLE() : 0)
/**
* @}
*/
/** @addtogroup STM32F1XX_NUCLEO_BUS STM32F1XX NUCLEO BUS
* @{
*/
/*###################### SPI1 ###################################*/
#define NUCLEO_SPIx SPI1
#define NUCLEO_SPIx_CLK_ENABLE() __HAL_RCC_SPI1_CLK_ENABLE()
#define NUCLEO_SPIx_SCK_GPIO_PORT GPIOA
#define NUCLEO_SPIx_SCK_PIN GPIO_PIN_5
#define NUCLEO_SPIx_SCK_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define NUCLEO_SPIx_SCK_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define NUCLEO_SPIx_MISO_MOSI_GPIO_PORT GPIOA
#define NUCLEO_SPIx_MISO_MOSI_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define NUCLEO_SPIx_MISO_MOSI_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
#define NUCLEO_SPIx_MISO_PIN GPIO_PIN_6
#define NUCLEO_SPIx_MOSI_PIN GPIO_PIN_7
/* Maximum Timeout values for flags waiting loops. These timeouts are not based
on accurate values, they just guarantee that the application will not remain
stuck if the SPI communication is corrupted.
You may modify these timeout values depending on CPU frequency and application
conditions (interrupts routines ...). */
#define NUCLEO_SPIx_TIMEOUT_MAX 1000
/**
* @brief SD Control Lines management
*/
#define SD_CS_LOW() HAL_GPIO_WritePin(SD_CS_GPIO_PORT, SD_CS_PIN, GPIO_PIN_RESET)
#define SD_CS_HIGH() HAL_GPIO_WritePin(SD_CS_GPIO_PORT, SD_CS_PIN, GPIO_PIN_SET)
/**
* @brief LCD Control Lines management
*/
#define LCD_CS_LOW() HAL_GPIO_WritePin(LCD_CS_GPIO_PORT, LCD_CS_PIN, GPIO_PIN_RESET)
#define LCD_CS_HIGH() HAL_GPIO_WritePin(LCD_CS_GPIO_PORT, LCD_CS_PIN, GPIO_PIN_SET)
#define LCD_DC_LOW() HAL_GPIO_WritePin(LCD_DC_GPIO_PORT, LCD_DC_PIN, GPIO_PIN_RESET)
#define LCD_DC_HIGH() HAL_GPIO_WritePin(LCD_DC_GPIO_PORT, LCD_DC_PIN, GPIO_PIN_SET)
/**
* @brief SD Control Interface pins (shield D4)
*/
#define SD_CS_PIN GPIO_PIN_5
#define SD_CS_GPIO_PORT GPIOB
#define SD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define SD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Control Interface pins (shield D10)
*/
#define LCD_CS_PIN GPIO_PIN_6
#define LCD_CS_GPIO_PORT GPIOB
#define LCD_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define LCD_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @brief LCD Data/Command Interface pins
*/
#define LCD_DC_PIN GPIO_PIN_9
#define LCD_DC_GPIO_PORT GPIOA
#define LCD_DC_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define LCD_DC_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
/*##################### ADC1 ###################################*/
/**
* @brief ADC Interface pins
* used to detect motion of Joystick available on Adafruit 1.8" TFT shield
*/
#define NUCLEO_ADCx ADC1
#define NUCLEO_ADCx_CLK_ENABLE() __HAL_RCC_ADC1_CLK_ENABLE()
#define NUCLEO_ADCx_CLK_DISABLE() __HAL_RCC_ADC1_CLK_DISABLE()
#define NUCLEO_ADCx_GPIO_PORT GPIOB
#define NUCLEO_ADCx_GPIO_PIN GPIO_PIN_0
#define NUCLEO_ADCx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define NUCLEO_ADCx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOB_CLK_DISABLE()
/**
* @}
*/
/**
* @}
*/
/** @addtogroup STM32F1XX_NUCLEO_Exported_Functions
* @{
*/
uint32_t BSP_GetVersion(void);
/** @addtogroup STM32F1XX_NUCLEO_LED_Functions STM32F1XX NUCLEO LED Functions
* @{
*/
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);
/**
* @}
*/
/** @addtogroup STM32F1XX_NUCLEO_BUTTON_Functions STM32F1XX NUCLEO BUTTON Functions
* @{
*/
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);
#if defined(HAL_ADC_MODULE_ENABLED)
uint8_t BSP_JOY_Init(void);
JOYState_TypeDef BSP_JOY_GetState(void);
void BSP_JOY_DeInit(void);
#endif /* HAL_ADC_MODULE_ENABLED */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F1XX_NUCLEO_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

Some files were not shown because too many files have changed in this diff Show More