Merge pull request #8423 from cmonr/rollup2

Rollup PR: Additional doc PRs + lingering need:CI PRs
pull/8222/merge
Cruz Monrreal 2018-10-15 10:04:04 -05:00 committed by GitHub
commit e0e915f5db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 279 additions and 131 deletions

View File

@ -114,7 +114,7 @@ public:
}
protected:
#if !defined(DOXYGEN_ONLY)
virtual void lock()
{
_mutex->lock();
@ -127,6 +127,7 @@ protected:
analogin_t _adc;
static SingletonPtr<PlatformMutex> _mutex;
#endif //!defined(DOXYGEN_ONLY)
};
} // namespace mbed

View File

@ -141,7 +141,7 @@ public:
}
protected:
#if !defined(DOXYGEN_ONLY)
virtual void lock()
{
_mutex.lock();
@ -154,6 +154,7 @@ protected:
dac_t _dac;
PlatformMutex _mutex;
#endif //!defined(DOXYGEN_ONLY)
};
} // namespace mbed

View File

@ -108,6 +108,11 @@ public:
/** An operator shorthand for read()
* \sa DigitalIn::read()
* @code
* DigitalIn button(BUTTON1);
* DigitalOut led(LED1);
* led = button; // Equivalent to led.write(button.read())
* @endcode
*/
operator int()
{
@ -116,7 +121,9 @@ public:
}
protected:
#if !defined(DOXYGEN_ONLY)
gpio_t gpio;
#endif //!defined(DOXYGEN_ONLY)
};
} // namespace mbed

View File

@ -121,6 +121,13 @@ public:
/** A shorthand for write()
* \sa DigitalInOut::write()
* @code
* DigitalInOut inout(PIN);
* DigitalIn button(BUTTON1);
* inout.output();
*
* inout = button; // Equivalent to inout.write(button.read())
* @endcode
*/
DigitalInOut &operator= (int value)
{
@ -129,7 +136,8 @@ public:
return *this;
}
/** A shorthand for write()
/**A shorthand for write() using the assignment operator which copies the
* state from the DigitalInOut argument.
* \sa DigitalInOut::write()
*/
DigitalInOut &operator= (DigitalInOut &rhs)
@ -142,6 +150,13 @@ public:
/** A shorthand for read()
* \sa DigitalInOut::read()
* @code
* DigitalInOut inout(PIN);
* DigitalOut led(LED1);
*
* inout.input();
* led = inout; // Equivalent to led.write(inout.read())
* @endcode
*/
operator int()
{
@ -150,7 +165,9 @@ public:
}
protected:
#if !defined(DOXYGEN_ONLY)
gpio_t gpio;
#endif //!defined(DOXYGEN_ONLY)
};
} // namespace mbed

View File

@ -104,6 +104,11 @@ public:
/** A shorthand for write()
* \sa DigitalOut::write()
* @code
* DigitalIn button(BUTTON1);
* DigitalOut led(LED1);
* led = button; // Equivalent to led.write(button.read())
* @endcode
*/
DigitalOut &operator= (int value)
{
@ -112,7 +117,8 @@ public:
return *this;
}
/** A shorthand for write()
/** A shorthand for write() using the assignment operator which copies the
* state from the DigitalOut argument.
* \sa DigitalOut::write()
*/
DigitalOut &operator= (DigitalOut &rhs)
@ -125,6 +131,11 @@ public:
/** A shorthand for read()
* \sa DigitalOut::read()
* @code
* DigitalIn button(BUTTON1);
* DigitalOut led(LED1);
* led = button; // Equivalent to led.write(button.read())
* @endcode
*/
operator int()
{
@ -133,7 +144,9 @@ public:
}
protected:
#if !defined(DOXYGEN_ONLY)
gpio_t gpio;
#endif //!defined(DOXYGEN_ONLY)
};
} // namespace mbed

View File

@ -41,16 +41,32 @@ namespace mbed {
*
* Example:
* @code
* // Read from I2C slave at address 0x62
*
* Read temperature from LM75BD
* #include "mbed.h"
*
* I2C i2c(p28, p27);
* I2C i2c(I2C_SDA , I2C_SCL);
* const int addr7bit = 0x48; // 7-bit I2C address
* const int addr8bit = 0x48 << 1; // 8-bit I2C address, 0x90
*
* int main() {
* int address = 0x62;
* char data[2];
* i2c.read(address, data, 2);
* char cmd[2];
* while (1) {
* cmd[0] = 0x01;
* cmd[1] = 0x00;
*
* // read and write takes the 8-bit version of the address.
* // set up configuration register (at 0x01)
* i2c.write(addr8bit, cmd, 2);
*
* wait(0.5);
*
* // read temperature register
* cmd[0] = 0x00;
* i2c.write(addr8bit, cmd, 1);
* i2c.read( addr8bit, cmd, 2);
*
* float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0);
* printf("Temp = %.2f\n", tmp);
* }
* }
* @endcode
* @ingroup drivers
@ -92,10 +108,11 @@ public:
* @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.
*
* @returns
* 0 on success (ack),
* non-0 on failure (nack)
* nonzero on failure (nack)
*/
int read(int address, char *data, int length, bool repeated = false);
@ -117,10 +134,11 @@ public:
* @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.
*
* @returns
* 0 on success (ack),
* non-0 on failure (nack)
* nonzero on failure (nack)
*/
int write(int address, const char *data, int length, bool repeated = false);
@ -137,7 +155,6 @@ public:
/** Creates a start condition on the I2C bus
*/
void start(void);
/** Creates a stop condition on the I2C bus
@ -159,23 +176,25 @@ public:
#if DEVICE_I2C_ASYNCH
/** Start non-blocking I2C transfer.
/** Start nonblocking I2C transfer.
*
* This function locks the deep sleep until any event has occurred
*
* @param address 8/10 bit I2C slave address
* @param tx_buffer The TX buffer with data to be transfered
* @param tx_length The length of TX buffer in bytes
* @param rx_buffer The RX buffer which is used for received data
* @param rx_buffer The RX buffer, which is used for received data
* @param rx_length The length of RX buffer in bytes
* @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
* @return Zero if the transfer has started, or -1 if I2C peripheral is busy
* 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);
/** Abort the on-going I2C transfer
/** Abort the ongoing I2C transfer
*/
void abort_transfer();
@ -193,6 +212,7 @@ protected:
bool _deep_sleep_locked;
#endif
#if !defined(DOXYGEN_ONLY)
protected:
void aquire();
@ -202,6 +222,7 @@ protected:
static SingletonPtr<PlatformMutex> _mutex;
PinName _sda;
PinName _scl;
#endif
private:
/** Recover I2C bus, when stuck with SDA low
@ -210,7 +231,7 @@ private:
* @param sda I2C data line pin
* @param scl I2C clock line pin
*
* @returns:
* @returns
* '0' - Successfully recovered
* 'I2C_ERROR_BUS_BUSY' - In case of failure
*

View File

@ -2803,6 +2803,7 @@ public:
#endif
protected:
#if !defined(DOXYGEN_ONLY)
template <typename F>
friend class Event;
struct equeue _equeue;
@ -3379,6 +3380,7 @@ protected:
f(c0, c1, c2, c3, c4, a0, a1, a2, a3, a4);
}
};
#endif //!defined(DOXYGEN_ONLY)
};
}

View File

@ -0,0 +1,49 @@
Permissive Binary License
Version 1.0, September 2015
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:
1) Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
2) Unless to the extent explicitly permitted by law, no reverse
engineering, decompilation, or disassembly of this software is
permitted.
3) Redistribution as part of a software development kit must include the
accompanying file named "DEPENDENCIES" and any dependencies listed in
that file.
4) Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
Limited patent license. The copyright holders (and contributors) grant a
worldwide, non-exclusive, no-charge, royalty-free patent license to
make, have made, use, offer to sell, sell, import, and otherwise
transfer this software, where such license applies only to those patent
claims licensable by the copyright holders (and contributors) that are
necessarily infringed by this software. This patent license shall not
apply to any combinations that include this software. No hardware is
licensed hereunder.
If you institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the software
itself infringes your patent(s), then your rights granted under this
license shall terminate as of the date such litigation is filed.
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,10 @@
{
"name": "bootloader_DISCO_L475VG_IOT01A",
"target_overrides": {
"*": {
"target.app_offset": "0x9800",
"target.header_offset": "0x9000",
"target.bootloader_img": "mbed-bootloader-internal_dfb7cc.bin"
}
}
}

View File

@ -119,7 +119,6 @@ bool UBLOX_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
{
int sock_id = 0;
bool socketOpenWorking = false;
_at.lock();
if (socket->proto == NSAPI_UDP) {
@ -137,12 +136,12 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
sock_id = _at.read_int();
_at.resp_stop();
} // Unsupported protocol is checked in "is_protocol_supported" function
_at.unlock();
socketOpenWorking = (_at.get_last_error() == NSAPI_ERROR_OK);
if (!socketOpenWorking) {
if ((_at.get_last_error() != NSAPI_ERROR_OK) || (sock_id == -1)) {
_at.unlock();
return NSAPI_ERROR_NO_SOCKET;
}
_at.unlock();
// Check for duplicate socket id delivered by modem
for (int i = 0; i < UBLOX_MAX_SOCKET; i++) {
@ -162,8 +161,15 @@ nsapi_error_t UBLOX_AT_CellularStack::socket_connect(nsapi_socket_t handle, cons
{
CellularSocket *socket = (CellularSocket *)handle;
if (!socket->created) {
create_socket_impl(socket);
if (socket) {
if (!socket->created) {
nsapi_error_t err = create_socket_impl(socket);
if(err != NSAPI_ERROR_OK) {
return err;
}
}
} else {
return NSAPI_ERROR_DEVICE_ERROR;
}
_at.lock();

View File

@ -82,11 +82,11 @@ public:
/**
* Constructor
*
* @param fh A FileHandle to a digital interface to use for AT commands
* @param output_delimiter end of command line termination
* @param buffer_size size of internal buffer for transaction
* @param timeout timeout of the connection
* @param debug turns on/off debug output for AT commands
* @param fh A FileHandle to the digital interface, used for AT commands
* @param output_delimiter End of command-line termination
* @param buffer_size Size of internal buffer for transaction
* @param timeout Timeout of the connection
* @param debug Turns on/off debug output for AT commands
*/
ATCmdParser(FileHandle *fh, const char *output_delimiter = "\r",
int buffer_size = 256, int timeout = 8000, bool debug = false)
@ -114,7 +114,8 @@ public:
/**
* Allows timeout to be changed between commands
*
* @param timeout timeout of the connection
* @param timeout ATCmdParser APIs (read/write/send/recv ..etc) throw an
* error if no response is received in `timeout` duration
*/
void set_timeout(int timeout)
{
@ -122,13 +123,15 @@ public:
}
/**
* For backwards compatibility.
* For backward compatibility.
* @deprecated Do not use this function. This function has been replaced with set_timeout for consistency.
*
* Please use set_timeout(int) API only from now on.
* Allows timeout to be changed between commands
*
* @param timeout timeout of the connection
* @param timeout ATCmdParser APIs (read/write/send/recv ..etc) throw an
* error if no response is received in `timeout` duration
*
*/
MBED_DEPRECATED_SINCE("mbed-os-5.5.0", "Replaced with set_timeout for consistency")
void setTimeout(int timeout)
@ -139,7 +142,7 @@ public:
/**
* Sets string of characters to use as line delimiters
*
* @param output_delimiter string of characters to use as line delimiters
* @param output_delimiter String of characters to use as line delimiters
*/
void set_delimiter(const char *output_delimiter)
{
@ -165,7 +168,7 @@ public:
/**
* Allows traces from modem to be turned on or off
*
* @param on set as 1 to turn on traces and vice versa.
* @param on Set as 1 to turn on traces and vice versa.
*/
void debug_on(uint8_t on)
{
@ -173,12 +176,12 @@ public:
}
/**
* For backwards compatibility.
* For backward compatibility.
* @deprecated Do not use this function. This function has been replaced with debug_on for consistency.
*
* Allows traces from modem to be turned on or off
*
* @param on set as 1 to turn on traces and vice versa.
* @param on Set as 1 to turn on traces and vice versa.
*/
MBED_DEPRECATED_SINCE("mbed-os-5.5.0", "Replaced with debug_on for consistency")
void debugOn(uint8_t on)
@ -237,8 +240,8 @@ public:
/**
* Write an array of bytes to the underlying stream
*
* @param data the array of bytes to write
* @param size number of bytes to write
* @param data The array of bytes to write
* @param size Number of bytes to write
* @return number of bytes written or -1 on failure
*/
int write(const char *data, int size);
@ -246,8 +249,8 @@ public:
/**
* Read an array of bytes from the underlying stream
*
* @param data the destination for the read bytes
* @param size number of bytes to read
* @param data The buffer for filling the read bytes
* @param size Number of bytes to read
* @return number of bytes read or -1 on failure
*/
int read(char *data, int size);
@ -256,8 +259,8 @@ public:
* Direct printf to underlying stream
* @see printf
*
* @param format format string to pass to printf
* @param ... arguments to printf
* @param format Format string to pass to printf
* @param ... Variable arguments to printf
* @return number of bytes written or -1 on failure
*/
int printf(const char *format, ...) MBED_PRINTF_METHOD(1, 2);
@ -268,8 +271,8 @@ public:
* Direct scanf on underlying stream
* @see scanf
*
* @param format format string to pass to scanf
* @param ... arguments to scanf
* @param format Format string to pass to scanf
* @param ... Variable arguments to scanf
* @return number of bytes read or -1 on failure
*/
int scanf(const char *format, ...) MBED_SCANF_METHOD(1, 2);
@ -279,8 +282,8 @@ public:
/**
* Attach a callback for out-of-band data
*
* @param prefix string on when to initiate callback
* @param func callback to call when string is read
* @param prefix String on when to initiate callback
* @param func Callback to call when string is read
* @note out-of-band data is only processed during a scanf call
*/
void oob(const char *prefix, mbed::Callback<void()> func);
@ -293,7 +296,7 @@ public:
/**
* Abort current recv
*
* Can be called from oob handler to interrupt the current
* Can be called from out-of-band handler to interrupt the current
* recv operation.
*/
void abort();
@ -304,7 +307,7 @@ public:
* Process out-of-band data in the receive buffer. This function
* returns immediately if there is no data to process.
*
* @return true if oob data processed, false otherwise
* @return true if out-of-band data processed, false otherwise
*/
bool process_oob(void);
};

View File

@ -40,13 +40,14 @@ are active, the second one (MBED_MEM_TRACING_ENABLED) will trace the first one's
/* Implementation of the runtime max heap usage checker */
/******************************************************************************/
/* Size must be a multiple of 8 to keep alignment */
typedef struct {
uint32_t size;
uint32_t pad;
uint32_t signature;
} alloc_info_t;
#ifdef MBED_HEAP_STATS_ENABLED
#define MBED_HEAP_STATS_SIGNATURE (0xdeadbeef)
static SingletonPtr<PlatformMutex> malloc_stats_mutex;
static mbed_stats_heap_t heap_stats = {0, 0, 0, 0, 0, 0, 0};
@ -106,6 +107,7 @@ extern "C" void *malloc_wrapper(struct _reent *r, size_t size, void *caller)
alloc_info_t *alloc_info = (alloc_info_t *)__real__malloc_r(r, size + sizeof(alloc_info_t));
if (alloc_info != NULL) {
alloc_info->size = size;
alloc_info->signature = MBED_HEAP_STATS_SIGNATURE;
ptr = (void *)(alloc_info + 1);
heap_stats.current_size += size;
heap_stats.total_size += size;
@ -186,13 +188,18 @@ extern "C" void free_wrapper(struct _reent *r, void *ptr, void *caller)
alloc_info_t *alloc_info = NULL;
if (ptr != NULL) {
alloc_info = ((alloc_info_t *)ptr) - 1;
size_t user_size = alloc_info->size;
size_t alloc_size = MALLOC_HEAP_TOTAL_SIZE(MALLOC_HEADER_PTR(alloc_info));
heap_stats.current_size -= user_size;
heap_stats.alloc_cnt -= 1;
heap_stats.overhead_size -= (alloc_size - user_size);
if (MBED_HEAP_STATS_SIGNATURE == alloc_info->signature) {
size_t user_size = alloc_info->size;
size_t alloc_size = MALLOC_HEAP_TOTAL_SIZE(MALLOC_HEADER_PTR(alloc_info));
alloc_info->signature = 0x0;
heap_stats.current_size -= user_size;
heap_stats.alloc_cnt -= 1;
heap_stats.overhead_size -= (alloc_size - user_size);
__real__free_r(r, (void *)alloc_info);
} else {
__real__free_r(r, ptr);
}
}
__real__free_r(r, (void *)alloc_info);
malloc_stats_mutex->unlock();
#else // #ifdef MBED_HEAP_STATS_ENABLED
@ -233,7 +240,6 @@ extern "C" void *__wrap__memalign_r(struct _reent *r, size_t alignment, size_t b
}
/******************************************************************************/
/* ARMCC / IAR memory allocation wrappers */
/******************************************************************************/
@ -288,6 +294,7 @@ extern "C" void *malloc_wrapper(size_t size, void *caller)
alloc_info_t *alloc_info = (alloc_info_t *)SUPER_MALLOC(size + sizeof(alloc_info_t));
if (alloc_info != NULL) {
alloc_info->size = size;
alloc_info->signature = MBED_HEAP_STATS_SIGNATURE;
ptr = (void *)(alloc_info + 1);
heap_stats.current_size += size;
heap_stats.total_size += size;
@ -386,13 +393,18 @@ extern "C" void free_wrapper(void *ptr, void *caller)
alloc_info_t *alloc_info = NULL;
if (ptr != NULL) {
alloc_info = ((alloc_info_t *)ptr) - 1;
size_t user_size = alloc_info->size;
size_t alloc_size = MALLOC_HEAP_TOTAL_SIZE(MALLOC_HEADER_PTR(alloc_info));
heap_stats.current_size -= user_size;
heap_stats.alloc_cnt -= 1;
heap_stats.overhead_size -= (alloc_size - user_size);
if (MBED_HEAP_STATS_SIGNATURE == alloc_info->signature) {
size_t user_size = alloc_info->size;
size_t alloc_size = MALLOC_HEAP_TOTAL_SIZE(MALLOC_HEADER_PTR(alloc_info));
alloc_info->signature = 0x0;
heap_stats.current_size -= user_size;
heap_stats.alloc_cnt -= 1;
heap_stats.overhead_size -= (alloc_size - user_size);
SUPER_FREE((void *)alloc_info);
} else {
SUPER_FREE(ptr);
}
}
SUPER_FREE((void *)alloc_info);
malloc_stats_mutex->unlock();
#else // #ifdef MBED_HEAP_STATS_ENABLED

View File

@ -59,7 +59,7 @@ extern "C" {
/** Set the current time
*
* Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
* Initializes and sets the time of the microcontroller Real-Time Clock (RTC)
* to the time represented by the number of seconds since January 1, 1970
* (the UNIX timestamp).
*
@ -85,7 +85,7 @@ void set_time(time_t t);
* @param read_rtc pointer to function which returns current UNIX timestamp
* @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
* @param init_rtc pointer to funtion which initializes RTC, can be NULL
* @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
* @param isenabled_rtc pointer to function which returns if the RTC is enabled, can be NULL
*/
void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));

View File

@ -149,9 +149,11 @@ void spi_frequency(spi_t *obj, int hz) {
hz_min = pclk_base / 2 / 256 / 8;
hz_max = pclk_base / 2;
if (((uint32_t)hz < hz_min) || ((uint32_t)hz > hz_max)) {
error("Couldn't setup requested SPI frequency");
return;
if ((uint32_t)hz < hz_min) {
hz = hz_min;
}
if ((uint32_t)hz > hz_max) {
hz = hz_max;
}
div = (pclk_base / hz / 2);

View File

@ -359,8 +359,8 @@ MBED_WEAK const PinMap PinMap_SPI_SSEL[] = {
{PA_4, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, // Connected to ARD_D8
{PA_4_ALT0, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI3)}, // Connected to ARD_D8
{PA_11, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)}, // Connected to USB_OTG_FS_DM
{PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, // Connected to ARD_D10
{PA_15_ALT0, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI3)}, // Connected to ARD_D10
{PA_15_ALT0, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI1)}, // Connected to ARD_D10
{PA_15, SPI_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI3)}, // Connected to ARD_D10
{PB_1, SPI_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF6_SPI5)}, // Connected to ARD_A4
{PB_9, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)}, // Connected to CODEC_WS [WM8994ECS_LRCLK1]
{PB_12, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)}, // Connected to ARD_D13 // Connected to WIFI module // Connected to LD5

View File

@ -311,6 +311,15 @@ typedef enum {
QSPI_FLASH1_SCK = PB_2,
QSPI_FLASH1_CSN = PG_6,
/**** WIFI ISM43362 pins ****/
ISM43362_WIFI_MISO = PB_4,
ISM43362_WIFI_MOSI = PB_5,
ISM43362_WIFI_SCLK = PB_12,
ISM43362_WIFI_NSS = PG_11,
ISM43362_WIFI_RESET = PH_1,
ISM43362_WIFI_DATAREADY = PG_12,
ISM43362_WIFI_WAKEUP = PB_15,
// Not connected
NC = (int)0xFFFFFFFF
} PinName;

View File

@ -97,6 +97,17 @@ void SystemInit(void)
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
#endif
/* In DISCO_F413ZH board, Arduino connector and Wifi embeded module are sharing the same SPI pins */
/* We need to set the default SPI SS pin for the Wifi module to the inactive state i.e. 1 */
/* See board User Manual: WIFI_SPI_CS = PG_11*/
__HAL_RCC_GPIOG_CLK_ENABLE();
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Pin = GPIO_PIN_11;
HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOG, GPIO_PIN_11, GPIO_PIN_SET);
}

View File

@ -536,7 +536,9 @@ HAL_StatusTypeDef init_uart(serial_t *obj)
#if defined(LPUART1_BASE)
if (huart->Instance == LPUART1) {
if (obj_s->baudrate <= 9600) {
#if ((MBED_CONF_TARGET_LPUART_CLOCK_SOURCE) & USE_LPUART_CLK_LSE)
HAL_UARTEx_EnableClockStopMode(huart);
#endif
HAL_UARTEx_EnableStopMode(huart);
} else {
HAL_UARTEx_DisableClockStopMode(huart);

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2017 All rights reserved
* (C)Copyright TOSHIBA ELECTRONIC DEVICES & STORAGE CORPORATION 2018 All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdbool.h>
#include "us_ticker_api.h"
#include "tmpm46b_tmrb.h"
#define TMR16A_100US 0xFFFF
#define TMRB_CLK_DIV 0x3
#define MAX_TICK_16_BIT 0xFFFF
#define TMRB_CLK_DIV 0x3
static uint8_t us_ticker_inited = 0; // Is ticker initialized yet?
static volatile uint32_t us_ticker = 0; // timer counter
static bool us_ticker_inited = false; // Is ticker initialized yet?
const ticker_info_t* us_ticker_get_info()
{
@ -35,34 +35,32 @@ const ticker_info_t* us_ticker_get_info()
void us_ticker_init(void)
{
TMRB_InitTypeDef m_tmrb0;
TMRB_FFOutputTypeDef FFStruct;
if (us_ticker_inited) {
us_ticker_disable_interrupt();
return;
}
us_ticker_inited = 1;
us_ticker_inited = true;
// TSB_TB0 using free-run
m_tmrb0.Mode = TMRB_INTERVAL_TIMER;
m_tmrb0.ClkDiv = TMRB_CLK_DIV;
m_tmrb0.UpCntCtrl = TMRB_FREE_RUN;
m_tmrb0.TrailingTiming = MAX_TICK_16_BIT;
m_tmrb0.LeadingTiming = MAX_TICK_16_BIT;
// Enable channel 0
TMRB_Enable(TSB_TB0);
// Stops and clear count operation
TMRB_SetRunState(TSB_TB0, TMRB_STOP);
// Disable to TBxFF0 reverse trigger
FFStruct.FlipflopCtrl = TMRB_FLIPFLOP_CLEAR;
FFStruct.FlipflopReverseTrg =TMRB_DISABLE_FLIPFLOP;
TMRB_SetFlipFlop(TSB_TB0, &FFStruct);
// TSB_TB0 using free-run
m_tmrb0.Mode = TMRB_INTERVAL_TIMER;
m_tmrb0.ClkDiv = TMRB_CLK_DIV;
m_tmrb0.UpCntCtrl = TMRB_AUTO_CLEAR;
m_tmrb0.TrailingTiming = TMR16A_100US;
m_tmrb0.LeadingTiming = TMR16A_100US;
// Mask All interrupts
TMRB_SetINTMask(TSB_TB0, TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_MATCH_TRAILING_INT | TMRB_MASK_OVERFLOW_INT);
TMRB_Init(TSB_TB0, &m_tmrb0);
// Enable TMRB when system is in idle mode
TMRB_SetIdleMode(TSB_TB0, ENABLE);
// Starts TSB_TB0
TMRB_SetRunState(TSB_TB0, TMRB_RUN);
NVIC_SetVector(INTTB0_IRQn, (uint32_t)us_ticker_irq_handler);
}
uint32_t us_ticker_read(void)
@ -80,59 +78,40 @@ uint32_t us_ticker_read(void)
void us_ticker_set_interrupt(timestamp_t timestamp)
{
TMRB_InitTypeDef m_tmrb1;
TMRB_FFOutputTypeDef FFStruct;
const uint32_t now_ticks = us_ticker_read();
uint32_t delta_ticks =
timestamp >= now_ticks ? timestamp - now_ticks : (uint32_t)((uint64_t) timestamp + 0xFFFF - now_ticks);
if (delta_ticks == 0) {
/* The requested delay is less than the minimum resolution of this counter. */
delta_ticks = 1;
}
// Ticker interrupt handle
TMRB_Enable(TSB_TB1);
TMRB_SetRunState(TSB_TB1, TMRB_STOP);
NVIC_SetVector(INTTB1_IRQn, (uint32_t)us_ticker_irq_handler);
NVIC_EnableIRQ(INTTB1_IRQn);
// Split delta for preventing the Multiply overflowing
FFStruct.FlipflopCtrl = TMRB_FLIPFLOP_CLEAR;
FFStruct.FlipflopReverseTrg = TMRB_DISABLE_FLIPFLOP;
TMRB_SetFlipFlop(TSB_TB1, &FFStruct);
// TSB_TB0 using free-run
m_tmrb1.Mode = TMRB_INTERVAL_TIMER;
m_tmrb1.ClkDiv = TMRB_CLK_DIV;
m_tmrb1.UpCntCtrl = TMRB_AUTO_CLEAR;
m_tmrb1.TrailingTiming = delta_ticks;
m_tmrb1.LeadingTiming = delta_ticks;
TMRB_Init(TSB_TB1, &m_tmrb1);
TMRB_SetINTMask(TSB_TB1,TMRB_MASK_OVERFLOW_INT | TMRB_MASK_MATCH_LEADING_INT);
// Enable TMRB when system is in idle mode
TMRB_SetIdleMode(TSB_TB1, ENABLE);
TMRB_SetRunState(TSB_TB1, TMRB_RUN);
NVIC_DisableIRQ(INTTB0_IRQn);
NVIC_ClearPendingIRQ(INTTB0_IRQn);
TMRB_ChangeTrailingTiming(TSB_TB0, timestamp);
// Mask all Interrupts except trailing edge interrupt
TMRB_SetINTMask(TSB_TB0, TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_OVERFLOW_INT);
NVIC_EnableIRQ(INTTB0_IRQn);
}
void us_ticker_fire_interrupt(void)
{
NVIC_SetPendingIRQ(INTTB1_IRQn);
NVIC_SetPendingIRQ(INTTB0_IRQn);
NVIC_EnableIRQ(INTTB0_IRQn);
}
void us_ticker_disable_interrupt(void)
{
// Also disable interrupts by NVIC
NVIC_DisableIRQ(INTTB1_IRQn);
// Mask All interrupts
TMRB_SetINTMask(TSB_TB0, TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_MATCH_TRAILING_INT | TMRB_MASK_OVERFLOW_INT);
// Also clear and disable interrupts by NVIC
NVIC_ClearPendingIRQ(INTTB0_IRQn);
NVIC_DisableIRQ(INTTB0_IRQn);
}
void us_ticker_clear_interrupt(void)
{
// No flag to clear
NVIC_ClearPendingIRQ(INTTB0_IRQn);
}
void us_ticker_free(void)
{
TMRB_SetINTMask(TSB_TB0, TMRB_MASK_MATCH_LEADING_INT | TMRB_MASK_MATCH_TRAILING_INT | TMRB_MASK_OVERFLOW_INT);
NVIC_ClearPendingIRQ(INTTB0_IRQn);
NVIC_DisableIRQ(INTTB0_IRQn);
TMRB_SetRunState(TSB_TB0, TMRB_STOP);
TMRB_Disable(TSB_TB0);
us_ticker_inited = false;
}

View File

@ -4365,7 +4365,7 @@
"extra_labels": ["TOSHIBA"],
"macros": ["__TMPM46B__"],
"supported_toolchains": ["GCC_ARM", "ARM", "IAR"],
"device_has": ["ANALOGIN", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SPI", "I2C", "STDIO_MESSAGES", "TRNG", "FLASH", "SLEEP"],
"device_has": ["USTICKER", "ANALOGIN", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SPI", "I2C", "STDIO_MESSAGES", "TRNG", "FLASH", "SLEEP"],
"device_name": "TMPM46BF10FG",
"detect_code": ["7013"],
"release_versions": ["5"],

View File

@ -142,7 +142,10 @@ class _GccParser(_Parser):
return join('[lib]', test_re_obj_name.group(2),
test_re_obj_name.group(3))
else:
print("Unknown object name found in GCC map file: %s" % line)
if (not line.startswith("LONG") and
not line.startswith("linker stubs")):
print("Unknown object name found in GCC map file: %s"
% line)
return '[misc]'
def parse_section(self, line):