コード例 #1
0
void NRF24L01p::block_when_tx_mode_more_than_4ms() {

    // Timing functions are to slow and not precise enough for the Arduino
    // So we keep track how many packets have been send.
    //
    // 2 Mb/s = 250 KB/s = 250 B/s = 7.8 packets per ms (not including overhead)
    //
    // So we block the TX FIFO every 32 packets
    //
    // Todo: update timing for other speeds, as less packets will be send per ms    

    bool is_tx_fifo_empty = tx_fifo_empty();

    if (is_tx_fifo_empty) {
        fifo_tx_written_counter = 0;
    }

    if (!is_tx_fifo_empty && fifo_tx_written_counter > 32) {
        while (!tx_fifo_empty()) {
            // The nRF24L01+ transmitter PLL operates in open loop when in TX
            // mode. It is important never to keep the nRF24L01+ in TX mode for more than 4ms at a time. If the
            // Enhanced ShockBurst™ features are enabled, nRF24L01+ is never in TX mode longer than 4ms.
            // Do not use TX mode for more than 4 ms without auto acknowledgement
        }
        fifo_tx_written_counter = 0;
    }
}
コード例 #2
0
ファイル: bridge.c プロジェクト: lvjh/esp8266_ili9341
/**
  @brief Network receive callback function
  @param[in] *arg: unused
  @param[in] *data: Data received
  @param[in] length: Length of data received
  @return void
*/
MEMSPACE
static void tcp_data_receive_callback(void *arg, char *data, uint16_t length)
{
	uint16_t current;
	uint8_t byte;

// Echo debug
#if 0
	for(current = 0; current < length; current++)
		uart0_putc(data[current]);
#endif

// FIXME NOT WORKING
//
	for(current = 0; (current < length) && queue_space(uart_send_queue); current++)
	{
		byte = (uint8_t)data[current];
		queue_pushc(uart_send_queue, byte);
	}
	if(queue_empty(uart_send_queue) && tx_fifo_empty(0))
		uart_tx_disable(0);
	else
		uart_tx_enable(0);
}