Exemplo n.º 1
0
static void SendChar(unsigned char ch, UART_Desc *desc) {
	desc->isSent = FALSE; /* this will be set to 1 once the block has been sent */
	while (AS1_SendBlock(desc->handle, (LDD_TData*) &ch, 1) != ERR_OK) {
	} /* Send char */
	while (!desc->isSent) {
	} /* wait until we get the green flag from the TX interrupt */
}
Exemplo n.º 2
0
void GetConvolutionResultPacketHandler(void)
{
  Communication.Error = AS1_SendBlock(AS1_DeviceData, &Camera.ConvolutionResult[0], PIXEL_NUM);
  if(Communication.Error) {

  }  
}
Exemplo n.º 3
0
void GetCameraDataPacketHandler(void)
{
  Communication.Error = AS1_SendBlock(AS1_DeviceData, &Camera.readPointerToBuffer[0], PIXEL_NUM);
  if(Communication.Error) {

  }
}
Exemplo n.º 4
0
/* ===================================================================*/
void AS1_OnBlockReceived(LDD_TUserData *UserDataPtr)
{
	/* Write your code here ... */
	char *TEXTO[40];
	sprintf (TEXTO, "Recbido %s\n\r", UserDataPtr );
	AS1_SendBlock(NULL, TEXTO, sizeof(TEXTO));
    LED_VERD_On();WAIT1_Waitms(200);LED_VERD_Off();
}
Exemplo n.º 5
0
void GetAccelerometerDataPacketHandler(void)
{
  sprintf(&Communication.CommunicationString[0], "%i %i %i\n", Accelerometer.X, Accelerometer.Y, Accelerometer.Z);
  Communication.Error = AS1_SendBlock(AS1_DeviceData, &Communication.CommunicationString[0], strlen(Communication.CommunicationString));
  if(Communication.Error) {

  }
}
Exemplo n.º 6
0
Arquivo: Events.c Projeto: ducis/HCS
/*
** ===================================================================
**     Event       :  AS1_OnIdle (module Events)
**
**     From bean   :  AS1 [AsynchroSerial]
**     Description :
**         This event is called when an idle condition on the
**         receiver is detected.
**         The event is available only when both <Interrupt
**         service/event> and <Receiver > properties are enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void  AS1_OnIdle(void)
{
  /* Write your code here ... */       
  extern float timecoefficient;
  if(AS1_GetCharsInRxBuf()>0){ 
    unsigned char cmd=255;
    AS1_RecvChar(&cmd);
    if(cmd==0){//handshake
      unsigned char t=0;
      unsigned char rply[2]={0};
      unsigned short x;
      //unsigned char r;
      x=AS1_RecvChar(&t);
      rply[1]=(t+17)&0xff;
      AS1_SendBlock(rply,2,&x);
    }else if(cmd==1){//general query
      word x;
      byte t[4];
      AS1_RecvBlock(t,4,&x);
      AS1_SendBlock((byte*)(t[0]+(t[1]<<8)),t[2]+(t[3]<<8),&x);
    }else if(cmd==2){//inc
      timecoefficient+=0.00001f;
    }else if(cmd==3){//dec
      timecoefficient-=0.00001f;
    }
  }
 /* char cmd=0;
  AS1_RecvChar(&cmd);
  if(cmd==CMD_SETTIMECOEFFICIENT&&AS1_GetCharsInRxBuf()>=sizeof(float)){
    char t=0;
    AS1_RecvBlock((char *)&timecoefficient,sizeof(float),&t);
    if(t!=sizeof(float)){
      //error;
    }
  }else if(cmd==CMD_INC){
    timecoefficient+=0.00001f;
  }else if(cmd==CMD_DEC){
    timecoefficient-=0.00001f;
  }*/
}
Exemplo n.º 7
0
/*
** ===================================================================
**     Event       :  TI1_OnInterrupt (module Events)
**
**     Component   :  TI1 [TimerInt]
**     Description :
**         When a timer interrupt occurs this event is called (only
**         when the component is enabled - <Enable> and the events are
**         enabled - <EnableEvent>). This event is enabled only if a
**         <interrupt service/event> is enabled.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void TI1_OnInterrupt(void)
{
  /* Write your code here ... */
	LED_VERD_Neg();WAIT1_Waitms(333);
	LED_AZUL_Neg();WAIT1_Waitms(333);
	LED_VERM_Neg();WAIT1_Waitms(333);

	LED_VERD_Off();
	LED_AZUL_Off();
	LED_VERM_Off();

	AS1_SendBlock(NULL, "Serial.", 8);
}
Exemplo n.º 8
0
static void SendChar(unsigned char ch) {
  SentFlag = 0; /* this will be set to 1 once the block has been sent */
  while(AS1_SendBlock(serialHandle, (LDD_TData*)&ch, 1)!=ERR_OK) {} /* Send char */
  while(SentFlag==0) {} /* wait until we get the green flag from the TX interrupt */
}
Exemplo n.º 9
0
byte sendData(){
	byte error;
	averagedData.uData.id = Hall_Effect_Bit_GetVal() ? 0xFF : 0x00;	//	Replace with hall pin
	error = AS1_SendBlock(averagedData.rData, 4, &dataBlockSize);
	return error;
}
Exemplo n.º 10
0
void GetOdometryTotalDistancePacketHandler(void)
{
  sprintf(&Communication.CommunicationString[0], "%lu\n", Odometry.TotalDistance);
  Communication.Error = AS1_SendBlock(AS1_DeviceData, &Communication.CommunicationString[0], strlen(Communication.CommunicationString));
}
Exemplo n.º 11
0
// Steering
void GetSteeringControllerConstantsCommandHandler(uint8_t* PacketPattern)
{
  sprintf(&Communication.CommunicationString[0], "Kp: %ld  Ki: %ld  Kd: %ld  Aw: %ld\n",Steering.Kp, Steering.Ki, Steering.Kd, Steering.AntiWindUp);
  Communication.Error = AS1_SendBlock(AS1_DeviceData, &Communication.CommunicationString[0], strlen(Communication.CommunicationString));
}