Darien Figueroa / Mbed 2 deprecated repo3

Dependencies:   mbed MAX14720 MAX30205 USBDevice

Embed: (wiki syntax)

« Back to documentation index

HID Class Reference

HID Class Reference

USB Human Interface Device functions to connect to EV kit without requiring a custom device driver. More...

Public Member Functions

bool HandleWMDeviceChangeMessage (Message m)
 Called when a WM_DEVICECHANGE message has arrived, indicating that a device has been attached or removed.
void findHIDs ()
 findHIDs() called upon startup or if a desired HID has been inserted or removed
Boolean RegisterForDeviceNotifications (IntPtr formHandle, Guid classGuid, ref IntPtr deviceNotificationHandle)
 Requests to receive a notification when a device is attached or removed.
void StopReceivingDeviceNotifications (IntPtr deviceNotificationHandle)
 Requests to stop receiving notification messages when a device in an interface class is attached or removed.
void FirmwareVersion (out byte VerMajor, out byte VerMinor, out byte verYearHundreds, out byte verYear, out byte verMonth, out byte verDay)
 Firmware command code 0 IN = Firmware version
void LEDSet (byte xxxxxxP22P21)
 Firmware command code 1 OUT = LED (C51F321 P2.2=red, P2.1=green)
void GPIOP0Get (out byte xxxxxxP06P07)
 Firmware command code 1 IN = GPIOP0Get read I/O pins P0.6, P0.7
void GPIOP1P2ConfigSet (byte P1MDOUT, byte P2MDOUT, byte weakPullupDisable)
 Firmware command code 2 OUT = GPIO configuration (C51F321 P1 and P2)
void GPIOP1P2ConfigGet (out byte P1MDOUT, out byte P2MDOUT, out byte weakPullupDisable)
 Firmware command code 2 IN = GPIO configuration (C51F321 P1 and P2)
void GPIOP1P2Out (byte P1, byte P2)
 Firmware command code 3 OUT = GPIO value (C51F321 P1 and P2)
void GPIOP1P2In (out byte P1, out byte P2)
 Firmware command code 3 IN = GPIO value (C51F321 P1 and P2)
void I2CConfigSet (byte gI2Cflags, byte EXTHOLD, byte ClearSDAbyTogglingSCL)
 Firmware command code 4 OUT = I2C configuration (IO_BUFFER.Ptr[3+gOffset] & 1) ? (SMB0CF |= 0x10) : (SMB0CF &= 0xEF)
void I2CConfigGet (out byte gI2Cflags, out byte EXTHOLD)
 Firmware command code 4 IN = I2C configuration (IO_BUFFER.Ptr[3+gOffset] & 1) ? (SMB0CF |= 0x10) : (SMB0CF &= 0xEF)
void I2CClockSet (byte ReloadTH1)
 Firmware command code 5 OUT = I2C clock rate (number of counts to overflow) SCL_kHz = TimerClockMHz * 1000 / ReloadTH1
void I2CClockGet (out byte TimerClockMHz, out byte ReloadTH1)
 Firmware command code 5 IN = I2C clock rate (number of counts to overflow) SCL_kHz = TimerClockMHz * 1000 / ReloadTH1
void I2CWrite (byte deviceAddress, byte numDataBytes, byte numRegBytes, byte[] data, byte[] reg, bool ignoreNACK=false)
 Firmware command code 6 OUT = I2C transaction
int I2CRead (byte deviceAddress, byte numDataBytes, byte numRegBytes, byte[] readData, byte[] reg, bool ignoreNACK=false)
 Firmware command code 6 IN = I2C transaction
void SPIConfigSet (byte config)
 Firmware command code 7 OUT = SPI config ((SPI0CFG & 0x30) >> 4) + (SPI0CN & 4)
void SPIConfigGet (out byte config)
 Firmware command code 7 IN = SPI config ((SPI0CFG & 0x30) >> 4) + (SPI0CN & 4)
void SPIClockSet (byte SPI0CKR)
 Firmware command code 8 OUT = SPI clock rate
void SPIClockGet (out byte SPI0CKR)
 Firmware command code 8 IN = SPI clock rate
void SPITransfer (byte[] mosiData, out byte[] misoBuffer)
 Firmware command code 9 = SPI transaction
void INT0Enable (byte EX0)
 Firmware command code 23 OUT = enable INT0 (or Mock HID FIFO data diagnostic)
  • INT0Enable(0) disabled (EX0=0)
  • INT0Enable(1) real hardware (EX0=1)
  • INT0Enable(2) Mock HID x1 channel 101, 102, 103, ...

byte SearchI2CdeviceAddressList (byte[] I2C_DeviceAddressList_8bitLeftJustified, byte DeviceId_RegAddress, byte DeviceId_RegValue_Expect)
 Search for a device attached to I2C bus, given a list of poossible device addresses, and a constant device ID register to test.

Detailed Description

USB Human Interface Device functions to connect to EV kit without requiring a custom device driver.

Definition at line 23 of file HSPGui/HID.cs.


Member Function Documentation

void findHIDs (  )

findHIDs() called upon startup or if a desired HID has been inserted or removed

Definition at line 582 of file HSPGui/HID.cs.

void FirmwareVersion ( out byte  VerMajor,
out byte  VerMinor,
out byte  verYearHundreds,
out byte  verYear,
out byte  verMonth,
out byte  verDay 
)

Firmware command code 0 IN = Firmware version

Parameters:
VerMajor
VerMinor
verYearHundreds
verYear
verMonth
verDay

Definition at line 1237 of file HSPGui/HID.cs.

void GPIOP0Get ( out byte  xxxxxxP06P07 )

Firmware command code 1 IN = GPIOP0Get read I/O pins P0.6, P0.7

Parameters:
xxxxxxP06P07

Definition at line 1309 of file HSPGui/HID.cs.

void GPIOP1P2ConfigGet ( out byte  P1MDOUT,
out byte  P2MDOUT,
out byte  weakPullupDisable 
)

Firmware command code 2 IN = GPIO configuration (C51F321 P1 and P2)

Parameters:
P1MDOUT
P2MDOUT
weakPullupDisable

Definition at line 1359 of file HSPGui/HID.cs.

void GPIOP1P2ConfigSet ( byte  P1MDOUT,
byte  P2MDOUT,
byte  weakPullupDisable 
)

Firmware command code 2 OUT = GPIO configuration (C51F321 P1 and P2)

Parameters:
P1MDOUT
P2MDOUT
weakPullupDisable

Definition at line 1335 of file HSPGui/HID.cs.

void GPIOP1P2In ( out byte  P1,
out byte  P2 
)

Firmware command code 3 IN = GPIO value (C51F321 P1 and P2)

Parameters:
P1
P2

Definition at line 1409 of file HSPGui/HID.cs.

void GPIOP1P2Out ( byte  P1,
byte  P2 
)

Firmware command code 3 OUT = GPIO value (C51F321 P1 and P2)

Parameters:
P1
P2

Definition at line 1387 of file HSPGui/HID.cs.

bool HandleWMDeviceChangeMessage ( Message  m )

Called when a WM_DEVICECHANGE message has arrived, indicating that a device has been attached or removed.

Parameters:
ma message with information about the device
Returns:
true on HID device arrival or remove complete

Definition at line 530 of file HSPGui/HID.cs.

void I2CClockGet ( out byte  TimerClockMHz,
out byte  ReloadTH1 
)

Firmware command code 5 IN = I2C clock rate (number of counts to overflow) SCL_kHz = TimerClockMHz * 1000 / ReloadTH1

Parameters:
TimerClockMHzSMBus timer's clock frequency (in MHz); expect constant 8
ReloadTH1SMBus timer's count value: SCL_kHz = TimerClockMHz * 1000 / ReloadTH1

Definition at line 1527 of file HSPGui/HID.cs.

void I2CClockSet ( byte  ReloadTH1 )

Firmware command code 5 OUT = I2C clock rate (number of counts to overflow) SCL_kHz = TimerClockMHz * 1000 / ReloadTH1

Parameters:
ReloadTH1SMBus timer's count value: ReloadTH1 = (byte)(0.5 + (TimerClockMHz * 1000 / SCL_kHz))

Definition at line 1503 of file HSPGui/HID.cs.

void I2CConfigGet ( out byte  gI2Cflags,
out byte  EXTHOLD 
)

Firmware command code 4 IN = I2C configuration (IO_BUFFER.Ptr[3+gOffset] & 1) ? (SMB0CF |= 0x10) : (SMB0CF &= 0xEF)

Parameters:
gI2Cflagsbit0 == 1: repeated start
EXTHOLDSMB0CF & 0x10

Definition at line 1478 of file HSPGui/HID.cs.

void I2CConfigSet ( byte  gI2Cflags,
byte  EXTHOLD,
byte  ClearSDAbyTogglingSCL 
)

Firmware command code 4 OUT = I2C configuration (IO_BUFFER.Ptr[3+gOffset] & 1) ? (SMB0CF |= 0x10) : (SMB0CF &= 0xEF)

Parameters:
gI2Cflagsbit0 == 1: repeated start
EXTHOLDset EXTHOLD bit (SMBus setup / hold time extension)
ClearSDAbyTogglingSCLclear SDA by toggling SCL

Definition at line 1445 of file HSPGui/HID.cs.

int I2CRead ( byte  deviceAddress,
byte  numDataBytes,
byte  numRegBytes,
byte[]  readData,
byte[]  reg,
bool  ignoreNACK = false 
)

Firmware command code 6 IN = I2C transaction

Parameters:
deviceAddressI2C device address, 8-bit left-justified (LSB=R/w bit)
numDataBytes
numRegBytes
readData
reg
ignoreNACK
Returns:
status value; may be HID.I2C_NACK_ERROR if ignoreNACK parameter is true

Definition at line 1580 of file HSPGui/HID.cs.

void I2CWrite ( byte  deviceAddress,
byte  numDataBytes,
byte  numRegBytes,
byte[]  data,
byte[]  reg,
bool  ignoreNACK = false 
)

Firmware command code 6 OUT = I2C transaction

Parameters:
deviceAddressI2C device address, 8-bit left-justified (LSB=R/w bit)
numDataBytes
numRegBytes
data
reg
ignoreNACK

Definition at line 1561 of file HSPGui/HID.cs.

void INT0Enable ( byte  EX0 )

Firmware command code 23 OUT = enable INT0 (or Mock HID FIFO data diagnostic)

  • INT0Enable(0) disabled (EX0=0)
  • INT0Enable(1) real hardware (EX0=1)
  • INT0Enable(2) Mock HID x1 channel 101, 102, 103, ...

  • INT0Enable(3) Mock HID x2 channels 101, 201, 102, 202, 103, 203, ...
  • INT0Enable(4) Mock HID x3 channels 101, 201, 301, 102, 202, 302, 103, 203, 303, ...
  • INT0Enable(5) Mock HID x4 channels 101, 201, 301, 401, 102, 202, 302, 402, 103, 203, 303, 403, ...
Parameters:
EX0

Definition at line 1725 of file HSPGui/HID.cs.

void LEDSet ( byte  xxxxxxP22P21 )

Firmware command code 1 OUT = LED (C51F321 P2.2=red, P2.1=green)

Parameters:
xxxxxxP22P210x02=P2.2 Red, 0x01=P2.1 Green

Definition at line 1287 of file HSPGui/HID.cs.

Boolean RegisterForDeviceNotifications ( IntPtr  formHandle,
Guid  classGuid,
ref IntPtr  deviceNotificationHandle 
)

Requests to receive a notification when a device is attached or removed.

Parameters:
formHandlehandle to the window that will receive device events.
classGuiddevice interface GUID.
deviceNotificationHandlereturned device notification handle.
Returns:
True on success.

Definition at line 932 of file HSPGui/HID.cs.

byte SearchI2CdeviceAddressList ( byte[]  I2C_DeviceAddressList_8bitLeftJustified,
byte  DeviceId_RegAddress,
byte  DeviceId_RegValue_Expect 
)

Search for a device attached to I2C bus, given a list of poossible device addresses, and a constant device ID register to test.

Parameters:
I2C_DeviceAddressList_8bitLeftJustifiedList of possible I2C device addresses to test. I2C device addresses are 8-bit left-justified (LSB=R/w bit)
DeviceId_RegAddressdevice register address of a constant "Device ID" register
DeviceId_RegValue_Expectregister value of the constant "Device ID" register
Returns:
I2C device addresses, or 0 if not found

Definition at line 1752 of file HSPGui/HID.cs.

void SPIClockGet ( out byte  SPI0CKR )

Firmware command code 8 IN = SPI clock rate

Parameters:
SPI0CKR

Definition at line 1628 of file HSPGui/HID.cs.

void SPIClockSet ( byte  SPI0CKR )

Firmware command code 8 OUT = SPI clock rate

Parameters:
SPI0CKR

Definition at line 1617 of file HSPGui/HID.cs.

void SPIConfigGet ( out byte  config )

Firmware command code 7 IN = SPI config ((SPI0CFG & 0x30) >> 4) + (SPI0CN & 4)

Parameters:
config

Definition at line 1605 of file HSPGui/HID.cs.

void SPIConfigSet ( byte  config )

Firmware command code 7 OUT = SPI config ((SPI0CFG & 0x30) >> 4) + (SPI0CN & 4)

Parameters:
config

Definition at line 1593 of file HSPGui/HID.cs.

void SPITransfer ( byte[]  mosiData,
out byte[]  misoBuffer 
)

Firmware command code 9 = SPI transaction

Parameters:
mosiDataSPI MOSI (Master-Out, Slave-In) data to write into slave device
misoBufferSPI MISO (Master-In, Slave-Out) data buffer containing data bytes received from slave device (size will be allocated same size as mosiData)

Definition at line 1642 of file HSPGui/HID.cs.

void StopReceivingDeviceNotifications ( IntPtr  deviceNotificationHandle )

Requests to stop receiving notification messages when a device in an interface class is attached or removed.

Parameters:
deviceNotificationHandlehandle returned previously by RegisterDeviceNotification.

Definition at line 998 of file HSPGui/HID.cs.