Added dummy parameter to HardwareSerial begin() for device config. This is a work in progress, the config value is not used to control the hardware yet
This commit is contained in:
parent
0ca64e1a9a
commit
244674ca81
|
@ -108,8 +108,20 @@ static void disable_timer_if_necessary(timer_dev *dev, uint8 ch) {
|
|||
#warning "Unsupported STM32 series; timer conflicts are possible"
|
||||
#endif
|
||||
|
||||
void HardwareSerial::begin(uint32 baud) {
|
||||
ASSERT(baud <= this->usart_device->max_baud);
|
||||
void HardwareSerial::begin(uint32 baud)
|
||||
{
|
||||
begin(baud,SERIAL_8N1);
|
||||
}
|
||||
/*
|
||||
* Roger Clark.
|
||||
* Note. The config parameter is not currently used. This is a work in progress.
|
||||
* Code needs to be written to set the config of the hardware serial control register in question.
|
||||
*
|
||||
*/
|
||||
|
||||
void HardwareSerial::begin(uint32 baud, uint8_t config)
|
||||
{
|
||||
// ASSERT(baud <= this->usart_device->max_baud);// Roger Clark. Assert doesn't do anything useful, we may as well save the space in flash and ram etc
|
||||
|
||||
if (baud > this->usart_device->max_baud) {
|
||||
return;
|
||||
|
|
|
@ -76,6 +76,37 @@ typedef uint8_t rx_buffer_index_t;
|
|||
|
||||
struct usart_dev;
|
||||
|
||||
/* Roger Clark
|
||||
*
|
||||
* Added config defines from AVR
|
||||
* Note. The values will need to be changed to match STM32 USART config register values, these are just place holders.
|
||||
*/
|
||||
// Define config for Serial.begin(baud, config);
|
||||
#define SERIAL_5N1 0x00
|
||||
#define SERIAL_6N1 0x02
|
||||
#define SERIAL_7N1 0x04
|
||||
#define SERIAL_8N1 0x06
|
||||
#define SERIAL_5N2 0x08
|
||||
#define SERIAL_6N2 0x0A
|
||||
#define SERIAL_7N2 0x0C
|
||||
#define SERIAL_8N2 0x0E
|
||||
#define SERIAL_5E1 0x20
|
||||
#define SERIAL_6E1 0x22
|
||||
#define SERIAL_7E1 0x24
|
||||
#define SERIAL_8E1 0x26
|
||||
#define SERIAL_5E2 0x28
|
||||
#define SERIAL_6E2 0x2A
|
||||
#define SERIAL_7E2 0x2C
|
||||
#define SERIAL_8E2 0x2E
|
||||
#define SERIAL_5O1 0x30
|
||||
#define SERIAL_6O1 0x32
|
||||
#define SERIAL_7O1 0x34
|
||||
#define SERIAL_8O1 0x36
|
||||
#define SERIAL_5O2 0x38
|
||||
#define SERIAL_6O2 0x3A
|
||||
#define SERIAL_7O2 0x3C
|
||||
#define SERIAL_8O2 0x3E
|
||||
|
||||
/* Roger clark. Changed class inheritance from Print to Stream.
|
||||
* Also added new functions for peek() and availableForWrite()
|
||||
* Note. AvailableForWrite is only a stub function in the cpp
|
||||
|
@ -89,6 +120,7 @@ public:
|
|||
|
||||
/* Set up/tear down */
|
||||
void begin(uint32 baud);
|
||||
void begin(uint32 baud,uint8_t config);
|
||||
void end();
|
||||
virtual int available(void);
|
||||
virtual int peek(void);
|
||||
|
|
Loading…
Reference in New Issue