Skip to content

Commit 07dcdc4

Browse files
committed
[I2C] Able to build without HAL module
As Wire is a built-in library no need to modify it. Signed-off-by: Frederic Pillon <[email protected]>
1 parent efdbd29 commit 07dcdc4

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Diff for: cores/arduino/stm32/stm32yyxx_hal_conf.h

+6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
* Defined by default
2222
*/
2323
#define HAL_ADC_MODULE_ENABLED
24+
25+
#if !defined(HAL_I2C_MODULE_DISABLED)
2426
#define HAL_I2C_MODULE_ENABLED
27+
#else
28+
#undef HAL_I2C_MODULE_ENABLED
29+
#endif
30+
2531
#define HAL_RTC_MODULE_ENABLED
2632
#define HAL_SPI_MODULE_ENABLED
2733

Diff for: cores/arduino/stm32/twi.c

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#ifdef __cplusplus
4343
extern "C" {
4444
#endif
45+
#if defined(HAL_I2C_MODULE_ENABLED)
4546

4647
/* Private Defines */
4748
/// @brief I2C timout in tick unit
@@ -694,6 +695,7 @@ void I2C4_ER_IRQHandler(void)
694695
}
695696
#endif // !defined(STM32F0xx) && !defined(STM32L0xx)
696697
#endif // I2C4_BASE
698+
#endif /* HAL_I2C_MODULE_ENABLED */
697699

698700
#ifdef __cplusplus
699701
}

Diff for: cores/arduino/stm32/twi.h

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#ifdef __cplusplus
4848
extern "C" {
4949
#endif
50+
#if defined(HAL_I2C_MODULE_ENABLED)
5051

5152
/* Exported types ------------------------------------------------------------*/
5253
/* offsetof is a gcc built-in function, this is the manual implementation */
@@ -163,6 +164,7 @@ i2c_status_e i2c_IsDeviceReady(i2c_t *obj, uint8_t devAddr, uint32_t trials);
163164

164165
void i2c_attachSlaveRxEvent(i2c_t *obj, void (*function)(uint8_t *, int));
165166
void i2c_attachSlaveTxEvent(i2c_t *obj, void (*function)(void));
167+
#endif /* HAL_I2C_MODULE_ENABLED */
166168

167169
#ifdef __cplusplus
168170
}

0 commit comments

Comments
 (0)