Skip to content

Sync_180531 #1

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 19 commits into from
May 31, 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
4 changes: 4 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ GenF103.menu.upload_method.serialMethod=Serial
GenF103.menu.upload_method.serialMethod.upload.protocol=maple_serial
GenF103.menu.upload_method.serialMethod.upload.tool=serial_upload

GenF103.menu.upload_method.bmpMethod=BMP (Black Magic Probe)
GenF103.menu.upload_method.bmpMethod.upload.protocol=gdb_bmp
GenF103.menu.upload_method.bmpMethod.upload.tool=bmp_upload

###############################
# Maple
Maple.name=Maple series
Expand Down
11 changes: 11 additions & 0 deletions cores/arduino/HardwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ void HardwareSerial::init(void)
_serial.tx_tail = 0;
}

void HardwareSerial::configForLowPower(void)
{
#if defined(HAL_PWR_MODULE_ENABLED) && defined(UART_IT_WUF)
// Reconfigure properly Serial instance to use HSI as clock source
end();
uart_config_lowpower(&_serial);
begin(_serial.baudrate, _config);
#endif
}

// Actual interrupt handlers //////////////////////////////////////////////////////////////

void HardwareSerial::_rx_complete_irq(serial_t* obj)
Expand Down Expand Up @@ -226,6 +236,7 @@ void HardwareSerial::begin(unsigned long baud, byte config)
uint32_t databits = 0;

_serial.baudrate = (uint32_t)baud;
_config = config;

// Manage databits
switch(config & 0x07) {
Expand Down
4 changes: 4 additions & 0 deletions cores/arduino/HardwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,15 @@ class HardwareSerial : public Stream
void setRx(PinName _rx);
void setTx(PinName _tx);

friend class STM32LowPower;

// Interrupt handlers
static void _rx_complete_irq(serial_t* obj);
static int _tx_complete_irq(serial_t* obj);
private:
uint8_t _config;
void init(void);
void configForLowPower(void);
};

extern HardwareSerial Serial1;
Expand Down
1 change: 1 addition & 0 deletions cores/arduino/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ extern "C"{
#include "digital_io.h"
#include "hal_uart_emul.h"
#include "hw_config.h"
#include "low_power.h"
#include "rtc.h"
#include "spi_com.h"
#include "stm32_eeprom.h"
Expand Down
9 changes: 9 additions & 0 deletions cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ void initVariant() { }
// Required by FreeRTOS, see http://www.freertos.org/RTOS-Cortex-M3-M4.html
#ifdef NVIC_PRIORITYGROUP_4
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
#endif
#if (__CORTEX_M == 0x07U)
// Defined in CMSIS core_cm7.h
#ifndef I_CACHE_DISABLED
SCB_EnableICache();
#endif
#ifndef D_CACHE_DISABLED
SCB_EnableDCache();
#endif
#endif

init();
Expand Down
10 changes: 8 additions & 2 deletions cores/arduino/stm32/PinNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ extern "C" {
#endif

typedef enum {
// Not connected
NC = (int)0xFFFFFFFF,

// Pin name definition
PA_0 = (PortA << 4) + 0x00,
PA_1 = (PortA << 4) + 0x01,
PA_2 = (PortA << 4) + 0x02,
Expand Down Expand Up @@ -205,8 +208,11 @@ typedef enum {
PK_14 = (PortK << 4) + 0x0E,
PK_15 = (PortK << 4) + 0x0F,
#endif
// Not connected
NC = (int)0xFFFFFFFF
// Specific pin name define in the variant
#if __has_include("PinNamesVar.h")
#include "PinNamesVar.h"
#endif
P_END = NC
} PinName;

#ifdef __cplusplus
Expand Down
Loading