Subversion Repositories libSerial

Rev

Rev 5 | Rev 7 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line 137... Line 137...
137
  __disable_irq ();
137
  __disable_irq ();
138
  uint32_t rxStatus;    // status from USART receiver
138
  uint32_t rxStatus;    // status from USART receiver
139
 
139
 
140
  rxStatus = instance->Handle->Instance->SR;// read the status bits - this resets all the hardware signalling flags
140
  rxStatus = instance->Handle->Instance->SR;// read the status bits - this resets all the hardware signalling flags
141
 
141
 
-
 
142
  if ((rxStatus & USART_SR_LBD))
-
 
143
      __HAL_UART_CLEAR_FLAG(instance->Handle,USART_SR_LBD);
-
 
144
 
142
  if ((rxStatus & USART_SR_RXNE)!= RESET)
145
  if ((rxStatus & USART_SR_RXNE)!= RESET)
143
    {
146
    {
144
      // no error has occurred...
147
      // no error has occurred...
145
      uint8_t rxChar = (uint8_t) (instance->Handle->Instance->DR & 0xff);// read the bottom 8-bits only
148
      uint8_t rxChar = (uint8_t) (instance->Handle->Instance->DR & 0xff);// read the bottom 8-bits only
146
 
149
 
Line 157... Line 160...
157
              instance->rx_usart_buffer_full = 1; /* buffer overrun */
160
              instance->rx_usart_buffer_full = 1; /* buffer overrun */
158
            }
161
            }
159
        }
162
        }
160
    }
163
    }
161
  /* check for transmitter interrupt : this code is used */
164
  /* check for transmitter interrupt : this code is used */
162
  if (instance->tx_usart_running && ((rxStatus & USART_SR_TXE) != RESET))
165
  if ((rxStatus & USART_SR_TXE) != RESET)
163
    {
166
    {
164
 
167
 
-
 
168
 
165
      /* Only enable the transmitter when baud detect has completed or check expired.
169
      /* Only enable the transmitter when baud detect has completed or check expired.
166
       * and the software is ready for it to be enabled as programming mode is wanting
170
       * and the software is ready for it to be enabled as programming mode is wanting
167
       * to receive a response and that can get blocked if we're streaming a lot of debug messages*/
171
       * to receive a response and that can get blocked if we're streaming a lot of debug messages*/
168
      if (instance->tx_usart_in_Ptr != instance->tx_usart_out_Ptr)
172
      if (instance->tx_usart_in_Ptr != instance->tx_usart_out_Ptr)
169
        {
173
        {
Line 175... Line 179...
175
          if (instance->tx_usart_out_Ptr >= TX_USART_BUFF_SIZ)
179
          if (instance->tx_usart_out_Ptr >= TX_USART_BUFF_SIZ)
176
            {
180
            {
177
              instance->tx_usart_out_Ptr = 0;
181
              instance->tx_usart_out_Ptr = 0;
178
            }
182
            }
179
        }
183
        }
180
      else
184
      if (instance->tx_usart_count == 0)
181
        {
185
        {
182
          __HAL_UART_DISABLE_IT (instance->Handle, UART_IT_TXE);
186
          __HAL_UART_DISABLE_IT (instance->Handle, UART_IT_TXE);
183
          instance->tx_usart_running = 0;
187
          instance->tx_usart_running = 0;
184
        }
188
        }
185
    }
189
    }