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

cores/arduino/Tone.cpp

Lines changed: 15 additions & 0 deletions
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 */

cores/arduino/WInterrupts.cpp

Lines changed: 17 additions & 0 deletions
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
}

cores/arduino/pins_arduino.h

Lines changed: 4 additions & 0 deletions
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

cores/arduino/stm32/analog.c

Lines changed: 16 additions & 4 deletions
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
}

cores/arduino/stm32/interrupt.cpp

Lines changed: 3 additions & 0 deletions
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****/

cores/arduino/stm32/interrupt.h

Lines changed: 4 additions & 1 deletion
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

cores/arduino/stm32/rtc.h

Lines changed: 2 additions & 1 deletion
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

cores/arduino/stm32/spi_com.c

Lines changed: 2 additions & 0 deletions
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
}

cores/arduino/stm32/spi_com.h

Lines changed: 2 additions & 0 deletions
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
}

cores/arduino/stm32/stm32_eeprom.h

Lines changed: 1 addition & 1 deletion
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" {

0 commit comments

Comments
 (0)