koreio.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define KIO_FWVersion   0x00
#define KIO_IOReadBase   0x01
#define KIO_PWMRatio   0x01
#define KIO_ANReadBase   0x11
#define KIO_ANWriteBase   0x11
#define KIO_IOConfigIn   0x19
#define KIO_IOConfigOut   0x1A
#define KIO_IOConfigPwm   0x1B
#define KIO_IOClearBase   0x1C
#define KIO_IOSetBase   0x1D
#define KIO_IOChgBase   0x1E
#define KIO_IOChgLed   0x1C
#define KIO_FreqBase   0x1F
#define KIO_ClearCAN   0x21
#define KIO_PWClearBase   0x22
#define KIO_PWSetBase   0x23
#define KIO_PWChgBase   0x24
#define KIO_TimerBase   0x25
#define KIO_CANWriteBase   0x26
#define KIO_I2CWriteBase   0x32
#define KIO_I2CReadBase   0x33
#define KIO_I2CReturnRead   0x6C
#define KIO_I2CScan   0x37
#define KIO_I2CWriteAddr   0x38
#define KIO_I2C_ScanRead   0x70
#define KIO_I2CList   0x71
#define KIO_CANReadBase   0x59
#define KIO_Status   0xF2

Functions

void kio_GetFWVersion (knet_dev_t *dev, unsigned int *)
int kio_SetIO (knet_dev_t *dev, unsigned int io)
int kio_ClearIO (knet_dev_t *dev, unsigned int io)
int kio_ReadIO (knet_dev_t *dev, unsigned int io)
int kio_ChangeIO (knet_dev_t *dev, unsigned int io)
int kio_ReadAnalog (knet_dev_t *dev, unsigned int an, uint16_t *value, uint32_t *time)
int kio_ChangeLed (knet_dev_t *dev, unsigned state)
int kio_ConfigIO (knet_dev_t *dev, unsigned io, unsigned config)
int kio_ChangePWM_ratio (knet_dev_t *dev, unsigned int io, unsigned int ratio)
int kio_ChangePWM_freq (knet_dev_t *dev, uint16_t freq)
void kio_i2c_StartScan (knet_dev_t *dev)
void kio_i2c_StartRead (knet_dev_t *dev, char device, char reg, char n_read)
int kio_t2c_ReturnRead (knet_dev_t *dev, char n_read, uint32_t *values)
int kio_SetANValue (knet_dev_t *dev, unsigned int an, unsigned int value)
int kio_i2c_ListScan (knet_dev_t *dev, char *list)
int kio_i2c_Write (knet_dev_t *dev, char device, char reg, char txdata)
int kio_ReadCAN (knet_dev_t *dev, uint32_t *id, char *len, uint32_t *can_data1, uint32_t *can_data2, char *can_status, uint32_t *time)
int kio_SendCAN (knet_dev_t *dev, uint32_t id, uint32_t can_data1, uint32_t can_data2, char len, char can_status)


Define Documentation

#define KIO_ANReadBase   0x11

Definition at line 23 of file koreio.h.

Referenced by kio_ReadAnalog().

#define KIO_ANWriteBase   0x11

Definition at line 24 of file koreio.h.

Referenced by kio_SetANValue().

#define KIO_CANReadBase   0x59

Definition at line 46 of file koreio.h.

Referenced by kio_ReadCAN().

#define KIO_CANWriteBase   0x26

Definition at line 38 of file koreio.h.

Referenced by kio_SendCAN().

#define KIO_ClearCAN   0x21

Definition at line 33 of file koreio.h.

Referenced by kio_ReadCAN().

#define KIO_FreqBase   0x1F

Definition at line 32 of file koreio.h.

Referenced by kio_ChangePWM_freq().

#define KIO_FWVersion   0x00

Definition at line 20 of file koreio.h.

Referenced by kio_GetFWVersion().

#define KIO_I2C_ScanRead   0x70

Definition at line 44 of file koreio.h.

Referenced by kio_i2c_ListScan().

#define KIO_I2CList   0x71

Definition at line 45 of file koreio.h.

Referenced by kio_i2c_ListScan().

#define KIO_I2CReadBase   0x33

Definition at line 40 of file koreio.h.

Referenced by kio_i2c_StartRead().

#define KIO_I2CReturnRead   0x6C

Definition at line 41 of file koreio.h.

Referenced by kio_i2c_ReturnRead().

#define KIO_I2CScan   0x37

Definition at line 42 of file koreio.h.

Referenced by kio_i2c_StartScan().

#define KIO_I2CWriteAddr   0x38

Definition at line 43 of file koreio.h.

Referenced by kio_i2c_Write().

#define KIO_I2CWriteBase   0x32

Definition at line 39 of file koreio.h.

Referenced by kio_i2c_Write().

#define KIO_IOChgBase   0x1E

Definition at line 30 of file koreio.h.

Referenced by kio_ChangeIO().

#define KIO_IOChgLed   0x1C

Definition at line 31 of file koreio.h.

Referenced by kio_ChangeLed().

#define KIO_IOClearBase   0x1C

Definition at line 28 of file koreio.h.

Referenced by kio_ClearIO().

#define KIO_IOConfigIn   0x19

Definition at line 25 of file koreio.h.

Referenced by kio_ConfigIO().

#define KIO_IOConfigOut   0x1A

Definition at line 26 of file koreio.h.

Referenced by kio_ConfigIO().

#define KIO_IOConfigPwm   0x1B

Definition at line 27 of file koreio.h.

Referenced by kio_ConfigIO().

#define KIO_IOReadBase   0x01

Definition at line 21 of file koreio.h.

Referenced by kio_ReadIO().

#define KIO_IOSetBase   0x1D

Definition at line 29 of file koreio.h.

Referenced by kio_SetIO().

#define KIO_PWChgBase   0x24

Definition at line 36 of file koreio.h.

Referenced by kio_ChangePW().

#define KIO_PWClearBase   0x22

Definition at line 34 of file koreio.h.

Referenced by kio_ClearPW().

#define KIO_PWMRatio   0x01

Definition at line 22 of file koreio.h.

Referenced by kio_ChangePWM_ratio().

#define KIO_PWSetBase   0x23

Definition at line 35 of file koreio.h.

Referenced by kio_SetPW().

#define KIO_Status   0xF2

Definition at line 47 of file koreio.h.

Referenced by kio_SendCAN().

#define KIO_TimerBase   0x25

Definition at line 37 of file koreio.h.

Referenced by kio_Timer().


Function Documentation

int kio_ChangeIO ( knet_dev_t dev,
unsigned int  io 
)

Change the state of a digital IO

Parameters:
dev K-Net Device Descriptor to the KoreIO
io the io to reset (0-15)
Returns:
  • 0 if succesful
  • -1 if the given io is invalid
  • -2 if the given io is not in output mode

Definition at line 406 of file koreio.c.

References KIO_IOChgBase, and knet_write8().

Referenced by changeio(), and main().

Here is the call graph for this function:

int kio_ChangeLed ( knet_dev_t dev,
unsigned  state 
)

Change the state of the LED

Parameters:
dev K-Net Device Descriptor to the KoreIO
state The LED state is 0 to switch it off 1 to switch it on 2 to changed it
Returns:
  • 0 if succesful
  • -1 if the given state is invalid

Definition at line 381 of file koreio.c.

References KIO_IOChgLed, and knet_write8().

Referenced by changeled().

Here is the call graph for this function:

int kio_ChangePWM_freq ( knet_dev_t dev,
uint16_t  freq 
)

Change PWM frequency

Parameters:
dev K-Net Device Descriptor to the KoreIo
freq Frequency of the PWM
Returns:
  • 0 if succesful
  • -1 if fail

Definition at line 473 of file koreio.c.

References KIO_FreqBase, and knet_write8().

Referenced by main(), and setfreq().

Here is the call graph for this function:

int kio_ChangePWM_ratio ( knet_dev_t dev,
unsigned int  io,
unsigned int  ratio 
)

Change PWM channel ratio

Parameters:
dev K-Net Device Descriptor to the KoreIo
io the io to modify PWM ratio ratio the ratio value
Returns:
  • 0 if succesful
  • -1 if the given io is invalid

Definition at line 449 of file koreio.c.

References KIO_PWMRatio, and knet_write8().

Referenced by elbow(), finger(), gripper(), main(), motor(), rotate(), sequence(), setratio(), shoulder(), and wrist().

Here is the call graph for this function:

int kio_ClearIO ( knet_dev_t dev,
unsigned int  io 
)

Set a digital IO state to 0

Parameters:
dev K-Net Device Descriptor to the KoreIO
io the io to reset (0-15)
Returns:
  • 0 if succesful
  • -1 if the given io is invalid
  • -2 if the given io is not in output mode

Definition at line 427 of file koreio.c.

References KIO_IOClearBase, and knet_write8().

Referenced by main(), and resetio().

Here is the call graph for this function:

int kio_ConfigIO ( knet_dev_t dev,
unsigned  io,
unsigned  config 
)

Configure a digital IO to be used as an input, output or PWM ouput

Parameters:
dev K-Net Device Descriptor to the KoreIO
io the io to set (0-15)
config the mode to set (0: input) (1: ouput) (2: pwm)
Returns:
  • 0 if succesful
  • -1 if the given io is invalid
  • -2 if the given config is invalid

Definition at line 296 of file koreio.c.

References KIO_IOConfigIn, KIO_IOConfigOut, KIO_IOConfigPwm, and knet_write8().

Referenced by configio(), and main().

Here is the call graph for this function:

void kio_GetFWVersion ( knet_dev_t dev,
unsigned int *  version 
)

This function get the firmware version and revision number.

Parameters:
dev K-Net Device Descriptor to the KoreIO
version A pointer to a variable that will receive the firmware version number.

Definition at line 41 of file koreio.c.

References KIO_FWVersion, and knet_read8().

Referenced by main().

Here is the call graph for this function:

int kio_i2c_ListScan ( knet_dev_t dev,
char *  list 
)

Return the list of answering devices from a scan on the secondary I2C bus. The scan must be started using kio_i2c_StartScan.

Parameters:
dev K-Net Device Descriptor to the KoreIO
list A pointer to an array of characters to store the list. The array must be large enough to store all the addesses (up to 128bytes).
Returns:
the number of answering devices
  • -1 if the given pointer is null
  • -2 in case of knet transfer failure

Definition at line 602 of file koreio.c.

References KIO_I2C_ScanRead, KIO_I2CList, knet_lltransfer(), and knet_read8().

Referenced by listscan().

Here is the call graph for this function:

void kio_i2c_StartRead ( knet_dev_t dev,
char  device,
char  reg,
char  n_read 
)

Start an register read on the secondary I2C bus.

Parameters:
dev K-Net Device Descriptor to the KoreIO
device Device address
reg Device register address
n_read Number of read (max 4)

Definition at line 632 of file koreio.c.

References KIO_I2CReadBase, and knet_write8().

Referenced by readi2c().

Here is the call graph for this function:

void kio_i2c_StartScan ( knet_dev_t dev  ) 

Start an address scan on the secondary I2C bus.

Parameters:
dev K-Net Device Descriptor to the KoreIO

Definition at line 583 of file koreio.c.

References KIO_I2CScan, and knet_write8().

Referenced by startscan().

Here is the call graph for this function:

int kio_i2c_Write ( knet_dev_t dev,
char  device,
char  reg,
char  txdata 
)

Write on the secondary I2C bus.

Parameters:
dev K-Net Device Descriptor to the KoreIO
device Device address
reg Device register address
txdata Data to write on device
Returns:
  • 0 if succesful
  • -1 if fail

Definition at line 699 of file koreio.c.

References KIO_I2CWriteAddr, KIO_I2CWriteBase, and knet_write8().

Referenced by writei2c().

Here is the call graph for this function:

int kio_ReadAnalog ( knet_dev_t dev,
unsigned int  an,
uint16_t *  value,
uint32_t *  time 
)

Read an Analog input level. The 10 bit value, as well as the corresponding timestamp are returned. The timestamp is given is mS since the last reset of the timer.

Parameters:
dev K-Net Device Descriptor to the KoreIO
an The analog input to read
value Pointer to store the 10bit value from the A/D
time Pointer to store the 32bit value of the timestamp
Returns:
  • 0 if succesful
  • -1 if the given Analog is invalid
  • -2 in case of knet transfer failure

Definition at line 67 of file koreio.c.

References buf, KIO_ANReadBase, and knet_read8().

Referenced by main(), and readad().

Here is the call graph for this function:

int kio_ReadCAN ( knet_dev_t dev,
uint32_t *  id,
char *  len,
uint32_t *  can_data1,
uint32_t *  can_data2,
char *  can_status,
uint32_t *  time 
)

Read the Can message and erase it. Return the number of other Can messages available.

Parameters:
dev K-Net Device Descriptor to the KoreIO
id Pointer to store the 32bit value of the identifier
len Pointer to store the Data length of the message
can_data1 Pointer to store the 4 Bytes high of Data
can_data2 Pointer to store the 4 Bytes low of Data
status Pointer to store the Status bits of the message
time Pointer to store the 4 Bytes of the message timing
Returns:
  • n_mess The number of available messages if succesful
  • -1 if the buffer is empty
  • -2 in case of knet transfer failure

Definition at line 123 of file koreio.c.

References buf, KIO_CANReadBase, KIO_ClearCAN, knet_lltransfer(), and knet_write8().

Referenced by readcan().

Here is the call graph for this function:

int kio_ReadIO ( knet_dev_t dev,
unsigned int  io 
)

Read a digital IO state

Parameters:
dev K-Net Device Descriptor to the KoreIO
io the io to read (0-15)
Returns:
  • 0 if succesful
  • -1 if the given io is invalid
  • -2 if the given io is not in input mode

Definition at line 331 of file koreio.c.

References KIO_IOReadBase, and knet_read8().

Referenced by readio().

Here is the call graph for this function:

int kio_SendCAN ( knet_dev_t dev,
uint32_t  id,
uint32_t  can_data1,
uint32_t  can_data2,
char  len,
char  can_status 
)

Send a CAN message on the CAN bus

Parameters:
dev K-Net Device Descriptor to the KoreIO
id Can identifier on 32 Bits
can_data1 4 Data high
can_data2 4 Data low
len Number of Bytes to send on the Bus
status Set the CAN control bits
Returns:
  • 0 if succesful
  • 1 if fail

Definition at line 195 of file koreio.c.

References KIO_CANWriteBase, KIO_Status, knet_read8(), and knet_write8().

Referenced by can7seg(), and canled().

Here is the call graph for this function:

int kio_SetANValue ( knet_dev_t dev,
unsigned int  an,
unsigned int  value 
)

Change a analog output value

Parameters:
dev K-Net Device Descriptor to the KoreIO
an the output to set (0-7)
value the analog value (0-255)
Returns:
  • 0 if succesful
  • -1 if the given output is invalid

Definition at line 265 of file koreio.c.

References KIO_ANWriteBase, and knet_write8().

Referenced by setad().

Here is the call graph for this function:

int kio_SetIO ( knet_dev_t dev,
unsigned int  io 
)

Set a digital IO state to 1

Parameters:
dev K-Net Device Descriptor to the KoreIO
io the io to set (0-15)
Returns:
  • 0 if succesful
  • -1 if the given io is invalid
  • -2 if the given io is not in output mode

Definition at line 358 of file koreio.c.

References KIO_IOSetBase, and knet_write8().

Referenced by main(), and setio().

Here is the call graph for this function:

int kio_t2c_ReturnRead ( knet_dev_t dev,
char  n_read,
uint32_t *  values 
)


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