Skip to content

Commit a89738d

Browse files
committed
[I2C] Allow to enable HAL module only
Allow HAL I2C module usage without any usage by the core. Fixes stm32duino#697 Signed-off-by: Frederic Pillon <[email protected]>
1 parent 16e9c1d commit a89738d

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

cores/arduino/board.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "spi_com.h"
1818
#include "stm32_eeprom.h"
1919
#include "timer.h"
20-
#include "twi.h"
2120
#include "uart.h"
2221

2322
#ifdef __cplusplus

libraries/Wire/src/Wire.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
#ifndef TwoWire_h
2323
#define TwoWire_h
2424

25-
#include <inttypes.h>
2625
#include "Stream.h"
2726
#include "Arduino.h"
27+
extern "C" {
28+
#include "utility/twi.h"
29+
}
2830

2931
#define BUFFER_LENGTH 32
3032

libraries/Wire/src/utility/twi.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@
3636
******************************************************************************
3737
*/
3838
#include "core_debug.h"
39-
#include "twi.h"
39+
#include "utility/twi.h"
4040
#include "PinAF_STM32F1.h"
4141

4242
#ifdef __cplusplus
4343
extern "C" {
4444
#endif
45-
#if defined(HAL_I2C_MODULE_ENABLED)
4645

4746
/* Private Defines */
4847
/// @brief I2C timout in tick unit
@@ -1150,7 +1149,6 @@ void I2C4_ER_IRQHandler(void)
11501149
HAL_I2C_ER_IRQHandler(handle);
11511150
}
11521151
#endif // I2C4_BASE
1153-
#endif /* HAL_I2C_MODULE_ENABLED */
11541152

11551153
#ifdef __cplusplus
11561154
}

libraries/Wire/src/utility/twi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#ifdef __cplusplus
4848
extern "C" {
4949
#endif
50-
#if defined(HAL_I2C_MODULE_ENABLED)
5150

5251
/* Exported types ------------------------------------------------------------*/
5352
/* offsetof is a gcc built-in function, this is the manual implementation */
@@ -137,7 +136,6 @@ i2c_status_e i2c_IsDeviceReady(i2c_t *obj, uint8_t devAddr, uint32_t trials);
137136

138137
void i2c_attachSlaveRxEvent(i2c_t *obj, void (*function)(uint8_t *, int));
139138
void i2c_attachSlaveTxEvent(i2c_t *obj, void (*function)(void));
140-
#endif /* HAL_I2C_MODULE_ENABLED */
141139

142140
#ifdef __cplusplus
143141
}

0 commit comments

Comments
 (0)