Show amigo.h syntax highlighted
/*
*
* Copyright (c) 2003 The Regents of the University of California. All
* rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "uart.h"
#ifndef _AMIGO
#define _AMIGO
//#define AMIGO_PRINT_CONSOLE 0
//::::::::::::::
//amigo_func.h
//::::::::::::::
#define RCV_MSG_LEN 200
#define SND_MSG_LEN 200
#define PI 3.1415926535898
#define MAXV 1000
#define MAXA 200
#define MAXRV 30
#define MAXRA 100
int amigoMoveRel(float ,float ,float ,float ,short ,float ,float );
int amigoMoveAbs(float ,float ,float ,float ,short ,float ,float );
int amigoRotateAbs(float, short, float, float);
int amigoRotateRel(float, short, float, float);
int amigoHead(float, float, float, float);
int amigoDoMove(float ,signed short ,signed short );
void amigoDoTurn(short, short);
float amigoDoTimeToVel(float,float );
//::::::::::::::
//amigo_cmd.h
//::::::::::::::
void amigoCmdTypeA(unsigned short cmd);
void amigoCmdTypeB(unsigned short cmd, signed short p);
void amigoCmdConn();
void amigoCmdHead(short r);
void amigoCmdDHead(short r);
void amigoCmdSetRA(short a);
void amigoCmdSetRV(short s);
void amigoCmdVel(short v);
void amigoCmdSetV(short v);
void amigoCmdSetA(short a);
void amigoCmdStop(void);
void amigoCmdSetO(void);
void amigoCmdClose(void);
void amigoCmdOpen(void);
void amigoCmdPulse(void);
void amigoCmdEnable(short e);
//::::::::::::::
//amigo_chk.h
//::::::::::::::
int amigoReceiverInit();
unsigned short amigoChkX();
unsigned short amigoChkY();
signed short amigoChkOrientation();
char *amigoChkSonar();
unsigned short amigoChkMotorBusy();
void amigoSetMotorStop();
void amigoSetMotorBusy();
unsigned char receive_bytes(COMM_HANDLE hCOM, unsigned char *rcvmsg);
#ifndef AMIGO_SIP_INFO
struct amigo_sip { // server information packets
char motor_stat;
unsigned short xpos;
unsigned short ypos;
signed short orientation;
signed short lvel;
signed short rvel;
char battery;
char sonar[6];
}amigo_info;
#else
extern struct amigo_sip { // server information
packets
char motor_stat;
unsigned short xpos;
unsigned short ypos;
signed short orientation;
signed short lvel;
signed short rvel;
char battery;
char sonar[24];
}amigo_info;
#endif
#define AMIGO_SIP_INFO 1
//::::::::::::::
//amigo_cmd.h
//::::::::::::::
#define PULSE 0
#define OPEN 1
#define CLOSE 2
#define POLLING 3
#define ENABLE 4
#define SETA 5
#define SETV 6
#define SET0 7
#define SETRV 10
#define VEL 11
#define HEAD 12
#define DHEAD 13
#define SAY 15
#define CONFIG 18
#define ENCODER 19
#define RVEL 21
#define DCHEAD 22
#define SETRA 23
#define SONAR 28
#define STOP 29
#define DIGOUT 30
#define VEL2 32
#define GRIPPER 33
#define ADSEL 35
#define GRIPPERVAL 36
#define IOREQUEST 40
#define PTUPOS 41
#define TTY2 42
#define GETAUX 43
#define BUMPSTALL 44
#define TCM2 45
#define E_STOP 55
#define STEP 64
#define SOUND 90
#define PLAYLIST 91
#define SOUNDTOG 92
#endif
#define XPOS (((float)(amigo_info.xpos-16384))*0.5083*0.001)
#define YPOS (((float)(amigo_info.ypos-16384))*0.5083*0.001)
// byte offset of the sonar
#define SONARNUM0 amigo_info.sonar[0]
#define SONARNUM1 amigo_info.sonar[3]
#define SONARVALUE0 ((amigo_info.sonar[2]<<8)+amigo_info.sonar[1])
#define SONARVALUE1 ((amigo_info.sonar[5]<<8)+amigo_info.sonar[4])
See more files for this project here