hem.c File Reference

This module provides useful basic facilities to use a Hemisson Robot from KoreBot. More...

Include dependency graph for hem.c:

Go to the source code of this file.

Functions

int hem_getOSVersion (knet_dev_t *dev, unsigned char *version, unsigned char *revision)
int hem_setSpeed (knet_dev_t *dev, int left, int right)
int hem_beep (knet_dev_t *dev, unsigned int state)
int hem_readSwitches (knet_dev_t *dev, unsigned int *state)
int hem_setLEDs (knet_dev_t *dev, unsigned int state)
int hem_readProximitySensors (knet_dev_t *dev, unsigned char *sensors)
int hem_readAmbientLightSensors (knet_dev_t *dev, unsigned char *sensors)
int hem_readTVRemote (knet_dev_t *dev, unsigned char *value)
int hem_readI2C (knet_dev_t *dev, unsigned char slave, unsigned char reg, unsigned char *data, unsigned char count)
int hem_writeI2C (knet_dev_t *dev, unsigned char slave, unsigned char reg, unsigned char *data, unsigned char count)
int hem_fastRead (knet_dev_t *dev, unsigned char *motorLeft, unsigned char *motorRight, unsigned char *proximitySensors, unsigned char *ambientLightSensors, unsigned char *switches, unsigned char *tvRemoteData, unsigned char *version, unsigned char *revision)
int hem_fastWrite (knet_dev_t *dev, unsigned char motorLeft, unsigned char motorRight, unsigned char ledState)


Detailed Description

This module provides useful basic facilities to use a Hemisson Robot from KoreBot.

Hemisson Robot Support for KoreBot.

Author:
Cédric Gaudin (K-Team SA)
Note:
Copyright (C) 2004 K-TEAM SA
Bug:
none discovered. (not tested)
Todo:
nothing.

Definition in file hem.c.


Function Documentation

int hem_beep ( knet_dev_t dev,
unsigned int  state 
)

This function changes the state of the continous beeper.

Definition at line 102 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_fastRead ( knet_dev_t dev,
unsigned char *  motorLeft,
unsigned char *  motorRight,
unsigned char *  proximitySensors,
unsigned char *  ambientLightSensors,
unsigned char *  switches,
unsigned char *  tvRemoteData,
unsigned char *  version,
unsigned char *  revision 
)

This function reads all input of the Hemisson Robot.

Parameters:
dev K-Net Device Descriptor
motorLeft Left motor state
motorRight Right motor state
proximitySensors An array of size hem_SensorMax containing the proximity intensity for each sensor (range [0..255]). The smaller is the value, the further is the object.
ambientLightSensors An array of size hem_SensorMax containing the ambient light intensity for each sensor
switches 4-bit switch value
tvRemoveData TV remote last data received
version HemiOS version number
revision HemiOS revision number
Returns:
<=0 on error or 1 on success

Definition at line 397 of file hem.c.

References buf, hem_SensorMax, knet_llread(), and knet_printf().

Here is the call graph for this function:

int hem_fastWrite ( knet_dev_t dev,
unsigned char  motorLeft,
unsigned char  motorRight,
unsigned char  ledState 
)

This function changes the motor speed and the led state.

Parameters:
dev K-Net Device Descriptor
motorLeft Left motor speed
motorRight Right motor speed
ledState Led state
Returns:
<=0 on error or 1 on success

Definition at line 470 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_getOSVersion ( knet_dev_t dev,
unsigned char *  version,
unsigned char *  revision 
)

This function returns the version of the HemiOS.

Definition at line 30 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_readAmbientLightSensors ( knet_dev_t dev,
unsigned char *  sensors 
)

This function reads the ambient light using the infra-red sensors.

Parameters:
dev K-Net Device Descriptor
sensor An array of size hem_SensorMax containing the ambient light intensity for each sensor (range [0..255]). The smaller is the value, the more infra-red light is detected.
Returns:
<=0 on error or >0 on success

Definition at line 241 of file hem.c.

References buf, hem_SensorMax, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_readI2C ( knet_dev_t dev,
unsigned char  slave,
unsigned char  reg,
unsigned char *  data,
unsigned char  count 
)

This function reads a given number of registers of an I²C peripheral.

Parameters:
dev K-Net device descriptor
slave I²C Slave address
reg I²C Start register
data I²C Data read
count Number of registers to read
Returns:
The number of registers read on success or <=0 on error

Definition at line 310 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_readProximitySensors ( knet_dev_t dev,
unsigned char *  sensors 
)

This function reads the proximity of an object using the infra-red sensors.

Parameters:
dev K-Net Device Descriptor
sensor An array of size hem_SensorMax containing the proximity intensity for each sensor (range [0..255]). The smaller is the value, the further is the object.
Returns:
<= on error or >0 on success

Definition at line 201 of file hem.c.

References buf, hem_SensorMax, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_readSwitches ( knet_dev_t dev,
unsigned int *  state 
)

Definition at line 123 of file hem.c.

References buf, hem_Switch1, hem_Switch2, hem_Switch3, hem_Switch4, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_readTVRemote ( knet_dev_t dev,
unsigned char *  value 
)

This function reads the last character received from the TV remote.

Definition at line 275 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_setLEDs ( knet_dev_t dev,
unsigned int  state 
)

This function changes the LED state.

Parameters:
dev K-Net Device Descriptor
state New Led State

Definition at line 169 of file hem.c.

References buf, hem_LedFrontLeft, hem_LedFrontRight, hem_LedOnOff, hem_LedPgmExec, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_setSpeed ( knet_dev_t dev,
int  left,
int  right 
)

This function changes the speed of the left & right motor of the Hemission robot.

Parameters:
dev K-Net Device Descriptor
left Left Motor Speed. (range [-9..9])
right Right Motor Speed. (range [-9..9])
Returns:
<=0 on error or >0 on sucess
Remarks:
A speed of '0' stops the motor.

Definition at line 76 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:

int hem_writeI2C ( knet_dev_t dev,
unsigned char  slave,
unsigned char  reg,
unsigned char *  data,
unsigned char  count 
)

This function writes a given number of registers to an I²C peripheral.

Definition at line 347 of file hem.c.

References buf, knet_printf(), and knet_read_string().

Here is the call graph for this function:


Generated on Wed Dec 15 11:49:27 2010 for KoreBot Library by  doxygen 1.5.5