Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

HID Sensor
[Mindsensors]

Files

file  MSHID-driver.h
 

Mindsensors HID Sensor driver.


Defines

#define MSHID_I2C_ADDR   0x04
#define MSHID_CMD   0x41
#define MSHID_KEYBMOD   0x42
#define MSHID_KEYBDATA   0x43
#define MSHID_XMIT   0x54
#define MSHID_ASCII   0x41
#define MSHID_DDATA   0x44
#define MSHID_MOD_NONE   0x00
#define MSHID_MOD_LCTRL   0x01
#define MSHID_MOD_LSHIFT   0x02
#define MSHID_MOD_LALT   0x04
#define MSHID_MOD_LGUI   0x08
#define MSHID_MOD_RCTRL   0x10
#define MSHID_MOD_RSHIFT   0x20
#define MSHID_MOD_RALT   0x40
#define MSHID_MOD_RGUI   0x80

Functions

bool MSHIDsendCommand (tSensors link, byte command, ubyte address=MSHID_I2C_ADDR)
bool MSHIDsendKeyboardData (tSensors link, byte modifier, byte keybdata, ubyte address=MSHID_I2C_ADDR)
bool MSHIDsendString (tSensors link, string data, ubyte address=MSHID_I2C_ADDR)

Variables

tByteArray MSHID_I2CRequest

Detailed Description

HID Sensor


Define Documentation

#define MSHID_ASCII   0x41
Examples:
MSHID-test1.c.

Definition at line 49 of file MSHID-driver.h.

#define MSHID_CMD   0x41

Definition at line 44 of file MSHID-driver.h.

#define MSHID_DDATA   0x44
Examples:
MSHID-test1.c.

Definition at line 50 of file MSHID-driver.h.

#define MSHID_I2C_ADDR   0x04

Definition at line 43 of file MSHID-driver.h.

#define MSHID_KEYBDATA   0x43

Definition at line 46 of file MSHID-driver.h.

#define MSHID_KEYBMOD   0x42

Definition at line 45 of file MSHID-driver.h.

#define MSHID_MOD_LALT   0x04

Definition at line 56 of file MSHID-driver.h.

#define MSHID_MOD_LCTRL   0x01

Definition at line 54 of file MSHID-driver.h.

#define MSHID_MOD_LGUI   0x08
Examples:
MSHID-test1.c.

Definition at line 57 of file MSHID-driver.h.

#define MSHID_MOD_LSHIFT   0x02

Definition at line 55 of file MSHID-driver.h.

#define MSHID_MOD_NONE   0x00

Definition at line 53 of file MSHID-driver.h.

#define MSHID_MOD_RALT   0x40

Definition at line 60 of file MSHID-driver.h.

#define MSHID_MOD_RCTRL   0x10

Definition at line 58 of file MSHID-driver.h.

#define MSHID_MOD_RGUI   0x80

Definition at line 61 of file MSHID-driver.h.

#define MSHID_MOD_RSHIFT   0x20

Definition at line 59 of file MSHID-driver.h.

#define MSHID_XMIT   0x54
Examples:
MSHID-test1.c.

Definition at line 48 of file MSHID-driver.h.


Function Documentation

bool MSHIDsendCommand ( tSensors  link,
byte  command,
ubyte  address 
)

Send a direct command to the HID sensor

Parameters:
linkthe HID port number
commandthe command to be sent
addressthe I2C address to use, optional, defaults to 0x04
Returns:
true if no error occured, false if it did
Examples:
MSHID-test1.c.

Definition at line 77 of file MSHID-driver.h.

bool MSHIDsendKeyboardData ( tSensors  link,
byte  modifier,
byte  keybdata,
ubyte  address 
)

Send keyboard data to the HID sensor. Must be followed by a MSHID_XMIT command using MSHIDsendCommand()

Parameters:
linkthe HID port number
modifierthe keyboard modifier, like shift, control. Can be OR'd together.
keybdatathe keystroke to be sent to the computer
addressthe I2C address to use, optional, defaults to 0x04
Returns:
true if no error occured, false if it did
Examples:
MSHID-test1.c.

Definition at line 97 of file MSHID-driver.h.

bool MSHIDsendString ( tSensors  link,
string  data,
ubyte  address 
)

Send a string to the computer. Can be up to 19 characters long.
It recognises the following escaped keys:


  • : new line
  • : carriage return
  • : tab
  • \: a backslash
  • ": double quote
    Parameters:
    linkthe HID port number
    datathe string to be transmitted
    addressthe I2C address to use, optional, defaults to 0x04
    Returns:
    true if no error occured, false if it did
Examples:
MSHID-test1.c.

Definition at line 122 of file MSHID-driver.h.


Variable Documentation

Array to hold I2C command data

Definition at line 67 of file MSHID-driver.h.