Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit241510d

Browse files
committed
fixup! Revert deleting eeprom function definition
1 parent75fac5a commit241510d

File tree

2 files changed

+22
-37
lines changed

2 files changed

+22
-37
lines changed

‎cores/arduino/stm32/stm32_eeprom.c‎

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,6 @@
3939
extern"C" {
4040
#endif
4141

42-
#ifndefEEPROM_RETRAM_MODE/* Buffering not needed in RETRAM mode */
43-
44-
staticvoideeprom_buffer_fill();
45-
staticvoideeprom_buffer_flush();
46-
staticuint8_teeprom_buffered_read_byte(constuint32_tpos);
47-
staticvoideeprom_buffered_write_byte(uint32_tpos,uint8_tvalue);
48-
4942
/* Be able to change FLASH_BANK_NUMBER to use if relevant */
5043
#if !defined(FLASH_BANK_NUMBER)&&\
5144
(defined(STM32F0xx)|| defined(STM32F1xx)|| defined(STM32G4xx)||\
@@ -137,6 +130,8 @@ static inline uint32_t get_flash_end(void)
137130
*/
138131
#if defined(STM32L0xx)
139132
#defineFLASH_BASE_ADDRESS ((uint32_t)(DATA_EEPROM_BASE))
133+
#elif defined(EEPROM_RETRAM_MODE)
134+
#defineFLASH_BASE_ADDRESS EEPROM_RETRAM_START_ADDRESS
140135
#else
141136
#defineFLASH_BASE_ADDRESS ((uint32_t)((FLASH_END + 1) - FLASH_PAGE_SIZE))
142137
#endif
@@ -201,6 +196,20 @@ void eeprom_buffer_fill(void)
201196
memcpy(eeprom_buffer, (uint8_t*)(FLASH_BASE_ADDRESS),E2END+1);
202197
}
203198

199+
#if defined(EEPROM_RETRAM_MODE)
200+
201+
/**
202+
* @brief This function writes the buffer content into the flash
203+
* @param none
204+
* @retval none
205+
*/
206+
voideeprom_buffer_flush(void)
207+
{
208+
memcpy((uint8_t*)(FLASH_BASE_ADDRESS),eeprom_buffer,E2END+1);
209+
}
210+
211+
#else/* defined(EEPROM_RETRAM_MODE) */
212+
204213
/**
205214
* @brief This function writes the buffer content into the flash
206215
* @param none
@@ -313,36 +322,7 @@ void eeprom_buffer_flush(void)
313322
#endif
314323
}
315324

316-
#else/* EEPROM_RETRAM_MODE */
317-
/**
318-
* @brief Function reads a byte from emulated eeprom (flash)
319-
* @param pos : address to read
320-
* @retval byte : data read from eeprom
321-
*/
322-
uint8_teeprom_read_byte(constuint32_tpos)
323-
{
324-
uint8_ttmp;
325-
if (pos>E2END) {
326-
return0;
327-
}
328-
memcpy(&tmp, (uint8_t*)(EEPROM_RETRAM_START_ADDRESS+pos),sizeof(uint8_t));
329-
returntmp;
330-
}
331-
332-
/**
333-
* @brief Function writes a byte to emulated eeprom (flash)
334-
* @param pos : address to write
335-
* @param value : value to write
336-
* @retval none
337-
*/
338-
voideeprom_write_byte(uint32_tpos,uint8_tvalue)
339-
{
340-
if (pos>E2END) {
341-
return;
342-
}
343-
memcpy((uint8_t*)(EEPROM_RETRAM_START_ADDRESS+pos),&value,sizeof(uint8_t));
344-
}
345-
#endif/* EEPROM_RETRAM_MODE */
325+
#endif/* defined(EEPROM_RETRAM_MODE) */
346326

347327
#ifdef__cplusplus
348328
}

‎cores/arduino/stm32/stm32_eeprom.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ extern "C" {
8989
uint8_teeprom_read_byte(constuint32_tpos);
9090
voideeprom_write_byte(uint32_tpos,uint8_tvalue);
9191

92+
voideeprom_buffer_fill();
93+
voideeprom_buffer_flush();
94+
uint8_teeprom_buffered_read_byte(constuint32_tpos);
95+
voideeprom_buffered_write_byte(uint32_tpos,uint8_tvalue);
96+
9297
#ifdef__cplusplus
9398
}
9499
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp