Пример #1
0
void Usart3Put(uint8_t ch)
{
	//put char to the buffer
	BufferPut(&U3Tx, ch);
	//enable Transmit Data Register empty interrupt
	USART_ITConfig(USART3, USART_IT_TXE, ENABLE);
}
Пример #2
0
JNIEXPORT void JNICALL Java_com_aio4c_buffer_Buffer_putLong(JNIEnv* jvm, jobject buffer, jlong l) {
    Buffer* _buffer = _GetBuffer(jvm, buffer);

    if (!BufferPut(_buffer, &l, sizeof(jlong))) {
        _ThrowBufferOverflow(jvm, buffer);
    }
}
Пример #3
0
void USART1_IRQHandler(void)
{
  portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

  // Code from Original ISR
       uint8_t ch;
       //if Receive interrupt
       if (USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
         {
           ch=(uint8_t)USART_ReceiveData(USART1);
           //put char to the buffer
           BufferPut(&U1Rx, ch);
           xSemaphoreGiveFromISR( xSerialHandlerSemaphore, & xHigherPriorityTaskWoken);
         }
       if (USART_GetITStatus(USART1, USART_IT_TXE) != RESET)
         {
           if (BufferGet(&U1Tx, &ch) == SUCCESS)//if buffer read
             {
               USART_SendData(USART1, ch);
             }
           else//if buffer empty
             {
               //disable Transmit Data Register empty interrupt
               USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
             }
         }



  portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
}
Пример #4
0
/**
  * @brief  This function handles USART1 global interrupt request.
  * @param  None
  * @retval None
  */
void USART1_IRQHandler(void)
{
  uint8_t ch;
  printf("interrupt \n");
  if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
  {
    /* Read one byte from the receive data register */
    ch = USART_ReceiveData(USART1);
    //put char to the buffer
    BufferPut(&U1Rx, ch);
    //printf("\n get new value %d",INSTR); debug purpose
  }
}
Пример #5
0
void comm_put(char d)
{

#ifdef BUFFERED
        //put char to the buffer
        BufferPut(&U1Tx, d);
        //enable Transmit Data Register empty interrupt
        USART_ITConfig(USART1, USART_IT_TXE, ENABLE);
#else
          USART_SendData(USART1, (uint8_t) d);
          //Loop until the end of transmission
          while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)
          {
          }
#endif
/*
        while(USART_GetFlagStatus(g_usart, USART_FLAG_TXE) == RESET) { ; }
        USART_SendData(g_usart, (uint16_t)d);*/
}