asuro.h File Reference


Functions

void BackLED (_Bool left, _Bool right)
 control the BackLEDs
int Battery (void)
 read the battery power state
void EncoderInit (void)
 initialise and starts odometry mesurement
void EncoderReset (void)
 set odometry tick count to zero
void EncoderStart (void)
 start counting odometry ticks
void EncoderStop (void)
 stop counting odometry sensor ticks
void FrontLED (_Bool status)
 control the FrontLED
unsigned long Gettime (void)
 return time since system start in ms
void Init (void)
 initialise the hardware
void LineData (unsigned int *data)
 read out the phototransistors on the bottom
void MotorSpeed (unsigned char left_speed, unsigned char right_speed)
 set motor speed
void MotorState (unsigned char left, unsigned char right)
 set motor state
void mSleep (unsigned int ms)
 sleep function (ms)
void OdometryData (unsigned int *data)
 reads out the odometry phototransistors
unsigned char PollSwitch (void)
 read the switches
void Rotate (int angle, unsigned char speed)
 turn the robot using the odometry sensors
void SerRead (unsigned char *data, unsigned char length, unsigned int timeout)
 recieve characters over the serial interface
void SerWrite (char *data, unsigned char length)
 send characters over the serial interface
void Sleep (unsigned char time36kHz)
 sleep function (36Khz)
void StartSwitch (void)
 send interrupt on switch press
void StatusLED (unsigned char color)
 control the StatusLED
void StopSwitch (void)
 stop sending switch interrupt
void Travel (int distance, unsigned char speed)
 move the robot forward/ backward

Variables

unsigned char encoder [2]
 odometry sensors tick count
volatile _Bool sw_pressed
 any switch pressed?

Function Documentation

void BackLED ( _Bool  left,
_Bool  right 
)

control the BackLEDs

values: ON, OFF

Parameters:
left leftLED status
right rightLED status

int Battery ( void   ) 

read the battery power state

Returns:
ADC value. range: 0..1023

void EncoderInit ( void   ) 

initialise and starts odometry mesurement

uses interrupt(ADC_vect)

See also:
encoder

void EncoderReset ( void   ) 

set odometry tick count to zero

void EncoderStart ( void   ) 

start counting odometry ticks

void EncoderStop ( void   ) 

stop counting odometry sensor ticks

void FrontLED ( _Bool  status  )  [inline]

control the FrontLED

Parameters:
status values: ON, OFF

unsigned long Gettime ( void   ) 

return time since system start in ms

Returns:
current system time in ms

void Init ( void   ) 

initialise the hardware

initialise ports, ADC, PWM
this function must be called by every program at first

void LineData ( unsigned int *  data  ) 

read out the phototransistors on the bottom

Parameters:
data pointer to the data destination. access: data[LEFT], data[RIGHT]. range 0..1023

void MotorSpeed ( unsigned char  left_speed,
unsigned char  right_speed 
) [inline]

set motor speed

value range: 0..255

Parameters:
left_speed left motor
right_speed right motor

void MotorState ( unsigned char  left,
unsigned char  right 
) [inline]

set motor state

values: FWD, RWD, BREAK, FREE

Parameters:
left left motor
right right motor

void mSleep ( unsigned int  ms  ) 

sleep function (ms)

Parameters:
ms time in ms

void OdometryData ( unsigned int *  data  ) 

reads out the odometry phototransistors

Parameters:
data pointer to an array. access: data[LEFT], data[RIGHT]

unsigned char PollSwitch ( void   ) 

read the switches

Returns:
char whose bits represent the switches
bit0 = K6, ... , bit5 = K1

void Rotate ( int  angle,
unsigned char  speed 
)

turn the robot using the odometry sensors

Parameters:
angle degrees to turn. positive = turn right, negative = turn left. range: -360..360
speed motor speed. range: 0..255

void SerRead ( unsigned char *  data,
unsigned char  length,
unsigned int  timeout 
)

recieve characters over the serial interface

Parameters:
data pointer to the destination array
length character count
timeout 0 = blocking mode

void SerWrite ( char *  data,
unsigned char  length 
)

send characters over the serial interface

Parameters:
data string-pointer
length character count

void Sleep ( unsigned char  time36kHz  ) 

sleep function (36Khz)

Parameters:
time36kHz time in 1/36k (sec)

void StartSwitch ( void   ) 

send interrupt on switch press

binds switch press to external Interrupt 1
catch it with ISR(INT1_vect)
see avr-libc documentation for details

See also:
StopSwitch

void StatusLED ( unsigned char  color  )  [inline]

control the StatusLED

Parameters:
color values: OFF, GREEN, RED, YELLOW

void StopSwitch ( void   ) 

stop sending switch interrupt

clears INT1_vect

See also:
StartSwitch

void Travel ( int  distance,
unsigned char  speed 
)

move the robot forward/ backward

Parameters:
distance travalling distance in cm. positive = forward, negative = backward
speed motor speed. range: 0..255


Variable Documentation

unsigned char encoder[2]

odometry sensors tick count

access: encoder[LEFT], encoder[RIGHT]
range: 0..255

See also:
EncoderInit

volatile _Bool sw_pressed

any switch pressed?

is being set to TRUE by interrupt if a switch is pressed
remember to set it to false again, since it is not reset automatically

See also:
StartSwitch


Generated on Sat Nov 4 13:22:42 2006 for libasuro by  doxygen 1.4.7