Ejemplo n.º 1
0
void main(void) {
/* USER CODE BEGIN (3) */

	/* Initialize sci for communication over USB */
	sciInit();
	sciSend(scilinREG,19,(unsigned char *)"CAN code start...\r\n");
	printf("Code start...\r\n");

	/* enable irq interrupt in Cortex R4 */
    _enable_interrupt_();

    /** - writing a random data in RAM - to transmit */
    //dumpSomeData();

    /** - configuring CAN1 MB1,Msg ID-1 to transmit and CAN2 MB1 to receive */
    canInit();

    /** - enabling error interrupts */
    canEnableErrorNotification(canREG1);
	canEnableErrorNotification(canREG2);

	//while(1){}; /* wait forever after tx-rx complete. */


	//ADC stuff
	adcInit();
	adcData_t adc_data[16];
	adcData_t *ptr = &adc_data[0];
	int j;
	uint8 tx_data[D_COUNT][8];
	uint8 *tx_ptr = &tx_data[0][0];
	while(1) {
		for(j=0U;j<15000;j++){
			adc_convert_all_channels(ptr);
			int i;
			for(i=0;i<sizeof(adc_data)/sizeof(adc_data[0]);i++) {
				can_transmit_recieve(canREG1, canMESSAGE_BOX1, &adc_data[i]);
			}
		}
		//for(i=0;i<sizeof(tx_data)/sizeof(tx_data[0]);i++) {
		//	can_transmit_recieve(canREG1, canMESSAGE_BOX1, &tx_data[i]);
		//}
	}
    //exit(0);
/* USER CODE END */
}
Ejemplo n.º 2
0
/**
 * @brief   Send debug text API.
 *
 * @description The API can be used by TPS driver to send the debug text buffer.The Application\n
 *              should appropriately make use of the debug information.
 *
 * @image html  todo
 * @image rtf   todo
 * @image latex todo
 *
 * @param [in]  *u8textbuf pointer to text buffer
 * @param [in]  u32textlength length of the text buffer
 *
 * @return      TRUE : no errors
 *              FALSE: Errors in execution
 *
 * Example Usage:
 * @code
 *      todo
 * @endcode
 *
 * @entrymode   todo
 * @exitmode    todo
 *
 * @seealso     todo
 *
 * **Note: todo**
 *
 * @destag      todo
 * @reqtag      todo
 */
boolean SendDebugTextTPS(const uint8 * const u8textbuf,const uint32 u32textlength)
{
    boolean blRetVal = TRUE;
    sciSend(sciREG, u32textlength, (uint8*)u8textbuf);
    return blRetVal;
}