Ejemplo n.º 1
0
/*#####################################################*/
void gpio_idle(new_gpio *gpio_struct)
{
	if(_gpio_in(gpio_struct) == 0 && gpio_struct->LastState == true) {
		gpio_struct->LastState = false;
		gpio_struct->event.state_dn = true;
		if(gpio_struct->event.on_state_changed) gpio_struct->event.on_state_changed(gpio_struct->event.on_state_changed_data, false);
	} else if(_gpio_in(gpio_struct) != 0 && gpio_struct->LastState == false) {
		gpio_struct->LastState = true;
		gpio_struct->event.state_up = true;
		if(gpio_struct->event.on_state_changed) gpio_struct->event.on_state_changed(gpio_struct->event.on_state_changed_data, true);
	}
}
//EXPORT_SYMBOL(sec_set_led_state);
int sec_get_led_state(int lednum)
{
	int i, rgb=0;
	if(lednum<LED1 || lednum>=LED_MAX){
		LOG("args boundary error\n");
		return -1;
	}
	for(i=0;i<LED_COLOR_MAX;i++) { // i= LED_COLOR_BIT
		rgb = _gpio_in(g_led_pins[lednum][i]);
		rgb=rgb<<1;
	}
	return rgb;
}