Continued work on MAX5715. MACRO functions are done, mostly tested in logic analyzer. SPI unable to work with hardware SS, so software SS is used instead

Added UART3 on PB10/PB11 for terminal (future use)

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@225 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-09-29 14:42:38 +00:00
parent b56bc71f36
commit f44979bf75
15 changed files with 412 additions and 95 deletions

View File

@@ -172,6 +172,58 @@ void USART1_IRQHandler(void)
}
/** ----------------------------------------------------------------------------
* @brief Function: USART3_IRQHandler
*
* Dedicated Interrupt Service Routine for USART3
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
void USART3_IRQHandler(void)
{
static signed portBASE_TYPE higherPriorityTaskWoken = pdFALSE;
//! Transmission register empty interrupt
if(USART_GetITStatus(USART3, USART_IT_TXE) != RESET)
{
//! Receive element from usart transmission queue
struct usartQueueItem usartTxItem;
xQueueReceiveFromISR(uart3->txQueue, &usartTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
USART_SendData(USART3, usartTxItem.byte);
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(uart3->txQueue))
{
//! Disable the COMPORT Transmit interrupt and release semaphore
USART_ITConfig(USART3, USART_IT_TXE, DISABLE);
xSemaphoreGiveFromISR(uart3->txSemaphore, &higherPriorityTaskWoken);
}
}
//! Current interrupt is triggered by USART_RXNE (receive register not empty)
if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET)
{
//! Read one byte from the receive data register
struct usartQueueItem usartRxItem;
//! Reading from reception register automatically clears the RXNE interrupt
usartRxItem.byte = (unsigned char) 0xFF & USART_ReceiveData(USART3);
//! Add the byte to the bluetooth RX queue
//! In case of a full queue, the data is dumped
(void)xQueueSendFromISR(uart3->rxQueue, &usartRxItem, &higherPriorityTaskWoken);
}
portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}
/** ----------------------------------------------------------------------------
* @brief Function: SPI1_IRQHandler
*
@@ -195,15 +247,7 @@ void SPI1_IRQHandler (void)
xQueueReceiveFromISR(spi1->txQueue, &spiTxItem, &higherPriorityTaskWoken);
//! Write one byte to the transmit data register
if (spi1->SPI_InitStruct.SPI_NSS == SPI_NSS_Soft)
{
GPIO_ResetBits(spi1->SPI_CE->GPIO_Typedef, spi1->SPI_CE->GPIO_InitStruct.GPIO_Pin);
}
SPI_I2S_SendData(SPI1, spiTxItem.byte);
if (spi1->SPI_InitStruct.SPI_NSS == SPI_NSS_Soft)
{
GPIO_SetBits(spi1->SPI_CE->GPIO_Typedef, spi1->SPI_CE->GPIO_InitStruct.GPIO_Pin);
}
//! check if queue is empty -> all bytes transmit
if(pdTRUE == xQueueIsQueueEmptyFromISR(spi1->txQueue))
{