diff options
author | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-19 10:53:07 +0000 |
---|---|---|
committer | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-19 10:53:07 +0000 |
commit | acf59b1abb346998c492b93fee4a680a32f538d5 (patch) | |
tree | c49dd57f489769608095736457a0db9350868a47 /src/wiring/comm/Serial.cpp | |
parent | af4c4985cef82b80b936584d686c80d9538082b6 (diff) | |
download | librambutan-acf59b1abb346998c492b93fee4a680a32f538d5.tar.gz librambutan-acf59b1abb346998c492b93fee4a680a32f538d5.zip |
Added licensing. Moved lots of header files around. Added HardwareSerial reads, writes. Tweaked some of the util and assert functions. Added various useful routines for printing stuff to the serial port. Continued moving out stm32lib. Slightly more consistent naming, this will come in another change.
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@74 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/wiring/comm/Serial.cpp')
-rw-r--r-- | src/wiring/comm/Serial.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/wiring/comm/Serial.cpp b/src/wiring/comm/Serial.cpp deleted file mode 100644 index 3c43436..0000000 --- a/src/wiring/comm/Serial.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//#include "stm32f10x_usart.h" -#include "stm32f10x_gpio.h" -#include "stm32f10x_rcc.h" -#include "gpio.h" -#include "Serial.h" -#include "wiring.h" - -int SendChar (int ch) { - /* Write character to Serial Port */ -// USART_SendData(USART2, (unsigned char) ch); -// while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) == RESET) -// ; -// -// // while (!(USART2->SR & USART_FLAG_TXE)); -// return (ch); -} - -void uart_send(const char* str) { - while (*str != '\0') { - SendChar(*str); - str++; - } -} - - -Serial::Serial() { -} - -void Serial::write(uint8_t c) { - SendChar(c); -} - -void Serial::begin(uint32_t baud) { - // USART_InitTypeDef USART_InitStructure; - - /* Turn on the clock */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); - -#if 0 - /* Configure USART2 Tx as alternate function push-pull */ - GPIO_InitTypeDef GPIO_InitStructure; - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; - GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; - GPIO_Init(GPIOA, &GPIO_InitStructure); - - /* Configure USART2 Rx as input floating */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_Init(GPIOA, &GPIO_InitStructure); -#endif - - pinMode(1, GPIO_MODE_AF_OUTPUT_PP); - pinMode(0, GPIO_MODE_INPUT_FLOATING); - - /* Enable USART2 */ -// USART_InitStructure.USART_BaudRate = baud; -// USART_InitStructure.USART_WordLength = USART_WordLength_8b; -// USART_InitStructure.USART_StopBits = USART_StopBits_1; -// USART_InitStructure.USART_Parity = USART_Parity_No ; -// USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; -// USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; -// USART_Init(USART2, &USART_InitStructure); -// USART_Cmd(USART2, ENABLE); -} - -Serial Serial1; |