min.c
void min_tx_frame(uint8_t id, uint8_t payload[], uint8_t length)
{
	uint8_t n, i;
	uint16_t checksum;


	tx_header_byte_countdown = 2U;
	fletcher16_tx_init();

	/* Header is 3 bytes; because unstuffed will reset receiver immediately */
	min_tx_byte(HEADER_BYTE);
	min_tx_byte(HEADER_BYTE);
	min_tx_byte(HEADER_BYTE);

	stuffed_tx_byte(id);

	stuffed_tx_byte(length);

	for(i = 0, n = length; n > 0; n--, i++) {
		stuffed_tx_byte(payload[i]);
	}

	checksum = fletcher16_tx_finalize();

	/* Network order is big-endian */
	stuffed_tx_byte(checksum >> 8);
	stuffed_tx_byte(checksum &0x00ff);

	/* Ensure end-of-frame doesn't contain 0xaa and confuse search for start-of-frame */
	min_tx_byte(EOF_BYTE);
}
/* Main transmit function. Calls out to a byte transmit function,
 * typically connected to a FIFO with a UART driver.
 *
 * payload is a pointer to a buffer containing the rest of the payload,
 * and id is the frame ID within a message set.
 *
 * control encodes the length of the frame in the bottom four bits. The
 * top four bits are reserved and must be passed through unchanged.
 *
 * Frames should not be transmitted until sending is enabled (so that
 * the system can be quiescent until other devices have initialized).
 *
 */
Main transmit function. Calls out to a byte transmit function,
typically connected to a FIFO with a UART driver.

payload is a pointer to a buffer containing the rest of the payload,
and id is the frame ID within a message set.

control encodes the length of the frame in the bottom four bits. The
top four bits are reserved and must be passed through unchanged.

Frames should not be transmitted until sending is enabled (so that
the system can be quiescent until other devices have initialized).
Main transmit function . Calls out to a byte transmit function typically connected to a FIFO with a UART driver . payload is a pointer to a buffer containing the rest of the payload and id is the frame ID within a message set . control encodes the length of the frame in the bottom four bits . The top four bits are reserved and must be passed through unchanged . Frames should not be transmitted until sending is enabled ( so that the system can be quiescent until other devices have initialized ) .
void min_tx_frame(uint8_t id, uint8_t payload[], uint8_t length)
{
	uint8_t n, i;
	uint16_t checksum;
	tx_header_byte_countdown = 2U;
	fletcher16_tx_init();
	min_tx_byte(HEADER_BYTE);
	min_tx_byte(HEADER_BYTE);
	min_tx_byte(HEADER_BYTE);
	stuffed_tx_byte(id);
	stuffed_tx_byte(length);
	for(i = 0, n = length; n > 0; n--, i++) {
		stuffed_tx_byte(payload[i]);
	}
	checksum = fletcher16_tx_finalize();
	stuffed_tx_byte(checksum >> 8);
	stuffed_tx_byte(checksum &0x00ff);
	min_tx_byte(EOF_BYTE);
}
void min_tx_frame ( uint8_t id , uint8_t payload [ ] , uint8_t length ) { uint8_t n , i ; uint16_t checksum ; tx_header_byte_countdown = 2U ; fletcher16_tx_init ( ) ; min_tx_byte ( HEADER_BYTE ) ; min_tx_byte ( HEADER_BYTE ) ; min_tx_byte ( HEADER_BYTE ) ; stuffed_tx_byte ( id ) ; stuffed_tx_byte ( length ) ; for ( i = 0 , n = length ; n > 0 ; n -- , i ++ ) { stuffed_tx_byte ( payload [ i ] ) ; } checksum = fletcher16_tx_finalize ( ) ; stuffed_tx_byte ( checksum >> 8 ) ; stuffed_tx_byte ( checksum & 0x00ff ) ; min_tx_byte ( EOF_BYTE ) ; }
Main transmit function.
Main transmit function .
/* Header is 3 bytes; because unstuffed will reset receiver immediately */ /* Network order is big-endian */ /* Ensure end-of-frame doesn't contain 0xaa and confuse search for start-of-frame */