200117StepMotorControl

Dependencies:   X_NUCLEO_IHM02A1 TextLCD

Committer:
danjecsr
Date:
Fri Jan 17 07:58:29 2020 +0000
Revision:
29:d5c13978c8e9
Parent:
28:ed18e436f437
ProjectStep200117

Who changed what in which revision?

UserRevisionLine numberNew contents of line
danjecsr 28:ed18e436f437 1 /**
danjecsr 28:ed18e436f437 2 ******************************************************************************
danjecsr 28:ed18e436f437 3 * @file EEPROM/EEPROM_Emulation/inc/eeprom.h
danjecsr 28:ed18e436f437 4 * @author MCD Application Team
danjecsr 28:ed18e436f437 5 * @version V1.0.1
danjecsr 28:ed18e436f437 6 * @date 29-January-2016
danjecsr 28:ed18e436f437 7 * @brief This file contains all the functions prototypes for the EEPROM
danjecsr 28:ed18e436f437 8 * emulation firmware library.
danjecsr 28:ed18e436f437 9 ******************************************************************************
danjecsr 28:ed18e436f437 10 * @attention
danjecsr 28:ed18e436f437 11 *
danjecsr 28:ed18e436f437 12 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
danjecsr 28:ed18e436f437 13 *
danjecsr 28:ed18e436f437 14 * Redistribution and use in source and binary forms, with or without modification,
danjecsr 28:ed18e436f437 15 * are permitted provided that the following conditions are met:
danjecsr 28:ed18e436f437 16 * 1. Redistributions of source code must retain the above copyright notice,
danjecsr 28:ed18e436f437 17 * this list of conditions and the following disclaimer.
danjecsr 28:ed18e436f437 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
danjecsr 28:ed18e436f437 19 * this list of conditions and the following disclaimer in the documentation
danjecsr 28:ed18e436f437 20 * and/or other materials provided with the distribution.
danjecsr 28:ed18e436f437 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
danjecsr 28:ed18e436f437 22 * may be used to endorse or promote products derived from this software
danjecsr 28:ed18e436f437 23 * without specific prior written permission.
danjecsr 28:ed18e436f437 24 *
danjecsr 28:ed18e436f437 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
danjecsr 28:ed18e436f437 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
danjecsr 28:ed18e436f437 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
danjecsr 28:ed18e436f437 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
danjecsr 28:ed18e436f437 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
danjecsr 28:ed18e436f437 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
danjecsr 28:ed18e436f437 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
danjecsr 28:ed18e436f437 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
danjecsr 28:ed18e436f437 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
danjecsr 28:ed18e436f437 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
danjecsr 28:ed18e436f437 35 *
danjecsr 28:ed18e436f437 36 ******************************************************************************
danjecsr 28:ed18e436f437 37 */
danjecsr 28:ed18e436f437 38
danjecsr 28:ed18e436f437 39 /* Define to prevent recursive inclusion -------------------------------------*/
danjecsr 28:ed18e436f437 40 #ifndef __EEPROM_H
danjecsr 28:ed18e436f437 41 #define __EEPROM_H
danjecsr 28:ed18e436f437 42
danjecsr 28:ed18e436f437 43 /* Includes ------------------------------------------------------------------*/
danjecsr 28:ed18e436f437 44 #include "stm32f4xx_hal.h"
danjecsr 28:ed18e436f437 45
danjecsr 28:ed18e436f437 46 /* Exported constants --------------------------------------------------------*/
danjecsr 28:ed18e436f437 47 /* EEPROM emulation firmware error codes */
danjecsr 28:ed18e436f437 48 #define EE_OK (uint32_t)HAL_OK
danjecsr 28:ed18e436f437 49 #define EE_ERROR (uint32_t)HAL_ERROR
danjecsr 28:ed18e436f437 50 #define EE_BUSY (uint32_t)HAL_BUSY
danjecsr 28:ed18e436f437 51 #define EE_TIMEOUT (uint32_t)HAL_TIMEOUT
danjecsr 28:ed18e436f437 52
danjecsr 28:ed18e436f437 53 /* Define the size of the sectors to be used */
danjecsr 28:ed18e436f437 54 #define PAGE_SIZE (uint32_t)0x4000 /* Page size = 16KByte */
danjecsr 28:ed18e436f437 55
danjecsr 28:ed18e436f437 56 /* Device voltage range supposed to be [2.7V to 3.6V], the operation will
danjecsr 28:ed18e436f437 57 be done by word */
danjecsr 28:ed18e436f437 58 #define VOLTAGE_RANGE (uint8_t)VOLTAGE_RANGE_3
danjecsr 28:ed18e436f437 59
danjecsr 28:ed18e436f437 60 /* EEPROM start address in Flash */
danjecsr 28:ed18e436f437 61 #define EEPROM_START_ADDRESS ((uint32_t)0x08008000) /* EEPROM emulation start address:
danjecsr 28:ed18e436f437 62 from sector2 : after 16KByte of used
danjecsr 28:ed18e436f437 63 Flash memory */
danjecsr 28:ed18e436f437 64
danjecsr 28:ed18e436f437 65 /* Pages 0 and 1 base and end addresses */
danjecsr 28:ed18e436f437 66 #define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
danjecsr 28:ed18e436f437 67 #define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
danjecsr 28:ed18e436f437 68 #define PAGE0_ID FLASH_SECTOR_2
danjecsr 28:ed18e436f437 69
danjecsr 28:ed18e436f437 70 #define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000))
danjecsr 28:ed18e436f437 71 #define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1)))
danjecsr 28:ed18e436f437 72 #define PAGE1_ID FLASH_SECTOR_3
danjecsr 28:ed18e436f437 73
danjecsr 28:ed18e436f437 74 /* Used Flash pages for EEPROM emulation */
danjecsr 28:ed18e436f437 75 #define PAGE0 ((uint16_t)0x0000)
danjecsr 28:ed18e436f437 76 #define PAGE1 ((uint16_t)0x0001) /* Page nb between PAGE0_BASE_ADDRESS & PAGE1_BASE_ADDRESS*/
danjecsr 28:ed18e436f437 77
danjecsr 28:ed18e436f437 78 /* No valid page define */
danjecsr 28:ed18e436f437 79 #define NO_VALID_PAGE ((uint16_t)0x00AB)
danjecsr 28:ed18e436f437 80
danjecsr 28:ed18e436f437 81 /* Page status definitions */
danjecsr 28:ed18e436f437 82 #define ERASED ((uint16_t)0xFFFF) /* Page is empty */
danjecsr 28:ed18e436f437 83 #define RECEIVE_DATA ((uint16_t)0xEEEE) /* Page is marked to receive data */
danjecsr 28:ed18e436f437 84 #define VALID_PAGE ((uint16_t)0x0000) /* Page containing valid data */
danjecsr 28:ed18e436f437 85
danjecsr 28:ed18e436f437 86 /* Valid pages in read and write defines */
danjecsr 28:ed18e436f437 87 #define READ_FROM_VALID_PAGE ((uint8_t)0x00)
danjecsr 28:ed18e436f437 88 #define WRITE_IN_VALID_PAGE ((uint8_t)0x01)
danjecsr 28:ed18e436f437 89
danjecsr 28:ed18e436f437 90 /* Page full define */
danjecsr 28:ed18e436f437 91 #define PAGE_FULL ((uint8_t)0x80)
danjecsr 28:ed18e436f437 92
danjecsr 28:ed18e436f437 93 /* Variables' number */
danjecsr 28:ed18e436f437 94 #define NB_OF_VAR ((uint8_t)0x03)
danjecsr 28:ed18e436f437 95
danjecsr 28:ed18e436f437 96 /* Exported types ------------------------------------------------------------*/
danjecsr 28:ed18e436f437 97 /* Exported macro ------------------------------------------------------------*/
danjecsr 28:ed18e436f437 98 /* Exported functions ------------------------------------------------------- */
danjecsr 28:ed18e436f437 99 uint16_t EE_Init(void);
danjecsr 28:ed18e436f437 100 uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data);
danjecsr 28:ed18e436f437 101 uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data);
danjecsr 28:ed18e436f437 102
danjecsr 28:ed18e436f437 103 #endif /* __EEPROM_H */
danjecsr 28:ed18e436f437 104
danjecsr 28:ed18e436f437 105 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/