示例#1
0
/* ===================================================================*/
void AS1_OnBlockReceived(LDD_TUserData *UserDataPtr)
{
	  UART_Desc *ptr = (UART_Desc*)UserDataPtr;

	  (void)AS1_ReceiveBlock(ptr->handle, (LDD_TData *)&ptr->rxChar, sizeof(ptr->rxChar));
	  (void)ptr->rxPutFct(ptr->rxChar); /* but received character into buffer */
}
static void Init(void) {
    /* initialize struct fields */
    deviceData.handle = AS1_Init(&deviceData);
    deviceData.isSent = FALSE;
    deviceData.rxChar = '\0';
    deviceData.rxPutFct = RxBuf_Put;
    /* set up to receive RX into input buffer */
    RxBuf_Init(); /* initialize RX buffer */
    /* Set up ReceiveBlock() with a single byte buffer. We will be called in OnBlockReceived() event. */
    while(AS1_ReceiveBlock(deviceData.handle, (LDD_TData *)&deviceData.rxChar, sizeof(deviceData.rxChar))!=ERR_OK) {} /* initial kick off for receiving data */
}
示例#3
0
static void Init(void) {
	Frame.Data = rxbuffer; /* Set pointer to OutData buffer */

	// Inicializacion UART
	uartData.handle = AS1_Init(&uartData);
	uartData.isSent = FALSE;
	uartData.rxChar = '\0';
	uartData.rxPutFct = UART_RxBuff_Put;

	canData.handle = CAN1_Init(&canData);
	canData.isSent = FALSE;
	canData.rxChar = '\0';
	canData.rxPutFct = CAN_RxBuff_Put;

	/* set up to receive RX into input buffer */
	UART_RxBuff_Init(); /* initialize RX buffer */
	CAN_RxBuff_Init(); /* initialize RX buffer */

	/* Set up ReceiveBlock() with a single byte buffer. We will be called in OnBlockReceived() event. */
	while (AS1_ReceiveBlock(uartData.handle, (LDD_TData *) &uartData.rxChar,
			sizeof(uartData.rxChar)) != ERR_OK) {
	} /* initial kick off for receiving data */
}
示例#4
0
float rotSpeed = 0;
float penSpeed = 0;  // these are local variables for Function SteppermotorMove-Command, but for performance-reasons it will be initialized here

static void Init(void)
{
  /* initialize struct fields */
  deviceData.handle = AS1_Init (&deviceData);
  deviceData.isSent = FALSE;
  deviceData.rxChar = '\0';
  deviceData.rxPutFct = RxBuf_Put;

  /* set up to receive RX into input buffer */
  //  RxBuf_Init(); /* initialize RX buffer */
  /* Set up ReceiveBlock() with a single byte buffer. We will be called in OnBlockReceived() event. */
  while (AS1_ReceiveBlock (deviceData.handle, (LDD_TData *) &deviceData.rxChar,
                           sizeof(deviceData.rxChar)) != ERR_OK)
  {
  } /* initial kick off for receiving data */


  AccelStepper_Init (&rotMotor, STEP1_PIN, DIR1_PIN);
  AccelStepper_Init (&penMotor, STEP2_PIN, DIR2_PIN);