[sky9x] Issue 142 fixed
[sky9x] Tada was cut [sky9x] Issue 99 fixed [sky9x / gruvin9x] Menu popup has now a scrollbar on the right [sky9x] WDT was not working at all
This commit is contained in:
+43
-1
@@ -82,6 +82,49 @@ void dump(unsigned char *data, unsigned int size)
|
||||
debugPuts("\n\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a UART peripheral with the specified parameters.
|
||||
*
|
||||
* baudrate Baudrate at which the UART should operate (in Hz).
|
||||
* masterClock Frequency of the system master clock (in Hz).
|
||||
* uses PA9 and PA10, RXD2 and TXD2
|
||||
*/
|
||||
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock)
|
||||
{
|
||||
register Uart *pUart = CONSOLE_USART;
|
||||
|
||||
/* Configure PIO */
|
||||
configure_pins( (PIO_PA9 | PIO_PA10), PIN_PERIPHERAL | PIN_INPUT | PIN_PER_A | PIN_PORTA | PIN_NO_PULLUP ) ;
|
||||
|
||||
/* Configure PMC */
|
||||
PMC->PMC_PCER0 = 1 << CONSOLE_ID;
|
||||
|
||||
/* Reset and disable receiver & transmitter */
|
||||
pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX
|
||||
| UART_CR_RXDIS | UART_CR_TXDIS;
|
||||
|
||||
/* Configure mode */
|
||||
pUart->UART_MR = 0x800 ; // NORMAL, No Parity
|
||||
|
||||
/* Configure baudrate */
|
||||
/* Asynchronous, no oversampling */
|
||||
pUart->UART_BRGR = (masterClock / baudrate) / 16;
|
||||
|
||||
/* Disable PDC channel */
|
||||
pUart->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS;
|
||||
|
||||
/* Enable receiver and transmitter */
|
||||
pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
|
||||
pUart->UART_IER = UART_IER_RXRDY ;
|
||||
NVIC_EnableIRQ(UART0_IRQn) ;
|
||||
}
|
||||
|
||||
void DEBUG_UART_Stop()
|
||||
{
|
||||
CONSOLE_USART->UART_IDR = UART_IDR_RXRDY ;
|
||||
NVIC_DisableIRQ(UART0_IRQn) ;
|
||||
}
|
||||
|
||||
Fifo32 debugFifo;
|
||||
|
||||
extern "C" void UART0_IRQHandler()
|
||||
@@ -89,7 +132,6 @@ extern "C" void UART0_IRQHandler()
|
||||
debugFifo.push(CONSOLE_USART->UART_RHR);
|
||||
}
|
||||
|
||||
|
||||
void debugTask(void* pdata)
|
||||
{
|
||||
uint8_t rxchar ;
|
||||
|
||||
Reference in New Issue
Block a user