Compare commits
4
Commits
f0a16c5fa9
..
trunk
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf23313428 | ||
|
|
b88f87c35d | ||
|
|
3fcbaec2fb | ||
|
|
11f9d3b18c |
No files matched your search
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: 'Issue report'
|
||||
about: 'Create a report to help us improve the quality of our software'
|
||||
title: ''
|
||||
labels: ''
|
||||
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 your report to the **ST Community** in the STM32 MCUs dedicated [page](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
|
||||
|
||||
**Describe the bug (skip if none)**
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce the bug (skip if none)**
|
||||
|
||||
1. Indicate the global behavior of your application project
|
||||
2. List the modules that you suspect to be the cause of the problem (Drivers, BSP, MW...)
|
||||
3. Describe the use case that generates the problem
|
||||
4. How we can reproduce the problem
|
||||
|
||||
|
||||
**Additional context**
|
||||
|
||||
If you have a first analysis, an enhancement, a fix or a patch, thank you to share your proposal.
|
||||
|
||||
**Screenshots**
|
||||
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
@@ -0,0 +1,5 @@
|
||||
## IMPORTANT INFORMATION
|
||||
|
||||
### Contributor License Agreement (CLA)
|
||||
* 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/stm32f429i-discovery/blob/main/CONTRIBUTING.md) file.
|
||||
@@ -0,0 +1,73 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team via this [link](https://www.st.com/content/st_com/en/contact-us.html).
|
||||
All complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 1.4,
|
||||
available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
|
||||
|
||||
For answers to common questions about this code of conduct, see the [FAQ section](https://www.contributor-covenant.org/faq).
|
||||
@@ -0,0 +1,38 @@
|
||||
## 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.
|
||||
|
||||
This guide mainly focuses on steps to be followed to submit an issue or a pull-request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
|
||||
To report a bug or a request please file an issue in the right repository
|
||||
(example for [stm32f429i-discovery](https://github.com/STMicroelectronics/stm32f429i-discovery/issues/new/choose)).
|
||||
|
||||
Please check the following boxes 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, it should be submitted to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/2) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
|
||||
### 2. Posting the issue
|
||||
|
||||
When you have checked the previous boxes, create a new report from the **Issues** tab of the repository. A template is available to help you report the issue you are facing or the enhancement you would like to propose.
|
||||
|
||||
### 3. Pull Requests
|
||||
|
||||
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.
|
||||
|
||||
### 4. 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.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright 2017 STMicroelectronics.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,39 @@
|
||||
# BSP STM32F429I-DISCOVERY Component
|
||||
|
||||

|
||||
|
||||
## Overview
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost.
|
||||
|
||||
**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series.
|
||||
* The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product.
|
||||
* The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio.
|
||||
* The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series.
|
||||
* A consistent set of middleware libraries such as RTOS, USB, FatFS, graphics, touch sensing library...
|
||||
* A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series.
|
||||
|
||||
Two models of publication are proposed for the STM32Cube embedded software:
|
||||
* The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series).
|
||||
* The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions.
|
||||
|
||||
## Description
|
||||
|
||||
This **stm32f429i-discovery** MCU component repository is one element of the **STM32CubeF4** MCU embedded software package, providing the **STM32F429I-DISCOVERY** BSP BOARD component part.
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32f429i-discovery/blob/main/Release_Notes.html).
|
||||
|
||||
## Compatibility information
|
||||
|
||||
Below is the list of the BSP *component* drivers to be used with this BSP *board* driver. It is **crucial** that you use a consistent set of CMSIS - HAL - BSP versions, as mentioned in [this](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeF4/blob/master/Release_Notes.html) release note.
|
||||
|
||||
* [stm32-bsp-common](https://github.com/STMicroelectronics/stm32-bsp-common)
|
||||
* [stm32-ili9341](https://github.com/STMicroelectronics/stm32-ili9341)
|
||||
* [stm32-l3gd20](https://github.com/STMicroelectronics/stm32-l3gd20)
|
||||
* [stm32-stmpe811](https://github.com/STMicroelectronics/stm32-stmpe811)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
|
||||
@@ -0,0 +1,250 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for STM32F429 Discovery Board Drivers</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="_htmresc/mini-st_2020.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="icon" type="image/x-icon" href="_htmresc/favicon.png" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<center>
|
||||
<h1 id="release-notes-for">Release Notes for</h1>
|
||||
<h1 id="stm32f429-discovery-board-drivers"><mark>STM32F429 Discovery Board Drivers</mark></h1>
|
||||
<p>Copyright © 2017 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="_htmresc/st_logo_2020.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This directory contains the board drivers to demonstrate the capabilities of the STM32F429 Discovery Board Drivers.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section14" checked aria-hidden="true"> <label for="collapse-section14" aria-hidden="true">V2.1.8 / 22-September-2023</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update Release_Notes.html to support new format</li>
|
||||
<li>Update touch calibration to fix inverted touch panel on STM32F429I-DISCOVERY</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section13" aria-hidden="true"> <label for="collapse-section13" aria-hidden="true">V2.1.7 / 11-Fabruary-2022</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update to support the I3G4250D gyroscope component</li>
|
||||
<li>All source files: update disclaimer to add reference to the new license agreement</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section12" aria-hidden="true"> <label for="collapse-section12" aria-hidden="true">V2.1.6 / 06-October-2017</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Remove Date & Version</li>
|
||||
<li>stm32f429i_discovery_lcd.c/.h
|
||||
<ul>
|
||||
<li>Update BSP_LCD_DrawBitmap() API to fix functional misbehaviour with SW4STM32 Toolchain</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section11" aria-hidden="true"> <label for="collapse-section11" aria-hidden="true">V2.1.5 / 27-January-2017</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Replace __PPP_CLK_ENABLE/DISABLE with __HAL_RCC_PPP_ENABLE/DISABLE</li>
|
||||
<li>Set NVIC priority to 0x0F</li>
|
||||
<li>stm32f429i_discovery_lcd.c/.h
|
||||
<ul>
|
||||
<li>Update BSP_LCD_ReadPixel implementation for ARGB8888 and RGB888 formats</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section10" aria-hidden="true"> <label for="collapse-section10" aria-hidden="true">V2.1.4 / 06-May-2016</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery_lcd.c/.h
|
||||
<ul>
|
||||
<li>Provide BSP full coverage for the LTDC reload HW capabilities (Immediate reload , Vertical Blanking Reload , No reload)
|
||||
<ul>
|
||||
<li>BSP_LCD_Relaod() to disable the color keying without reloading</li>
|
||||
<li>BSP_LCD_SetLayerVisible_NoReload() to set an LCD Layer visible without reloading</li>
|
||||
<li>BSP_LCD_SetTransparency_NoReload() to configure the transparency without reloading</li>
|
||||
<li>BSP_LCD_SetLayerAddress_NoReload() to set an LCD layer frame buffer address without reloading</li>
|
||||
<li>BSP_LCD_SetLayerWindow_NoReload() to set display window without reloading</li>
|
||||
<li>BSP_LCD_SetColorKeying_NoReload() to configure and sets the color keying without reloading</li>
|
||||
<li>BSP_LCD_ResetColorKeying_NoReload() to disables the color keying without reloading</li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section9" aria-hidden="true"> <label for="collapse-section9" aria-hidden="true">V2.1.3 / 13-January-2016</label>
|
||||
<div>
|
||||
<h2 id="main-changes-5">Main Changes</h2>
|
||||
<ul>
|
||||
<li>General updates to fix doxygen errors</li>
|
||||
<li>Add STM32429I_EVAL_BSP_User_Manual.chm file</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section8" aria-hidden="true"> <label for="collapse-section8" aria-hidden="true">V2.1.2 / 02-March-2015</label>
|
||||
<div>
|
||||
<h2 id="main-changes-6">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery.c/.h
|
||||
<ul>
|
||||
<li>Align to STM32F4xx HAL Driver V1.3.0 for __HAL_RCC_PPP_CLK_ENABLE() .</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section7" aria-hidden="true"> <label for="collapse-section7" aria-hidden="true">V2.1.1 / 10-December-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-7">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery.c/.h
|
||||
<ul>
|
||||
<li>Change I2C_SPEED used define by BSP_I2C_SPEED</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_sdram.c
|
||||
<ul>
|
||||
<li>BSP_SDRAM_Initialization_sequence(): Fix wrong configuration of the burst length</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_gyroscope.h, stm32f429i_discovery_io.h,stm32f429i_discovery_lcd.c/.h and stm32f429i_discovery_ts.h:
|
||||
<ul>
|
||||
<li>Change “" by”/" in the include path to fix compilation issue under Linux</li>
|
||||
</ul></li>
|
||||
<li>Miscellaneous comments update</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section6" aria-hidden="true"> <label for="collapse-section6" aria-hidden="true">V2.1.0 / 19-June-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-8">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery.c/.h
|
||||
<ul>
|
||||
<li>Add protection for double initialization of IO_Init within LCD_IO_Init()</li>
|
||||
<li>Enhance BSP_PB_Init() function by removing the call of __SYSCFG_CLK_ENABLE() already enabled in the HAL_GPIO_Init()</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_gyroscope.c/.h
|
||||
<ul>
|
||||
<li>Update BSP_GYRO_Init() to support new L3GD20 device ID (I_AM_L3GD20_TR)</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_ts.c/.h
|
||||
<ul>
|
||||
<li>Correct wrong TS configuration BSP_TS_ITConfig() and TS IT implementation, BSP_TS_ITClear() related to the use of IO expander STMPE1600 device not available on stm32f429i discovery board</li>
|
||||
<li>Comments clean up and typo corrections</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_eeprom.c/.h
|
||||
<ul>
|
||||
<li>Update usage of BSP_EEPROM_TIMEOUT_UserCallback() function</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section5" aria-hidden="true"> <label for="collapse-section5" aria-hidden="true">V2.0.1 / 26-Fabruary-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-9">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery_eeprom.c/.h
|
||||
<ul>
|
||||
<li>Update usage of BSP_EEPROM_TIMEOUT_UserCallback() function</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section4" aria-hidden="true"> <label for="collapse-section4" aria-hidden="true">V2.0.0 / 18-Fabruary-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-10">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Major update based on STM32Cube specification: drivers architecture and APIs modified vs. V1.0.2, and thus the 2 versions are not compatible.</li>
|
||||
<li>This version has to be used only with STM32CubeF4 based development</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section3" aria-hidden="true"> <label for="collapse-section3" aria-hidden="true">V1.0.2 / 06-December-2013</label>
|
||||
<div>
|
||||
<h2 id="main-changes-11">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update IO expander interrupt line on stm32f429i_discovery_ioe.h file.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section2" aria-hidden="true"> <label for="collapse-section2" aria-hidden="true">V1.0.1 / 28-October-2013</label>
|
||||
<div>
|
||||
<h2 id="main-changes-12">Main Changes</h2>
|
||||
<ul>
|
||||
<li>stm32f429i_discovery_l3gd20.c, stm32f429i_discovery_lcd.c
|
||||
<ul>
|
||||
<li>Set SPI baudrate to 5.625 MHz to fit LCD and Gyroscope timing characteristics
|
||||
<ul>
|
||||
<li>ILI9341 LCD SPI interface max baud rate is 10MHz for write and 6.66MHz for read</li>
|
||||
<li>Gyroscope l3gd20 SPI interface max baud rate is 10MHz for write/read</li>
|
||||
</ul></li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_lcd.c
|
||||
<ul>
|
||||
<li>Improve SPI low level write routines (add check on BSY flag before to deselect the LCD)</li>
|
||||
<li>Remove the __IO attribute from these function’s parameters: LCD_SetLayer(), LCD_SetColors(), LCD_GetColors(), LCD_SetTextColor() and LCD_SetBackColor()</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_i2c_ee.c, stm32f429i_discovery_i2c_ ioe.c
|
||||
<ul>
|
||||
<li>Add a test in Init() function; if the I2C is already configured, then there is no need to reconfigure it again</li>
|
||||
<li>I2C_SPEED define moved to stm32f429i_discovery.h file</li>
|
||||
</ul></li>
|
||||
<li>stm32f429i_discovery_sdram.c
|
||||
<ul>
|
||||
<li>Update device refresh counter value to fit with SDRAM timing characteristics</li>
|
||||
</ul></li>
|
||||
<li>Miscellaneous robustness improvement</li>
|
||||
<li>Miscellaneous comments update</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section1" aria-hidden="true"> <label for="collapse-section1" aria-hidden="true">V1.0.0 / 20-September-2013</label>
|
||||
<div>
|
||||
<h2 id="main-changes-13">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official version of the STM32F429 Discovery Board Drivers</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,31 @@
|
||||
# Report potential product security vulnerabilities
|
||||
|
||||
ST places a high priority on security, and our Product Security Incident
|
||||
Response Team (PSIRT) is committed to rapidly addressing potential security
|
||||
vulnerabilities affecting our products. PSIRT's long history and vast experience
|
||||
in security allows ST to perform clear analyses and provide appropriate guidance
|
||||
on mitigations and solutions when applicable.
|
||||
|
||||
If you wish to report potential security vulnerabilities regarding our products,
|
||||
**please do not report them through public GitHub issues.** Instead, we
|
||||
encourage you to report them to our ST PSIRT following the process described at:
|
||||
**https://www.st.com/content/st_com/en/security/report-vulnerabilities.html**
|
||||
|
||||
### IMPORTANT - READ CAREFULLY:
|
||||
|
||||
STMicroelectronics International N.V., on behalf of itself, its affiliates and
|
||||
subsidiaries, (collectively “ST”) takes all potential security vulnerability
|
||||
reports or other related communications (“Report(s)”) seriously. In order to
|
||||
review Your Report (the terms “You” and “Yours” include your employer, and all
|
||||
affiliates, subsidiaries and related persons or entities) and take actions as
|
||||
deemed appropriate, ST requires that we have the rights and Your permission to
|
||||
do so.
|
||||
|
||||
As such, by submitting Your Report to ST, You agree that You have the right to
|
||||
do so, and You grant to ST the rights to use the Report for purposes related to
|
||||
security vulnerability analysis, testing, correction, patching, reporting and
|
||||
any other related purpose or function.
|
||||
|
||||
By submitting Your Report, You agree that ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,333 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains definitions for STM32F429I-Discovery Kit LEDs,
|
||||
* push-buttons hardware resources.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* IMPORTANT: One of the following flags must be defined in the preprocessor */
|
||||
/* options in order to select the target board revision: !!!!!!!!!! */
|
||||
/* USE_STM32F429I_DISCO */ /* Applicable for all boards except STM32F429I DISCOVERY REVD and above */
|
||||
/* USE_STM32F429I_DISCOVERY_REVD */ /* Applicable only for STM32F429I DISCOVERY REVD and above */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_H
|
||||
#define __STM32F429I_DISCOVERY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_LOW_LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_LOW_LEVEL_Exported_Types STM32F429I DISCOVERY LOW LEVEL Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LED3 = 0,
|
||||
LED4 = 1
|
||||
} Led_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_KEY = 0,
|
||||
} Button_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
} ButtonMode_TypeDef;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_Exported_Constants STM32F429I DISCOVERY LOW LEVEL Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define for STM32F429I_DISCO board
|
||||
*/
|
||||
#if !defined(USE_STM32F429I_DISCOVERY_REVD) && \
|
||||
!defined(USE_STM32F429I_DISCO)
|
||||
#define USE_STM32F429I_DISCO
|
||||
#endif
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_LED STM32F429I DISCOVERY LOW LEVEL LED
|
||||
* @{
|
||||
*/
|
||||
#define LEDn 2
|
||||
|
||||
#define LED3_PIN GPIO_PIN_13
|
||||
#define LED3_GPIO_PORT GPIOG
|
||||
#define LED3_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define LED3_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
|
||||
#define LED4_PIN GPIO_PIN_14
|
||||
#define LED4_GPIO_PORT GPIOG
|
||||
#define LED4_GPIO_CLK_ENABLE() __HAL_RCC_GPIOG_CLK_ENABLE()
|
||||
#define LED4_GPIO_CLK_DISABLE() __HAL_RCC_GPIOG_CLK_DISABLE()
|
||||
|
||||
#define LEDx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) LED3_GPIO_CLK_ENABLE(); else \
|
||||
if((__INDEX__) == 1) LED4_GPIO_CLK_ENABLE(); \
|
||||
}while(0)
|
||||
#define LEDx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) LED3_GPIO_CLK_DISABLE(); else \
|
||||
if((__INDEX__) == 1) LED4_GPIO_CLK_DISABLE(); \
|
||||
}while(0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_BUTTON STM32F429I DISCOVERY LOW LEVEL BUTTON
|
||||
* @{
|
||||
*/
|
||||
#define BUTTONn 1
|
||||
|
||||
/**
|
||||
* @brief Wakeup push-button
|
||||
*/
|
||||
#define KEY_BUTTON_PIN GPIO_PIN_0
|
||||
#define KEY_BUTTON_GPIO_PORT GPIOA
|
||||
#define KEY_BUTTON_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define KEY_BUTTON_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define KEY_BUTTON_EXTI_IRQn EXTI0_IRQn
|
||||
|
||||
#define BUTTONx_GPIO_CLK_ENABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_ENABLE(); \
|
||||
}while(0)
|
||||
#define BUTTONx_GPIO_CLK_DISABLE(__INDEX__) do{if((__INDEX__) == 0) KEY_BUTTON_GPIO_CLK_DISABLE(); \
|
||||
}while(0)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_BUS STM32F429I DISCOVERY LOW LEVEL BUS
|
||||
* @{
|
||||
*/
|
||||
/* Exported constanIO --------------------------------------------------------*/
|
||||
#define IO_I2C_ADDRESS 0x82
|
||||
#define TS_I2C_ADDRESS 0x82
|
||||
|
||||
#ifdef EE_M24LR64
|
||||
#define EEPROM_I2C_ADDRESS_A01 0xA0
|
||||
#define EEPROM_I2C_ADDRESS_A02 0xA6
|
||||
#endif /* EE_M24LR64 */
|
||||
|
||||
/*############################### I2Cx #######################################*/
|
||||
/* User can use this section to tailor I2Cx instance used and associated
|
||||
resources */
|
||||
#define DISCOVERY_I2Cx I2C3
|
||||
#define DISCOVERY_I2Cx_CLOCK_ENABLE() __HAL_RCC_I2C3_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_FORCE_RESET() __HAL_RCC_I2C3_FORCE_RESET()
|
||||
#define DISCOVERY_I2Cx_RELEASE_RESET() __HAL_RCC_I2C3_RELEASE_RESET()
|
||||
#define DISCOVERY_I2Cx_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define DISCOVERY_I2Cx_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
|
||||
/* Definition for DISCO I2Cx Pins */
|
||||
#define DISCOVERY_I2Cx_SCL_PIN GPIO_PIN_8
|
||||
#define DISCOVERY_I2Cx_SCL_GPIO_PORT GPIOA
|
||||
#define DISCOVERY_I2Cx_SCL_SDA_AF GPIO_AF4_I2C3
|
||||
#define DISCOVERY_I2Cx_SDA_PIN GPIO_PIN_9
|
||||
#define DISCOVERY_I2Cx_SDA_GPIO_PORT GPIOC
|
||||
|
||||
/* Definition for IOE I2Cx's NVIC */
|
||||
#define DISCOVERY_I2Cx_EV_IRQn I2C3_EV_IRQn
|
||||
#define DISCOVERY_I2Cx_ER_IRQn I2C3_ER_IRQn
|
||||
|
||||
/* I2C clock speed configuration (in Hz)
|
||||
WARNING:
|
||||
Make sure that this define is not already declared in other files.
|
||||
It can be used in parallel by other modules. */
|
||||
#ifndef BSP_I2C_SPEED
|
||||
#define BSP_I2C_SPEED 100000
|
||||
#endif /* BSP_I2C_SPEED */
|
||||
|
||||
#define I2Cx_TIMEOUT_MAX 0x3000 /*<! The value of the maximal timeout for I2C waiting loops */
|
||||
|
||||
/*############################### SPIx #######################################*/
|
||||
#define DISCOVERY_SPIx SPI5
|
||||
#define DISCOVERY_SPIx_CLK_ENABLE() __HAL_RCC_SPI5_CLK_ENABLE()
|
||||
#define DISCOVERY_SPIx_GPIO_PORT GPIOF /* GPIOF */
|
||||
#define DISCOVERY_SPIx_AF GPIO_AF5_SPI5
|
||||
#define DISCOVERY_SPIx_GPIO_CLK_ENABLE() __HAL_RCC_GPIOF_CLK_ENABLE()
|
||||
#define DISCOVERY_SPIx_GPIO_CLK_DISABLE() __HAL_RCC_GPIOF_CLK_DISABLE()
|
||||
#define DISCOVERY_SPIx_SCK_PIN GPIO_PIN_7 /* PF.07 */
|
||||
#define DISCOVERY_SPIx_MISO_PIN GPIO_PIN_8 /* PF.08 */
|
||||
#define DISCOVERY_SPIx_MOSI_PIN GPIO_PIN_9 /* PF.09 */
|
||||
/* 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 SPIx_TIMEOUT_MAX ((uint32_t)0x1000)
|
||||
|
||||
|
||||
/*################################ IOE #######################################*/
|
||||
/**
|
||||
* @brief IOE Control pin
|
||||
*/
|
||||
/* Definition for external IT for STMPE811 */
|
||||
#define STMPE811_INT_PIN GPIO_PIN_15
|
||||
#define STMPE811_INT_GPIO_PORT GPIOA
|
||||
#define STMPE811_INT_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define STMPE811_INT_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define STMPE811_INT_EXTI EXTI15_10_IRQn
|
||||
#define STMPE811_INT_EXTIHandler EXTI15_10_IRQHandler
|
||||
|
||||
/*################################ 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)
|
||||
|
||||
/* Set WRX High to send data */
|
||||
#define LCD_WRX_LOW() HAL_GPIO_WritePin(LCD_WRX_GPIO_PORT, LCD_WRX_PIN, GPIO_PIN_RESET)
|
||||
#define LCD_WRX_HIGH() HAL_GPIO_WritePin(LCD_WRX_GPIO_PORT, LCD_WRX_PIN, GPIO_PIN_SET)
|
||||
|
||||
/* Set WRX High to send data */
|
||||
#define LCD_RDX_LOW() HAL_GPIO_WritePin(LCD_RDX_GPIO_PORT, LCD_RDX_PIN, GPIO_PIN_RESET)
|
||||
#define LCD_RDX_HIGH() HAL_GPIO_WritePin(LCD_RDX_GPIO_PORT, LCD_RDX_PIN, GPIO_PIN_SET)
|
||||
|
||||
/**
|
||||
* @brief LCD Control pin
|
||||
*/
|
||||
#define LCD_NCS_PIN GPIO_PIN_2
|
||||
#define LCD_NCS_GPIO_PORT GPIOC
|
||||
#define LCD_NCS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define LCD_NCS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/**
|
||||
* @brief LCD Command/data pin
|
||||
*/
|
||||
#define LCD_WRX_PIN GPIO_PIN_13
|
||||
#define LCD_WRX_GPIO_PORT GPIOD
|
||||
#define LCD_WRX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
||||
#define LCD_WRX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
||||
|
||||
#define LCD_RDX_PIN GPIO_PIN_12
|
||||
#define LCD_RDX_GPIO_PORT GPIOD
|
||||
#define LCD_RDX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
|
||||
#define LCD_RDX_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
|
||||
|
||||
/*################################ GYROSCOPE #################################*/
|
||||
/* Read/Write command */
|
||||
#define READWRITE_CMD ((uint8_t)0x80)
|
||||
/* Multiple byte read/write command */
|
||||
#define MULTIPLEBYTE_CMD ((uint8_t)0x40)
|
||||
/* Dummy Byte Send by the SPI Master device in order to generate the Clock to the Slave device */
|
||||
#define DUMMY_BYTE ((uint8_t)0x00)
|
||||
|
||||
/* Chip Select macro definition */
|
||||
#define GYRO_CS_LOW() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_RESET)
|
||||
#define GYRO_CS_HIGH() HAL_GPIO_WritePin(GYRO_CS_GPIO_PORT, GYRO_CS_PIN, GPIO_PIN_SET)
|
||||
|
||||
/**
|
||||
* @brief GYROSCOPE SPI Interface pins
|
||||
*/
|
||||
#define GYRO_CS_PIN GPIO_PIN_1 /* PC.01 */
|
||||
#define GYRO_CS_GPIO_PORT GPIOC /* GPIOC */
|
||||
#define GYRO_CS_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
|
||||
#define GYRO_CS_GPIO_CLK_DISABLE() __HAL_RCC_GPIOC_CLK_DISABLE()
|
||||
|
||||
#define GYRO_INT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
|
||||
#define GYRO_INT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOA_CLK_DISABLE()
|
||||
#define GYRO_INT_GPIO_PORT GPIOA /* GPIOA */
|
||||
#define GYRO_INT1_PIN GPIO_PIN_1 /* PA.01 */
|
||||
#define GYRO_INT1_EXTI_IRQn EXTI1_IRQn
|
||||
#define GYRO_INT2_PIN GPIO_PIN_2 /* PA.02 */
|
||||
#define GYRO_INT2_EXTI_IRQn EXTI2_IRQn
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef EE_M24LR64
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_I2C_EEPROM STM32F429I DISCOVERY LOW LEVEL I2C EEPROM
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief I2C EEPROM Interface pins
|
||||
*/
|
||||
#define EEPROM_I2C_DMA DMA1
|
||||
#define EEPROM_I2C_DMA_CHANNEL DMA_CHANNEL_3
|
||||
#define EEPROM_I2C_DMA_STREAM_TX DMA1_Stream4
|
||||
#define EEPROM_I2C_DMA_STREAM_RX DMA1_Stream2
|
||||
#define EEPROM_I2C_DMA_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
|
||||
|
||||
#define EEPROM_I2C_DMA_TX_IRQn DMA1_Stream4_IRQn
|
||||
#define EEPROM_I2C_DMA_RX_IRQn DMA1_Stream2_IRQn
|
||||
#define EEPROM_I2C_DMA_TX_IRQHandler DMA1_Stream4_IRQHandler
|
||||
#define EEPROM_I2C_DMA_RX_IRQHandler DMA1_Stream2_IRQHandler
|
||||
#define EEPROM_I2C_DMA_PREPRIO 0x0F
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* EE_M24LR64 */
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_Exported_Macros STM32F429I DISCOVERY LOW LEVEL Exported Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_LOW_LEVEL_Exported_Functions STM32F429I DISCOVERY LOW LEVEL 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 ButtonMode);
|
||||
uint32_t BSP_PB_GetState(Button_TypeDef Button);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_H */
|
||||
@@ -0,0 +1,484 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_eeprom.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage an I2C M24LR64
|
||||
* EEPROM memory.
|
||||
* To be able to use this driver, the switch EE_M24LR64 must be defined
|
||||
* in your toolchain compiler preprocessor
|
||||
*
|
||||
* ===================================================================
|
||||
* Notes:
|
||||
* - This driver is intended for STM32F4xx families devices only.
|
||||
* - The I2C EEPROM memory (M24LR64) is available on separate daughter
|
||||
* board ANT7-M24LR-A, which is not provided with the STM32F429I
|
||||
* DISCOVERY board.
|
||||
* To use this driver you have to connect the ANT7-M24LR-A to CN3
|
||||
* connector of STM32F429I DISCOVERY board.
|
||||
* ===================================================================
|
||||
*
|
||||
* It implements a high level communication layer for read and write
|
||||
* from/to this memory. The needed STM32F4xx hardware resources (I2C and
|
||||
* GPIO) are defined in stm32f429i_discovery.h file, and the initialization is
|
||||
* performed in EEPROM_IO_Init() function declared in stm32f429i_discovery.c
|
||||
* file.
|
||||
* You can easily tailor this driver to any other development board,
|
||||
* by just adapting the defines for hardware resources and
|
||||
* EEPROM_IO_Init() function.
|
||||
*
|
||||
* @note In this driver, basic read and write functions (BSP_EEPROM_ReadBuffer()
|
||||
* and BSP_EEPROM_WritePage()) use DMA mode to perform the data
|
||||
* transfer to/from EEPROM memory.
|
||||
*
|
||||
* @note Regarding BSP_EEPROM_WritePage(), it is a optimized function to perform
|
||||
* small write (less than 1 page) BUT The number of bytes (combined to write start address) must not
|
||||
* cross the EEPROM page boundary. This function can only write into
|
||||
* the boundaries of an EEPROM page.
|
||||
* This function doesn't check on boundaries condition (in this driver
|
||||
* the function BSP_EEPROM_WriteBuffer() which calls BSP_EEPROM_WritePage() is
|
||||
* responsible of checking on Page boundaries).
|
||||
*
|
||||
*
|
||||
* +-----------------------------------------------------------------+
|
||||
* | Pin assignment for M24LR64 EEPROM |
|
||||
* +---------------------------------------+-----------+-------------+
|
||||
* | STM32F4xx I2C Pins | EEPROM | Pin |
|
||||
* +---------------------------------------+-----------+-------------+
|
||||
* | . | E0(GND) | 1 (0V) |
|
||||
* | . | AC0 | 2 |
|
||||
* | . | AC1 | 3 |
|
||||
* | . | VSS | 4 (0V) |
|
||||
* | SDA | SDA | 5 |
|
||||
* | SCL | SCL | 6 |
|
||||
* | . | E1(GND) | 7 (0V) |
|
||||
* | . | VDD | 8 (3.3V) |
|
||||
* +---------------------------------------+-----------+-------------+
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery_eeprom.h"
|
||||
|
||||
#ifdef EE_M24LR64
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM STM32F429I DISCOVERY EEPROM
|
||||
* @brief This file includes the I2C EEPROM driver of STM32F429I Discovery Kit.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Types STM32F429I DISCOVERY EEPROM Private Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Defines STM32F429I DISCOVERY EEPROM Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Macros STM32F429I DISCOVERY EEPROM Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Variables STM32F429I DISCOVERY EEPROM Private Variables
|
||||
* @{
|
||||
*/
|
||||
__IO uint16_t EEPROMAddress = 0;
|
||||
__IO uint32_t EEPROMTimeout = EEPROM_READ_TIMEOUT;
|
||||
__IO uint16_t EEPROMDataRead;
|
||||
__IO uint8_t EEPROMDataWrite;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Function_Prototypes STM32F429I DISCOVERY EEPROM Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Private_Functions STM32F429I DISCOVERY EEPROM Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes peripherals used by the I2C EEPROM driver.
|
||||
* @note There are 2 different versions of M24LR64 (A01 & A02).
|
||||
* Then try to connect on 1st one (EEPROM_I2C_ADDRESS_A01)
|
||||
* and if problem, check the 2nd one (EEPROM_I2C_ADDRESS_A02)
|
||||
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
|
||||
* different from EEPROM_OK (0)
|
||||
*/
|
||||
uint32_t BSP_EEPROM_Init(void)
|
||||
{
|
||||
/* I2C Initialization */
|
||||
EEPROM_IO_Init();
|
||||
|
||||
/*Select the EEPROM address for A01 and check if OK*/
|
||||
EEPROMAddress = EEPROM_I2C_ADDRESS_A01;
|
||||
if (EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
|
||||
{
|
||||
/*Select the EEPROM address for A02 and check if OK*/
|
||||
EEPROMAddress = EEPROM_I2C_ADDRESS_A02;
|
||||
if (EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
|
||||
{
|
||||
return EEPROM_FAIL;
|
||||
}
|
||||
}
|
||||
return EEPROM_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads a block of data from the EEPROM.
|
||||
* @param pBuffer : pointer to the buffer that receives the data read from
|
||||
* the EEPROM.
|
||||
* @param ReadAddr : EEPROM's internal address to start reading from.
|
||||
* @param NumByteToRead : pointer to the variable holding number of bytes to
|
||||
* be read from the EEPROM.
|
||||
*
|
||||
* @note The variable pointed by NumByteToRead is reset to 0 when all the
|
||||
* data are read from the EEPROM. Application should monitor this
|
||||
* variable in order know when the transfer is complete.
|
||||
*
|
||||
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
|
||||
* different from EEPROM_OK (0) or the timeout user callback.
|
||||
*/
|
||||
uint32_t BSP_EEPROM_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead)
|
||||
{
|
||||
uint32_t buffersize = *NumByteToRead;
|
||||
|
||||
/* Set the pointer to the Number of data to be read. This pointer will be used
|
||||
by the DMA Transfer Completer interrupt Handler in order to reset the
|
||||
variable to 0. User should check on this variable in order to know if the
|
||||
DMA transfer has been complete or not. */
|
||||
EEPROMDataRead = *NumByteToRead;
|
||||
|
||||
if (EEPROM_IO_ReadData(EEPROMAddress, ReadAddr, pBuffer, buffersize) != HAL_OK)
|
||||
{
|
||||
return EEPROM_FAIL;
|
||||
}
|
||||
|
||||
/* Wait transfer through DMA to be complete */
|
||||
EEPROMTimeout = HAL_GetTick() + EEPROM_READ_TIMEOUT;
|
||||
while (EEPROMDataRead > 0)
|
||||
{
|
||||
if (HAL_GetTick() > EEPROMTimeout)
|
||||
{
|
||||
BSP_EEPROM_TIMEOUT_UserCallback();
|
||||
return EEPROM_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
/* If all operations OK, return EEPROM_OK (0) */
|
||||
return EEPROM_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes more than one byte to the EEPROM with a single WRITE cycle.
|
||||
*
|
||||
* @note The number of bytes (combined to write start address) must not
|
||||
* cross the EEPROM page boundary. This function can only write into
|
||||
* the boundaries of an EEPROM page.
|
||||
* This function doesn't check on boundaries condition (in this driver
|
||||
* the function BSP_EEPROM_WriteBuffer() which calls BSP_EEPROM_WritePage() is
|
||||
* responsible of checking on Page boundaries).
|
||||
*
|
||||
* @param pBuffer : pointer to the buffer containing the data to be written to
|
||||
* the EEPROM.
|
||||
* @param WriteAddr : EEPROM's internal address to write to.
|
||||
* @param NumByteToWrite : pointer to the variable holding number of bytes to
|
||||
* be written into the EEPROM.
|
||||
*
|
||||
* @note The variable pointed by NumByteToWrite is reset to 0 when all the
|
||||
* data are written to the EEPROM. Application should monitor this
|
||||
* variable in order know when the transfer is complete.
|
||||
*
|
||||
* @note This function just configure the communication and enable the DMA
|
||||
* channel to transfer data. Meanwhile, the user application may perform
|
||||
* other tasks in parallel.
|
||||
*
|
||||
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
|
||||
* different from EEPROM_OK (0) or the timeout user callback.
|
||||
*/
|
||||
uint32_t BSP_EEPROM_WritePage(uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite)
|
||||
{
|
||||
uint32_t buffersize = *NumByteToWrite;
|
||||
uint32_t status = EEPROM_OK;
|
||||
/* Set the pointer to the Number of data to be written. This pointer will be used
|
||||
by the DMA Transfer Completer interrupt Handler in order to reset the
|
||||
variable to 0. User should check on this variable in order to know if the
|
||||
DMA transfer has been complete or not. */
|
||||
EEPROMDataWrite = *NumByteToWrite;
|
||||
|
||||
if (EEPROM_IO_WriteData(EEPROMAddress, WriteAddr, pBuffer, buffersize) != HAL_OK)
|
||||
{
|
||||
status = EEPROM_FAIL;
|
||||
}
|
||||
|
||||
/* Wait transfer through DMA to be complete */
|
||||
EEPROMTimeout = HAL_GetTick() + EEPROM_WRITE_TIMEOUT;
|
||||
while (EEPROMDataWrite > 0)
|
||||
{
|
||||
if (HAL_GetTick() > EEPROMTimeout)
|
||||
{
|
||||
BSP_EEPROM_TIMEOUT_UserCallback();
|
||||
return EEPROM_TIMEOUT;
|
||||
}
|
||||
}
|
||||
|
||||
if (BSP_EEPROM_WaitEepromStandbyState() != EEPROM_OK)
|
||||
{
|
||||
return EEPROM_FAIL;
|
||||
}
|
||||
|
||||
/* If all operations OK, return EEPROM_OK (0) */
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes buffer of data to the I2C EEPROM.
|
||||
* @param pBuffer : pointer to the buffer containing the data to be written
|
||||
* to the EEPROM.
|
||||
* @param WriteAddr : EEPROM's internal address to write to.
|
||||
* @param NumByteToWrite : number of bytes to write to the EEPROM.
|
||||
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
|
||||
* different from EEPROM_OK (0) or the timeout user callback.
|
||||
*/
|
||||
uint32_t BSP_EEPROM_WriteBuffer(uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite)
|
||||
{
|
||||
uint16_t numofpage = 0, numofsingle = 0, count = 0;
|
||||
uint16_t addr = 0;
|
||||
uint8_t dataindex = 0;
|
||||
uint32_t status = EEPROM_OK;
|
||||
|
||||
addr = WriteAddr % EEPROM_PAGESIZE;
|
||||
count = EEPROM_PAGESIZE - addr;
|
||||
numofpage = NumByteToWrite / EEPROM_PAGESIZE;
|
||||
numofsingle = NumByteToWrite % EEPROM_PAGESIZE;
|
||||
|
||||
/* If WriteAddr is EEPROM_PAGESIZE aligned */
|
||||
if (addr == 0)
|
||||
{
|
||||
/* If NumByteToWrite < EEPROM_PAGESIZE */
|
||||
if (numofpage == 0)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = numofsingle;
|
||||
/* Start writing data */
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
/* If NumByteToWrite > EEPROM_PAGESIZE */
|
||||
else
|
||||
{
|
||||
while (numofpage--)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = EEPROM_PAGESIZE;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
WriteAddr += EEPROM_PAGESIZE;
|
||||
pBuffer += EEPROM_PAGESIZE;
|
||||
}
|
||||
|
||||
if (numofsingle != 0)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = numofsingle;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If WriteAddr is not EEPROM_PAGESIZE aligned */
|
||||
else
|
||||
{
|
||||
/* If NumByteToWrite < EEPROM_PAGESIZE */
|
||||
if (numofpage == 0)
|
||||
{
|
||||
/* If the number of data to be written is more than the remaining space
|
||||
in the current page: */
|
||||
if (NumByteToWrite > count)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = count;
|
||||
/* Write the data contained in same page */
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Store the number of data to be written */
|
||||
dataindex = (NumByteToWrite - count);
|
||||
/* Write the remaining data in the following page */
|
||||
status = BSP_EEPROM_WritePage((uint8_t *)(pBuffer + count), (WriteAddr + count), (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = numofsingle;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If NumByteToWrite > EEPROM_PAGESIZE */
|
||||
else
|
||||
{
|
||||
NumByteToWrite -= count;
|
||||
numofpage = NumByteToWrite / EEPROM_PAGESIZE;
|
||||
numofsingle = NumByteToWrite % EEPROM_PAGESIZE;
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = count;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
WriteAddr += count;
|
||||
pBuffer += count;
|
||||
}
|
||||
|
||||
while (numofpage--)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = EEPROM_PAGESIZE;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
WriteAddr += EEPROM_PAGESIZE;
|
||||
pBuffer += EEPROM_PAGESIZE;
|
||||
}
|
||||
if (numofsingle != 0)
|
||||
{
|
||||
/* Store the number of data to be written */
|
||||
dataindex = numofsingle;
|
||||
status = BSP_EEPROM_WritePage(pBuffer, WriteAddr, (uint8_t *)(&dataindex));
|
||||
if (status != EEPROM_OK)
|
||||
{
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If all operations OK, return EEPROM_OK (0) */
|
||||
return EEPROM_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wait for EEPROM Standby state.
|
||||
*
|
||||
* @note This function allows to wait and check that EEPROM has finished the
|
||||
* last operation. It is mostly used after Write operation: after receiving
|
||||
* the buffer to be written, the EEPROM may need additional time to actually
|
||||
* perform the write operation. During this time, it doesn't answer to
|
||||
* I2C packets addressed to it. Once the write operation is complete
|
||||
* the EEPROM responds to its address.
|
||||
*
|
||||
* @retval EEPROM_OK (0) if operation is correctly performed, else return value
|
||||
* different from EEPROM_OK (0) or the timeout user callback.
|
||||
*/
|
||||
uint32_t BSP_EEPROM_WaitEepromStandbyState(void)
|
||||
{
|
||||
/* Check if the maximum allowed number of trials has bee reached */
|
||||
if (EEPROM_IO_IsDeviceReady(EEPROMAddress, EEPROM_MAX_TRIALS) != HAL_OK)
|
||||
{
|
||||
/* If the maximum number of trials has been reached, exit the function */
|
||||
BSP_EEPROM_TIMEOUT_UserCallback();
|
||||
return EEPROM_TIMEOUT;
|
||||
}
|
||||
return EEPROM_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Memory Tx Transfer completed callbacks.
|
||||
* @param hi2c: I2C handle
|
||||
*/
|
||||
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
EEPROMDataWrite = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Memory Rx Transfer completed callbacks.
|
||||
* @param hi2c: I2C handle
|
||||
*/
|
||||
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
EEPROMDataRead = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Basic management of the timeout situation.
|
||||
*/
|
||||
__weak void BSP_EEPROM_TIMEOUT_UserCallback(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* EE_M24LR64 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_eeprom.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for
|
||||
* the stm32f429i_discovery_eeprom.c firmware driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_EEPROM_H
|
||||
#define __STM32F429I_DISCOVERY_EEPROM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_EEPROM STM32F429I DISCOVERY EEPROM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Exported_Types STM32F429I DISCOVERY EEPROM Exported Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Exported_Constants STM32F429I DISCOVERY EEPROM Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/* EEPROM hardware address and page size */
|
||||
#define EEPROM_PAGESIZE 4
|
||||
#define EEPROM_MAX_SIZE 0x2000 /* 64Kbit*/
|
||||
|
||||
/* Maximum Timeout values for flags and events waiting loops.
|
||||
This timeout is based on systick set to 1ms*/
|
||||
/* Timeout for read based if read all the EEPROM : EEPROM_MAX_SIZE * BSP_I2C_SPEED (640ms)*/
|
||||
#define EEPROM_READ_TIMEOUT ((uint32_t)(1000))
|
||||
/* Timeout for write based on max write which is EEPROM_PAGESIZE bytes: EEPROM_PAGESIZE * BSP_I2C_SPEED (320us)*/
|
||||
#define EEPROM_WRITE_TIMEOUT ((uint32_t)(1))
|
||||
|
||||
/* Maximum number of trials for EEPROM_WaitEepromStandbyState() function */
|
||||
#define EEPROM_MAX_TRIALS 300
|
||||
|
||||
#define EEPROM_OK 0
|
||||
#define EEPROM_FAIL 1
|
||||
#define EEPROM_TIMEOUT 2
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Exported_Macros STM32F429I DISCOVERY EEPROM Exported Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_EEPROM_Exported_Functions STM32F429I DISCOVERY EEPROM Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint32_t BSP_EEPROM_Init(void);
|
||||
uint32_t BSP_EEPROM_ReadBuffer(uint8_t *pBuffer, uint16_t ReadAddr, uint16_t *NumByteToRead);
|
||||
uint32_t BSP_EEPROM_WritePage(uint8_t *pBuffer, uint16_t WriteAddr, uint8_t *NumByteToWrite);
|
||||
uint32_t BSP_EEPROM_WriteBuffer(uint8_t *pBuffer, uint16_t WriteAddr, uint16_t NumByteToWrite);
|
||||
uint32_t BSP_EEPROM_WaitEepromStandbyState(void);
|
||||
|
||||
/* USER Callbacks: This function is declared as __weak in EEPROM driver and
|
||||
should be implemented into user application.
|
||||
BSP_EEPROM_TIMEOUT_UserCallback() function is called whenever a timeout condition
|
||||
occurs during communication (waiting on an event that doesn't occur, bus
|
||||
errors, busy devices ...). */
|
||||
void BSP_EEPROM_TIMEOUT_UserCallback(void);
|
||||
|
||||
|
||||
/* Link function for I2C EEPROM peripheral */
|
||||
void EEPROM_IO_Init(void);
|
||||
HAL_StatusTypeDef EEPROM_IO_WriteData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
|
||||
HAL_StatusTypeDef EEPROM_IO_ReadData(uint16_t DevAddress, uint16_t MemAddress, uint8_t *pBuffer, uint32_t BufferSize);
|
||||
HAL_StatusTypeDef EEPROM_IO_IsDeviceReady(uint16_t DevAddress, uint32_t Trials);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_EEPROM_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,273 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_gyroscope.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the
|
||||
* MEMS gyroscope available on STM32F429I-Discovery Kit.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery_gyroscope.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE STM32F429I DISCOVERY GYROSCOPE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_TypesDefinitions STM32F429I DISCOVERY GYROSCOPE Private TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_Defines STM32F429I DISCOVERY GYROSCOPE Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_Macros STM32F429I DISCOVERY GYROSCOPE Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_Variables STM32F429I DISCOVERY GYROSCOPE Private Variables
|
||||
* @{
|
||||
*/
|
||||
static GYRO_DrvTypeDef *GyroscopeDrv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_FunctionPrototypes STM32F429I DISCOVERY GYROSCOPE Private FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Private_Functions STM32F429I DISCOVERY GYROSCOPE Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set gyroscope Initialization.
|
||||
* @retval GYRO_OK if no problem during initialization
|
||||
*/
|
||||
uint8_t BSP_GYRO_Init(void)
|
||||
{
|
||||
uint8_t ret = GYRO_ERROR;
|
||||
uint16_t ctrl = 0x0000;
|
||||
GYRO_InitTypeDef Gyro_InitStructure;
|
||||
GYRO_FilterConfigTypeDef Gyro_FilterStructure = {0, 0};
|
||||
|
||||
if ((L3gd20Drv.ReadID() == I_AM_L3GD20) || (L3gd20Drv.ReadID() == I_AM_L3GD20_TR))
|
||||
{
|
||||
/* Initialize the gyroscope driver structure */
|
||||
GyroscopeDrv = &L3gd20Drv;
|
||||
|
||||
/* MEMS configuration ----------------------------------------------------*/
|
||||
/* Fill the gyroscope structure */
|
||||
Gyro_InitStructure.Power_Mode = L3GD20_MODE_ACTIVE;
|
||||
Gyro_InitStructure.Output_DataRate = L3GD20_OUTPUT_DATARATE_1;
|
||||
Gyro_InitStructure.Axes_Enable = L3GD20_AXES_ENABLE;
|
||||
Gyro_InitStructure.Band_Width = L3GD20_BANDWIDTH_4;
|
||||
Gyro_InitStructure.BlockData_Update = L3GD20_BlockDataUpdate_Continous;
|
||||
Gyro_InitStructure.Endianness = L3GD20_BLE_LSB;
|
||||
Gyro_InitStructure.Full_Scale = L3GD20_FULLSCALE_500;
|
||||
|
||||
/* Configure MEMS: data rate, power mode, full scale and axes */
|
||||
ctrl = (uint16_t)(Gyro_InitStructure.Power_Mode | Gyro_InitStructure.Output_DataRate | \
|
||||
Gyro_InitStructure.Axes_Enable | Gyro_InitStructure.Band_Width);
|
||||
|
||||
ctrl |= (uint16_t)((Gyro_InitStructure.BlockData_Update | Gyro_InitStructure.Endianness | \
|
||||
Gyro_InitStructure.Full_Scale) << 8);
|
||||
|
||||
/* Initialize the gyroscope */
|
||||
GyroscopeDrv->Init(ctrl);
|
||||
|
||||
Gyro_FilterStructure.HighPassFilter_Mode_Selection = L3GD20_HPM_NORMAL_MODE_RES;
|
||||
Gyro_FilterStructure.HighPassFilter_CutOff_Frequency = L3GD20_HPFCF_0;
|
||||
|
||||
ctrl = (uint8_t)((Gyro_FilterStructure.HighPassFilter_Mode_Selection | \
|
||||
Gyro_FilterStructure.HighPassFilter_CutOff_Frequency));
|
||||
|
||||
/* Configure the gyroscope main parameters */
|
||||
GyroscopeDrv->FilterConfig(ctrl) ;
|
||||
|
||||
GyroscopeDrv->FilterCmd(L3GD20_HIGHPASSFILTER_ENABLE);
|
||||
|
||||
ret = GYRO_OK;
|
||||
}
|
||||
#if defined(USE_STM32F429I_DISCOVERY_REVD)
|
||||
else if (I3g4250Drv.ReadID() == I_AM_I3G4250D)
|
||||
{
|
||||
/* Initialize the gyroscope driver structure */
|
||||
GyroscopeDrv = &I3g4250Drv;
|
||||
|
||||
/* Configure Mems : data rate, power mode, full scale and axes */
|
||||
Gyro_InitStructure.Power_Mode = I3G4250D_MODE_ACTIVE;
|
||||
Gyro_InitStructure.Output_DataRate = I3G4250D_OUTPUT_DATARATE_1;
|
||||
Gyro_InitStructure.Axes_Enable = I3G4250D_AXES_ENABLE;
|
||||
Gyro_InitStructure.Band_Width = I3G4250D_BANDWIDTH_4;
|
||||
Gyro_InitStructure.BlockData_Update = I3G4250D_BlockDataUpdate_Continous;
|
||||
Gyro_InitStructure.Endianness = I3G4250D_BLE_LSB;
|
||||
Gyro_InitStructure.Full_Scale = I3G4250D_FULLSCALE_500;
|
||||
|
||||
/* Configure MEMS: data rate, power mode, full scale and axes */
|
||||
ctrl = (uint16_t)(Gyro_InitStructure.Power_Mode | Gyro_InitStructure.Output_DataRate | \
|
||||
Gyro_InitStructure.Axes_Enable | Gyro_InitStructure.Band_Width);
|
||||
|
||||
ctrl |= (uint16_t)((Gyro_InitStructure.BlockData_Update | Gyro_InitStructure.Endianness | \
|
||||
Gyro_InitStructure.Full_Scale) << 8);
|
||||
|
||||
/* Initialize the gyroscope */
|
||||
GyroscopeDrv->Init(ctrl);
|
||||
|
||||
Gyro_FilterStructure.HighPassFilter_Mode_Selection = I3G4250D_HPM_NORMAL_MODE_RES;
|
||||
Gyro_FilterStructure.HighPassFilter_CutOff_Frequency = I3G4250D_HPFCF_0;
|
||||
|
||||
ctrl = (uint8_t)((Gyro_FilterStructure.HighPassFilter_Mode_Selection | \
|
||||
Gyro_FilterStructure.HighPassFilter_CutOff_Frequency));
|
||||
|
||||
/* Configure the gyroscope main parameters */
|
||||
GyroscopeDrv->FilterConfig(ctrl);
|
||||
|
||||
GyroscopeDrv->FilterCmd(I3G4250D_HIGHPASSFILTER_ENABLE);
|
||||
|
||||
ret = GYRO_OK;
|
||||
}
|
||||
#endif /* USE_STM32F429I_DISCOVERY_REVD */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ID of gyroscope component.
|
||||
* @retval ID
|
||||
*/
|
||||
uint8_t BSP_GYRO_ReadID(void)
|
||||
{
|
||||
uint8_t id = 0x00;
|
||||
|
||||
if (GyroscopeDrv->ReadID != NULL)
|
||||
{
|
||||
id = GyroscopeDrv->ReadID();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reboot memory content of Gyroscope.
|
||||
*/
|
||||
void BSP_GYRO_Reset(void)
|
||||
{
|
||||
if (GyroscopeDrv->Reset != NULL)
|
||||
{
|
||||
GyroscopeDrv->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures INT1 interrupt.
|
||||
* @param pIntConfig: pointer to a L3GD20_InterruptConfig_TypeDef
|
||||
* structure that contains the configuration setting for the L3GD20 Interrupt.
|
||||
*/
|
||||
void BSP_GYRO_ITConfig(GYRO_InterruptConfigTypeDef *pIntConfig)
|
||||
{
|
||||
uint16_t interruptconfig = 0x0000;
|
||||
|
||||
if (GyroscopeDrv->ConfigIT != NULL)
|
||||
{
|
||||
/* Configure latch Interrupt request and axe interrupts */
|
||||
interruptconfig |= ((uint8_t)(pIntConfig->Latch_Request | \
|
||||
pIntConfig->Interrupt_Axes) << 8);
|
||||
|
||||
interruptconfig |= (uint8_t)(pIntConfig->Interrupt_ActiveEdge);
|
||||
|
||||
GyroscopeDrv->ConfigIT(interruptconfig);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables INT1 or INT2 interrupt.
|
||||
* @param IntPin: Interrupt pin
|
||||
* This parameter can be:
|
||||
* @arg L3GD20_INT1
|
||||
* @arg L3GD20_INT2
|
||||
* @arg I3G4250D_INT1
|
||||
* @arg I3G4250D_INT2
|
||||
*/
|
||||
void BSP_GYRO_EnableIT(uint8_t IntPin)
|
||||
{
|
||||
if (GyroscopeDrv->EnableIT != NULL)
|
||||
{
|
||||
GyroscopeDrv->EnableIT(IntPin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables INT1 or INT2 interrupt.
|
||||
* @param IntPin: Interrupt pin
|
||||
* This parameter can be:
|
||||
* @arg L3GD20_INT1
|
||||
* @arg L3GD20_INT2
|
||||
* @arg I3G4250D_INT1
|
||||
* @arg I3G4250D_INT2
|
||||
*/
|
||||
void BSP_GYRO_DisableIT(uint8_t IntPin)
|
||||
{
|
||||
if (GyroscopeDrv->DisableIT != NULL)
|
||||
{
|
||||
GyroscopeDrv->DisableIT(IntPin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get XYZ angular acceleration.
|
||||
* @param pfData: pointer on floating array
|
||||
*/
|
||||
void BSP_GYRO_GetXYZ(float *pfData)
|
||||
{
|
||||
if (GyroscopeDrv->GetXYZ != NULL)
|
||||
{
|
||||
GyroscopeDrv->GetXYZ(pfData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_gyroscope.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains definitions for stm32f429i_discovery_gyroscope.c
|
||||
* firmware driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_GYROSCOPE_H
|
||||
#define __STM32F429I_DISCOVERY_GYROSCOPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery.h"
|
||||
/* Include Gyroscope component driver */
|
||||
#include "../Components/l3gd20/l3gd20.h"
|
||||
#if defined(USE_STM32F429I_DISCOVERY_REVD)
|
||||
#include "../Components/i3g4250d/i3g4250d.h"
|
||||
#endif /* USE_STM32F429I_DISCOVERY_REVD */
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_GYROSCOPE
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Exported_Types STM32F429I DISCOVERY GYROSCOPE Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GYRO_OK = 0,
|
||||
GYRO_ERROR = 1,
|
||||
GYRO_TIMEOUT = 2
|
||||
} GYRO_StatusTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Exported_Constants STM32F429I DISCOVERY GYROSCOPE Exported Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Exported_Macros STM32F429I DISCOVERY GYROSCOPE Exported Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_GYROSCOPE_Exported_Functions STM32F429I DISCOVERY GYROSCOPE Exported Functions
|
||||
* @{
|
||||
*/
|
||||
/* Gyroscope Functions */
|
||||
uint8_t BSP_GYRO_Init(void);
|
||||
void BSP_GYRO_Reset(void);
|
||||
uint8_t BSP_GYRO_ReadID(void);
|
||||
void BSP_GYRO_ITConfig(GYRO_InterruptConfigTypeDef *pIntConfigStruct);
|
||||
void BSP_GYRO_EnableIT(uint8_t IntPin);
|
||||
void BSP_GYRO_DisableIT(uint8_t IntPin);
|
||||
void BSP_GYRO_GetXYZ(float *pfData);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_GYROSCOPE_H */
|
||||
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_io.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage the STMPE811
|
||||
* IO Expander device mounted on STM32F429I-Discovery Kit.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery_io.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO STM32F429I DISCOVERY IO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Types_Definitions STM32F429I DISCOVERY IO Private Types Definitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Defines STM32F429I DISCOVERY IO Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Macros STM32F429I DISCOVERY IO Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Variables STM32F429I DISCOVERY IO Private Variables
|
||||
* @{
|
||||
*/
|
||||
static IO_DrvTypeDef *IoDrv;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Function_Prototypes STM32F429I DISCOVERY IO Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Private_Functions STM32F429I DISCOVERY IO Private 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 done correctly. Other value if error.
|
||||
*/
|
||||
uint8_t BSP_IO_Init(void)
|
||||
{
|
||||
uint8_t ret = IO_ERROR;
|
||||
|
||||
/* Read ID and verify the IO expander is ready */
|
||||
if (stmpe811_io_drv.ReadID(IO_I2C_ADDRESS) == STMPE811_ID)
|
||||
{
|
||||
/* Initialize the IO driver structure */
|
||||
IoDrv = &stmpe811_io_drv;
|
||||
ret = IO_OK;
|
||||
}
|
||||
|
||||
if (ret == IO_OK)
|
||||
{
|
||||
IoDrv->Init(IO_I2C_ADDRESS);
|
||||
IoDrv->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the selected pins IT status.
|
||||
* @param IoPin: The selected pins to check the status.
|
||||
* This parameter could be any combination of the IO pins.
|
||||
* @retval Status of IO Pin checked.
|
||||
*/
|
||||
uint8_t BSP_IO_ITGetStatus(uint16_t IoPin)
|
||||
{
|
||||
/* Return the IO Pin IT status */
|
||||
return (IoDrv->ITStatus(IO_I2C_ADDRESS, IoPin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears all the IO IT pending bits
|
||||
*/
|
||||
void BSP_IO_ITClear(void)
|
||||
{
|
||||
/* Clear all IO IT pending bits */
|
||||
IoDrv->ClearIT(IO_I2C_ADDRESS, IO_PIN_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures the IO pin(s) according to IO mode structure value.
|
||||
* @param IoPin: IO pin(s) 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 IoMode: 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
|
||||
*/
|
||||
void BSP_IO_ConfigPin(uint16_t IoPin, IO_ModeTypedef IoMode)
|
||||
{
|
||||
/* Configure the selected IO pin(s) mode */
|
||||
IoDrv->Config(IO_I2C_ADDRESS, IoPin, IoMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the selected pins state.
|
||||
* @param IoPin: The selected pins to write.
|
||||
* This parameter could be any combination of the IO pins.
|
||||
* @param PinState: the new pins state to write
|
||||
*/
|
||||
void BSP_IO_WritePin(uint16_t IoPin, uint8_t PinState)
|
||||
{
|
||||
/* Set the Pin state */
|
||||
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, PinState);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the selected pins current state.
|
||||
* @param IoPin: The selected pins to read.
|
||||
* This parameter could be any combination of the IO pins.
|
||||
* @retval The current pins state
|
||||
*/
|
||||
uint16_t BSP_IO_ReadPin(uint16_t IoPin)
|
||||
{
|
||||
return (IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the selected pins state.
|
||||
* @param IoPin: The selected pins to toggle.
|
||||
* This parameter could be any combination of the IO pins.
|
||||
*/
|
||||
void BSP_IO_TogglePin(uint16_t IoPin)
|
||||
{
|
||||
/* Toggle the current pin state */
|
||||
if (IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin) == 1 /* Set */)
|
||||
{
|
||||
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 0 /* Reset */);
|
||||
}
|
||||
else
|
||||
{
|
||||
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 1 /* Set */);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_io.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* stm32f429i_discovery_io.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_IO_H
|
||||
#define __STM32F429I_DISCOVERY_IO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery.h"
|
||||
/* Include IO component driver */
|
||||
#include "../Components/stmpe811/stmpe811.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_IO
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Exported_Types STM32F429I DISCOVERY IO Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
IO_OK = 0,
|
||||
IO_ERROR = 1,
|
||||
IO_TIMEOUT = 2
|
||||
} IO_StatusTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Exported_Constants STM32F429I DISCOVERY IO Exported Constants
|
||||
* @{
|
||||
*/
|
||||
#define IO_PIN_0 0x01
|
||||
#define IO_PIN_1 0x02
|
||||
#define IO_PIN_2 0x04
|
||||
#define IO_PIN_3 0x08
|
||||
#define IO_PIN_4 0x10
|
||||
#define IO_PIN_5 0x20
|
||||
#define IO_PIN_6 0x40
|
||||
#define IO_PIN_7 0x80
|
||||
#define IO_PIN_ALL 0xFF
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Exported_Macros STM32F429I DISCOVERY IO Exported Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_IO_Exported_Functions STM32F429I DISCOVERY IO Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_IO_Init(void);
|
||||
uint8_t BSP_IO_ITGetStatus(uint16_t IoPin);
|
||||
void BSP_IO_ITClear(void);
|
||||
void BSP_IO_ConfigPin(uint16_t IoPin, IO_ModeTypedef IoMode);
|
||||
void BSP_IO_WritePin(uint16_t IoPin, uint8_t PinState);
|
||||
uint16_t BSP_IO_ReadPin(uint16_t IoPin);
|
||||
void BSP_IO_TogglePin(uint16_t IoPin);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_IO_H */
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,460 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_sdram.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* IS42S16400J SDRAM memory mounted on STM32F429I-Discovery Kit.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery_sdram.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM STM32F429I DISCOVERY SDRAM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Types_Definitions STM32F429I DISCOVERY SDRAM Private Types Definitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Defines STM32F429I DISCOVERY SDRAM Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Macros STM32F429I DISCOVERY SDRAM Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Variables STM32F429I DISCOVERY SDRAM Private Variables
|
||||
* @{
|
||||
*/
|
||||
static SDRAM_HandleTypeDef SdramHandle;
|
||||
static FMC_SDRAM_TimingTypeDef Timing;
|
||||
static FMC_SDRAM_CommandTypeDef Command;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Function_Prototypes STM32F429I DISCOVERY SDRAM Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Private_Functions STM32F429I DISCOVERY SDRAM Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes the SDRAM device.
|
||||
*/
|
||||
uint8_t BSP_SDRAM_Init(void)
|
||||
{
|
||||
static uint8_t sdramstatus = SDRAM_ERROR;
|
||||
|
||||
/* SDRAM device configuration */
|
||||
SdramHandle.Instance = FMC_SDRAM_DEVICE;
|
||||
|
||||
/* FMC Configuration -------------------------------------------------------*/
|
||||
/* FMC SDRAM Bank configuration */
|
||||
/* Timing configuration for 90 Mhz of SD clock frequency (180Mhz/2) */
|
||||
/* TMRD: 2 Clock cycles */
|
||||
Timing.LoadToActiveDelay = 2;
|
||||
/* TXSR: min=70ns (7x11.11ns) */
|
||||
Timing.ExitSelfRefreshDelay = 7;
|
||||
/* TRAS: min=42ns (4x11.11ns) max=120k (ns) */
|
||||
Timing.SelfRefreshTime = 4;
|
||||
/* TRC: min=70 (7x11.11ns) */
|
||||
Timing.RowCycleDelay = 7;
|
||||
/* TWR: min=1+ 7ns (1+1x11.11ns) */
|
||||
Timing.WriteRecoveryTime = 2;
|
||||
/* TRP: 20ns => 2x11.11ns*/
|
||||
Timing.RPDelay = 2;
|
||||
/* TRCD: 20ns => 2x11.11ns */
|
||||
Timing.RCDDelay = 2;
|
||||
|
||||
/* FMC SDRAM control configuration */
|
||||
SdramHandle.Init.SDBank = FMC_SDRAM_BANK2;
|
||||
/* Row addressing: [7:0] */
|
||||
SdramHandle.Init.ColumnBitsNumber = FMC_SDRAM_COLUMN_BITS_NUM_8;
|
||||
/* Column addressing: [11:0] */
|
||||
SdramHandle.Init.RowBitsNumber = FMC_SDRAM_ROW_BITS_NUM_12;
|
||||
SdramHandle.Init.MemoryDataWidth = SDRAM_MEMORY_WIDTH;
|
||||
SdramHandle.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
|
||||
SdramHandle.Init.CASLatency = SDRAM_CAS_LATENCY;
|
||||
SdramHandle.Init.WriteProtection = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
|
||||
SdramHandle.Init.SDClockPeriod = SDCLOCK_PERIOD;
|
||||
SdramHandle.Init.ReadBurst = SDRAM_READBURST;
|
||||
SdramHandle.Init.ReadPipeDelay = FMC_SDRAM_RPIPE_DELAY_1;
|
||||
|
||||
/* SDRAM controller initialization */
|
||||
/* __weak function can be surcharged by the application code */
|
||||
BSP_SDRAM_MspInit(&SdramHandle, (void *)NULL);
|
||||
if (HAL_SDRAM_Init(&SdramHandle, &Timing) != HAL_OK)
|
||||
{
|
||||
sdramstatus = SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
sdramstatus = SDRAM_OK;
|
||||
}
|
||||
|
||||
/* SDRAM initialization sequence */
|
||||
BSP_SDRAM_Initialization_sequence(REFRESH_COUNT);
|
||||
|
||||
return sdramstatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Programs the SDRAM device.
|
||||
* @param RefreshCount: SDRAM refresh counter value
|
||||
*/
|
||||
void BSP_SDRAM_Initialization_sequence(uint32_t RefreshCount)
|
||||
{
|
||||
__IO uint32_t tmpmrd = 0;
|
||||
|
||||
/* Step 1: Configure a clock configuration enable command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
|
||||
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
|
||||
|
||||
/* Step 2: Insert 100 us minimum delay */
|
||||
/* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
|
||||
HAL_Delay(1);
|
||||
|
||||
/* Step 3: Configure a PALL (precharge all) command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_PALL;
|
||||
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
|
||||
|
||||
/* Step 4: Configure an Auto Refresh command */
|
||||
Command.CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
|
||||
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
|
||||
Command.AutoRefreshNumber = 4;
|
||||
Command.ModeRegisterDefinition = 0;
|
||||
|
||||
/* Send the command */
|
||||
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
|
||||
|
||||
/* Step 5: Program the external memory mode register */
|
||||
tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_1 |
|
||||
SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL |
|
||||
SDRAM_MODEREG_CAS_LATENCY_3 |
|
||||
SDRAM_MODEREG_OPERATING_MODE_STANDARD |
|
||||
SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;
|
||||
|
||||
Command.CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
|
||||
Command.CommandTarget = FMC_SDRAM_CMD_TARGET_BANK2;
|
||||
Command.AutoRefreshNumber = 1;
|
||||
Command.ModeRegisterDefinition = tmpmrd;
|
||||
|
||||
/* Send the command */
|
||||
HAL_SDRAM_SendCommand(&SdramHandle, &Command, SDRAM_TIMEOUT);
|
||||
|
||||
/* Step 6: Set the refresh rate counter */
|
||||
/* Set the device refresh rate */
|
||||
HAL_SDRAM_ProgramRefreshRate(&SdramHandle, RefreshCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads an mount of data from the SDRAM memory 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
|
||||
*/
|
||||
uint8_t BSP_SDRAM_ReadData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize)
|
||||
{
|
||||
if (HAL_SDRAM_Read_32b(&SdramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
|
||||
{
|
||||
return SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDRAM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads an mount of data from the SDRAM memory 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
|
||||
*/
|
||||
uint8_t BSP_SDRAM_ReadData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize)
|
||||
{
|
||||
if (HAL_SDRAM_Read_DMA(&SdramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
|
||||
{
|
||||
return SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDRAM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes an mount of data to the SDRAM memory 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
|
||||
*/
|
||||
uint8_t BSP_SDRAM_WriteData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize)
|
||||
{
|
||||
/* Disable write protection */
|
||||
HAL_SDRAM_WriteProtection_Disable(&SdramHandle);
|
||||
|
||||
/*Write 32-bit data buffer to SDRAM memory*/
|
||||
if (HAL_SDRAM_Write_32b(&SdramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
|
||||
{
|
||||
return SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDRAM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes an mount of data to the SDRAM memory 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
|
||||
*/
|
||||
uint8_t BSP_SDRAM_WriteData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize)
|
||||
{
|
||||
if (HAL_SDRAM_Write_DMA(&SdramHandle, (uint32_t *)uwStartAddress, pData, uwDataSize) != HAL_OK)
|
||||
{
|
||||
return SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDRAM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sends command to the SDRAM bank.
|
||||
* @param SdramCmd: Pointer to SDRAM command structure
|
||||
* @retval HAL status
|
||||
*/
|
||||
uint8_t BSP_SDRAM_Sendcmd(FMC_SDRAM_CommandTypeDef *SdramCmd)
|
||||
{
|
||||
if (HAL_SDRAM_SendCommand(&SdramHandle, SdramCmd, SDRAM_TIMEOUT) != HAL_OK)
|
||||
{
|
||||
return SDRAM_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SDRAM_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles SDRAM DMA transfer interrupt request.
|
||||
*/
|
||||
void BSP_SDRAM_DMA_IRQHandler(void)
|
||||
{
|
||||
HAL_DMA_IRQHandler(SdramHandle.hdma);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes SDRAM MSP.
|
||||
* @note This function can be surcharged by application code.
|
||||
* @param hsdram: pointer on SDRAM handle
|
||||
* @param Params: pointer on additional configuration parameters, can be NULL.
|
||||
*/
|
||||
__weak void BSP_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram, void *Params)
|
||||
{
|
||||
static DMA_HandleTypeDef dmaHandle;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
if (hsdram != (SDRAM_HandleTypeDef *)NULL)
|
||||
{
|
||||
/* Enable FMC clock */
|
||||
__HAL_RCC_FMC_CLK_ENABLE();
|
||||
|
||||
/* Enable chosen DMAx clock */
|
||||
__DMAx_CLK_ENABLE();
|
||||
|
||||
/* Enable GPIOs clock */
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOG_CLK_ENABLE();
|
||||
|
||||
/*-- GPIOs Configuration -----------------------------------------------------*/
|
||||
/*
|
||||
+-------------------+--------------------+--------------------+--------------------+
|
||||
+ SDRAM pins assignment +
|
||||
+-------------------+--------------------+--------------------+--------------------+
|
||||
| PD0 <-> FMC_D2 | PE0 <-> FMC_NBL0 | PF0 <-> FMC_A0 | PG0 <-> FMC_A10 |
|
||||
| PD1 <-> FMC_D3 | PE1 <-> FMC_NBL1 | PF1 <-> FMC_A1 | PG1 <-> FMC_A11 |
|
||||
| PD8 <-> FMC_D13 | PE7 <-> FMC_D4 | PF2 <-> FMC_A2 | PG8 <-> FMC_SDCLK |
|
||||
| PD9 <-> FMC_D14 | PE8 <-> FMC_D5 | PF3 <-> FMC_A3 | PG15 <-> FMC_NCAS |
|
||||
| PD10 <-> FMC_D15 | PE9 <-> FMC_D6 | PF4 <-> FMC_A4 |--------------------+
|
||||
| PD14 <-> FMC_D0 | PE10 <-> FMC_D7 | PF5 <-> FMC_A5 |
|
||||
| PD15 <-> FMC_D1 | PE11 <-> FMC_D8 | PF11 <-> FMC_NRAS |
|
||||
+-------------------| PE12 <-> FMC_D9 | PF12 <-> FMC_A6 |
|
||||
| PE13 <-> FMC_D10 | PF13 <-> FMC_A7 |
|
||||
| PE14 <-> FMC_D11 | PF14 <-> FMC_A8 |
|
||||
| PE15 <-> FMC_D12 | PF15 <-> FMC_A9 |
|
||||
+-------------------+--------------------+--------------------+
|
||||
| PB5 <-> FMC_SDCKE1|
|
||||
| PB6 <-> FMC_SDNE1 |
|
||||
| PC0 <-> FMC_SDNWE |
|
||||
+-------------------+
|
||||
|
||||
*/
|
||||
|
||||
/* Common GPIO configuration */
|
||||
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStructure.Speed = GPIO_SPEED_FAST;
|
||||
GPIO_InitStructure.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStructure.Alternate = GPIO_AF12_FMC;
|
||||
|
||||
/* GPIOB configuration */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_5 | GPIO_PIN_6;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
|
||||
/* GPIOC configuration */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
|
||||
/* GPIOD configuration */
|
||||
GPIO_InitStructure.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, &GPIO_InitStructure);
|
||||
|
||||
/* GPIOE configuration */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_7 |
|
||||
GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 |
|
||||
GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 |
|
||||
GPIO_PIN_14 | GPIO_PIN_15;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStructure);
|
||||
|
||||
/* GPIOF configuration */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 |
|
||||
GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 |
|
||||
GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 |
|
||||
GPIO_PIN_14 | GPIO_PIN_15;
|
||||
HAL_GPIO_Init(GPIOF, &GPIO_InitStructure);
|
||||
|
||||
/* GPIOG configuration */
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 |
|
||||
GPIO_PIN_5 | GPIO_PIN_8 | GPIO_PIN_15;
|
||||
HAL_GPIO_Init(GPIOG, &GPIO_InitStructure);
|
||||
|
||||
/* Configure common DMA parameters */
|
||||
dmaHandle.Init.Channel = SDRAM_DMAx_CHANNEL;
|
||||
dmaHandle.Init.Direction = DMA_MEMORY_TO_MEMORY;
|
||||
dmaHandle.Init.PeriphInc = DMA_PINC_ENABLE;
|
||||
dmaHandle.Init.MemInc = DMA_MINC_ENABLE;
|
||||
dmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
|
||||
dmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
|
||||
dmaHandle.Init.Mode = DMA_NORMAL;
|
||||
dmaHandle.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
dmaHandle.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
|
||||
dmaHandle.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
|
||||
dmaHandle.Init.MemBurst = DMA_MBURST_SINGLE;
|
||||
dmaHandle.Init.PeriphBurst = DMA_PBURST_SINGLE;
|
||||
|
||||
dmaHandle.Instance = SDRAM_DMAx_STREAM;
|
||||
|
||||
/* Associate the DMA handle */
|
||||
__HAL_LINKDMA(hsdram, hdma, dmaHandle);
|
||||
|
||||
/* Deinitialize the stream for new transfer */
|
||||
HAL_DMA_DeInit(&dmaHandle);
|
||||
|
||||
/* Configure the DMA stream */
|
||||
HAL_DMA_Init(&dmaHandle);
|
||||
|
||||
/* NVIC configuration for DMA transfer complete interrupt */
|
||||
HAL_NVIC_SetPriority(SDRAM_DMAx_IRQn, 0x0F, 0);
|
||||
HAL_NVIC_EnableIRQ(SDRAM_DMAx_IRQn);
|
||||
} /* of if(hsdram != (SDRAM_HandleTypeDef *)NULL) */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DeInitializes SDRAM MSP.
|
||||
* @note This function can be surcharged by application code.
|
||||
* @param hsdram: pointer on SDRAM handle
|
||||
* @param Params: pointer on additional configuration parameters, can be NULL.
|
||||
*/
|
||||
__weak void BSP_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram, void *Params)
|
||||
{
|
||||
static DMA_HandleTypeDef dma_handle;
|
||||
|
||||
if (hsdram != (SDRAM_HandleTypeDef *)NULL)
|
||||
{
|
||||
/* Disable NVIC configuration for DMA interrupt */
|
||||
HAL_NVIC_DisableIRQ(SDRAM_DMAx_IRQn);
|
||||
|
||||
/* Deinitialize the stream for new transfer */
|
||||
dma_handle.Instance = SDRAM_DMAx_STREAM;
|
||||
HAL_DMA_DeInit(&dma_handle);
|
||||
|
||||
/* DeInit GPIO pins can be done in the application
|
||||
(by surcharging this __weak function) */
|
||||
|
||||
/* GPIO pins clock, FMC clock and DMA clock can be shut down in the application
|
||||
by surcharging this __weak function */
|
||||
|
||||
} /* of if(hsdram != (SDRAM_HandleTypeDef *)NULL) */
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_sdram.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* stm32f429i_discovery_sdram.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_SDRAM_H
|
||||
#define __STM32F429I_DISCOVERY_SDRAM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_SDRAM
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Types STM32F429I DISCOVERY SDRAM Exported Types
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Constants STM32F429I DISCOVERY SDRAM Exported Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief SDRAM status structure definition
|
||||
*/
|
||||
#define SDRAM_OK ((uint8_t)0x00)
|
||||
#define SDRAM_ERROR ((uint8_t)0x01)
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Bank address
|
||||
*/
|
||||
#define SDRAM_DEVICE_ADDR ((uint32_t)0xD0000000)
|
||||
#define SDRAM_DEVICE_SIZE ((uint32_t)0x800000) /* SDRAM device size in Bytes */
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Memory Width
|
||||
*/
|
||||
/* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_8 */
|
||||
#define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_16
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM CAS Latency
|
||||
*/
|
||||
/* #define SDRAM_CAS_LATENCY FMC_SDRAM_CAS_LATENCY_2 */
|
||||
#define SDRAM_CAS_LATENCY FMC_SDRAM_CAS_LATENCY_3
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Memory clock period
|
||||
*/
|
||||
#define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_2 /* Default configuration used with LCD */
|
||||
/* #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_3 */
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Memory Read Burst feature
|
||||
*/
|
||||
#define SDRAM_READBURST FMC_SDRAM_RBURST_DISABLE /* Default configuration used with LCD */
|
||||
/* #define SDRAM_READBURST FMC_SDRAM_RBURST_ENABLE */
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Bank Remap
|
||||
*/
|
||||
/* #define SDRAM_BANK_REMAP */
|
||||
|
||||
/* Set the refresh rate counter */
|
||||
/* (15.62 us x Freq) - 20 */
|
||||
#define REFRESH_COUNT ((uint32_t)1386) /* SDRAM refresh counter */
|
||||
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
|
||||
|
||||
/* DMA definitions for SDRAM DMA transfer */
|
||||
#define __DMAx_CLK_ENABLE __HAL_RCC_DMA2_CLK_ENABLE
|
||||
#define SDRAM_DMAx_CHANNEL DMA_CHANNEL_0
|
||||
#define SDRAM_DMAx_STREAM DMA2_Stream0
|
||||
#define SDRAM_DMAx_IRQn DMA2_Stream0_IRQn
|
||||
#define SDRAM_DMAx_IRQHandler DMA2_Stream0_IRQHandler
|
||||
|
||||
/**
|
||||
* @brief FMC SDRAM Mode definition register defines
|
||||
*/
|
||||
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
|
||||
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
|
||||
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
|
||||
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
|
||||
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
|
||||
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
|
||||
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
|
||||
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
|
||||
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
|
||||
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
|
||||
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Macro STM32F429I DISCOVERY SDRAM Exported Macro
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Functions STM32F429I DISCOVERY SDRAM Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_SDRAM_Init(void);
|
||||
void BSP_SDRAM_Initialization_sequence(uint32_t RefreshCount);
|
||||
uint8_t BSP_SDRAM_ReadData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
||||
uint8_t BSP_SDRAM_ReadData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
||||
uint8_t BSP_SDRAM_WriteData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
||||
uint8_t BSP_SDRAM_WriteData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
||||
uint8_t BSP_SDRAM_Sendcmd(FMC_SDRAM_CommandTypeDef *SdramCmd);
|
||||
void BSP_SDRAM_DMA_IRQHandler(void);
|
||||
|
||||
/* These function can be modified in case the current settings (e.g. DMA stream)
|
||||
need to be changed for specific application needs */
|
||||
void BSP_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram, void *Params);
|
||||
void BSP_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram, void *Params);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_SDRAM_H */
|
||||
@@ -0,0 +1,250 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_ts.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file provides a set of functions needed to manage Touch
|
||||
* screen available with STMPE811 IO Expander device mounted on
|
||||
* STM32F429I-Discovery Kit.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery_ts.h"
|
||||
#include "stm32f429i_discovery_io.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS STM32F429I DISCOVERY TS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Types_Definitions STM32F429I DISCOVERY TS Private Types Definitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Defines STM32F429I DISCOVERY TS Private Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Macros STM32F429I DISCOVERY TS Private Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Variables STM32F429I DISCOVERY TS Private Variables
|
||||
* @{
|
||||
*/
|
||||
static TS_DrvTypeDef *TsDrv;
|
||||
static uint16_t TsXBoundary, TsYBoundary;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Function_Prototypes STM32F429I DISCOVERY TS Private Function Prototypes
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Private_Functions STM32F429I DISCOVERY TS Private Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes and configures the touch screen functionalities and
|
||||
* configures all necessary hardware resources (GPIOs, clocks..).
|
||||
* @param XSize: The maximum X size of the TS area on LCD
|
||||
* @param YSize: The 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;
|
||||
|
||||
/* Initialize x and y positions boundaries */
|
||||
TsXBoundary = XSize;
|
||||
TsYBoundary = YSize;
|
||||
|
||||
/* Read ID and verify if the IO expander is ready */
|
||||
if (stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID)
|
||||
{
|
||||
/* Initialize the TS driver structure */
|
||||
TsDrv = &stmpe811_ts_drv;
|
||||
|
||||
ret = TS_OK;
|
||||
}
|
||||
|
||||
if (ret == TS_OK)
|
||||
{
|
||||
/* Initialize the LL TS Driver */
|
||||
TsDrv->Init(TS_I2C_ADDRESS);
|
||||
TsDrv->Start(TS_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures and enables the touch screen interrupts.
|
||||
* @retval TS_OK: if ITconfig is OK. Other value if error.
|
||||
*/
|
||||
uint8_t BSP_TS_ITConfig(void)
|
||||
{
|
||||
/* Enable the TS ITs */
|
||||
TsDrv->EnableIT(TS_I2C_ADDRESS);
|
||||
|
||||
return TS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the TS IT status.
|
||||
* @retval Interrupt status.
|
||||
*/
|
||||
uint8_t BSP_TS_ITGetStatus(void)
|
||||
{
|
||||
/* Return the TS IT status */
|
||||
return (TsDrv->GetITStatus(TS_I2C_ADDRESS));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns status and positions of the touch screen.
|
||||
* @param TsState: Pointer to touch screen current state structure
|
||||
*/
|
||||
void BSP_TS_GetState(TS_StateTypeDef *TsState)
|
||||
{
|
||||
static uint32_t _x = 0, _y = 0;
|
||||
uint16_t xDiff, yDiff, x, y, xr, yr;
|
||||
|
||||
TsState->TouchDetected = TsDrv->DetectTouch(TS_I2C_ADDRESS);
|
||||
|
||||
if (TsState->TouchDetected)
|
||||
{
|
||||
TsDrv->GetXY(TS_I2C_ADDRESS, &x, &y);
|
||||
|
||||
#if defined (USE_STM32F429I_DISCOVERY_REVD)
|
||||
if (y > 3700)
|
||||
{
|
||||
y = 3700;
|
||||
}
|
||||
else if (y < 180)
|
||||
{
|
||||
y = 180;
|
||||
}
|
||||
|
||||
/* Y value first correction */
|
||||
y = 3700 - y;
|
||||
#else
|
||||
|
||||
/* Y value first correction */
|
||||
y -= 360;
|
||||
|
||||
#endif
|
||||
|
||||
/* Y value second correction */
|
||||
yr = y / 11;
|
||||
|
||||
/* Return y position value */
|
||||
if (yr <= 0)
|
||||
{
|
||||
yr = 0;
|
||||
}
|
||||
else if (yr > TsYBoundary)
|
||||
{
|
||||
yr = TsYBoundary - 1;
|
||||
}
|
||||
else
|
||||
{}
|
||||
y = yr;
|
||||
|
||||
/* X value first correction */
|
||||
if (x <= 3000)
|
||||
{
|
||||
x = 3870 - x;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 3800 - x;
|
||||
}
|
||||
|
||||
/* X value second correction */
|
||||
xr = x / 15;
|
||||
|
||||
/* Return X position value */
|
||||
if (xr <= 0)
|
||||
{
|
||||
xr = 0;
|
||||
}
|
||||
else if (xr > TsXBoundary)
|
||||
{
|
||||
xr = TsXBoundary - 1;
|
||||
}
|
||||
else
|
||||
{}
|
||||
|
||||
x = xr;
|
||||
xDiff = x > _x ? (x - _x): (_x - x);
|
||||
yDiff = y > _y ? (y - _y) : (_y - y);
|
||||
|
||||
if (xDiff + yDiff > 5)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
}
|
||||
|
||||
/* Update the X position */
|
||||
TsState->X = _x;
|
||||
|
||||
/* Update the Y position */
|
||||
TsState->Y = _y;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clears all touch screen interrupts.
|
||||
*/
|
||||
void BSP_TS_ITClear(void)
|
||||
{
|
||||
/* Clear TS IT pending bits */
|
||||
TsDrv->ClearIT(TS_I2C_ADDRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f429i_discovery_ts.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the
|
||||
* stm32f429i_discovery_ts.c driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM32F429I_DISCOVERY_TS_H
|
||||
#define __STM32F429I_DISCOVERY_TS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f429i_discovery.h"
|
||||
/* Include TouchScreen component driver */
|
||||
#include "../Components/stmpe811/stmpe811.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F429I_DISCOVERY_TS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Exported_Types STM32F429I DISCOVERY TS Exported Types
|
||||
* @{
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t TouchDetected;
|
||||
uint16_t X;
|
||||
uint16_t Y;
|
||||
uint16_t Z;
|
||||
} TS_StateTypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Exported_Constants STM32F429I DISCOVERY 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;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Exported_Macros STM32F429I DISCOVERY TS Exported Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM32F429I_DISCOVERY_TS_Exported_Functions STM32F429I DISCOVERY TS Exported Functions
|
||||
* @{
|
||||
*/
|
||||
uint8_t BSP_TS_Init(uint16_t XSize, uint16_t YSize);
|
||||
void BSP_TS_GetState(TS_StateTypeDef *TsState);
|
||||
uint8_t BSP_TS_ITConfig(void);
|
||||
uint8_t BSP_TS_ITGetStatus(void);
|
||||
void BSP_TS_ITClear(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM32F429I_DISCOVERY_TS_H */
|
||||
@@ -39,7 +39,6 @@ C_SOURCES = \
|
||||
Core/Src/main.c \
|
||||
Core/Src/stm32f4xx_it.c \
|
||||
Core/Src/stm32f4xx_hal_msp.c \
|
||||
Core/Src/stm32f429i_discovery_lcd.c \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
|
||||
Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
* scrtest1
|
||||
** what is this
|
||||
Testing the LCD screen on the [[https://www.st.com/en/evaluation-tools/32f429idiscovery.html][STM32f429i-DISC1]] discovery board.
|
||||
** sources
|
||||
*** Drivers/BSP/STM32F429I-Discovery
|
||||
[[https://github.com/STMicroelectronics/32f429idiscovery-bsp/releases/tag/v2.1.8]]
|
||||
** get working for development
|
||||
#+begin_src bash
|
||||
git clone https://git.therats.win/jazz/scrtest1.git
|
||||
|
||||
Reference in new issue
Block a user