/***********************************************************************
[function]: 
                      callback:         write a byte data  to ctpm;
[parameters]:
			  buffer[in]:       write buffer;
			  length[in]:      the size of write data;    
[return]:
			  FTS_TRUE:      success;
			  FTS_FALSE:     io fail;
************************************************************************/
static bool byte_write(u8* buffer, int length)
{

printk("[ELDIAU] ft5406_ts.c: byte_write\n");
    
    return i2c_write_interface(buffer, length);
}
Example #2
0
/***********************************************************************
[function]:
                      callback:         send a command to ctpm.
[parameters]:
			  btcmd[in]:       command code;
			  btPara1[in]:     parameter 1;
			  btPara2[in]:     parameter 2;
			  btPara3[in]:     parameter 3;
                      num[in]:         the valid input parameter numbers,
                                           if only command code needed and no
                                           parameters followed,then the num is 1;
[return]:
			  FTS_TRUE:      success;
			  FTS_FALSE:     io fail;
************************************************************************/
static bool cmd_write(u8 btcmd,u8 btPara1,u8 btPara2,u8 btPara3,u8 num)
{
    u8 write_cmd[4] = {0};

    write_cmd[0] = btcmd;
    write_cmd[1] = btPara1;
    write_cmd[2] = btPara2;
    write_cmd[3] = btPara3;
    return i2c_write_interface(write_cmd, num);
}
Example #3
0
/***********************************************************************
    [function]:
		           callback:                read register value ftom ctpm by i2c interface;
    [parameters]:
                        reg_name[in]:         the register which you want to write;
			    tx_buf[in]:              buffer which is contained of the writing value;
    [return]:
			    FTS_TRUE:              success;
			    FTS_FALSE:             fail;
************************************************************************/
static bool fts_register_write(u8 reg_name, u8* tx_buf)
{
    u8 write_cmd[2] = {0};

    write_cmd[0] = reg_name;
    write_cmd[1] = *tx_buf;

    /*call the write callback function*/
    return i2c_write_interface(write_cmd, 2);
}
Example #4
0
/*
[function]:
    write a value to register.
[parameters]:
    e_reg_name[in]     : register name;
    pbt_buf[in]        : the returned register value;
[return]:
    HC_TRUE    	: success;
    HC_FALSE    : io fail;
*/
int hc_register_write(u8 e_reg_name, u8 bt_value)
{
    HC_BYTE write_cmd[2] = {0};

    write_cmd[0] = e_reg_name;
    write_cmd[1] = bt_value;

    /*call the write callback function*/
    return i2c_write_interface(I2C_CTPM_ADDRESS, write_cmd, 2);
}
Example #5
0
static int ft_cmd_write(unsigned char btcmd, unsigned char btPara1, unsigned char btPara2,
		unsigned char btPara3, int num)
{
    unsigned char write_cmd[4] = {0};

    write_cmd[0] = btcmd;
    write_cmd[1] = btPara1;
    write_cmd[2] = btPara2;
    write_cmd[3] = btPara3;
    return i2c_write_interface(&write_cmd, num);
}
/***********************************************************************
    [function]: 
		           callback:                read register value ftom ctpm by i2c interface;
    [parameters]:
                        reg_name[in]:         the register which you want to write;
			    tx_buf[in]:              buffer which is contained of the writing value;
    [return]:
			    FTS_TRUE:              success;
			    FTS_FALSE:             fail;
************************************************************************/
static bool fts_register_write(u8 reg_name, u8* tx_buf)
{
	u8 write_cmd[2] = {0};

	write_cmd[0] = reg_name;
	write_cmd[1] = *tx_buf;

printk("[ELDIAU] ft5406_ts.c: fts_register_write\n");

	/*call the write callback function*/
	return i2c_write_interface(write_cmd, 2);
}
/***********************************************************************
[function]: 
                      callback:         send a command to ctpm.
[parameters]:
			  btcmd[in]:       command code;
			  btPara1[in]:     parameter 1;    
			  btPara2[in]:     parameter 2;    
			  btPara3[in]:     parameter 3;    
                      num[in]:         the valid input parameter numbers, 
                                           if only command code needed and no 
                                           parameters followed,then the num is 1;    
[return]:
			  FTS_TRUE:      success;
			  FTS_FALSE:     io fail;
************************************************************************/
static bool cmd_write(u8 btcmd,u8 btPara1,u8 btPara2,u8 btPara3,u8 num)
{
    u8 write_cmd[4] = {0};

    write_cmd[0] = btcmd;
    write_cmd[1] = btPara1;
    write_cmd[2] = btPara2;
    write_cmd[3] = btPara3;

printk("[ELDIAU] ft5406_ts.c: cmd_write\n");

    return i2c_write_interface(write_cmd, num);
}
Example #8
0
u8 hc_register_read(u8 e_reg_name, u8* pbt_buf, u8 bt_len)
{
#if 1
    u8 read_cmd[3]= {0};
    u8 cmd_len     = 0;

    read_cmd[0] = e_reg_name;
    cmd_len = 1;

    if(!i2c_write_interface(I2C_CTPM_ADDRESS, read_cmd, cmd_len))	{
        return HC_FALSE;
    }

    /*call the read callback function to get the register value*/
    if(!i2c_read_interface(I2C_CTPM_ADDRESS, pbt_buf, bt_len)) {
        return HC_FALSE;
    }
    return HC_TRUE;
#else
    u8 read_cmd[3] = {0};
    u8 i = 0;

    for(i=0; i<bt_len; i++) {
        read_cmd[0] = e_reg_name + i;

        if(!i2c_write_interface(I2C_CTPM_ADDRESS, read_cmd, 1))	{
            return HC_FALSE;
        }

        /*call the read callback function to get the register value*/
        if(!i2c_read_interface(I2C_CTPM_ADDRESS, pbt_buf+i, 1)) {
            return HC_FALSE;
        }
    }

    return HC_TRUE;
#endif
}
Example #9
0
/***********************************************************************
    [function]:
		           callback:                 read register value ftom ctpm by i2c interface;
    [parameters]:
                        reg_name[in]:         the register which you want to read;
			    rx_buf[in]:              data buffer which is used to store register value;
			    rx_length[in]:          the length of the data buffer;
    [return]:
			    FTS_TRUE:              success;
			    FTS_FALSE:             fail;
************************************************************************/
static bool fts_register_read(u8 reg_name, u8* rx_buf, int rx_length)
{
    u8 read_cmd[2]= {0};
    u8 cmd_len 	= 0;

    read_cmd[0] = reg_name;
    cmd_len = 1;

    /*send register addr*/
    if(!i2c_write_interface(&read_cmd[0], cmd_len))
    {
        return false;
    }

    /*call the read callback function to get the register value*/
    if(!i2c_read_interface(rx_buf, rx_length))
    {
        return false;
    }
    return true;
}
Example #10
0
/***********************************************************************
[function]:
                      callback:         write a byte data  to ctpm;
[parameters]:
			  buffer[in]:       write buffer;
			  length[in]:      the size of write data;
[return]:
			  FTS_TRUE:      success;
			  FTS_FALSE:     io fail;
************************************************************************/
static bool byte_write(u8* buffer, int length)
{

    return i2c_write_interface(buffer, length);
}