没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
00001 /**
00002 ******************************************************************************
00003 * @file DMA/I2C_RAM/main.c
00004 * @author MCD Application Team
00005 * @version V3.5.0
00006 * @date 08-April-2011
00007 * @brief Main program body
00008 ******************************************************************************
00009 * @attention
00010 *
00011 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00012 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00013 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00014 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00015 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00016 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00017 *
00018 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
00019 ******************************************************************************
00020 */
00021
00022 /* Includes ------------------------------------------------------------------*/
00023 #include "stm32f10x.h"
00024
00025 /** @addtogroup STM32F10x_StdPeriph_Examples
00026 * @{
00027 */
00028
00029 /** @addtogroup DMA_I2C_RAM
00030 * @{
00002 ******************************************************************************
00003 * @file DMA/I2C_RAM/main.c
00004 * @author MCD Application Team
00005 * @version V3.5.0
00006 * @date 08-April-2011
00007 * @brief Main program body
00008 ******************************************************************************
00009 * @attention
00010 *
00011 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00012 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00013 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00014 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00015 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00016 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00017 *
00018 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
00019 ******************************************************************************
00020 */
00021
00022 /* Includes ------------------------------------------------------------------*/
00023 #include "stm32f10x.h"
00024
00025 /** @addtogroup STM32F10x_StdPeriph_Examples
00026 * @{
00027 */
00028
00029 /** @addtogroup DMA_I2C_RAM
00030 * @{
00031 */
00032
00033 /* Private typedef -----------------------------------------------------------*/
00034 typedef enum { FAILED = 0, PASSED = !FAILED} TestStatus;
00035
00036 /* Private define ------------------------------------------------------------*/
00037 #define I2C1_DR_Address 0x40005410
00038 #define I2C2_DR_Address 0x40005810
00039 #define I2C1_SLAVE_ADDRESS7 0x30
00040 #define I2C2_SLAVE_ADDRESS7 0x30
00041 #define BufferSize 8
00042 #define ClockSpeed 100000
00043
00044 /* Private macro -------------------------------------------------------------*/
00045 /* Private variables ---------------------------------------------------------*/
00046 I2C_InitTypeDef I2C_InitStructure;
00047 DMA_InitTypeDef DMA_InitStructure;
00048 uint8_t I2C1_Buffer_Tx[BufferSize] = {1, 2, 3, 4, 5, 6, 7, 8};
00049 uint8_t I2C2_Buffer_Rx[BufferSize];
00050 uint8_t Tx_Idx = 0, Rx_Idx = 0;
00051 volatile TestStatus TransferStatus;
00052
00053 /* Private function prototypes -----------------------------------------------*/
00054 void RCC_Configuration(void);
00055 void GPIO_Configuration(void);
00056 TestStatus Buffercmp(uint8_t* pBuffer, uint8_t* pBuffer1, uint16_t BufferLength);
00057
00058 /* Private functions ---------------------------------------------------------*/
00059
00060 /**
00032
00033 /* Private typedef -----------------------------------------------------------*/
00034 typedef enum { FAILED = 0, PASSED = !FAILED} TestStatus;
00035
00036 /* Private define ------------------------------------------------------------*/
00037 #define I2C1_DR_Address 0x40005410
00038 #define I2C2_DR_Address 0x40005810
00039 #define I2C1_SLAVE_ADDRESS7 0x30
00040 #define I2C2_SLAVE_ADDRESS7 0x30
00041 #define BufferSize 8
00042 #define ClockSpeed 100000
00043
00044 /* Private macro -------------------------------------------------------------*/
00045 /* Private variables ---------------------------------------------------------*/
00046 I2C_InitTypeDef I2C_InitStructure;
00047 DMA_InitTypeDef DMA_InitStructure;
00048 uint8_t I2C1_Buffer_Tx[BufferSize] = {1, 2, 3, 4, 5, 6, 7, 8};
00049 uint8_t I2C2_Buffer_Rx[BufferSize];
00050 uint8_t Tx_Idx = 0, Rx_Idx = 0;
00051 volatile TestStatus TransferStatus;
00052
00053 /* Private function prototypes -----------------------------------------------*/
00054 void RCC_Configuration(void);
00055 void GPIO_Configuration(void);
00056 TestStatus Buffercmp(uint8_t* pBuffer, uint8_t* pBuffer1, uint16_t BufferLength);
00057
00058 /* Private functions ---------------------------------------------------------*/
00059
00060 /**
剩余8页未读,继续阅读
资源评论
- yfanpro2021-01-17lan huo yi dui,bie lang fei ji fen
quickbrain
- 粉丝: 160
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功