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 KIO_ANReadBase 0x11 |
#define KIO_ANWriteBase 0x11 |
#define KIO_CANReadBase 0x59 |
#define KIO_CANWriteBase 0x26 |
#define KIO_ClearCAN 0x21 |
#define KIO_FreqBase 0x1F |
#define KIO_FWVersion 0x00 |
#define KIO_I2C_ScanRead 0x70 |
#define KIO_I2CList 0x71 |
#define KIO_I2CReadBase 0x33 |
#define KIO_I2CReturnRead 0x6C |
#define KIO_I2CScan 0x37 |
#define KIO_I2CWriteAddr 0x38 |
#define KIO_I2CWriteBase 0x32 |
#define KIO_IOChgBase 0x1E |
#define KIO_IOChgLed 0x1C |
#define KIO_IOClearBase 0x1C |
#define KIO_IOConfigIn 0x19 |
#define KIO_IOConfigOut 0x1A |
#define KIO_IOConfigPwm 0x1B |
#define KIO_IOReadBase 0x01 |
#define KIO_IOSetBase 0x1D |
#define KIO_PWChgBase 0x24 |
#define KIO_PWClearBase 0x22 |
#define KIO_PWMRatio 0x01 |
#define KIO_PWSetBase 0x23 |
#define KIO_Status 0xF2 |
#define KIO_TimerBase 0x25 |
int kio_ChangeIO | ( | knet_dev_t * | dev, | |
unsigned int | io | |||
) |
Change the state of a digital IO
dev | K-Net Device Descriptor to the KoreIO | |
io | the io to reset (0-15) |
Definition at line 406 of file koreio.c.
References KIO_IOChgBase, and knet_write8().
Referenced by changeio(), and main().
int kio_ChangeLed | ( | knet_dev_t * | dev, | |
unsigned | state | |||
) |
Change the state of the LED
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 |
Definition at line 381 of file koreio.c.
References KIO_IOChgLed, and knet_write8().
Referenced by changeled().
int kio_ChangePWM_freq | ( | knet_dev_t * | dev, | |
uint16_t | freq | |||
) |
Change PWM frequency
dev | K-Net Device Descriptor to the KoreIo | |
freq | Frequency of the PWM |
Definition at line 473 of file koreio.c.
References KIO_FreqBase, and knet_write8().
Referenced by main(), and setfreq().
int kio_ChangePWM_ratio | ( | knet_dev_t * | dev, | |
unsigned int | io, | |||
unsigned int | ratio | |||
) |
Change PWM channel ratio
dev | K-Net Device Descriptor to the KoreIo | |
io | the io to modify PWM ratio ratio the ratio value |
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().
int kio_ClearIO | ( | knet_dev_t * | dev, | |
unsigned int | io | |||
) |
Set a digital IO state to 0
dev | K-Net Device Descriptor to the KoreIO | |
io | the io to reset (0-15) |
Definition at line 427 of file koreio.c.
References KIO_IOClearBase, and knet_write8().
Referenced by main(), and resetio().
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
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) |
Definition at line 296 of file koreio.c.
References KIO_IOConfigIn, KIO_IOConfigOut, KIO_IOConfigPwm, and knet_write8().
Referenced by configio(), and main().
void kio_GetFWVersion | ( | knet_dev_t * | dev, | |
unsigned int * | version | |||
) |
This function get the firmware version and revision number.
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().
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.
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). |
Definition at line 602 of file koreio.c.
References KIO_I2C_ScanRead, KIO_I2CList, knet_lltransfer(), and knet_read8().
Referenced by listscan().
void kio_i2c_StartRead | ( | knet_dev_t * | dev, | |
char | device, | |||
char | reg, | |||
char | n_read | |||
) |
Start an register read on the secondary I2C bus.
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().
void kio_i2c_StartScan | ( | knet_dev_t * | dev | ) |
Start an address scan on the secondary I2C bus.
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().
int kio_i2c_Write | ( | knet_dev_t * | dev, | |
char | device, | |||
char | reg, | |||
char | txdata | |||
) |
Write on the secondary I2C bus.
dev | K-Net Device Descriptor to the KoreIO | |
device | Device address | |
reg | Device register address | |
txdata | Data to write on device |
Definition at line 699 of file koreio.c.
References KIO_I2CWriteAddr, KIO_I2CWriteBase, and knet_write8().
Referenced by writei2c().
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.
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 |
Definition at line 67 of file koreio.c.
References buf, KIO_ANReadBase, and knet_read8().
Referenced by main(), and readad().
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.
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 |
Definition at line 123 of file koreio.c.
References buf, KIO_CANReadBase, KIO_ClearCAN, knet_lltransfer(), and knet_write8().
Referenced by readcan().
int kio_ReadIO | ( | knet_dev_t * | dev, | |
unsigned int | io | |||
) |
Read a digital IO state
dev | K-Net Device Descriptor to the KoreIO | |
io | the io to read (0-15) |
Definition at line 331 of file koreio.c.
References KIO_IOReadBase, and knet_read8().
Referenced by readio().
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
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 |
Definition at line 195 of file koreio.c.
References KIO_CANWriteBase, KIO_Status, knet_read8(), and knet_write8().
Referenced by can7seg(), and canled().
int kio_SetANValue | ( | knet_dev_t * | dev, | |
unsigned int | an, | |||
unsigned int | value | |||
) |
Change a analog output value
dev | K-Net Device Descriptor to the KoreIO | |
an | the output to set (0-7) | |
value | the analog value (0-255) |
Definition at line 265 of file koreio.c.
References KIO_ANWriteBase, and knet_write8().
Referenced by setad().
int kio_SetIO | ( | knet_dev_t * | dev, | |
unsigned int | io | |||
) |
Set a digital IO state to 1
dev | K-Net Device Descriptor to the KoreIO | |
io | the io to set (0-15) |
Definition at line 358 of file koreio.c.
References KIO_IOSetBase, and knet_write8().
Referenced by main(), and setio().
int kio_t2c_ReturnRead | ( | knet_dev_t * | dev, | |
char | n_read, | |||
uint32_t * | values | |||
) |