Skip to content

Rollup PR: Bring small fixes into 5.10.4 #8694

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 8 commits into from
Nov 9, 2018
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
2 changes: 2 additions & 0 deletions drivers/BusIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class BusIn : private NonCopyable<BusIn> {
*/
DigitalIn &operator[](int index);

#if !defined(DOXYGEN_ONLY)
protected:
DigitalIn *_pin[16];

Expand All @@ -120,6 +121,7 @@ class BusIn : private NonCopyable<BusIn> {
private:
virtual void lock();
virtual void unlock();
#endif
};

} // namespace mbed
Expand Down
9 changes: 5 additions & 4 deletions drivers/BusInOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ class BusInOut : private NonCopyable<BusInOut> {
*/
int read();

/** Set as an output
/** Set all the pins in bus as output
*/
void output();

/** Set as an input
/** Set all the pins in bus as an input
*/
void input();

/** Set the input pin mode
/** Set the input pin mode for all the pins in bus
*
* @param pull PullUp, PullDown, PullNone
*/
Expand Down Expand Up @@ -124,7 +124,7 @@ class BusInOut : private NonCopyable<BusInOut> {
* \sa BusInOut::read()
*/
operator int();

#if !defined(DOXYGEN_ONLY)
protected:
virtual void lock();
virtual void unlock();
Expand All @@ -137,6 +137,7 @@ class BusInOut : private NonCopyable<BusInOut> {
int _nc_mask;

PlatformMutex _mutex;
#endif
};

} // namespace mbed
Expand Down
3 changes: 2 additions & 1 deletion drivers/BusOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class BusOut : private NonCopyable<BusOut> {
* \sa BusOut::read()
*/
operator int();

#if !defined(DOXYGEN_ONLY)
protected:
virtual void lock();
virtual void unlock();
Expand All @@ -121,6 +121,7 @@ class BusOut : private NonCopyable<BusOut> {
int _nc_mask;

PlatformMutex _mutex;
#endif
};

} // namespace mbed
Expand Down
2 changes: 2 additions & 0 deletions drivers/FlashIAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class FlashIAP : private NonCopyable<FlashIAP> {
*/
uint8_t get_erase_value() const;

#if !defined(DOXYGEN_ONLY)
private:

/* Check if address and size are aligned to a sector
Expand All @@ -151,6 +152,7 @@ class FlashIAP : private NonCopyable<FlashIAP> {
flash_t _flash;
uint8_t *_page_buf;
static SingletonPtr<PlatformMutex> _mutex;
#endif
};

} /* namespace mbed */
Expand Down
12 changes: 7 additions & 5 deletions drivers/I2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class I2C : private NonCopyable<I2C> {
* @param data Pointer to the byte-array to read data in to
* @param length Number of bytes to read
* @param repeated Repeated start, true - don't send stop at end
* default value is false.
* default value is false.
*
* @returns
* 0 on success (ack),
Expand All @@ -134,7 +134,7 @@ class I2C : private NonCopyable<I2C> {
* @param data Pointer to the byte-array data to send
* @param length Number of bytes to send
* @param repeated Repeated start, true - do not send stop at end
* default value is false.
* default value is false.
*
* @returns
* 0 on success (ack),
Expand Down Expand Up @@ -188,8 +188,8 @@ class I2C : private NonCopyable<I2C> {
* @param event The logical OR of events to modify
* @param callback The event callback function
* @param repeated Repeated start, true - do not send stop at end
* default value is false.
*
* default value is false.
*
* @returns Zero if the transfer has started, or -1 if I2C peripheral is busy
*/
int transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event = I2C_EVENT_TRANSFER_COMPLETE, bool repeated = false);
Expand All @@ -198,6 +198,7 @@ class I2C : private NonCopyable<I2C> {
*/
void abort_transfer();

#if !defined(DOXYGEN_ONLY)
protected:
/** Lock deep sleep only if it is not yet locked */
void lock_deep_sleep();
Expand All @@ -211,6 +212,7 @@ class I2C : private NonCopyable<I2C> {
DMAUsage _usage;
bool _deep_sleep_locked;
#endif
#endif

#if !defined(DOXYGEN_ONLY)
protected:
Expand All @@ -222,7 +224,6 @@ class I2C : private NonCopyable<I2C> {
static SingletonPtr<PlatformMutex> _mutex;
PinName _sda;
PinName _scl;
#endif

private:
/** Recover I2C bus, when stuck with SDA low
Expand All @@ -237,6 +238,7 @@ class I2C : private NonCopyable<I2C> {
*
*/
int recover(PinName sda, PinName scl);
#endif
};

} // namespace mbed
Expand Down
2 changes: 2 additions & 0 deletions drivers/InterruptManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class InterruptManager : private NonCopyable<InterruptManager> {
"public API of mbed-os and is being removed in the future.")
bool remove_handler(pFunctionPointer_t handler, IRQn_Type irq);

#if !defined(DOXYGEN_ONLY)
private:
InterruptManager();
~InterruptManager();
Expand Down Expand Up @@ -198,6 +199,7 @@ class InterruptManager : private NonCopyable<InterruptManager> {
CallChain *_chains[NVIC_NUM_VECTORS];
static InterruptManager *_instance;
PlatformMutex _mutex;
#endif
};

} // namespace mbed
Expand Down
3 changes: 2 additions & 1 deletion drivers/LowPowerTimeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ namespace mbed {
* @ingroup drivers
*/
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {

#if !defined(DOXYGEN_ONLY)
private:
virtual void handler(void)
{
_function.call();
}
#endif
};

}
Expand Down
2 changes: 2 additions & 0 deletions drivers/MbedCRC.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class MbedCRC {
return width;
}

#if !defined(DOXYGEN_ONLY)
private:
uint32_t _initial_value;
uint32_t _final_xor;
Expand Down Expand Up @@ -546,6 +547,7 @@ class MbedCRC {
}
_mode = (_crc_table != NULL) ? TABLE : BITWISE;
}
#endif
};

#if defined ( __CC_ARM )
Expand Down
4 changes: 1 addition & 3 deletions drivers/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ class SPI : private NonCopyable<SPI> {
*/
int set_dma_usage(DMAUsage usage);

#if !defined(DOXYGEN_ONLY)
protected:
/** SPI interrupt handler.
*/
Expand Down Expand Up @@ -263,8 +264,6 @@ class SPI : private NonCopyable<SPI> {
*/
void start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event);

#if !defined(DOXYGEN_ONLY)

private:
/** Lock deep sleep only if it is not yet locked */
void lock_deep_sleep();
Expand Down Expand Up @@ -294,7 +293,6 @@ class SPI : private NonCopyable<SPI> {
#endif //DEVICE_SPI_ASYNCH

#if !defined(DOXYGEN_ONLY)

protected:
/* Internal SPI object identifying the resources */
spi_t _spi;
Expand Down
8 changes: 6 additions & 2 deletions drivers/SerialBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class SerialBase : private NonCopyable<SerialBase> {
*/
void send_break();

#if !defined(DOXYGEN_ONLY)
protected:

/** Acquire exclusive access to this serial port
Expand All @@ -150,7 +151,7 @@ class SerialBase : private NonCopyable<SerialBase> {
/** Release exclusive access to this serial port
*/
virtual void unlock(void);

#endif
public:

#if DEVICE_SERIAL_FC
Expand Down Expand Up @@ -235,12 +236,15 @@ class SerialBase : private NonCopyable<SerialBase> {
*/
int set_dma_usage_rx(DMAUsage usage);

#if !defined(DOXYGEN_ONLY)
protected:
void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event, unsigned char char_match);
void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event);
void interrupt_handler_asynch(void);
#endif
#endif

#if !defined(DOXYGEN_ONLY)
protected:
SerialBase(PinName tx, PinName rx, int baud);
virtual ~SerialBase();
Expand All @@ -259,7 +263,7 @@ class SerialBase : private NonCopyable<SerialBase> {
serial_t _serial;
Callback<void()> _irq[IrqCnt];
int _baud;

#endif
};

} // namespace mbed
Expand Down
2 changes: 2 additions & 0 deletions drivers/Timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ namespace mbed {
*/
class Timeout : public Ticker, private NonCopyable<Timeout> {

#if !defined(DOXYGEN_ONLY)
protected:
virtual void handler();
#endif
};

} // namespace mbed
Expand Down
2 changes: 2 additions & 0 deletions drivers/TimerEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TimerEvent : private NonCopyable<TimerEvent> {
*/
virtual ~TimerEvent();

#if !defined(DOXYGEN_ONLY)
protected:
// The handler called to service the timer event of the derived class
virtual void handler() = 0;
Expand Down Expand Up @@ -77,6 +78,7 @@ class TimerEvent : private NonCopyable<TimerEvent> {
ticker_event_t event;

const ticker_data_t *_ticker_data;
#endif
};

} // namespace mbed
Expand Down
71 changes: 1 addition & 70 deletions targets/TARGET_STM/TARGET_STM32F2/pin_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,76 +32,7 @@

#include "cmsis.h"

// when LL is available, below include can be used
// #include "stm32f2xx_ll_gpio.h"
// until then let's define locally the required functions
#define LL_GPIO_PIN_0 GPIO_BSRR_BS0 /*!< Select pin 0 */
#define LL_GPIO_PIN_1 GPIO_BSRR_BS1 /*!< Select pin 1 */
#define LL_GPIO_PIN_2 GPIO_BSRR_BS2 /*!< Select pin 2 */
#define LL_GPIO_PIN_3 GPIO_BSRR_BS3 /*!< Select pin 3 */
#define LL_GPIO_PIN_4 GPIO_BSRR_BS4 /*!< Select pin 4 */
#define LL_GPIO_PIN_5 GPIO_BSRR_BS5 /*!< Select pin 5 */
#define LL_GPIO_PIN_6 GPIO_BSRR_BS6 /*!< Select pin 6 */
#define LL_GPIO_PIN_7 GPIO_BSRR_BS7 /*!< Select pin 7 */
#define LL_GPIO_PIN_8 GPIO_BSRR_BS8 /*!< Select pin 8 */
#define LL_GPIO_PIN_9 GPIO_BSRR_BS9 /*!< Select pin 9 */
#define LL_GPIO_PIN_10 GPIO_BSRR_BS10 /*!< Select pin 10 */
#define LL_GPIO_PIN_11 GPIO_BSRR_BS11 /*!< Select pin 11 */
#define LL_GPIO_PIN_12 GPIO_BSRR_BS12 /*!< Select pin 12 */
#define LL_GPIO_PIN_13 GPIO_BSRR_BS13 /*!< Select pin 13 */
#define LL_GPIO_PIN_14 GPIO_BSRR_BS14 /*!< Select pin 14 */
#define LL_GPIO_PIN_15 GPIO_BSRR_BS15 /*!< Select pin 15 */

#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */
#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODE0_0 /*!< Select output mode */
#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODE0_1 /*!< Select alternate function mode */
#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODE0 /*!< Select analog mode */

#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */
#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT0 /*!< Select open-drain as output type */

#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */
#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */
#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */

#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */
#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */
#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */
#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */

__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
{
MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)),
(Alternate << (POSITION_VAL(Pin) * 4U)));
}

__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
{
MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)),
(Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
}
__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
{
MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
}
__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
{
return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin));
}
__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
{
MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
}
__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
{
MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
}
__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
{
MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)),
(Speed << (POSITION_VAL(Pin) * 2U)));
}
// Above lines shall be defined in LL when available
#include "stm32f2xx_ll_gpio.h"

extern const uint32_t ll_pin_defines[16];

Expand Down
Loading