Skip to content

Commit 89e7ef5

Browse files
authored
Merge pull request #518 from fpistm/default_HAL_conf
2 parents fd6c14a + 751aee4 commit 89e7ef5

File tree

183 files changed

+3074
-17997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+3074
-17997
lines changed

Diff for: cores/arduino/Tone.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "Arduino.h"
2323

2424
PinName g_lastPin = NC;
25+
26+
#ifdef HAL_TIM_MODULE_ENABLED
2527
static stimer_t _timer;
2628

2729
// frequency (in hertz) and duration (in milliseconds).
@@ -47,3 +49,16 @@ void noTone(uint8_t _pin)
4749
g_lastPin = NC;
4850
}
4951
}
52+
#else
53+
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
54+
{
55+
UNUSED(_pin);
56+
UNUSED(frequency);
57+
UNUSED(duration);
58+
}
59+
60+
void noTone(uint8_t _pin)
61+
{
62+
UNUSED(_pin);
63+
}
64+
#endif /* HAL_TIM_MODULE_ENABLED */

Diff for: cores/arduino/WInterrupts.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode)
2626
{
27+
#if !defined(HAL_EXTI_MODULE_DISABLED)
2728
uint32_t it_mode;
2829
PinName p = digitalPinToPinName(pin);
2930
GPIO_TypeDef *port = set_GPIO_Port_Clock(STM_PORT(p));
@@ -53,20 +54,36 @@ void attachInterrupt(uint32_t pin, callback_function_t callback, uint32_t mode)
5354
#endif /* STM32F1xx */
5455

5556
stm32_interrupt_enable(port, STM_GPIO_PIN(p), callback, it_mode);
57+
#else
58+
UNUSED(pin);
59+
UNUSED(callback);
60+
UNUSED(mode);
61+
#endif
5662
}
5763

5864
void attachInterrupt(uint32_t pin, void (*callback)(void), uint32_t mode)
5965
{
66+
#if !defined(HAL_EXTI_MODULE_DISABLED)
6067
callback_function_t _c = callback;
6168
attachInterrupt(pin, _c, mode);
69+
#else
70+
UNUSED(pin);
71+
UNUSED(callback);
72+
UNUSED(mode);
73+
#endif
74+
6275
}
6376

6477
void detachInterrupt(uint32_t pin)
6578
{
79+
#if !defined(HAL_EXTI_MODULE_DISABLED)
6680
PinName p = digitalPinToPinName(pin);
6781
GPIO_TypeDef *port = get_GPIO_Port(STM_PORT(p));
6882
if (!port) {
6983
return;
7084
}
7185
stm32_interrupt_disable(port, STM_GPIO_PIN(p));
86+
#else
87+
UNUSED(pin);
88+
#endif
7289
}

Diff for: cores/arduino/pins_arduino.h

+4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
*/
1818
#ifndef _PINS_ARDUINO_H_
1919
#define _PINS_ARDUINO_H_
20+
#include <stdlib.h> /* Required for static_assert */
2021
// Include board variant
2122
#include "variant.h"
23+
#include "PinNames.h"
24+
2225

2326
// Avoid PortName issue
2427
_Static_assert(LastPort <= 0x0F, "PortName must be less than 16");
@@ -201,6 +204,7 @@ static const uint8_t SCL = PIN_WIRE_SCL;
201204
#ifdef __cplusplus
202205
extern "C" {
203206
#endif
207+
extern const PinName digitalPin[];
204208

205209
#define NOT_AN_INTERRUPT NC // -1
206210

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

+16-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@
4444
extern "C" {
4545
#endif
4646

47+
48+
/* Private_Variables */
49+
#if defined(HAL_ADC_MODULE_ENABLED) || defined(HAL_DAC_MODULE_ENABLED) ||\
50+
defined(HAL_TIM_MODULE_ENABLED)
51+
static PinName g_current_pin = NC;
52+
#endif
53+
4754
/* Private_Defines */
55+
#ifdef HAL_ADC_MODULE_ENABLED
56+
4857
#if defined(ADC_SAMPLETIME_8CYCLES_5)
4958
#define SAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
5059
#elif defined(ADC_SAMPLETIME_12CYCLES_5)
@@ -79,9 +88,6 @@ extern "C" {
7988
#define ADC_REGULAR_RANK_1 1
8089
#endif
8190

82-
/* Private_Variables */
83-
static PinName g_current_pin = NC;
84-
8591
/* Private Functions */
8692
static uint32_t get_adc_channel(PinName pin)
8793
{
@@ -155,7 +161,9 @@ static uint32_t get_adc_channel(PinName pin)
155161
}
156162
return channel;
157163
}
164+
#endif /* HAL_ADC_MODULE_ENABLED */
158165

166+
#ifdef HAL_TIM_MODULE_ENABLED
159167
static uint32_t get_pwm_channel(PinName pin)
160168
{
161169
uint32_t function = pinmap_function(pin, PinMap_PWM);
@@ -179,6 +187,7 @@ static uint32_t get_pwm_channel(PinName pin)
179187
}
180188
return channel;
181189
}
190+
#endif /* HAL_TIM_MODULE_ENABLED */
182191

183192
#ifdef HAL_DAC_MODULE_ENABLED
184193
static uint32_t get_dac_channel(PinName pin)
@@ -337,7 +346,7 @@ void dac_stop(PinName pin)
337346
}
338347
#endif //HAL_DAC_MODULE_ENABLED
339348

340-
349+
#ifdef HAL_ADC_MODULE_ENABLED
341350
////////////////////////// ADC INTERFACE FUNCTIONS /////////////////////////////
342351

343352
/**
@@ -641,7 +650,9 @@ uint16_t adc_read_value(PinName pin)
641650

642651
return uhADCxConvertedValue;
643652
}
653+
#endif /* HAL_ADC_MODULE_ENABLED */
644654

655+
#ifdef HAL_TIM_MODULE_ENABLED
645656
////////////////////////// PWM INTERFACE FUNCTIONS /////////////////////////////
646657

647658

@@ -775,6 +786,7 @@ void pwm_stop(PinName pin)
775786

776787
HAL_TIM_PWM_DeInit(&timHandle);
777788
}
789+
#endif /* HAL_TIM_MODULE_ENABLED */
778790

779791
#ifdef __cplusplus
780792
}

Diff for: cores/arduino/stm32/interrupt.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
*/
3838
#include "interrupt.h"
3939

40+
#if !defined(HAL_EXTI_MODULE_DISABLED)
41+
4042
/* Private Types */
4143

4244
/*As we can have only one interrupt/pin id, don't need to get the port info*/
@@ -370,5 +372,6 @@ void EXTI15_10_IRQHandler(void)
370372
#ifdef __cplusplus
371373
}
372374
#endif
375+
#endif /* !HAL_EXTI_MODULE_DISABLED */
373376
#endif
374377
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#define __INTERRUPT_H
4141

4242
/* Includes ------------------------------------------------------------------*/
43-
#include "variant.h"
43+
#include "stm32_def.h"
44+
45+
#if !defined(HAL_EXTI_MODULE_DISABLED)
4446

4547
#if defined(STM32F3xx)
4648
#define EXTI2_IRQn EXTI2_TSC_IRQn
@@ -67,6 +69,7 @@ void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_function_
6769
/* Exported functions ------------------------------------------------------- */
6870
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, void (*callback)(void), uint32_t mode);
6971
void stm32_interrupt_disable(GPIO_TypeDef *port, uint16_t pin);
72+
#endif /* !HAL_EXTI_MODULE_DISABLED */
7073

7174
#endif /* __INTERRUPT_H */
7275

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
#define __RTC_H
4141

4242
/* Includes ------------------------------------------------------------------*/
43-
#include "variant.h"
43+
#include <stdbool.h>
44+
#include "stm32_def.h"
4445
#include "backup.h"
4546
#include "clock.h"
4647

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

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#ifdef __cplusplus
4545
extern "C" {
4646
#endif
47+
#if defined(HAL_SPI_MODULE_ENABLED)
4748

4849
/* Private Functions */
4950
/**
@@ -402,6 +403,7 @@ spi_status_e spi_transfer(spi_t *obj, uint8_t *tx_buffer,
402403

403404
return ret;
404405
}
406+
#endif /* HAL_SPI_MODULE_ENABLED */
405407

406408
#ifdef __cplusplus
407409
}

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

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#ifdef __cplusplus
4747
extern "C" {
4848
#endif
49+
#if defined(HAL_SPI_MODULE_ENABLED)
4950

5051
/* Exported types ------------------------------------------------------------*/
5152

@@ -101,6 +102,7 @@ spi_status_e spi_send(spi_t *obj, uint8_t *Data, uint16_t len, uint32_t Timeout)
101102
spi_status_e spi_transfer(spi_t *obj, uint8_t *tx_buffer,
102103
uint8_t *rx_buffer, uint16_t len, uint32_t Timeout);
103104
uint32_t spi_getClkFreq(spi_t *obj);
105+
#endif /* HAL_SPI_MODULE_ENABLED */
104106

105107
#ifdef __cplusplus
106108
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define __STM32_EEPROM_H
3838

3939
/* Includes ------------------------------------------------------------------*/
40-
#include "variant.h"
40+
#include "stm32_def.h"
4141

4242
#ifdef __cplusplus
4343
extern "C" {

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

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#ifndef __STM32YYxx_HAL_CONF_H
2+
#define __STM32YYxx_HAL_CONF_H
3+
4+
/*
5+
* Mandatory HAL modules
6+
*/
7+
#define HAL_MODULE_ENABLED
8+
#define HAL_CORTEX_MODULE_ENABLED
9+
#define HAL_DMA_MODULE_ENABLED /* Required by other modules */
10+
#define HAL_FLASH_MODULE_ENABLED
11+
#define HAL_GPIO_MODULE_ENABLED
12+
#define HAL_PWR_MODULE_ENABLED
13+
#define HAL_RCC_MODULE_ENABLED
14+
15+
/*
16+
* Optional HAL modules, can be enabled/disabled using
17+
* variant.h, build_opt.h or hal_conf_extra.h
18+
*/
19+
/*
20+
* Defined by default
21+
*/
22+
#if !defined(HAL_ADC_MODULE_DISABLED)
23+
#define HAL_ADC_MODULE_ENABLED
24+
#else
25+
#undef HAL_ADC_MODULE_ENABLED
26+
#endif
27+
28+
#if !defined(HAL_I2C_MODULE_DISABLED)
29+
#define HAL_I2C_MODULE_ENABLED
30+
#else
31+
#undef HAL_I2C_MODULE_ENABLED
32+
#endif
33+
34+
#if !defined(HAL_RTC_MODULE_DISABLED)
35+
#define HAL_RTC_MODULE_ENABLED
36+
#else
37+
#undef HAL_RTC_MODULE_ENABLED
38+
#endif
39+
40+
#if !defined(HAL_SPI_MODULE_DISABLED)
41+
#define HAL_SPI_MODULE_ENABLED
42+
#else
43+
#undef HAL_SPI_MODULE_ENABLED
44+
#endif
45+
46+
#if !defined(HAL_TIM_MODULE_DISABLED)
47+
#define HAL_TIM_MODULE_ENABLED
48+
#else
49+
#undef HAL_TIM_MODULE_ENABLED
50+
#endif
51+
52+
/*
53+
* Not defined by default
54+
*/
55+
#if !defined(HAL_DAC_MODULE_DISABLED)
56+
/*#define HAL_DAC_MODULE_ENABLED*/
57+
#else
58+
#undef HAL_DAC_MODULE_ENABLED
59+
#endif
60+
61+
/* Note: interrupt API does not used HAL EXTI module */
62+
/* anyway API is cleaned with HAL_EXTI_MODULE_DISABLED */
63+
#if !defined(HAL_EXTI_MODULE_DISABLED)
64+
/*#define HAL_EXTI_MODULE_ENABLED*/
65+
#else
66+
#undef HAL_EXTI_MODULE_ENABLED
67+
#endif
68+
69+
#if !defined(HAL_ETH_MODULE_DISABLED)
70+
/*#define HAL_ETH_MODULE_ENABLED*/
71+
#else
72+
#undef HAL_ETH_MODULE_ENABLED
73+
#endif
74+
75+
#if !defined(HAL_SD_MODULE_DISABLED)
76+
/*#define HAL_SD_MODULE_ENABLED*/
77+
#else
78+
#undef HAL_SD_MODULE_ENABLED
79+
#endif
80+
81+
#if !defined(HAL_QSPI_MODULE_DISABLED)
82+
/*#define HAL_QSPI_MODULE_ENABLED*/
83+
#else
84+
#undef HAL_QSPI_MODULE_ENABLED
85+
#endif
86+
87+
/*
88+
* Disabled HAL modules, handled thanks Arduino menu
89+
*/
90+
/*#define HAL_UART_MODULE_ENABLED*/
91+
/*#define HAL_PCD_MODULE_ENABLED*/
92+
93+
/*
94+
* Unused HAL modules
95+
*/
96+
#if 0
97+
HAL_CAN_LEGACY_MODULE_ENABLED
98+
HAL_CAN_LEGACY_MODULE_ENABLED
99+
HAL_CEC_MODULE_ENABLED
100+
HAL_COMP_MODULE_ENABLED
101+
HAL_CRC_MODULE_ENABLED
102+
HAL_CRYP_MODULE_ENABLED
103+
HAL_DCMI_MODULE_ENABLED
104+
HAL_DFSDM_MODULE_ENABLED
105+
HAL_DMA2D_MODULE_ENABLED
106+
HAL_DSI_MODULE_ENABLED
107+
HAL_EXTI_MODULE_ENABLED // interrupt API does not use the module
108+
HAL_FDCAN_MODULE_ENABLED
109+
HAL_FIREWALL_MODULE_ENABLED
110+
HAL_FMPI2C_MODULE_ENABLED
111+
HAL_GFXMMU_MODULE_ENABLED
112+
HAL_HASH_MODULE_ENABLED
113+
HAL_HCD_MODULE_ENABLED
114+
HAL_HRTIM_MODULE_ENABLED
115+
HAL_HSEM_MODULE_ENABLED
116+
HAL_I2S_MODULE_ENABLED
117+
HAL_IPCC_MODULE_ENABLED
118+
HAL_IRDA_MODULE_ENABLED
119+
HAL_IWDG_MODULE_ENABLED // IWD built-in library uses LL
120+
HAL_JPEG_MODULE_ENABLED
121+
HAL_LCD_MODULE_ENABLED
122+
HAL_LPTIM_MODULE_ENABLED
123+
HAL_LTDC_MODULE_ENABLED
124+
HAL_MDIOS_MODULE_ENABLED
125+
HAL_MDMA_MODULE_ENABLED
126+
HAL_MMC_MODULE_ENABLED
127+
HAL_NAND_MODULE_ENABLED
128+
HAL_NOR_MODULE_ENABLED
129+
HAL_OPAMP_MODULE_ENABLED
130+
HAL_OSPI_MODULE_ENABLED
131+
HAL_PCCARD_MODULE_ENABLED
132+
HAL_PKA_MODULE_ENABLED
133+
HAL_RAMECC_MODULE_ENABLED
134+
HAL_RNG_MODULE_ENABLED
135+
HAL_SAI_MODULE_ENABLED
136+
HAL_SDADC_MODULE_ENABLED
137+
HAL_SDRAM_MODULE_ENABLED
138+
HAL_SMARTCARD_MODULE_ENABLED
139+
HAL_SMBUS_MODULE_ENABLED
140+
HAL_SPDIFRX_MODULE_ENABLED
141+
HAL_SRAM_MODULE_ENABLED
142+
HAL_SWPMI_MODULE_ENABLED
143+
HAL_TSC_MODULE_ENABLED
144+
HAL_USART_MODULE_ENABLED
145+
HAL_WWDG_MODULE_ENABLED
146+
#endif
147+
148+
#endif /* __STM32YYxx_HAL_CONF_H */
149+
150+

0 commit comments

Comments
 (0)