From d2e42029ec04c3f224580f8007cdfbbfe0fc47a6 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Fri, 26 May 2017 18:45:56 +0200 Subject: Initial Commit --- ...___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html | 284 +++++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 ucs2-lib/doc/html/group___g___u_c_s___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html (limited to 'ucs2-lib/doc/html/group___g___u_c_s___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html') diff --git a/ucs2-lib/doc/html/group___g___u_c_s___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html b/ucs2-lib/doc/html/group___g___u_c_s___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html new file mode 100644 index 0000000..1b81a0e --- /dev/null +++ b/ucs2-lib/doc/html/group___g___u_c_s___i2_c_gade4a94669fe4f29f18fe5bfd4e102474.html @@ -0,0 +1,284 @@ + + + + + +UNICENS: Ucs_I2c_WritePort + + + + + + + + + + + + + + + +
+
+
+ + + + + + + +
Logo +
UNICENS V2.1.0-3491
+
User Manual and API Reference
+ +
+
+ + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Ucs_Return_t Ucs_I2c_WritePort (Ucs_Inst_tself,
uint16_t destination_address,
uint16_t port_handle,
Ucs_I2c_TrMode_t mode,
uint8_t block_count,
uint8_t slave_address,
uint16_t timeout,
uint8_t data_len,
uint8_t * data_ptr,
Ucs_I2c_WritePortResCb_t result_fptr 
)
+
+ +

Writes a block of bytes to an I2C device at a specified I2C address.

+ + + +
 This function corresponds with the INIC function INIC.I2CPortWrite.
+
Parameters
+ + + + + + + + + + + +
selfThe UNICENS instance pointer
destination_addressAddress of the target device. Use the UCS_ADDR_LOCAL_DEV macro to target the local device.
+ The following address ranges are supported:
    +
  • [0x10 ... 0x2FF]
  • +
  • [0x500 ... 0xFEF]
  • +
  • UCS_ADDR_LOCAL_DEV
  • +
+
port_handlePort resource handle. + + +
 I2CPortHandle
+
modeThe write transfer mode. + + +
 Mode
+
block_countThe number of blocks to be written to the I2C address. If parameter mode is not set to Burst Mode, the value of block_count has to be set to 0. Otherwise the valid range of this parameter goes from 1 to 30. + + +
 BlockCount
+
slave_addressThe 7-bit I2C slave address of the peripheral to be read. + + +
 SlaveAddress
+
timeoutThe timeout for the I2C Port write. + + +
 Timeout
+
data_lenThe total number of bytes to be written to the addressed I2C peripheral. Even if parameter mode is set to Burst Mode, the data_len shall correspond to the whole size of the burst transfer. That is, the data_len shall equal the size of a block times the block_count value.
data_ptrReference to the data to be written.
result_fptrRequired result callback function pointer.
+
+
+
Returns
Possible return values are shown in the table below. + + + + + + + + + + + + +
Value Description
UCS_RET_SUCCESS No error
UCS_RET_ERR_PARAM At least one parameter is wrong
UCS_RET_ERR_BUFFER_OVERFLOW No message buffer available
UCS_RET_ERR_API_LOCKED API is currently locked
UCS_RET_ERR_NOT_INITIALIZED UNICENS is not initialized
+
+


+ Example

+
uint8_t myData[] = {0x4U, 0x3U, 0x2U, 0x1U, 0x0U, 0x4U, 0x3U, 0x2U, 0x1U, 0x0U, 0x05U, 0x05U};
+
+
// Main function
+
void main()
+
{
+
Ucs_Return_t result = Ucs_I2c_WritePort(0x15U, 0x0F00U, UCS_I2C_BURST_MODE, 4U, 0x20U, 0x0FU, 12U, myData, &App_I2cWritePortResCb);
+
if (result != UCS_RET_SUCCESS)
+
{
+
// Error handling here
+
}
+
}
+
+
// The event handler function
+
// Handle I2cWritePort event
+
static void App_I2cWritePortResCb(uint16_t device_id, uint16_t port_handle, uint8_t i2c_slave_address, uint8_t data_len, Ucs_I2c_Result_t result, void * user_ptr)
+
{
+
if (result.code == UCS_I2C_RES_SUCCESS)
+
{
+
// Do what needs to be..
+
}
+
else
+
{
+
// Error handling here
+
switch(result.details.result_type)
+
{
+ +
// Handle the target results
+
break;
+
+ +
default:
+
// Handle transmission error
+
break;
+
}
+
}
+
}
+
+
+
+
+
+ + + + + + -- cgit 1.2.3-korg