Skip to content

Commit 5e6c121

Browse files
committed
chore(eeprom): disable for HALv2 support
EEPROM required some rework to support HALv2 driver, so disable it for now. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent ed1e17d commit 5e6c121

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎CI/build/examples/BareMinimum/BareMinimum.ino‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
* It allows to test build of built-in libraries
44
* and can not be executed.
55
*/
6-
6+
#if defined(HAL_FLASH_MODULE_ENABLED)
77
#include <EEPROM.h>
8+
#endif
89
#ifndef STM32MP1xx
910
#include <IWatchdog.h>
1011
#endif
@@ -91,10 +92,11 @@ void setup() {
9192
}
9293
swSerial.end();
9394

95+
#if defined(HAL_FLASH_MODULE_ENABLED)
9496
// EEPROM
9597
byte value = EEPROM.read(0x01);
9698
EEPROM.write(EEPROM.length() - 1, value);
97-
99+
#endif
98100
#ifndef STM32MP1xx
99101
// IWDG
100102
if (!IWatchdog.isReset(true)) {

‎libraries/EEPROM/src/EEPROM.h‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
extern "C" {
2626
#include "utility/stm32_eeprom.h"
2727
}
28-
28+
#if defined(USE_HALV2_DRIVER)
29+
#warning "EEPROM library is not yet compatible with HALv2 driver."
30+
#endif
2931
/***
3032
EERef class.
3133
@@ -42,7 +44,11 @@ struct EERef {
4244
//Access/read members.
4345
uint8_t operator*() const
4446
{
47+
#if defined(USE_HALV2_DRIVER)
48+
return 0; //EEPROM library is not yet compatible with HALv2 driver.
49+
#else
4550
return eeprom_read_byte(/*(uint8_t*)*/ index);
51+
#endif
4652
}
4753
operator uint8_t() const
4854
{
@@ -56,7 +62,11 @@ struct EERef {
5662
}
5763
EERef &operator=(uint8_t in)
5864
{
65+
#if defined(USE_HALV2_DRIVER)
66+
return *this; //EEPROM library is not yet compatible with HALv2 driver.
67+
#else
5968
return eeprom_write_byte(/*(uint8_t*)*/ index, in), *this;
69+
#endif
6070
}
6171
EERef &operator +=(uint8_t in)
6272
{
@@ -222,7 +232,11 @@ struct EEPROMClass {
222232
}
223233
uint16_t length()
224234
{
235+
#if defined(USE_HALV2_DRIVER)
236+
return 0;
237+
#else
225238
return E2END + 1;
239+
#endif
226240
}
227241

228242
//Functionality to 'get' and 'put' objects to and from EEPROM.

‎libraries/EEPROM/src/utility/stm32_eeprom.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <string.h>
2222
#include <stdbool.h>
2323

24+
#if !defined(USE_HALV2_DRIVER)
2425
#ifdef __cplusplus
2526
extern "C" {
2627
#endif
@@ -378,5 +379,5 @@ void eeprom_buffer_flush(void)
378379
#ifdef __cplusplus
379380
}
380381
#endif
381-
382+
#endif /* !USE_HALV2_DRIVER */
382383
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

‎libraries/EEPROM/src/utility/stm32_eeprom.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
/* Includes ------------------------------------------------------------------*/
2424
#include "stm32_def.h"
25-
25+
#if !defined(USE_HALV2_DRIVER)
2626
#ifdef __cplusplus
2727
extern "C" {
2828
#endif
@@ -123,7 +123,7 @@ void eeprom_buffered_write_byte(uint32_t pos, uint8_t value);
123123
#ifdef __cplusplus
124124
}
125125
#endif
126-
126+
#endif /* !USE_HALV2_DRIVER */
127127
#endif /* __STM32_EEPROM_H */
128128

129129
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

0 commit comments

Comments
 (0)