示例#1
0
static __inline int pp2106_get_data(uint32_t *p_data)
{
	int trigger_count;
	int first_bit_count = 0;

	QWERTY_SDA_OUTPUT();
	QWERTY_SCL_HIGH();
	QWERTY_SDA_LOW();

	for (trigger_count=QWERTY_START_BIT;
			trigger_count < QWERTY_MAX_BIT; trigger_count++) {
		if (trigger_count == QWERTY_START_BIT) {
			QWERTY_SCL_LOW();
			QWERTY_SDA_INPUT();	
			QWERTY_SCL_HIGH();
		} 
		else if (trigger_count >= QWERTY_1ST_BIT7 &&
				trigger_count <= QWERTY_1ST_BIT0) {
			QWERTY_SCL_LOW();
			if(QWERTY_SDA_READ()) {
				*p_data |= 0x80 >> (first_bit_count);
			}
			first_bit_count++;
			QWERTY_SCL_HIGH();
		}
		else if (trigger_count == QWERTY_ACK_BIT) {
static __inline int pp2106_get_data(uint32_t *p_data)
{
	int trigger_count;
	int first_bit_count = 0;
  	int ret = 1;

  	udelay(35);
  	if(gpio_get_value(pp2106_pdata->irq_pin) == 1)
  	{
    	ret = 2;
    	return ret;
  	}

	QWERTY_SDA_OUTPUT();
	QWERTY_SCL_HIGH();
	QWERTY_SDA_LOW();

	for (trigger_count=QWERTY_START_BIT;
			trigger_count < QWERTY_MAX_BIT; trigger_count++) {
		if (trigger_count == QWERTY_START_BIT) {
			QWERTY_SCL_LOW();
			QWERTY_SDA_INPUT();	
			QWERTY_SCL_HIGH();
		} 
		else if (trigger_count >= QWERTY_1ST_BIT7 &&
				trigger_count <= QWERTY_1ST_BIT0) {
			QWERTY_SCL_LOW();
			if(QWERTY_SDA_READ()) {
				*p_data |= 0x80 >> (first_bit_count);
			}
			first_bit_count++;
			QWERTY_SCL_HIGH();
		}
		else if (trigger_count == QWERTY_ACK_BIT) {
示例#3
0
static __inline void pp2106_send_ack(void)
{
	QWERTY_SDA_OUTPUT();
	QWERTY_SDA_LOW();

	QWERTY_SCL_LOW();
	gpio_configure(KEY_SDA_PIN,GPIOF_INPUT);  
	QWERTY_SCL_HIGH();
}
static __inline void pp2106_send_ack(void)
{
	QWERTY_SDA_OUTPUT();
	QWERTY_SDA_LOW();

	QWERTY_SCL_LOW();
	gpio_direction_input(KEY_SDA_PIN);
	QWERTY_SCL_HIGH();
}