/** ****************************************************************** * @file main.c * @author fire * @version V1.0 * @date 2019-xx-xx * @brief 基本读写EEPROM ****************************************************************** * @attention * * 实验平台:野火 STM32H750 开发板 * 论坛 :http://www.firebbs.cn * 淘宝 :http://firestm32.taobao.com * ****************************************************************** */ #include "stm32h7xx.h" #include "main.h" #include "./led/bsp_led.h" #include "./delay/core_delay.h" #include "./mpu/bsp_mpu.h" #include "./usart/bsp_debug_usart.h" #include "./i2c/bsP_i2c_ee.h" #define DATA_Size 256 #define EEP_Firstpage 0x00 uint8_t I2c_Buf_Write[DATA_Size]; uint8_t I2c_Buf_Read[DATA_Size]; uint8_t I2C_Test(void); /** * @brief 主函数 * @param 无 * @retval 无 */ int main(void) { /* 系统时钟初始化成480MHz */ SystemClock_Config(); /* 默认不配置 MPU,若需要更高性能,当配置 MPU 后,使用 DMA 时需注意 Cache 与 内存内容一致性的问题, 具体注意事项请参考配套教程的 MPU 配置相关章节 */ // Board_MPU_Config(0, MPU_Normal_WT, 0xD0000000, MPU_32MB); // Board_MPU_Config(1, MPU_Normal_WT, 0x24000000, MPU_512KB); SCB_EnableICache(); // 使能指令 Cache // SCB_EnableDCache(); // 使能数据 Cache LED_GPIO_Config(); /* 配置串口1为:115200 8-N-1 */ DEBUG_USART_Config(); printf("\r\n 欢迎使用野火 STM32 H750 开发板。\r\n"); printf("\r\n 这是一个I2C外设(AT24C02)读写测试例程 \r\n"); /* I2C 外设初(AT24C02)始化 */ I2C_EE_Init(); if(I2C_Test() ==1) { LED_GREEN; } else { LED_RED; } while (1) { } } /** * @brief I2C(AT24C02)读写测试 * @param 无 * @retval 正常返回1 ,不正常返回0 */ uint8_t I2C_Test(void) { uint16_t i; EEPROM_INFO("写入的数据"); for ( i=0; i