aboutsummaryrefslogtreecommitdiff
path: root/keyboards/matrix/noah/eeprom_f4.h
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/matrix/noah/eeprom_f4.h')
-rw-r--r--keyboards/matrix/noah/eeprom_f4.h130
1 files changed, 0 insertions, 130 deletions
diff --git a/keyboards/matrix/noah/eeprom_f4.h b/keyboards/matrix/noah/eeprom_f4.h
deleted file mode 100644
index bc4fa08cf..000000000
--- a/keyboards/matrix/noah/eeprom_f4.h
+++ /dev/null
@@ -1,130 +0,0 @@
1/**
2 ******************************************************************************
3 * @file EEPROM/EEPROM_Emulation/inc/eeprom.h
4 * @author MCD Application Team
5 * @brief This file contains all the functions prototypes for the EEPROM
6 * emulation firmware library.
7 ******************************************************************************
8 * @attention
9 *
10 * <h2><center>&copy; Copyright � 2017 STMicroelectronics International N.V.
11 * All rights reserved.</center></h2>
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted, provided that the following conditions are met:
15 *
16 * 1. Redistribution of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. Neither the name of STMicroelectronics nor the names of other
22 * contributors to this software may be used to endorse or promote products
23 * derived from this software without specific written permission.
24 * 4. This software, including modifications and/or derivative works of this
25 * software, must execute solely and exclusively on microcontroller or
26 * microprocessor devices manufactured by or for STMicroelectronics.
27 * 5. Redistribution and use of this software other than as permitted under
28 * this license is void and will automatically terminate your rights under
29 * this license.
30 *
31 * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
32 * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
35 * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
36 * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
37 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
38 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
39 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
42 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 *
44 ******************************************************************************
45 */
46
47/* Define to prevent recursive inclusion -------------------------------------*/
48#ifndef __EEPROM_H
49#define __EEPROM_H
50
51
52/* Includes ------------------------------------------------------------------*/
53#include "hal.h"
54
55typedef enum
56{
57 HAL_OK = 0x00U,
58 HAL_ERROR = 0x01U,
59 HAL_BUSY = 0x02U,
60 HAL_TIMEOUT = 0x03U
61} HAL_StatusTypeDef;
62
63/* Exported constants --------------------------------------------------------*/
64/* EEPROM emulation firmware error codes */
65#define EE_OK (uint32_t)HAL_OK
66#define EE_ERROR (uint32_t)HAL_ERROR
67#define EE_BUSY (uint32_t)HAL_BUSY
68#define EE_TIMEOUT (uint32_t)HAL_TIMEOUT
69
70/* Define the size of the sectors to be used */
71#define PAGE_SIZE (uint32_t)0x4000 /* Page size = 16KByte */
72
73/* Device voltage range supposed to be [2.7V to 3.6V], the operation will
74 be done by word */
75#define VOLTAGE_RANGE (uint8_t)VOLTAGE_RANGE_3
76
77/* EEPROM start address in Flash */
78#define EEPROM_START_ADDRESS ((uint32_t)0x08008000) /* EEPROM emulation start address:
79 from sector2 : after 16KByte of used
80 Flash memory */
81
82/* Pages 0 and 1 base and end addresses */
83#define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x0000))
84#define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1)))
85#define PAGE0_ID 2//FLASH_SECTOR_2
86
87#define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x4000))
88#define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1)))
89#define PAGE1_ID 3//FLASH_SECTOR_3
90
91/* Used Flash pages for EEPROM emulation */
92#define PAGE0 ((uint16_t)0x0000)
93#define PAGE1 ((uint16_t)0x0001) /* Page nb between PAGE0_BASE_ADDRESS & PAGE1_BASE_ADDRESS*/
94
95/* No valid page define */
96#define NO_VALID_PAGE ((uint16_t)0x00AB)
97
98/* Page status definitions */
99#define ERASED ((uint16_t)0xFFFF) /* Page is empty */
100#define RECEIVE_DATA ((uint16_t)0xEEEE) /* Page is marked to receive data */
101#define VALID_PAGE ((uint16_t)0x0000) /* Page containing valid data */
102
103/* Valid pages in read and write defines */
104#define READ_FROM_VALID_PAGE ((uint8_t)0x00)
105#define WRITE_IN_VALID_PAGE ((uint8_t)0x01)
106
107/* Page full define */
108#define PAGE_FULL ((uint8_t)0x80)
109
110/* Variables' number */
111#define NB_OF_VAR ((uint8_t)0x16)
112
113/* Exported types ------------------------------------------------------------*/
114/* Exported macro ------------------------------------------------------------*/
115/* Exported functions ------------------------------------------------------- */
116
117HAL_StatusTypeDef FLASH_UnlockF4(void);
118HAL_StatusTypeDef FLASH_EraseSectorF4(uint32_t sector);
119HAL_StatusTypeDef FLASH_ProgramHalfWordF4(uint32_t address, uint16_t data);
120
121uint16_t EE_Init(void);
122uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data);
123uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data);
124
125#define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= EEPROM_START_ADDRESS) && ((ADDRESS) < PAGE1_END_ADDRESS))
126#define IS_FLASH_SECTOR(SECTOR) (((SECTOR) >= PAGE0_ID) && ((SECTOR) <= PAGE1_ID))
127
128#endif /* __EEPROM_H */
129
130/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/