Skip to content

Fix mis-placed extern "C" in board.h + some legacy comment cleanup #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cores/arduino/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
* Core and peripherals registers definitions
*/
#include "interrupt.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include "analog.h"
#include "clock.h"
#include "core_callback.h"
Expand All @@ -21,8 +18,11 @@ extern "C" {
#include "twi.h"
#include "uart.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void init(void) ;
#ifdef __cplusplus
}
#endif // __cplusplus
#endif /* __cplusplus */
#endif /* _BOARD_H_ */
66 changes: 3 additions & 63 deletions cores/arduino/stm32/analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32f4xx_system
* @{
*/

/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "stm32_def.h"
#include "analog.h"
#include "timer.h"
Expand All @@ -55,20 +44,7 @@
extern "C" {
#endif

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/
/* Private_Defines */
#if defined(ADC_SAMPLETIME_8CYCLES_5)
#define SAMPLINGTIME ADC_SAMPLETIME_8CYCLES_5;
#elif defined(ADC_SAMPLETIME_12CYCLES_5)
Expand Down Expand Up @@ -102,30 +78,11 @@ extern "C" {
#ifndef ADC_REGULAR_RANK_1
#define ADC_REGULAR_RANK_1 1
#endif
/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/
/* Private_Variables */
static PinName g_current_pin = NC;

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/
/* Private Functions */
static uint32_t get_adc_channel(PinName pin)
{
uint32_t function = pinmap_function(pin, PinMap_ADC);
Expand Down Expand Up @@ -804,23 +761,6 @@ void pwm_stop(PinName pin)
HAL_TIM_PWM_DeInit(&timHandle);
}


/**
* @}
*/


/**
* @}
*/

/**
* @}
*/

/**
* @}
*/
#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 0 additions & 3 deletions cores/arduino/stm32/analog.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
extern "C" {
#endif

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void dac_write_value(PinName pin, uint32_t value, uint8_t do_init);
void dac_stop(PinName pin);
Expand Down
68 changes: 5 additions & 63 deletions cores/arduino/stm32/interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,57 +35,21 @@
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32f4xx_system
* @{
*/

/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "stm32_def.h"
#include "interrupt.h"

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/
/* Private Types */

/*As we can have only one interrupt/pin id, don't need to get the port info*/
typedef struct {
IRQn_Type irqnb;
std::function<void(void)> callback;
} gpio_irq_conf_str;

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/
/* Private_Defines */
#define NB_EXTI (16)
/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/
/* Private Variables */
static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = {
#if defined (STM32F0xx) || defined (STM32L0xx)
{.irqnb = EXTI0_1_IRQn, .callback = NULL}, //GPIO_PIN_0
Expand Down Expand Up @@ -123,25 +87,14 @@ static gpio_irq_conf_str gpio_irq_conf[NB_EXTI] = {
{.irqnb = EXTI15_10_IRQn, .callback = NULL} //GPIO_PIN_15
#endif
};
/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/

static uint8_t get_pin_id(uint16_t pin);

/**
* @}
*/
/* Private Functions */
/**
* @brief This function returns the pin ID function of the HAL PIN definition
* @param pin : one of the gpio pin
* @retval None
*/
uint8_t get_pin_id(uint16_t pin)
static uint8_t get_pin_id(uint16_t pin)
{
uint8_t id = 0;

Expand Down Expand Up @@ -397,15 +350,4 @@ void EXTI15_10_IRQHandler(void)
}
#endif
#endif
/**
* @}
*/

/**
* @}
*/

/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
3 changes: 0 additions & 3 deletions cores/arduino/stm32/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ typedef std::function<void(void)> callback_function_t;
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, callback_function_t callback, uint32_t mode);
#endif

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void stm32_interrupt_enable(GPIO_TypeDef *port, uint16_t pin, void (*callback)(void), uint32_t mode);
void stm32_interrupt_disable(GPIO_TypeDef *port, uint16_t pin);
Expand Down
71 changes: 1 addition & 70 deletions cores/arduino/stm32/spi_com.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/

/** @addtogroup stm32f4xx_system
* @{
*/

/** @addtogroup STM32F4xx_System_Private_Includes
* @{
*/
#include "core_debug.h"
#include "stm32_def.h"
#include "spi_com.h"
Expand All @@ -56,53 +45,7 @@
extern "C" {
#endif

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Defines
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Macros
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Variables
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
* @{
*/

/**
* @}
*/

/** @addtogroup STM32F4xx_System_Private_Functions
* @{
*/
/* Private Functions */
/**
* @brief return clock freq of an SPI instance
* @param spi_inst : SPI instance
Expand Down Expand Up @@ -460,18 +403,6 @@ spi_status_e spi_transfer(spi_t *obj, uint8_t *tx_buffer,
return ret;
}


/**
* @}
*/

/**
* @}
*/

/**
* @}
*/
#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 0 additions & 3 deletions cores/arduino/stm32/spi_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ typedef enum {
SPI_ERROR = 2
} spi_status_e;

/* Exported constants --------------------------------------------------------*/

/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb);
void spi_deinit(spi_t *obj);
Expand Down
Loading