Made changes for Nucleo F103RB and Generic STM32F103C . Note this commit only works with these 2 boards, on all others Serial will not compile
This commit is contained in:
parent
39b200982a
commit
a1fdae2817
|
@ -37,6 +37,8 @@
|
||||||
#include <libmaple/timer.h>
|
#include <libmaple/timer.h>
|
||||||
#include <libmaple/usart.h>
|
#include <libmaple/usart.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
#define DEFINE_HWSERIAL(name, n) \
|
#define DEFINE_HWSERIAL(name, n) \
|
||||||
HardwareSerial name(USART##n, \
|
HardwareSerial name(USART##n, \
|
||||||
BOARD_USART##n##_TX_PIN, \
|
BOARD_USART##n##_TX_PIN, \
|
||||||
|
@ -86,6 +88,8 @@
|
||||||
DEFINE_HWSERIAL_UART(Serial5, 6);
|
DEFINE_HWSERIAL_UART(Serial5, 6);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
HardwareSerial::HardwareSerial(usart_dev *usart_device,
|
HardwareSerial::HardwareSerial(usart_dev *usart_device,
|
||||||
uint8 tx_pin,
|
uint8 tx_pin,
|
||||||
uint8 rx_pin) {
|
uint8 rx_pin) {
|
||||||
|
|
|
@ -100,6 +100,20 @@ struct usart_dev;
|
||||||
#define SERIAL_9O2 0B00101011
|
#define SERIAL_9O2 0B00101011
|
||||||
|
|
||||||
|
|
||||||
|
/* Roger Clark
|
||||||
|
* Moved macros from hardwareSerial.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DEFINE_HWSERIAL(name, n) \
|
||||||
|
HardwareSerial name(USART##n, \
|
||||||
|
BOARD_USART##n##_TX_PIN, \
|
||||||
|
BOARD_USART##n##_RX_PIN)
|
||||||
|
|
||||||
|
#define DEFINE_HWSERIAL_UART(name, n) \
|
||||||
|
HardwareSerial name(UART##n, \
|
||||||
|
BOARD_USART##n##_TX_PIN, \
|
||||||
|
BOARD_USART##n##_RX_PIN)
|
||||||
|
|
||||||
|
|
||||||
/* Roger clark. Changed class inheritance from Print to Stream.
|
/* Roger clark. Changed class inheritance from Print to Stream.
|
||||||
* Also added new functions for peek() and availableForWrite()
|
* Also added new functions for peek() and availableForWrite()
|
||||||
|
|
|
@ -35,6 +35,10 @@
|
||||||
#include <libmaple/gpio.h>
|
#include <libmaple/gpio.h>
|
||||||
#include <libmaple/timer.h>
|
#include <libmaple/timer.h>
|
||||||
|
|
||||||
|
/* Roger Clark. Added next to includes for changes to Serial */
|
||||||
|
#include <libmaple/usart.h>
|
||||||
|
#include <HardwareSerial.h>
|
||||||
|
|
||||||
#include <wirish_debug.h>
|
#include <wirish_debug.h>
|
||||||
#include <wirish_types.h>
|
#include <wirish_types.h>
|
||||||
|
|
||||||
|
@ -109,3 +113,27 @@ extern const uint8 boardADCPins[BOARD_NR_ADC_PINS] __FLASH__ = {
|
||||||
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
|
extern const uint8 boardUsedPins[BOARD_NR_USED_PINS] __FLASH__ = {
|
||||||
USB_DP, USB_DM
|
USB_DP, USB_DM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Roger Clark
|
||||||
|
*
|
||||||
|
* 2015/05/28
|
||||||
|
*
|
||||||
|
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
|
||||||
|
* Maps to which hardware serial port on the microprocessor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef SERIAL_USB
|
||||||
|
DEFINE_HWSERIAL(Serial1, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial2, 2);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial3, 3);
|
||||||
|
#else
|
||||||
|
DEFINE_HWSERIAL(Serial, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial1, 2);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial2, 3);
|
||||||
|
#endif
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
#include <libmaple/gpio.h>
|
#include <libmaple/gpio.h>
|
||||||
#include <libmaple/timer.h>
|
#include <libmaple/timer.h>
|
||||||
|
|
||||||
|
/* Roger Clark. Added next to includes for changes to Serial */
|
||||||
|
#include <libmaple/usart.h>
|
||||||
|
#include <HardwareSerial.h>
|
||||||
|
|
||||||
|
|
||||||
#include <wirish_debug.h>
|
#include <wirish_debug.h>
|
||||||
#include <wirish_types.h>
|
#include <wirish_types.h>
|
||||||
// boardInit(): NUCLEO rely on some remapping
|
// boardInit(): NUCLEO rely on some remapping
|
||||||
|
@ -231,3 +236,28 @@ MOSI alternate functions on the GPIO ports.
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Roger Clark
|
||||||
|
*
|
||||||
|
* 2015/05/28
|
||||||
|
*
|
||||||
|
* Moved definitions for Hardware Serial devices from HardwareSerial.cpp so that each board can define which Arduino "Serial" instance
|
||||||
|
* Maps to which hardware serial port on the microprocessor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef SERIAL_USB
|
||||||
|
DEFINE_HWSERIAL(Serial1, 2);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial2, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial3, 3);
|
||||||
|
#else
|
||||||
|
DEFINE_HWSERIAL(Serial, 2);// Use HW Serial 2 as "Serial"
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial1, 1);
|
||||||
|
|
||||||
|
DEFINE_HWSERIAL(Serial2, 3);
|
||||||
|
#endif
|
Loading…
Reference in New Issue