COM iMX6 WinCE: Difference between revisions

From Wiki-DB
Jump to navigationJump to search
Capfel (talk | contribs)
No edit summary
Capfel (talk | contribs)
 
(83 intermediate revisions by 3 users not shown)
Line 24: Line 24:


== <br/>WEC7 / WEC2013 DHHalLib (function library) ==
== <br/>WEC7 / WEC2013 DHHalLib (function library) ==
The DHHalLib provides hardware related functions for Windows Embedded CE 6 and Windows Embedded Compact 7. All the functionality is available from the user mode.
The DHHalLib provides hardware related functions for Windows Embedded CE 6, Windows Embedded Compact 7 and Windows Embedded Compact 2013. All the functionality is available from the user mode.
=== Version numbers ===
=== Version numbers ===
:'''Read DHHalLib version'''
:'''Read DHHalLib version'''
Line 73: Line 73:
     DHCOM_GPIO_V,
     DHCOM_GPIO_V,
     DHCOM_GPIO_W,
     DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
     DHCOM_GPIO_NOT_DEFINED
     DHCOM_GPIO_NOT_DEFINED
   }*pDHCOM_GPIOEnum;
   }*pDHCOM_GPIOEnum;
  typedef enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  }*pDHCOM_GPIOISRType;


:'''Direction'''
:'''Direction'''
Line 104: Line 118:
:'''Set Interrupt'''
:'''Set Interrupt'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool GPIOSetInterrupt(DHCOM_GPIOEnum eGpio, HANDLE *hEvent, unsigned long ulTimeout) </code>''
|''<code> bool GPIOSetInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, HANDLE *hEvent, unsigned long ulTimeout) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>DHCOM_GPIOISRType eISRType</code> = DHCOM GPIO interrupt trigger level
::<code>HANDLE *hEvent</code> = external EventHandle Pointer
::<code>HANDLE *hEvent</code> = external EventHandle Pointer
::<code>unsigned long ulTimeout</code> = Interrupt timeout (0 = infinite)
::<code>bool bState</code> = GPIO Interrupt State
:Return value: <code>bool</code> --> true = success; false = failed
:'''Set Single Interrupt'''
:{| class="wikitable"
|''<code> bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, unsigned long ulTimeout) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>DHCOM_GPIOISRType eISRType</code> = DHCOM GPIO interrupt trigger level
::<code>unsigned long ulTimeout</code> = Interrupt timeout (0 = infinite)
::<code>bool bState</code> = GPIO Interrupt State
::<code>bool bState</code> = GPIO Interrupt State
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed
Line 211: Line 238:


=== SPI ===
=== SPI ===
:'''Note:''' These SPI Devices can only be set. The mapping is done with the following enum.
:'''Note:''' The following SPI Devices can be set. The mapping is done with the following enum.


   typedef enum DHCOM_SPIEnum
   typedef enum DHCOM_SPIEnum
Line 224: Line 251:
     typedef enum DHCOM_SPIModeEnum
     typedef enum DHCOM_SPIModeEnum
     {
     {
         SPI_CS0=0,
         SPI_MODE0=0,
         SPI_CS1,
         SPI_MODE1,
         SPI_CS2,
         SPI_MODE2,
         SPI_CS3
         SPI_MODE3
     }*pDHCOM_SPIModeEnum;
     }*pDHCOM_SPIModeEnum;


:'''Open'''
:'''Buffer fill instructions'''
:{| class="wikitable"
:'''Note 1:''' Bits in first array-element are aligned to right.
|''<code> bool SPIOpen(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, unsigned int iSPIFreq) </code>''
:'''Note 2:''' First bit transferred is at highest valid bit-position of array-element "0".
|}
:'''Note 3:''' The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
:Input values:  
:'''Note 4:''' If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
:'''Note 5:''' First bit transferred in array-elements "n" (n>0) is at bit-position "31"
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
::<code>unsigned int iSPIFreq</code> = DHCOM SPI frequency (e.g. 16MHz = 16000000)
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
:Return value: <code>bool</code> --> true = success; false = failed
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized    |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|


:'''Close'''
'''Examples less or equal than 32 bit(s):'''
:{| class="wikitable"
|-------------------------------------------------------------------------------------|
|''<code> void SPIClose(DHCOM_SPIEnum eSPIPort) </code>''
|                              Array-Element[0]                                      |
|}
|-------------------------------------------------------------------------------------|
:Input values:  
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00        |          0x02        |        0x0f        |      0xaa    | Example Data
|-------------------------------------------------------------------------------------|
|                                                                    | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  ---> | Example: 17 bit(s)
|                      |      <------  24 bit(s) to send/receive    ----->         | Example: 24 bit(s)
|                    <------  32 bit(s) to send/receive    ----->                   | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|


:'''Read'''
'''Examples greater 32 bit(s):'''
:{| class="wikitable"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|''<code> bool SPIRead(DHCOM_SPIEnum eSPIPort, unsigned int *pOutBuffer) </code>''
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
|}
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
:Input values:
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
:Return value: <code>bool</code> --> true = success; false = failed
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |         <---- first bit located at bit-position "0" of array-element "0" --->        |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->           |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                     |
| Example: 64 bit(s) to send/receive          <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                             |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|


:'''Write'''
:'''Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above) '''
:{| class="wikitable"
:[[Image:WEC_SPI_example.png|800px]]
|''<code> bool SPIWrite(DHCOM_SPIEnum eSPIPort, unsigned int *pInBuffer, unsigned int *pOutBuffer, bool bLoopback) </code>''
|}
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>unsigned int *pInBuffer</code> = Pointer to the input buffer
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer (If not Loopback used = NULL)
::<code>bool bLoopback</code> = Enable/Disable Loopback transmission
:Return value: <code>bool</code> --> true = success; false = failed


:'''Read multiple bytes'''
:'''Open'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool SPIReadMultiple(DHCOM_SPIEnum eSPIPort, unsigned int iWCount, unsigned int *pOutBuffer) </code>''
|''<code> bool SPIOpen(DHCOM_SPIEnum eSPIPort) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>unsigned int iWCount</code> = Number of bytes to read (max. 1024 Bytes)
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


:'''Write multiple bytes'''
:'''Close'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool SPIWriteMultiple(DHCOM_SPIEnum eSPIPort, unsigned int *pOutBuffer, unsigned int iWCount) </code>''
|''<code> void SPIClose(DHCOM_SPIEnum eSPIPort) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer
:Return value: <code>bool</code> --> true = success; false = failed


:'''Read bytes from NOR Flash'''
:'''Configure'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool SPIReadNORFlash(DHCOM_SPIEnum eSPIPort, unsigned int iSPIReg, unsigned int iWCount, unsigned int *pOutBuffer) </code>''
|''<code> bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, unsigned int iSPIFreq) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>unsigned int iSPIReg</code> = SPI NOR Flash Start Address (0..65565)
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
::<code>unsigned int iWCount</code> = Number of bytes to read (max. 1024 Bytes)
::<code>unsigned int iSPIFreq</code> = DHCOM SPI clock (e.g. 1MHz = 1000000)
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer
::<code>bool useDMA</code> = Enable DHCOM SPI DMA function
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


:'''Write bytes to NOR Flash'''
:'''Exchange'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool SPIWriteNORFlash(DHCOM_SPIEnum eSPIPort, unsigned int iSPIReg, unsigned int *pOutBuffer, unsigned int iWCount) </code>''
|''<code> bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, unsigned long *pOutBuffer, unsigned long *pInBuffer) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>unsigned int iSPIReg</code> = SPI NOR Flash Start Address (0..65565)
::<code>int iBitCount</code> = Data length (bit(s) count) to send/receive
::<code>unsigned int *pOutBuffer</code> = Pointer to the output buffer
::<code>unsigned long *pOutBuffer</code> = Pointer to the output buffer
::<code>unsigned long *pInBuffer</code> = Pointer to the input buffer
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


=== UART === (Note: Currently available for WEC 2013)
=== UART ===
(Note: Currently available for WEC 2013)
:'''Note:''' These UART Devices can only be set. The mapping is done with the following enum.
:'''Note:''' These UART Devices can only be set. The mapping is done with the following enum.


Line 440: Line 476:
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


=== CAN === (Note: Currently available for WEC 2013)
=== CAN ===
(Note: Currently available for WEC 2013)
:'''Note:''' These CAN Devices can only be set. The mapping is done with the following enum.
:'''Note:''' These CAN Devices can only be set. The mapping is done with the following enum.


Line 486: Line 523:
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>DHCOM_CANModeEnum eCANMode</code> = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
::<code>DHCOM_CANModeEnum eCANMode</code> = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
::<code>unsigned long lCANBitrate</code> = DHCOM UART frequency (e.g. 500000 bit/s = 500kbit)
::<code>unsigned long lCANBitrate</code> = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
::<code>bool bCANTLPrio</code> = DHCOM CAN transmit local prio (e.g. false = disabled)
::<code>bool bCANTLPrio</code> = DHCOM CAN transmit local priority (e.g. false = disabled)
::<code>bool bCANLoopback</code> = DHCOM CAN loopback mode (e.g. false = disabled)
::<code>bool bCANLoopback</code> = DHCOM CAN loopback mode (e.g. false = disabled)
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed
Line 495: Line 532:
:'''Configure Timing'''
:'''Configure Timing'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool CANConfigureTimimg(DHCOM_CANEnum eCANPort, unsigned long lPrescaler, unsigned char cPropSeg, unsigned char cPhase1Seg, unsigned char cPhase2Seg, unsigned char RJW) </code>''
|''<code> bool CANConfigureTiming(DHCOM_CANEnum eCANPort, unsigned long lPrescaler, unsigned char cPropSeg, unsigned char cPhase1Seg, unsigned char cPhase2Seg, unsigned char RJW) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>unsigned long lPrescaler</code> = Prescaler value
::<code>unsigned long lPrescaler</code> = Prescaler value
::<code>unsigned char cPropSeg</code> = Property segmentation time value
::<code>unsigned char cPropSeg</code> = Property segmentation time value
Line 509: Line 546:
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) </code>''
|''<code> bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) </code>''
|'''Attention:''' CANConfigureFilter() might be call before you can read data.
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>int iFilterID</code> = Filter ID value
::<code>int iFilterID</code> = Filter ID value
::<code>int iFilterIDMask</code> = Filter ID Mask value
::<code>int iFilterIDMask</code> = Filter ID Mask value
Line 523: Line 561:
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


:'''Configure Message'''
:'''Configure Message'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, unsigned char cCANMsgPrio, unsigned long lCANMsgTimeout, bool bTXAbort) </code>''
|''<code> bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, unsigned char cCANMsgPrio, unsigned long lCANMsgTimeout, bool bReadWrite) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>DHCOM_CANFrameEnum eCANFrame</code> = DHCOM CAN frame name (e.g. DHCOM_CAN_DATA)
::<code>DHCOM_CANFrameEnum eCANFrame</code> = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
::<code>int iCANMsgID</code> = CAN Message identification number (e.g. 0x2)
::<code>int iCANMsgID</code> = CAN Message identification number (e.g. 0x2) - only for can write
::<code>unsigned char cCANMsgPrio</code> = CAN Message priority (e.g. 1)
::<code>unsigned char cCANMsgPrio</code> = CAN Message priority (e.g. 1) - only for can write
::<code>unsigned long lCANMsgTimeout</code> = CAN Message timeout (e.g. 1000 = 1 sec)
::<code>unsigned long lCANMsgTimeout</code> = CAN Message timeout (e.g. 1000 = 1 sec)
::<code>bool bTXAbort</code> = CAN Message timeout enable (e.g. false = disabled)
::<code>bool bReadWrite</code> = (Read = false, Write = true)
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


Line 544: Line 582:
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>int *iCANMsgID</code> = Pointer to Message identification value
::<code>int *iCANMsgID</code> = Pointer to Message identification value
::<code>int *iCANMsgLength</code> = Pointer to Message length value
::<code>int *iCANMsgLength</code> = Pointer to Message length value
Line 555: Line 593:
:'''Read'''
:'''Read'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool CANRead(DHCOM_CANEnum eCANPort, unsigned char *pInBuffer, int iDataLength) </code>''
|''<code> bool CANRead(DHCOM_CANEnum eCANPort, unsigned char *pInBuffer, int iDataLength, int *iResult) </code>''
|'''Attention:''' CANConfigureFilter() might be call before you can read data.
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>unsigned char *pInBuffer</code> = Pointer to the input buffer
::<code>unsigned char *pInBuffer</code> = Pointer to the input buffer
::<code>int iDataLength</code> = Read data length
::<code>int iDataLength</code> = Read data length
::<code>int *iResult</code> = Pointer to the Result Value
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


:'''Write'''
:'''Write'''
:{| class="wikitable"
:{| class="wikitable"
|''<code> bool CANWrite(DHCOM_CANEnum eCANPort, unsigned char *pOutBuffer, int iDataLength = 8) </code>''
|''<code> bool CANWrite(DHCOM_CANEnum eCANPort, unsigned char *pOutBuffer, int iDataLength, int *iResult) </code>''
|}
|}
:Input values:  
:Input values:  
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>unsigned char *pOutBuffer</code> = Pointer to the output buffer
::<code>unsigned char *pOutBuffer</code> = Pointer to the output buffer
::<code>int iDataLength</code> = Write data length
::<code>int iDataLength</code> = Write data length
::<code>int *iResult</code> = Pointer to the Result Value
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


Line 610: Line 651:
::<code>unsigned long ulPhyAddr</code> = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
::<code>unsigned long ulPhyAddr</code> = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
::<code>unsigned char cRegSize</code> = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
::<code>unsigned char cRegSize</code> = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
:Return value: <code>int</code> --> returns the value from the specified Physical Address
=== KITL ===
:'''Restart'''
:{| class="wikitable"
|''<code> bool RestartPowerKITL() </code>''
|}
:Input values:
:Return value: <code>bool</code> --> true = success; false = failed
:'''Control'''
:{| class="wikitable"
|''<code> bool ControlPowerKITL(bool bEnable) </code>''
|}
:Input values:
::<code>bool bEnable</code> = Enable/Disable KITL Connection
:Return value: <code>bool</code> --> true = success; false = failed
=== Backlight ===
:'''Backlight Level'''
:{| class="wikitable"
|''<code> bool SetBacklightLevel(int Level) </code>''
|}
:''Note: In DHHalLib Version 1.0.0.0 only Backlight Enable/Disable available. (Value 0 = Disable, Value 1 to 255 = Enable)''
:Input values:
::<code>int Level</code> = Backlight Level (0 ... 255)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Backlight Timeout'''
:{| class="wikitable"
|''<code> bool SetBacklightSuspend(int Timeout, bool bEnable) </code>''
|}
:''Note: In DHHalLib Version 1.0.0.0 not available.''
:Input values:
::<code>int Timeout</code> = Timeout for Backlight (seconds)
::<code>bool bEnable</code> = Enable/Disable Timeout Backlight --> true = On; false = Off
:Return value: <code>bool</code> --> true = success; false = failed
=== Touch screen===
:'''Calibrate touch'''
:{| class="wikitable"
|''<code> bool CalibrateTouch() </code>''
|}
:Return value: <code>bool</code> --> true = success; false = failed
:'''Clear calibration data'''
:{| class="wikitable"
|''<code> bool ClearTouchCalibrationData() </code>''
|}
:Description:
:: This function delete the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>.
:Return value: <code>bool</code> --> true = success; false = failed
:'''Save calibration data'''
:{| class="wikitable"
|''<code> bool SaveTouchCalibrationData() </code>''
|}
:Description:
:: This function save the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>. For saving the value permanent please call <code>SaveRegistry() </code>afterwards.
:Return value: <code>bool</code> --> true = success; false = failed
=== Registry ===
:'''Save HIVE registry'''
:{| class="wikitable"
|''<code> bool SaveRegistry() </code>''
|}
:Return value: <code>bool</code> --> true = success; false = failed
:'''Create backup'''
:{| class="wikitable"
|''<code> bool CreateRegistryBackup() </code>''
|}
:Description:
:: This function generates the files ave_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. These files can be used at a later time to restore the registry.
:Return value: <code>bool</code> --> true = success; false = failed
:'''Restore backup'''
:{| class="wikitable"
|''<code> bool RestoreRegistryBackup() </code>''
|}
:Description:
:: This function restores the registry from the files Save_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. Afterwards a restart is carried out automatically. If the backup files are not present, then the function returns the return value flase.
:Return value: <code>bool</code> --> true = this never happens because a soft reset is performed; false = failed
=== Watchdog & Reset ===
:'''Soft reset'''
:{| class="wikitable"
|''<code> void SoftReset() </code>''
|}
=== Audio ===
:'''Set WAVE Out Volume Level'''
:{| class="wikitable"
|''<code> void SetWAVEOutVolumeLevel(int volumeLevel) </code>''
|}
:Description:
:: This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.
== <br/>(WEC7) / WEC2013 DHHalLib C# Wrapper (function wrapper) ==
The DHHalLib C# wrapper provides hardware related functions for Windows Embedded CE 6, Windows Embedded Compact 7 and Windows Embedded Compact 2013. All the functionality is available from the user mode.
=== Version numbers ===
:'''Read DHHalLib version'''
:{| class="wikitable"
|''<code> UInt32 DHHalLibGetVersion() </code>''
|}
:Return value: <code>UInt32</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
:'''BSP version'''
:{| class="wikitable"
|''<code> UInt32 BSPGetVersion() </code>''
|}
:Return value: <code>UInt32</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
:Note: The version number information is stored in the following registry key: <code>[HKEY_LOCAL_MACHINE\Ident] dword:"BSPVersionNumber"</code>
:'''Read image version'''
:{| class="wikitable"
|''<code> UInt32 WinCEImageGetVersion() </code>''
|}
:Return value: <code>UInt32</code> --> version number (e.g. 0x01040001 for version 1.4.0.1)
=== GPIO ===
:'''Note:''' These functions can only access the DHCOM standard GPIOs. The mapping is done with the following enum.
  public enum DHCOM_GPIOEnum
  {
    DHCOM_GPIO_A,
    DHCOM_GPIO_B,
    DHCOM_GPIO_C,
    DHCOM_GPIO_D,
    DHCOM_GPIO_E,
    DHCOM_GPIO_F,
    DHCOM_GPIO_G,
    DHCOM_GPIO_H,
    DHCOM_GPIO_I,
    DHCOM_GPIO_J,
    DHCOM_GPIO_K,
    DHCOM_GPIO_L,
    DHCOM_GPIO_M,
    DHCOM_GPIO_N,
    DHCOM_GPIO_O,
    DHCOM_GPIO_P,
    DHCOM_GPIO_Q,
    DHCOM_GPIO_R,
    DHCOM_GPIO_S,
    DHCOM_GPIO_T,
    DHCOM_GPIO_U,
    DHCOM_GPIO_V,
    DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
  public enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  };
:'''Direction'''
:{| class="wikitable"
|''<code> bool GPIOSetDirection( DHCOM_GPIOEnum eGpio, bool bInOut, bool bDefaultState) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio </code>= DHCOM GPIO pin name
::<code>bool bInOut</code> = GPIO direction (1 = input / 0 = output)
::<code>bool bDefaultState </code>= Default state (0 = low / 1 = high)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Set state'''
:{| class="wikitable"
|''<code> void GPIOSetPin(DHCOM_GPIOEnum eGpio, bool bState) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>bool bState</code> = pin state ( 0 = low / 1 = high)
:'''Read state'''
:{| class="wikitable"
|''<code> bool GPIOGetPin(DHCOM_GPIOEnum eGpio) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
:Return value: <code>bool</code> --> 0 = low; 1 = high
:'''Set Single Interrupt'''
:{| class="wikitable"
|''<code> bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, ulong ulTimeout) </code>''
|}
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
::<code>DHCOM_GPIOISRType eISRType</code> = DHCOM GPIO interrupt trigger level
::<code>ulong ulTimeout</code> = Interrupt timeout (0 = infinite)
::<code>bool bState</code> = GPIO Interrupt State
:Return value: <code>bool</code> --> true = success; false = failed
:'''Clear Interrupt'''
:{| class="wikitable"
|''<code> bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio) </code>''
|}
:''Note: Gpio Interrupt cannot disable by Hardware.''
:Input values:
::<code>DHCOM_GPIOEnum eGpio</code> = DHCOM GPIO pin name
:Return value: <code>bool</code> --> true = success; false = failed
=== I2C ===
:'''Note:''' These I2C Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CEnum
  {
    DHCOM_I2C0=0,
    DHCOM_I2C1,
    DHCOM_I2C2,
    DHCOM_I2C3,
    DHCOM_I2C_NOT_DEFINED
  };
:'''Note:''' These freqencies can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CFREQMode
  {
    I2C_100K=0,
    I2C_400K,
    I2C_800K,I2C_1600K,
    I2C_2400K,
    I2C_3200K
  };
:'''Open'''
:{| class="wikitable"
|''<code> bool I2COpen(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Close'''
:{| class="wikitable"
|''<code> void I2CClose(DHCOM_I2CEnum eI2CPort) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
:'''Read'''
:{| class="wikitable"
|''<code> bool I2CRead(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte[] pInBuffer) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>byte cDevId</code> = I2C device address (0..127)
::<code>byte cI2CReg</code> = I2C device register address (0..255)
::<code>ref byte pOutBuffer</code> = Pointer to the read byte
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write'''
:{| class="wikitable"
|''<code> bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cValue) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>byte cDevId</code> = I2C device address (0..127)
::<code>byte cI2CReg</code> = I2C device register address (0..255)
::<code>byte cValue</code> = Value to be written
:Return value: <code>bool</code> --> true = success; false = failed
:'''Read multiple bytes'''
:{| class="wikitable"
|''<code> bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] pInBuffer) </code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>byte cDevId</code> = I2C device address (0..127)
::<code>byte cI2CReg</code> = I2C device register address (0..255)
::<code>byte cBytes</code> = Number of bytes to be read (max. 255)
::<code>byte[] pInBuffer</code> = Pointer to the read buffer
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write multiple bytes'''
:{| class="wikitable"
|''<code> bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] pOutBuffer)</code>''
|}
:Input values:
::<code>DHCOM_I2CEnum eI2CPort</code> = DHCOM I2C port name (e.g. DHCOM_I2C0)
::<code>DHCOM_I2CFREQMode eI2CFreq</code> = DHCOM I2C port freqency name(e.g. I2C_100K)
::<code>byte cDevId</code> = I2C device address (0..127)
::<code>byte cI2CReg</code> = I2C device register address (0..255)
::<code>byte cBytes</code> = Number of bytes to be read (max. 255)
::<code>byte[] pOutBuffer</code> = Pointer to the input buffer
:Return value: <code>bool</code> --> true = success; false = failed
=== SPI ===
:'''Note:''' These SPI Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_SPIEnum
  {
        DHCOM_SPI1=0,
        DHCOM_SPI2,
        DHCOM_SPI_NOT_DEFINED
  };
:'''Note:''' These chip selects can be set. The mapping is done with the following enum.
    public enum DHCOM_SPIModeEnum
    {
        SPI_MODE0=0,
        SPI_MODE1,
        SPI_MODE2,
        SPI_MODE3
    };
:'''Buffer fill instructions'''
:'''Note 1:''' Bits in first array-element are aligned to right.
:'''Note 2:''' First bit transferred is at highest valid bit-position of array-element "0".
:'''Note 3:''' The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
:'''Note 4:''' If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
:'''Note 5:''' First bit transferred in array-elements "n" (n>0) is at bit-position "31"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>      | ---- All bit positions of required array-elements "n" (n>0) are always utilized    |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
'''Examples less or equal than 32 bit(s):'''
|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |
|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00        |          0x02        |        0x0f        |      0xaa    | Example Data
|-------------------------------------------------------------------------------------|
|                                                                    | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  --->  | Example: 17 bit(s)
|                      |      <------  24 bit(s) to send/receive    ----->        | Example: 24 bit(s)
|                    <------  32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|
'''Examples greater 32 bit(s):'''
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                              Array-Element[0]                                      |                          Array-Element[n]                                          |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00        |          0x00        |        0x01        |      0x02    |          0x04        |          0x08        |        0x0f        |      0xaa    | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |        <---- first bit located at bit-position "0" of array-element "0" --->        |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->            |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                      |
| Example: 64 bit(s) to send/receive          <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
:'''Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above) '''
:[[Image:WEC_SPI_example.png|800px]]
:'''Open'''
:{| class="wikitable"
|''<code> bool SPIOpen(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq) </code>''
|}
:Input values:
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
::<code>uint iSPIFreq</code> = DHCOM SPI frequency (e.g. 16MHz = 16000000)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Close'''
:{| class="wikitable"
|''<code> void SPIClose(DHCOM_SPIEnum eSPIPort) </code>''
|}
:Input values:
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
:'''Configure'''
:{| class="wikitable"
|''<code> bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq, bool useDMA) </code>''
|}
:Input values:
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>DHCOM_SPIModeEnum eSPIMode</code> = DHCOM SPI mode name(e.g. DHCOM_CS0)
::<code>uint iSPIFreq</code> = DHCOM SPI frequency (e.g. 16MHz = 16000000)
::<code>bool useDMA</code> = Enable DHCOM SPI DMA function
:Return value: <code>bool</code> --> true = success; false = failed
:'''Exchange'''
:{| class="wikitable"
|''<code> bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, ulong[] pOutBuffer, ulong[] pInBuffer) </code>''
|}
:Input values:
::<code>DHCOM_SPIEnum eSPIPort</code> = DHCOM SPI port name (e.g. DHCOM_SPI1)
::<code>int iBitCount</code> = Count of bit(s) length to send/receive
::<code>ulong[] pOutBuffer</code> = Array to the output buffer
::<code>ulong[] pInBuffer</code> = Array to the input buffer
:Return value: <code>bool</code> --> true = success; false = failed
=== UART ===
(only available for C/C++ applications)
(Note: Currently available for WEC 2013)
:'''Note:''' These UART Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_UARTEnum
  {
        DHCOM_UART1=1,
        DHCOM_UART2,
        DHCOM_UART3
  };
:'''Note:''' These mode selects can be set. The mapping is done with the following enum.
    public enum DHCOM_UARTModeEnum
    {
        DHCOM_HSHAKE_OFF=1,
        DHCOM_HSHAKE_SOFTWARE,
        DHCOM_HSHAKE_HARDWARE
    };
:'''Note:''' These parity selects can be set. The mapping is done with the following enum.
    public enum DHCOM_UARTParityEnum
    {
        DHCOM_NOPARITY=0,
        DHCOM_ODDPARITY,
        DHCOM_EVENPARITY,
        DHCOM_MARKPARITY,
        DHCOM_SPACEPARITY
    };
:'''Note:''' These stopbit selects can be set. The mapping is done with the following enum.
    public enum DHCOM_UARTStopBitEnum
    {
        DHCOM_ONESTOPBIT=0,
        DHCOM_ONE5STOPBITS,
        DHCOM_TWOSTOPBITS
    };
:'''Note:''' These byte size selects can be set. The mapping is done with the following enum.
    public enum DHCOM_UARTByteSizeEnum
    {
        DHCOM_5BIT=5,
        DHCOM_6BIT,
        DHCOM_7BIT,
        DHCOM_8BIT
    };
:'''Note:''' These event selects can be set. The mapping is done with the following enum.
    public enum DHCOM_UARTWEvent
    {
        SIG_RX_CHAR_DETECT_Flag=1,
        SIG_RX_EVENT_DETECT_Flag=2,
        SIG_TX_BUFFER_EMPTY_Flag=4,
        SIG_CTS_CHANGED_Flag=8,
        SIG_DSR_CHANGED_Flag=16,
        SIG_RLSD_CHANGED_Flag=32,
        SIG_BREAK_DETECT_Error=64,
        SIG_LINE_STATUS_Error=128,
        SIG_RING_DETECT_Error=512
    };
:'''Open'''
:{| class="wikitable"
|''<code> bool UARTOpen(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, ulong lUARTFreq) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
::<code>DHCOM_UARTModeEnum eUARTMode</code> = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
::<code>ulong lUARTFreq</code> = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Close'''
:{| class="wikitable"
|''<code> void UARTClose(DHCOM_UARTEnum eUARTPort) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
:'''Configure'''
:{| class="wikitable"
|''<code> bool UARTConfigure(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, DHCOM_UARTParityEnum eUARTParity, DHCOM_UARTStopBitEnum eUARTStopBit, DHCOM_UARTByteSizeEnum eUARTByteSize, ulong lUARTFreq) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
::<code>DHCOM_UARTModeEnum eUARTMode</code> = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
::<code>DHCOM_UARTParityEnum eUARTParity</code> = DHCOM UART parity name (e.g. DHCOM_NOPARITY)
::<code>DHCOM_UARTStopBitEnum eUARTStopBit</code> = DHCOM UART stop bit name (e.g. DHCOM_ONESTOPBIT)
::<code>DHCOM_UARTByteSizeEnum eUARTByteSize</code> = DHCOM UART byte size name (e.g. DHCOM_8BIT)
::<code>ulong lUARTFreq</code> = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Configure Timeout'''
:{| class="wikitable"
|''<code> bool UARTConfigureTimeout(DHCOM_UARTEnum eUARTPort, ulong lReadIntervalTimeout, ulong lReadTotalTimeoutConstant, ulong lReadTotalTimeoutMultiplier, ulong ulWriteTotalTimeoutConstant, ulong ulWriteTotalTimeoutMultiplier) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
::<code>ulong lReadIntervalTimeout</code> = Read interval timeout
::<code>ulong lReadTotalTimeoutConstant</code> = Read total timeout
::<code>ulong lReadTotalTimeoutMultiplier</code> = Read total timeout multiplier
::<code>ulong ulWriteTotalTimeoutConstant</code> = Write total timeout
::<code>ulong ulWriteTotalTimeoutMultiplier</code> = Write total timeout multiplier
:Return value: <code>bool</code> --> true = success; false = failed
:'''Clear buffer'''
:{| class="wikitable"
|''<code> bool UARTClearBuffer(DHCOM_UARTEnum eUARTPort) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
:'''Read'''
:{| class="wikitable"
|''<code> bool UARTRead(DHCOM_UARTEnum eUARTPort, int iDataLength, byte[] pInBuffer) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
::<code>int iDataLength</code> = Read data length
::<code>byte[] pInBuffer</code> = Pointer to the input buffer
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write'''
:{| class="wikitable"
|''<code> bool UARTWrite(DHCOM_UARTEnum eUARTPort, byte[] pOutBuffer) </code>''
|}
:Input values:
::<code>DHCOM_UARTEnum eUARTPort</code> = DHCOM UART port name (e.g. DHCOM_UART1)
::<code>byte[] pOutBuffer</code> = Pointer to the output buffer
:Return value: <code>bool</code> --> true = success; false = failed
=== CAN ===
(Note: Currently available for WEC 2013)
:'''Note:''' These CAN Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_CANEnum
  {
        DHCOM_CAN1=1,
        DHCOM_CAN_NOT_DEFINED
  };
:'''Note:''' These mode selects can be set. The mapping is done with the following enum.
    public enum DHCOM_CANModeEnum
    {
        DHCOM_CAN_STANDARD=0,
        DHCOM_CAN_EXTENDED
    };
:'''Note:''' These frame selects can be set. The mapping is done with the following enum.
    public enum DHCOM_CANFrameEnum
    {
        DHCOM_CAN_DATA=0,
        DHCOM_CAN_REMOTE
    };
:'''Open'''
:{| class="wikitable"
|''<code> bool CANOpen(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>DHCOM_CANModeEnum eCANMode</code> = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Close'''
:{| class="wikitable"
|''<code> void CANClose(DHCOM_CANEnum eCANPort) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
:'''Configure'''
:{| class="wikitable"
|''<code> bool CANConfigureMode(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode, UInt32 lCANBitrate = 0, bool bCANTLPrio = false, bool bCANLoopback = false) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>DHCOM_CANModeEnum eCANMode</code> = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
::<code>UInt32 lCANBitrate</code> = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
::<code>bool bCANTLPrio</code> = DHCOM CAN transmit local prio (e.g. false = disabled)
::<code>bool bCANLoopback</code> = DHCOM CAN loopback mode (e.g. false = disabled)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Configure Timing'''
:{| class="wikitable"
|''<code> bool CANConfigureTiming(DHCOM_CANEnum eCANPort, UInt32 lPrescaler, byte cPropSeg, byte cPhase1Seg, byte cPhase2Seg, byte RJW) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>UInt32 lPrescaler</code> = Prescaler value
::<code>byte cPropSeg</code> = Property segmentation time value
::<code>byte cPhase1Seg</code> = Phase 1 segmentation time value
::<code>byte cPhase2Seg</code> = Phase 2 segmentation time value
::<code>byte RJW</code> = Request jump time value
:Return value: <code>bool</code> --> true = success; false = failed
:'''Configure Filter'''
:{| class="wikitable"
|''<code> bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) </code>''
|'''Attention:''' CANConfigureFilter() might be call before you can read data.
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN port name (e.g. DHCOM_CAN1)
::<code>int iFilterID</code> = Filter ID value
::<code>int iFilterIDMask</code> = Filter ID Mask value
::<code>bool bFilterFormat</code> = Filter format (e.g. false = disabled)
::<code>bool bFilterRemote</code> = Filter remote frame (e.g. false = disabled)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Remove Filter'''
:{| class="wikitable"
|''<code> bool CANResetFilter(DHCOM_CANEnum eCANPort) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Configure Message'''
:{| class="wikitable"
|''<code> bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, byte cCANMsgPrio, UInt32 lCANMsgTimeout, bool bReadWrite) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>DHCOM_CANFrameEnum eCANFrame</code> = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
::<code>int iCANMsgID</code> = CAN Message identification number (e.g. 0x2) - only for write
::<code>byte cCANMsgPrio</code> = CAN Message priority (e.g. 1) - only for write
::<code>UInt32 lCANMsgTimeout</code> = CAN Message timeout (e.g. hex value: fa0 = 1 sec)
::<code>bool bReadWrite</code> = (Read = false, Write = true)
:Return value: <code>bool</code> --> true = success; false = failed
:'''Get Message Header'''
:{| class="wikitable"
|''<code> bool CANGetMessageParameter(DHCOM_CANEnum eCANPort, ref int iCANMsgID, ref int iCANMsgLength, ref int iCANFrame, ref byte cCANMsgPrio, ref UInt32 lCANMsgTimeout, ref int iTXAbort) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>ref int iCANMsgID</code> = Pointer to Message identification value
::<code>ref int iCANMsgLength</code> = Pointer to Message length value
::<code>ref int iCANFrame</code> = Pointer to Message frame value
::<code>ref byte cCANMsgPrio</code> = Pointer to Message priority value
::<code>ref UInt32 lCANMsgTimeout</code> = Pointer to Message timeout value
::<code>ref int iTXAbort</code> = Pointer to Message TX abort value
:Return value: <code>bool</code> --> true = success; false = failed
:'''Read'''
:{| class="wikitable"
|''<code> bool CANRead(DHCOM_CANEnum eCANPort, byte[] pInBuffer, int iDataLength, ref int iResult) </code>''
|'''Attention:''' CANConfigureFilter() might be call before you can read data.
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>byte[] pInBuffer</code> = Pointer to the input buffer
::<code>int iDataLength</code> = Read data length
::<code>ref int iResult</code> = Pointer to the Result Value
:Return value: <code>bool</code> --> true = success; false = failed
:'''Write'''
:{| class="wikitable"
|''<code> bool CANWrite(DHCOM_CANEnum eCANPort, byte[] pOutBuffer, int iDataLength, ref int iResult) </code>''
|}
:Input values:
::<code>DHCOM_CANEnum eCANPort</code> = DHCOM CAN interface (e.g. DHCOM_CAN1)
::<code>byte[] pOutBuffer</code> = Pointer to the output buffer
::<code>int iDataLength</code> = Write data length
::<code>ref int iResult</code> = Pointer to the Result Value
:Return value: <code>bool</code> --> true = success; false = failed
=== Physical Memory ===
:'''Note:''' These freqencies can only be set. The mapping is done with the following enum.
    public enum DHCOM_PHYEnum
    {
        DHCOM_PHY1=1,
        DHCOM_PHY2,
        DHCOM_PHY3,
        DHCOM_PHY4,
        DHCOM_PHY5,
        DHCOM_PHY6,
        DHCOM_PHY7,
        DHCOM_PHY8,
        DHCOM_PHY9
    };
:'''Write Physical Address'''
:{| class="wikitable"
|''<code> int WritePhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize, int iValue, bool bReadBack) </code>''
|}
:Input values:
::<code>DHCOM_PHYEnum PHYDev</code> = DHCOM PHY Device name (e.g. DHCOM_PHY1)
::<code>UInt32 ulPhyAddr</code> = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
::<code>byte cRegSize</code> = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
::<code>int iValue</code> = Value for Physical Address to write
::<code>bool bReadBack</code> = Enable/Disable Readback function (enable = true -> disable = false)
:Return value: <code>int</code> --> returns the written value from the specified Physical Address
:                    if bReadBack == TRUE, else 0x0 will be returned
:'''Read Physical Address'''
:{| class="wikitable"
|''<code> int ReadPhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize) </code>''
|}
:Input values:
::<code>DHCOM_PHYEnum PHYDev</code> = DHCOM PHY Device name (e.g. DHCOM_PHY1)
::<code>UInt32 ulPhyAddr</code> = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
::<code>byte cRegSize</code> = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
:Return value: <code>int</code> --> returns the value from the specified Physical Address
:Return value: <code>int</code> --> returns the value from the specified Physical Address


Line 661: Line 1,420:
:Description:
:Description:
:: This function delete the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>. For saving the value permanent please call <code>SaveRegistry() </code>afterwards.
:: This function delete the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>. For saving the value permanent please call <code>SaveRegistry() </code>afterwards.
:Return value: <code>bool</code> --> true = success; false = failed
:'''Save calibration data'''
:{| class="wikitable"
|''<code> bool SaveTouchCalibrationData() </code>''
|}
:Description:
:: This function save the registry entry <code>[HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" </code>. For saving the value permanent please call <code>SaveRegistry() </code>afterwards.
:Return value: <code>bool</code> --> true = success; false = failed
:Return value: <code>bool</code> --> true = success; false = failed


Line 691: Line 1,458:
|''<code> void SoftReset() </code>''
|''<code> void SoftReset() </code>''
|}
|}
=== Audio ===
:'''Set WAVE Out Volume Level'''
:{| class="wikitable"
|''<code> void SetWAVEOutVolumeLevel(int volumeLevel) </code>''
|}
:Description:
:: This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


== <br/>WEC2013 Debugging ==
== <br/>WEC2013 Debugging ==
Line 702: Line 1,477:
: 3. Now the debug session can be started from visual studio.
: 3. Now the debug session can be started from visual studio.
:: [[Image:WEC2013_debug.JPG|500px]]
:: [[Image:WEC2013_debug.JPG|500px]]
== <br/>WEC2013 eMMC Memory ==
If the Image is stored on the microSD card (default case), the eMMC flash memory is mounted to folder '''MMCMemory''' during running WEC2013 system.
The flash memory can be used to store any user data.
== <br/>WEC2013 FTP Connection==
WinSCP can be used to establish FTP connection to the system.
: 1. Download [https://winscp.net/eng/index.php WinSCP]
:: NOTES:
::* protocol: '''FTP'''
::* user name: '''user'''
::* default password: '''dhcom_imx6'''
::* port number: '''21'''
::* IP address: Use IP scanner (e.g. [http://angryip.org/ Angry IP scanner] to get device address. Hostname: '''DHCOM_IMX6'''


== <br/>WEC2013 VNC Connection==
== <br/>WEC2013 VNC Connection==

Latest revision as of 10:48, 12 May 2022


FAQ


WEC7 Tools

CE Remote Display Application

The Remote Display allows to operate the target device's Win CE desktop from a Windows PC. It requires a USB ActiveSync connection.
Download X86 remote display application (over ActiveSync connection)
Usage
1. Extract the zip file on your PC.
2. Wait for the ActiveSync connection to be ready.
3. Start ASRDisp.exe.


Binary BSP user guide

1. Download binary BSP (Please have a look at the iMX6 Downloads section.).
2. Unzip the files to any folder on your PC.
3. Call link-DHCOM_iMX6_BIN_GEN.bat file in the folder ...\DHCOM_iMX6_BSP_BIN\, to generate symbolic links in the \WINCE700\ folder.
4. Start Visual Studio 2008 with WEC7 platform builder.
5. Open platform builder project DHCOM_iMX6.pbxml at location C:\WINCE700\OSDesigns\DHCOM_iMX6_WEC7\.
6. Select retail build.
7. Call build --> rebuild solution to build the WEC7 image.
8. After the image build has completed successfully, the nk.nb0 image is stored at location C:\WINCE700\OSDesigns\DHCOM_iMX6_WEC7\RelDir\_1_Retail_DHCOM_iMX6_ARMV7\.
9. Copy the new nk.nb0 to your mircoSD card and restart the system.
Note: To delete the symbolic links (see 3.) please call unlink-DHCOM_iMX6_BIN_GEN.bat file in the folder ...\DHCOM_iMX6_BSP_BIN\


WEC7 / WEC2013 DHHalLib (function library)

The DHHalLib provides hardware related functions for Windows Embedded CE 6, Windows Embedded Compact 7 and Windows Embedded Compact 2013. All the functionality is available from the user mode.

Version numbers

Read DHHalLib version
unsigned long DHHalLibGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)
BSP version
unsigned long BSPGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)
Note: The version number information is stored in the following registry key: [HKEY_LOCAL_MACHINE\Ident] dword:"BSPVersionNumber"
Read image version
unsigned long WinCEImageGetVersion()
Return value: unsigned long --> version number (e.g. 0x01040001 for version 1.4.0.1)

GPIO

Note: These functions can only access the DHCOM standard GPIOs. The mapping is done with the following enum.
  typedef enum DHCOM_GPIOEnum
  {
    DHCOM_GPIO_A,
    DHCOM_GPIO_B,
    DHCOM_GPIO_C,
    DHCOM_GPIO_D,
    DHCOM_GPIO_E,
    DHCOM_GPIO_F,
    DHCOM_GPIO_G,
    DHCOM_GPIO_H,
    DHCOM_GPIO_I,
    DHCOM_GPIO_J,
    DHCOM_GPIO_K,
    DHCOM_GPIO_L,
    DHCOM_GPIO_M,
    DHCOM_GPIO_N,
    DHCOM_GPIO_O,
    DHCOM_GPIO_P,
    DHCOM_GPIO_Q,
    DHCOM_GPIO_R,
    DHCOM_GPIO_S,
    DHCOM_GPIO_T,
    DHCOM_GPIO_U,
    DHCOM_GPIO_V,
    DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
  typedef enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  }*pDHCOM_GPIOISRType;
Direction
bool GPIOSetDirection( DHCOM_GPIOEnum eGpio, bool bInOut, bool bDefaultState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bInOut = GPIO direction (1 = input / 0 = output)
bool bDefaultState = Default state (0 = low / 1 = high)
Return value: bool --> true = success; false = failed
Set state
void GPIOSetPin(DHCOM_GPIOEnum eGpio, bool bState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bState = pin state ( 0 = low / 1 = high)
Read state
bool GPIOGetPin(DHCOM_GPIOEnum eGpio)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> 0 = low; 1 = high
Set Interrupt
bool GPIOSetInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, HANDLE *hEvent, unsigned long ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
HANDLE *hEvent = external EventHandle Pointer
unsigned long ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Set Single Interrupt
bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, unsigned long ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
unsigned long ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Clear Interrupt
bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio)
Note: Gpio Interrupt cannot disable by Hardware.
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> true = success; false = failed

I2C

Note: These I2C Devices can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_I2CEnum
  {
   DHCOM_I2C0=0,
   DHCOM_I2C1,
   DHCOM_I2C2,
   DHCOM_I2C3,
   DHCOM_I2C_NOT_DEFINED
  }*pDHCOM_I2CEnum;
Note: These freqencies can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_I2CFREQMode
  {
   I2C_100K=0,
   I2C_400K,
   I2C_800K,I2C_1600K,
   I2C_2400K,
   I2C_3200K
  }*pDHCOM_I2CFREQMode;
Open
bool I2COpen(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
Return value: bool --> true = success; false = failed
Close
void I2CClose(DHCOM_I2CEnum eI2CPort)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
Read
bool I2CRead(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char *pOutBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char *pOutBuffer = Pointer to the read byte
Return value: bool --> true = success; false = failed
Write
bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cValue)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cValue = Value to be written
Return value: bool --> true = success; false = failed
Read multiple bytes
bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pOutBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cBytes = Number of bytes to be read (max. 255)
unsigned char *pOutBuffer = Pointer to the read buffer
Return value: bool --> true = success; false = failed
Write multiple bytes
bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, unsigned char cDevId, unsigned char cI2CReg, unsigned char cBytes, unsigned char *pInBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
unsigned char cDevId = I2C device address (0..127)
unsigned char cI2CReg = I2C device register address (0..255)
unsigned char cBytes = Number of bytes to be read (max. 255)
unsigned char *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

SPI

Note: The following SPI Devices can be set. The mapping is done with the following enum.
  typedef enum DHCOM_SPIEnum
  {
       DHCOM_SPI1=0,
       DHCOM_SPI2,
       DHCOM_SPI_NOT_DEFINED
  }*pDHCOM_SPIEnum;
Note: These chip selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_SPIModeEnum
   {
       SPI_MODE0=0,
       SPI_MODE1,
       SPI_MODE2,
       SPI_MODE3
   }*pDHCOM_SPIModeEnum;
Buffer fill instructions
Note 1: Bits in first array-element are aligned to right.
Note 2: First bit transferred is at highest valid bit-position of array-element "0".
Note 3: The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
Note 4: If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
Note 5: First bit transferred in array-elements "n" (n>0) is at bit-position "31"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized     |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Examples less or equal than 32 bit(s):
|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |
|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00         |          0x02         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|
|                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  --->  | Example: 17 bit(s)
|                       |       <------   24 bit(s) to send/receive    ----->         | Example: 24 bit(s)
|                    <------   32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|
Examples greater 32 bit(s):
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00         |          0x00         |        0x01         |      0x02     |          0x04         |          0x08         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |         <---- first bit located at bit-position "0" of array-element "0" --->         |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->            |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                      | 
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above)
Open
bool SPIOpen(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Return value: bool --> true = success; false = failed
Close
void SPIClose(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Configure
bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, unsigned int iSPIFreq)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
unsigned int iSPIFreq = DHCOM SPI clock (e.g. 1MHz = 1000000)
bool useDMA = Enable DHCOM SPI DMA function
Return value: bool --> true = success; false = failed
Exchange
bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, unsigned long *pOutBuffer, unsigned long *pInBuffer)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
int iBitCount = Data length (bit(s) count) to send/receive
unsigned long *pOutBuffer = Pointer to the output buffer
unsigned long *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

UART

(Note: Currently available for WEC 2013)

Note: These UART Devices can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_UARTEnum
  {
       DHCOM_UART1=1,
       DHCOM_UART2,
       DHCOM_UART3
  }*pDHCOM_UARTEnum;
Note: These mode selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTModeEnum
   {
       DHCOM_HSHAKE_OFF=1,
       DHCOM_HSHAKE_SOFTWARE,
       DHCOM_HSHAKE_HARDWARE
   }*pDHCOM_UARTModeEnum;
Note: These parity selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTParityEnum
   {
       DHCOM_NOPARITY=0,
       DHCOM_ODDPARITY,
       DHCOM_EVENPARITY,
       DHCOM_MARKPARITY,
       DHCOM_SPACEPARITY
   }*pDHCOM_UARTParityEnum;
Note: These stopbit selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTStopBitEnum
   {
       DHCOM_ONESTOPBIT=0,
       DHCOM_ONE5STOPBITS,
       DHCOM_TWOSTOPBITS
   }*pDHCOM_UARTStopBitEnum;
Note: These byte size selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTByteSizeEnum
   {
       DHCOM_5BIT=5,
       DHCOM_6BIT,
       DHCOM_7BIT,
       DHCOM_8BIT
   }*pDHCOM_UARTByteSizeEnum;
Note: These event selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_UARTWEvent
   {
       SIG_RX_CHAR_DETECT_Flag=1,
       SIG_RX_EVENT_DETECT_Flag=2,
       SIG_TX_BUFFER_EMPTY_Flag=4,
       SIG_CTS_CHANGED_Flag=8,
       SIG_DSR_CHANGED_Flag=16,
       SIG_RLSD_CHANGED_Flag=32,
       SIG_BREAK_DETECT_Error=64,
       SIG_LINE_STATUS_Error=128,
       SIG_RING_DETECT_Error=512
   }*pDHCOM_UARTWEvent;
Open
bool UARTOpen(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, unsigned long lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
unsigned long lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Close
void UARTClose(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Configure
bool UARTConfigure(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, DHCOM_UARTParityEnum eUARTParity, DHCOM_UARTStopBitEnum eUARTStopBit, DHCOM_UARTByteSizeEnum eUARTByteSize, unsigned long lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
DHCOM_UARTParityEnum eUARTParity = DHCOM UART parity name (e.g. DHCOM_NOPARITY)
DHCOM_UARTStopBitEnum eUARTStopBit = DHCOM UART stop bit name (e.g. DHCOM_ONESTOPBIT)
DHCOM_UARTByteSizeEnum eUARTByteSize = DHCOM UART byte size name (e.g. DHCOM_8BIT)
unsigned long lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Configure Timeout
bool UARTConfigureTimeout(DHCOM_UARTEnum eUARTPort, unsigned long lReadIntervalTimeout, unsigned long lReadTotalTimeoutConstant, unsigned long lReadTotalTimeoutMultiplier, unsigned long ulWriteTotalTimeoutConstant, unsigned long ulWriteTotalTimeoutMultiplier)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
unsigned long lReadIntervalTimeout = Read interval timeout
unsigned long lReadTotalTimeoutConstant = Read total timeout
unsigned long lReadTotalTimeoutMultiplier = Read total timeout multiplier
unsigned long ulWriteTotalTimeoutConstant = Write total timeout
unsigned long ulWriteTotalTimeoutMultiplier = Write total timeout multiplier
Return value: bool --> true = success; false = failed
Clear buffer
bool UARTClearBuffer(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Read
bool UARTRead(DHCOM_UARTEnum eUARTPort, int iDataLength, unsigned char *pInBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
int iDataLength = Read data length
unsigned char *pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed
Write
bool UARTWrite(DHCOM_UARTEnum eUARTPort, unsigned char *pOutBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
unsigned char *pOutBuffer = Pointer to the output buffer
Return value: bool --> true = success; false = failed

CAN

(Note: Currently available for WEC 2013)

Note: These CAN Devices can only be set. The mapping is done with the following enum.
  typedef enum DHCOM_CANEnum
  {
       DHCOM_CAN1=1,
       DHCOM_CAN_NOT_DEFINED
  }*pDHCOM_CANEnum;
Note: These mode selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_CANModeEnum
   {
       DHCOM_CAN_STANDARD=0,
       DHCOM_CAN_EXTENDED
   }*pDHCOM_CANModeEnum;
Note: These frame selects can be set. The mapping is done with the following enum.
   typedef enum DHCOM_CANFrameEnum
   {
       DHCOM_CAN_DATA=0,
       DHCOM_CAN_REMOTE
   }*pDHCOM_CANFrameEnum;
Open
bool CANOpen(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
Return value: bool --> true = success; false = failed
Close
void CANClose(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
Configure
bool CANConfigureMode(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode, unsigned long lCANBitrate = 0, bool bCANTLPrio = false, bool bCANLoopback = false)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
unsigned long lCANBitrate = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
bool bCANTLPrio = DHCOM CAN transmit local priority (e.g. false = disabled)
bool bCANLoopback = DHCOM CAN loopback mode (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Configure Timing
bool CANConfigureTiming(DHCOM_CANEnum eCANPort, unsigned long lPrescaler, unsigned char cPropSeg, unsigned char cPhase1Seg, unsigned char cPhase2Seg, unsigned char RJW)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned long lPrescaler = Prescaler value
unsigned char cPropSeg = Property segmentation time value
unsigned char cPhase1Seg = Phase 1 segmentation time value
unsigned char cPhase2Seg = Phase 2 segmentation time value
unsigned char RJW = Request jump time value
Return value: bool --> true = success; false = failed
Configure Filter
bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
int iFilterID = Filter ID value
int iFilterIDMask = Filter ID Mask value
bool bFilterFormat = Filter format (e.g. false = disabled)
bool bFilterRemote = Filter remote frame (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Remove Filter
bool CANResetFilter(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Return value: bool --> true = success; false = failed
Configure Message
bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, unsigned char cCANMsgPrio, unsigned long lCANMsgTimeout, bool bReadWrite)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANFrameEnum eCANFrame = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
int iCANMsgID = CAN Message identification number (e.g. 0x2) - only for can write
unsigned char cCANMsgPrio = CAN Message priority (e.g. 1) - only for can write
unsigned long lCANMsgTimeout = CAN Message timeout (e.g. 1000 = 1 sec)
bool bReadWrite = (Read = false, Write = true)
Return value: bool --> true = success; false = failed
Get Message Header
bool CANGetMessageParameter(DHCOM_CANEnum eCANPort, int *iCANMsgID, int *iCANMsgLength, int *iCANFrame, unsigned char *cCANMsgPrio, unsigned long *lCANMsgTimeout, int *iTXAbort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
int *iCANMsgID = Pointer to Message identification value
int *iCANMsgLength = Pointer to Message length value
int *iCANFrame = Pointer to Message frame value
unsigned char *cCANMsgPrio = Pointer to Message priority value
unsigned long *lCANMsgTimeout = Pointer to Message timeout value
int *iTXAbort = Pointer to Message TX abort value
Return value: bool --> true = success; false = failed
Read
bool CANRead(DHCOM_CANEnum eCANPort, unsigned char *pInBuffer, int iDataLength, int *iResult) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned char *pInBuffer = Pointer to the input buffer
int iDataLength = Read data length
int *iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed
Write
bool CANWrite(DHCOM_CANEnum eCANPort, unsigned char *pOutBuffer, int iDataLength, int *iResult)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
unsigned char *pOutBuffer = Pointer to the output buffer
int iDataLength = Write data length
int *iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed

Physical Memory

Note: These freqencies can only be set. The mapping is done with the following enum.
   typedef enum DHCOM_PHYEnum
   {
       DHCOM_PHY1=1,
       DHCOM_PHY2,
       DHCOM_PHY3,
       DHCOM_PHY4,
       DHCOM_PHY5,
       DHCOM_PHY6,
       DHCOM_PHY7,
       DHCOM_PHY8,
       DHCOM_PHY9
   }*pDHCOM_PHYEnum;
Write Physical Address
int WritePhysicalAddress(DHCOM_PHYEnum PHYDev, unsigned long ulPhyAddr, unsigned char cRegSize, int iValue, bool bReadBack)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
unsigned long ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
unsigned char cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
int iValue = Value for Physical Address to write
bool bReadBack = Enable/Disable Readback function (enable = true -> disable = false)
Return value: int --> returns the written value from the specified Physical Address
if bReadBack == TRUE, else 0x0 will be returned
Read Physical Address
int ReadPhysicalAddress(DHCOM_PHYEnum PHYDev, unsigned long ulPhyAddr, unsigned char cRegSize)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
unsigned long ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
unsigned char cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
Return value: int --> returns the value from the specified Physical Address

KITL

Restart
bool RestartPowerKITL()
Input values:
Return value: bool --> true = success; false = failed
Control
bool ControlPowerKITL(bool bEnable)
Input values:
bool bEnable = Enable/Disable KITL Connection
Return value: bool --> true = success; false = failed

Backlight

Backlight Level
bool SetBacklightLevel(int Level)
Note: In DHHalLib Version 1.0.0.0 only Backlight Enable/Disable available. (Value 0 = Disable, Value 1 to 255 = Enable)
Input values:
int Level = Backlight Level (0 ... 255)
Return value: bool --> true = success; false = failed
Backlight Timeout
bool SetBacklightSuspend(int Timeout, bool bEnable)
Note: In DHHalLib Version 1.0.0.0 not available.
Input values:
int Timeout = Timeout for Backlight (seconds)
bool bEnable = Enable/Disable Timeout Backlight --> true = On; false = Off
Return value: bool --> true = success; false = failed

Touch screen

Calibrate touch
bool CalibrateTouch()
Return value: bool --> true = success; false = failed
Clear calibration data
bool ClearTouchCalibrationData()
Description:
This function delete the registry entry [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" .
Return value: bool --> true = success; false = failed
Save calibration data
bool SaveTouchCalibrationData()
Description:
This function save the registry entry [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" . For saving the value permanent please call SaveRegistry() afterwards.
Return value: bool --> true = success; false = failed

Registry

Save HIVE registry
bool SaveRegistry()
Return value: bool --> true = success; false = failed
Create backup
bool CreateRegistryBackup()
Description:
This function generates the files ave_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. These files can be used at a later time to restore the registry.
Return value: bool --> true = success; false = failed
Restore backup
bool RestoreRegistryBackup()
Description:
This function restores the registry from the files Save_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. Afterwards a restart is carried out automatically. If the backup files are not present, then the function returns the return value flase.
Return value: bool --> true = this never happens because a soft reset is performed; false = failed

Watchdog & Reset

Soft reset
void SoftReset()

Audio

Set WAVE Out Volume Level
void SetWAVEOutVolumeLevel(int volumeLevel)
Description:
This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


(WEC7) / WEC2013 DHHalLib C# Wrapper (function wrapper)

The DHHalLib C# wrapper provides hardware related functions for Windows Embedded CE 6, Windows Embedded Compact 7 and Windows Embedded Compact 2013. All the functionality is available from the user mode.

Version numbers

Read DHHalLib version
UInt32 DHHalLibGetVersion()
Return value: UInt32 --> version number (e.g. 0x01040001 for version 1.4.0.1)
BSP version
UInt32 BSPGetVersion()
Return value: UInt32 --> version number (e.g. 0x01040001 for version 1.4.0.1)
Note: The version number information is stored in the following registry key: [HKEY_LOCAL_MACHINE\Ident] dword:"BSPVersionNumber"
Read image version
UInt32 WinCEImageGetVersion()
Return value: UInt32 --> version number (e.g. 0x01040001 for version 1.4.0.1)

GPIO

Note: These functions can only access the DHCOM standard GPIOs. The mapping is done with the following enum.
  public enum DHCOM_GPIOEnum
  {
    DHCOM_GPIO_A,
    DHCOM_GPIO_B,
    DHCOM_GPIO_C,
    DHCOM_GPIO_D,
    DHCOM_GPIO_E,
    DHCOM_GPIO_F,
    DHCOM_GPIO_G,
    DHCOM_GPIO_H,
    DHCOM_GPIO_I,
    DHCOM_GPIO_J,
    DHCOM_GPIO_K,
    DHCOM_GPIO_L,
    DHCOM_GPIO_M,
    DHCOM_GPIO_N,
    DHCOM_GPIO_O,
    DHCOM_GPIO_P,
    DHCOM_GPIO_Q,
    DHCOM_GPIO_R,
    DHCOM_GPIO_S,
    DHCOM_GPIO_T,
    DHCOM_GPIO_U,
    DHCOM_GPIO_V,
    DHCOM_GPIO_W,
    DHCOM_GPIO_PWM,
    DHCOM_GPIO_INT_PRIO,
    DHCOM_GPIO_166,
    DHCOM_GPIO_165,
    DHCOM_GPIO_NOT_DEFINED
  }*pDHCOM_GPIOEnum;
  public enum DHCOM_GPIOISRType
  {
    DHCOM_GPIO_INTR_LOW_LEV=0,
    DHCOM_GPIO_INTR_HIGH_LEV,
    DHCOM_GPIO_INTR_RISE_EDGE,
    DHCOM_GPIO_INTR_FALL_EDGE,
    DHCOM_GPIO_INTR_BOTH_EDGE,
    DHCOM_GPIO_INTR_NONE
  };
Direction
bool GPIOSetDirection( DHCOM_GPIOEnum eGpio, bool bInOut, bool bDefaultState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bInOut = GPIO direction (1 = input / 0 = output)
bool bDefaultState = Default state (0 = low / 1 = high)
Return value: bool --> true = success; false = failed
Set state
void GPIOSetPin(DHCOM_GPIOEnum eGpio, bool bState)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
bool bState = pin state ( 0 = low / 1 = high)
Read state
bool GPIOGetPin(DHCOM_GPIOEnum eGpio)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> 0 = low; 1 = high
Set Single Interrupt
bool GPIOSetSingleInterrupt(DHCOM_GPIOEnum eGpio, DHCOM_GPIOISRType eISRType, ulong ulTimeout)
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
DHCOM_GPIOISRType eISRType = DHCOM GPIO interrupt trigger level
ulong ulTimeout = Interrupt timeout (0 = infinite)
bool bState = GPIO Interrupt State
Return value: bool --> true = success; false = failed
Clear Interrupt
bool GPIOClearInterrupt(DHCOM_GPIOEnum eGpio)
Note: Gpio Interrupt cannot disable by Hardware.
Input values:
DHCOM_GPIOEnum eGpio = DHCOM GPIO pin name
Return value: bool --> true = success; false = failed

I2C

Note: These I2C Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CEnum
  {
   DHCOM_I2C0=0,
   DHCOM_I2C1,
   DHCOM_I2C2,
   DHCOM_I2C3,
   DHCOM_I2C_NOT_DEFINED
  };
Note: These freqencies can only be set. The mapping is done with the following enum.
  public enum DHCOM_I2CFREQMode
  {
   I2C_100K=0,
   I2C_400K,
   I2C_800K,I2C_1600K,
   I2C_2400K,
   I2C_3200K
  };
Open
bool I2COpen(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
Return value: bool --> true = success; false = failed
Close
void I2CClose(DHCOM_I2CEnum eI2CPort)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
Read
bool I2CRead(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte[] pInBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
ref byte pOutBuffer = Pointer to the read byte
Return value: bool --> true = success; false = failed
Write
bool I2CWrite(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cValue)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cValue = Value to be written
Return value: bool --> true = success; false = failed
Read multiple bytes
bool I2CReadMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] pInBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cBytes = Number of bytes to be read (max. 255)
byte[] pInBuffer = Pointer to the read buffer
Return value: bool --> true = success; false = failed
Write multiple bytes
bool I2CWriteMultipleBytes(DHCOM_I2CEnum eI2CPort, DHCOM_I2CFREQMode eI2CFreq, byte cDevId, byte cI2CReg, byte cBytes, byte[] pOutBuffer)
Input values:
DHCOM_I2CEnum eI2CPort = DHCOM I2C port name (e.g. DHCOM_I2C0)
DHCOM_I2CFREQMode eI2CFreq = DHCOM I2C port freqency name(e.g. I2C_100K)
byte cDevId = I2C device address (0..127)
byte cI2CReg = I2C device register address (0..255)
byte cBytes = Number of bytes to be read (max. 255)
byte[] pOutBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed

SPI

Note: These SPI Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_SPIEnum
  {
       DHCOM_SPI1=0,
       DHCOM_SPI2,
       DHCOM_SPI_NOT_DEFINED
  };
Note: These chip selects can be set. The mapping is done with the following enum.
   public enum DHCOM_SPIModeEnum
   {
       SPI_MODE0=0,
       SPI_MODE1,
       SPI_MODE2,
       SPI_MODE3
   };
Buffer fill instructions
Note 1: Bits in first array-element are aligned to right.
Note 2: First bit transferred is at highest valid bit-position of array-element "0".
Note 3: The remainder of the modulo operation "total number of SPI-transfer bits" mod 32 is equal to the number of valid bits located in array-element "0".
Note 4: If data length > 32 bits, all bit positions of required array-elements "n" (n>0) are always utilized.
Note 5: First bit transferred in array-elements "n" (n>0) is at bit-position "31"
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
| ---- If remainder of above modulo is > 0 then bit(s) shift to right ----->>>>       | ---- All bit positions of required array-elements "n" (n>0) are always utilized     |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Examples less or equal than 32 bit(s):
|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |
|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|
|          0x00         |          0x02         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|
|                                                                     | <--8 bit(s)-->| Example:  8 bit(s)
|                                            | <---- 17 bit(s) to send/receive  --->  | Example: 17 bit(s)
|                       |       <------   24 bit(s) to send/receive    ----->         | Example: 24 bit(s)
|                    <------   32 bit(s) to send/receive    ----->                    | Example: 32 bit(s)
|-------------------------------------------------------------------------------------|
Examples greater 32 bit(s):
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|                               Array-Element[0]                                      |                           Array-Element[n]                                          |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|0 | 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0|0|1|0|0|0|0|0|0|1|0|0 | 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 1| 0| 0| 0| 0| 0| 0| 0| 1| 1|1|1|1|0|1|0|1|0|1|0| Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
|          0x00         |          0x00         |        0x01         |      0x02     |          0x04         |          0x08         |        0x0f         |      0xaa     | Example Data
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
| Example: 33 bit(s) to send/receive                                                |         <---- first bit located at bit-position "0" of array-element "0" --->         |
| Example: 34 bit(s) to send/receive                                              |        <---- first bit located at bit-position "1" of array-element "0" --->            |
| Example: 41 bit(s) to send/receive                                |            <---- first bit located at bit-position "9" of array-element "0" --->                      | 
| Example: 64 bit(s) to send/receive           <---- first bit located at position "31" of array-element "0" (data length multiple of 32) --->                              |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
Example: Send 34bits (see example data (0x02 0x04 0x08 0x0F 0xAA) above)
Open
bool SPIOpen(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
uint iSPIFreq = DHCOM SPI frequency (e.g. 16MHz = 16000000)
Return value: bool --> true = success; false = failed
Close
void SPIClose(DHCOM_SPIEnum eSPIPort)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
Configure
bool SPIConfigure(DHCOM_SPIEnum eSPIPort, DHCOM_SPIModeEnum eSPIMode, uint iSPIFreq, bool useDMA)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
DHCOM_SPIModeEnum eSPIMode = DHCOM SPI mode name(e.g. DHCOM_CS0)
uint iSPIFreq = DHCOM SPI frequency (e.g. 16MHz = 16000000)
bool useDMA = Enable DHCOM SPI DMA function
Return value: bool --> true = success; false = failed
Exchange
bool SPIExchange(DHCOM_SPIEnum eSPIPort, int iBitCount, ulong[] pOutBuffer, ulong[] pInBuffer)
Input values:
DHCOM_SPIEnum eSPIPort = DHCOM SPI port name (e.g. DHCOM_SPI1)
int iBitCount = Count of bit(s) length to send/receive
ulong[] pOutBuffer = Array to the output buffer
ulong[] pInBuffer = Array to the input buffer
Return value: bool --> true = success; false = failed

UART

(only available for C/C++ applications) (Note: Currently available for WEC 2013)

Note: These UART Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_UARTEnum
  {
       DHCOM_UART1=1,
       DHCOM_UART2,
       DHCOM_UART3
  };
Note: These mode selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTModeEnum
   {
       DHCOM_HSHAKE_OFF=1,
       DHCOM_HSHAKE_SOFTWARE,
       DHCOM_HSHAKE_HARDWARE
   };
Note: These parity selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTParityEnum
   {
       DHCOM_NOPARITY=0,
       DHCOM_ODDPARITY,
       DHCOM_EVENPARITY,
       DHCOM_MARKPARITY,
       DHCOM_SPACEPARITY
   };
Note: These stopbit selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTStopBitEnum
   {
       DHCOM_ONESTOPBIT=0,
       DHCOM_ONE5STOPBITS,
       DHCOM_TWOSTOPBITS
   };
Note: These byte size selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTByteSizeEnum
   {
       DHCOM_5BIT=5,
       DHCOM_6BIT,
       DHCOM_7BIT,
       DHCOM_8BIT
   };
Note: These event selects can be set. The mapping is done with the following enum.
   public enum DHCOM_UARTWEvent
   {
       SIG_RX_CHAR_DETECT_Flag=1,
       SIG_RX_EVENT_DETECT_Flag=2,
       SIG_TX_BUFFER_EMPTY_Flag=4,
       SIG_CTS_CHANGED_Flag=8,
       SIG_DSR_CHANGED_Flag=16,
       SIG_RLSD_CHANGED_Flag=32,
       SIG_BREAK_DETECT_Error=64,
       SIG_LINE_STATUS_Error=128,
       SIG_RING_DETECT_Error=512
   };
Open
bool UARTOpen(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, ulong lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
ulong lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Close
void UARTClose(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Configure
bool UARTConfigure(DHCOM_UARTEnum eUARTPort, DHCOM_UARTModeEnum eUARTMode, DHCOM_UARTParityEnum eUARTParity, DHCOM_UARTStopBitEnum eUARTStopBit, DHCOM_UARTByteSizeEnum eUARTByteSize, ulong lUARTFreq)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
DHCOM_UARTModeEnum eUARTMode = DHCOM UART mode name(e.g. DHCOM_HSHAKE_OFF)
DHCOM_UARTParityEnum eUARTParity = DHCOM UART parity name (e.g. DHCOM_NOPARITY)
DHCOM_UARTStopBitEnum eUARTStopBit = DHCOM UART stop bit name (e.g. DHCOM_ONESTOPBIT)
DHCOM_UARTByteSizeEnum eUARTByteSize = DHCOM UART byte size name (e.g. DHCOM_8BIT)
ulong lUARTFreq = DHCOM UART frequency (e.g. 115200 bit/s = 115200)
Return value: bool --> true = success; false = failed
Configure Timeout
bool UARTConfigureTimeout(DHCOM_UARTEnum eUARTPort, ulong lReadIntervalTimeout, ulong lReadTotalTimeoutConstant, ulong lReadTotalTimeoutMultiplier, ulong ulWriteTotalTimeoutConstant, ulong ulWriteTotalTimeoutMultiplier)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
ulong lReadIntervalTimeout = Read interval timeout
ulong lReadTotalTimeoutConstant = Read total timeout
ulong lReadTotalTimeoutMultiplier = Read total timeout multiplier
ulong ulWriteTotalTimeoutConstant = Write total timeout
ulong ulWriteTotalTimeoutMultiplier = Write total timeout multiplier
Return value: bool --> true = success; false = failed
Clear buffer
bool UARTClearBuffer(DHCOM_UARTEnum eUARTPort)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
Read
bool UARTRead(DHCOM_UARTEnum eUARTPort, int iDataLength, byte[] pInBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
int iDataLength = Read data length
byte[] pInBuffer = Pointer to the input buffer
Return value: bool --> true = success; false = failed
Write
bool UARTWrite(DHCOM_UARTEnum eUARTPort, byte[] pOutBuffer)
Input values:
DHCOM_UARTEnum eUARTPort = DHCOM UART port name (e.g. DHCOM_UART1)
byte[] pOutBuffer = Pointer to the output buffer
Return value: bool --> true = success; false = failed

CAN

(Note: Currently available for WEC 2013)

Note: These CAN Devices can only be set. The mapping is done with the following enum.
  public enum DHCOM_CANEnum
  {
       DHCOM_CAN1=1,
       DHCOM_CAN_NOT_DEFINED
  };
Note: These mode selects can be set. The mapping is done with the following enum.
   public enum DHCOM_CANModeEnum
   {
       DHCOM_CAN_STANDARD=0,
       DHCOM_CAN_EXTENDED
   };
Note: These frame selects can be set. The mapping is done with the following enum.
   public enum DHCOM_CANFrameEnum
   {
       DHCOM_CAN_DATA=0,
       DHCOM_CAN_REMOTE
   };
Open
bool CANOpen(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN mode name(e.g. DHCOM_CAN_STANDARD)
Return value: bool --> true = success; false = failed
Close
void CANClose(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Configure
bool CANConfigureMode(DHCOM_CANEnum eCANPort, DHCOM_CANModeEnum eCANMode, UInt32 lCANBitrate = 0, bool bCANTLPrio = false, bool bCANLoopback = false)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANModeEnum eCANMode = DHCOM CAN id type (e.g. DHCOM_CAN_STANDARD | DHCOM_CAN_EXTENDED)
UInt32 lCANBitrate = DHCOM UART bitrate (e.g. 500000 bit/s = 500kbit)
bool bCANTLPrio = DHCOM CAN transmit local prio (e.g. false = disabled)
bool bCANLoopback = DHCOM CAN loopback mode (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Configure Timing
bool CANConfigureTiming(DHCOM_CANEnum eCANPort, UInt32 lPrescaler, byte cPropSeg, byte cPhase1Seg, byte cPhase2Seg, byte RJW)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
UInt32 lPrescaler = Prescaler value
byte cPropSeg = Property segmentation time value
byte cPhase1Seg = Phase 1 segmentation time value
byte cPhase2Seg = Phase 2 segmentation time value
byte RJW = Request jump time value
Return value: bool --> true = success; false = failed
Configure Filter
bool CANConfigureFilter(DHCOM_CANEnum eCANPort, int iFilterID, int iFilterIDMask, bool bFilterFormat, bool bFilterRemote) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN port name (e.g. DHCOM_CAN1)
int iFilterID = Filter ID value
int iFilterIDMask = Filter ID Mask value
bool bFilterFormat = Filter format (e.g. false = disabled)
bool bFilterRemote = Filter remote frame (e.g. false = disabled)
Return value: bool --> true = success; false = failed
Remove Filter
bool CANResetFilter(DHCOM_CANEnum eCANPort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
Return value: bool --> true = success; false = failed
Configure Message
bool CANConfigureMessage(DHCOM_CANEnum eCANPort, DHCOM_CANFrameEnum eCANFrame, int iCANMsgID, byte cCANMsgPrio, UInt32 lCANMsgTimeout, bool bReadWrite)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
DHCOM_CANFrameEnum eCANFrame = DHCOM CAN frame type (e.g. DHCOM_CAN_DATA | DHCOM_CAN_REMOTE)
int iCANMsgID = CAN Message identification number (e.g. 0x2) - only for write
byte cCANMsgPrio = CAN Message priority (e.g. 1) - only for write
UInt32 lCANMsgTimeout = CAN Message timeout (e.g. hex value: fa0 = 1 sec)
bool bReadWrite = (Read = false, Write = true)
Return value: bool --> true = success; false = failed
Get Message Header
bool CANGetMessageParameter(DHCOM_CANEnum eCANPort, ref int iCANMsgID, ref int iCANMsgLength, ref int iCANFrame, ref byte cCANMsgPrio, ref UInt32 lCANMsgTimeout, ref int iTXAbort)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
ref int iCANMsgID = Pointer to Message identification value
ref int iCANMsgLength = Pointer to Message length value
ref int iCANFrame = Pointer to Message frame value
ref byte cCANMsgPrio = Pointer to Message priority value
ref UInt32 lCANMsgTimeout = Pointer to Message timeout value
ref int iTXAbort = Pointer to Message TX abort value
Return value: bool --> true = success; false = failed
Read
bool CANRead(DHCOM_CANEnum eCANPort, byte[] pInBuffer, int iDataLength, ref int iResult) Attention: CANConfigureFilter() might be call before you can read data.
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
byte[] pInBuffer = Pointer to the input buffer
int iDataLength = Read data length
ref int iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed
Write
bool CANWrite(DHCOM_CANEnum eCANPort, byte[] pOutBuffer, int iDataLength, ref int iResult)
Input values:
DHCOM_CANEnum eCANPort = DHCOM CAN interface (e.g. DHCOM_CAN1)
byte[] pOutBuffer = Pointer to the output buffer
int iDataLength = Write data length
ref int iResult = Pointer to the Result Value
Return value: bool --> true = success; false = failed

Physical Memory

Note: These freqencies can only be set. The mapping is done with the following enum.
   public enum DHCOM_PHYEnum
   {
       DHCOM_PHY1=1,
       DHCOM_PHY2,
       DHCOM_PHY3,
       DHCOM_PHY4,
       DHCOM_PHY5,
       DHCOM_PHY6,
       DHCOM_PHY7,
       DHCOM_PHY8,
       DHCOM_PHY9
   };
Write Physical Address
int WritePhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize, int iValue, bool bReadBack)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
UInt32 ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
byte cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
int iValue = Value for Physical Address to write
bool bReadBack = Enable/Disable Readback function (enable = true -> disable = false)
Return value: int --> returns the written value from the specified Physical Address
if bReadBack == TRUE, else 0x0 will be returned
Read Physical Address
int ReadPhysicalAddress(DHCOM_PHYEnum PHYDev, UInt32 ulPhyAddr, byte cRegSize)
Input values:
DHCOM_PHYEnum PHYDev = DHCOM PHY Device name (e.g. DHCOM_PHY1)
UInt32 ulPhyAddr = Physical Address to write (e.g. GPIO1_MASK_REG = 0x209c014)
byte cRegSize = Register Size (8 = 8bit, 16 = 16bit, 32 = 32bit)
Return value: int --> returns the value from the specified Physical Address

KITL

Restart
bool RestartPowerKITL()
Input values:
Return value: bool --> true = success; false = failed
Control
bool ControlPowerKITL(bool bEnable)
Input values:
bool bEnable = Enable/Disable KITL Connection
Return value: bool --> true = success; false = failed

Backlight

Backlight Level
bool SetBacklightLevel(int Level)
Note: In DHHalLib Version 1.0.0.0 only Backlight Enable/Disable available. (Value 0 = Disable, Value 1 to 255 = Enable)
Input values:
int Level = Backlight Level (0 ... 255)
Return value: bool --> true = success; false = failed
Backlight Timeout
bool SetBacklightSuspend(int Timeout, bool bEnable)
Note: In DHHalLib Version 1.0.0.0 not available.
Input values:
int Timeout = Timeout for Backlight (seconds)
bool bEnable = Enable/Disable Timeout Backlight --> true = On; false = Off
Return value: bool --> true = success; false = failed

Touch screen

Calibrate touch
bool CalibrateTouch()
Return value: bool --> true = success; false = failed
Clear calibration data
bool ClearTouchCalibrationData()
Description:
This function delete the registry entry [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" . For saving the value permanent please call SaveRegistry() afterwards.
Return value: bool --> true = success; false = failed
Save calibration data
bool SaveTouchCalibrationData()
Description:
This function save the registry entry [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH] dword:"TouchCalibrationDone" . For saving the value permanent please call SaveRegistry() afterwards.
Return value: bool --> true = success; false = failed

Registry

Save HIVE registry
bool SaveRegistry()
Return value: bool --> true = success; false = failed
Create backup
bool CreateRegistryBackup()
Description:
This function generates the files ave_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. These files can be used at a later time to restore the registry.
Return value: bool --> true = success; false = failed
Restore backup
bool RestoreRegistryBackup()
Description:
This function restores the registry from the files Save_HKLM_Reg.srg and Save_HKLCU_Reg.srg in the folder \Storage Card\. Afterwards a restart is carried out automatically. If the backup files are not present, then the function returns the return value flase.
Return value: bool --> true = this never happens because a soft reset is performed; false = failed

Watchdog & Reset

Soft reset
void SoftReset()

Audio

Set WAVE Out Volume Level
void SetWAVEOutVolumeLevel(int volumeLevel)
Description:
This function set wave audio volume to specified given value. The range of 0 to 100 are only allowed.


WEC2013 Debugging

1. Enable connection to WEC2013 device via Telnet. DH electronics recommends PuTTY for Telnet connection.
Notes: PuTTY can be downloaded from www.heise.de. Default IP address is 192.168.1.110. No Login is used with the testsystem.
2. Before the Remote Debug session can be started it is necessary to start two applications via the telnet connection, by using the following commands:
  • START conmanclient3.exe
  • START cmaccept3.exe
NOTE: If you boot up the device, you have to start the service conmanclient3.exe once. The service cmaccept3.exe needs to be start before you will deploy or debug your application. The service cmaccept3.exe is closed automatically after 3 minutes. Be sure to connect your application with the device during this time period. Otherwise you have to start the cmaccept3.exe again. The files are stored in folder \windows\ at testimage.
3. Now the debug session can be started from visual studio.


WEC2013 eMMC Memory

If the Image is stored on the microSD card (default case), the eMMC flash memory is mounted to folder MMCMemory during running WEC2013 system. The flash memory can be used to store any user data.


WEC2013 FTP Connection

WinSCP can be used to establish FTP connection to the system.

1. Download WinSCP
NOTES:
  • protocol: FTP
  • user name: user
  • default password: dhcom_imx6
  • port number: 21
  • IP address: Use IP scanner (e.g. Angry IP scanner to get device address. Hostname: DHCOM_IMX6


WEC2013 VNC Connection

With WEC2013 efonVNC is used for remote desktop connection. For more information and license click here.

1. vncconfig.exe can be used to configure password and connection details (stored in folder \apps\wec2013\ at testimage).
NOTES:
  • default password: dhcom_imx6
  • default port number: 5900
  • Configuration is stored in registry at path [HKEY_CURRENT_USER\Software\RealVNC\WinVNC4]
2. winvnc.exe (stored in folder \apps\wec2013\ at testimage) must be started. This is done atomatically at startup with the testimage. Otherwise the application can be started via telnet.
3. Download VNC viewer provided by RealVNC for PC/Laptop from here. For more information and license click here.
4. Run VNC viewer application and connect the device by using IP address and port number.
NOTES:
  • default IP address: 192.168.1.110
  • default port number: 5900


WEC2013 Remote Tools

Before remote tools can be used, it is necessary to sstart some applications on WEC2013 Device.

1. Enable connection to WEC2013 device via Telnet. DH electronics recommends PuTTY for Telnet connection.
Notes: PuTTY can be downloaded from www.heise.de. Default IP address is 192.168.1.110. No Login is used with the testsystem.
2. Before the Remote Debug session can be started it is necessary to start two applications via the telnet connection, by using the following commands:
  • START conmanclient3.exe
  • START cmaccept3.exe
NOTE: If you boot up the device, you have to start the service conmanclient3.exe once. The service cmaccept3.exe needs to be start before you will deploy or debug your application. The service cmaccept3.exe is closed automatically after 3 minutes. Be sure to connect your application with the device during this time period. Otherwise you have to start the cmaccept3.exe again. The files are stored in folder \windows\ at testimage.
3. Now it is possible to use remote tools from Visual Studio


WEC2013 Test Tools

TEST_APP_CANTEST

The app can be used to test DHCOM CAN Port. The application is stored at folder \apps\wec2013\.
Download CAN Demo source code
CAN WRITE:
TEST_APP_CANTEST --write --len 8 --id 0x12 --idlen 11 --val 0x55 --remote 0
Description of the example:
  • --len: Send 8 Bytes
  • --id: Message ID is 0x12
  • --idlen: 11 = Standard ID; 29 can be used fpr extended ID
  • --val: Data starts with 0x55, then 0x56, ...
  • --remote: 0 = no remote frame
CAN READ:
TEST_APP_CANTEST --read --timeout 10000
Description of the example:
  • The application waits for 10 seconds to receive data.
CAN GET BITRATE:
TEST_APP_CANTEST --getbitrate
Description of the example:
  • The application shows the current used bitrate.
CAN SET BITRATE:
TEST_APP_CANTEST --setbitrate --bitrate 250000
Description of the example:
  • The application sets bitrate to 250kbps.

UART_Test

The app can be used to test DHCOM UART 2 Port. The application is stored at folder \apps\wec2013\.
Download UART Demo source code
UART_Test
Description of the example:
  • The application cyclic sends "Hello World" and receives data.
  • The baudrate 115200 is used for the demo.
  • q must be send to exit the demo.