dspic33_pwm_test.X/ring_buffer.c
/*! \brief RX Complete Interrupt Service Routine.
 *
 *  RX Complete Interrupt Service Routine.
 *  Stores received data in RX software buffer.
 *
 *  \param usart_data      The USART_data_t struct instance.
 */
\brief RX Complete Interrupt Service Routine.
RX Complete Interrupt Service Routine.
Stores received data in RX software buffer.


\ brief RX Complete Interrupt Service Routine . RX Complete Interrupt Service Routine . Stores received data in RX software buffer .
uint8_t rx_complete(_ring_buffer *rx, uint8_t rx_data)
{
	_ring_buffer * buf_ptr;
	volatile uint8_t ans, temp_head, temp_tail;
	buf_ptr = rx;
	 temp_head = (buf_ptr->head + 1) & USART_RX_BUFFER_MASK;
	 temp_tail = buf_ptr->tail;
	// data = usart_data->usart->DATA;
	if(temp_head == temp_tail){
	  	ans = 0;
	}else{
		ans = 1;
		rx->rx[rx->head] = rx_data;
		rx->head = temp_head;
	}
	return ans;
}
uint8_t rx_complete ( _ring_buffer * rx , uint8_t rx_data ) { _ring_buffer * buf_ptr ; volatile uint8_t ans , temp_head , temp_tail ; buf_ptr = rx ; temp_head = ( buf_ptr -> head + 1 ) & USART_RX_BUFFER_MASK ; temp_tail = buf_ptr -> tail ; if ( temp_head == temp_tail ) { ans = 0 ; } else { ans = 1 ; rx -> rx [ rx -> head ] = rx_data ; rx -> head = temp_head ; } return ans ; }
\brief RX Complete Interrupt Service Routine.
\ brief RX Complete Interrupt Service Routine .
/* Advance buffer head. */ /*uint8_t*/ /* Check for overflow. */ /*uint8_t*/ ///*uint8_t*/ data = usart_data->usart->DATA;