189 lines
3.9 KiB
C
189 lines
3.9 KiB
C
#include "awtk.h"
|
|
#include "gpio_protocol.h"
|
|
#include "board.h"
|
|
#include "chip.h"
|
|
|
|
|
|
void right_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_R_LED, TRUE);
|
|
}
|
|
|
|
void right_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_R_LED, FALSE);
|
|
}
|
|
|
|
void left_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_L_LED, TRUE);
|
|
}
|
|
|
|
void left_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_L_LED, FALSE);
|
|
}
|
|
|
|
void yg_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_YG_LED, TRUE);
|
|
}
|
|
|
|
void yg_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_YG_LED, FALSE);
|
|
}
|
|
|
|
void abs_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_ABS, TRUE);
|
|
}
|
|
|
|
void abs_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_ABS, FALSE);
|
|
}
|
|
|
|
void oil_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_OIL, TRUE);
|
|
}
|
|
|
|
void oil_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_OIL, FALSE);
|
|
}
|
|
|
|
void n_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_N_LED, TRUE);
|
|
}
|
|
|
|
void n_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_N_LED, FALSE);
|
|
}
|
|
|
|
void eng_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_ENG_LED, TRUE);
|
|
}
|
|
|
|
void eng_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_ENG_LED, FALSE);
|
|
}
|
|
|
|
void vbat_led_on(void){
|
|
gpio_direction_output(GPIO_LIGHT_VBAT_LED, TRUE);
|
|
}
|
|
|
|
void vbat_led_off(void){
|
|
gpio_direction_output(GPIO_LIGHT_VBAT_LED, FALSE);
|
|
}
|
|
|
|
|
|
void light_gpio_init(void){
|
|
//灯光使能
|
|
gpio_direction_output(47, TRUE);
|
|
//R_LED
|
|
gpio_direction_output(GPIO_LIGHT_R_LED, TRUE);
|
|
//YG_LED
|
|
gpio_direction_output(GPIO_LIGHT_YG_LED, TRUE);
|
|
//OIL_LED
|
|
gpio_direction_output(GPIO_LIGHT_OIL, TRUE);
|
|
//L_LED
|
|
gpio_direction_output(GPIO_LIGHT_L_LED, TRUE);
|
|
//N_LED
|
|
gpio_direction_output(GPIO_LIGHT_N_LED, TRUE);
|
|
// #if (MOTO_WARE_HOSE == MOTO_ICMX_A580A)
|
|
// //ABS_LED
|
|
// gpio_direction_output(GPIO_LIGHT_ABS, TRUE);
|
|
// //ENG_LED
|
|
// gpio_direction_output(GPIO_LIGHT_ENG_LED, TRUE);
|
|
// #endif
|
|
//VBAT_LED
|
|
gpio_direction_output(GPIO_LIGHT_VBAT_LED, TRUE);
|
|
|
|
gpio_direction_input(GPIO_LIGHT_SET);
|
|
gpio_direction_input(GPIO_LIGHT_MODE);
|
|
|
|
gpio_timer();//按键 //左右灯光
|
|
|
|
}
|
|
|
|
void light_off(void){
|
|
//R_LED
|
|
gpio_direction_output(GPIO_LIGHT_R_LED, FALSE);
|
|
//YG_LED
|
|
gpio_direction_output(GPIO_LIGHT_YG_LED, FALSE);
|
|
//OIL_LED
|
|
gpio_direction_output(GPIO_LIGHT_OIL, FALSE);
|
|
//L_LED
|
|
gpio_direction_output(GPIO_LIGHT_L_LED, FALSE);
|
|
//N_LED
|
|
gpio_direction_output(GPIO_LIGHT_N_LED, FALSE);
|
|
// #if (MOTO_WARE_HOSE == MOTO_ICMX_A580A)
|
|
// //ABS_LED
|
|
// gpio_direction_output(GPIO_LIGHT_ABS, FALSE);
|
|
// //ENG_LED
|
|
// gpio_direction_output(GPIO_LIGHT_ENG_LED, FALSE);
|
|
// #endif
|
|
//VBAT_LED
|
|
gpio_direction_output(GPIO_LIGHT_VBAT_LED, FALSE);
|
|
|
|
}
|
|
|
|
|
|
void right_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:right_led_off();break;
|
|
case 1:right_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void left_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:left_led_off();break;
|
|
case 1:left_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void yg_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:yg_led_off();break;
|
|
case 1:
|
|
yg_led_on();
|
|
break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void abs_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:abs_led_off();break;
|
|
case 1:abs_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void oil_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:oil_led_off();break;
|
|
case 1:oil_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void n_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:n_led_off();break;
|
|
case 1:n_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void vbat_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:vbat_led_off();break;
|
|
case 1:vbat_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|
|
|
|
void eng_led_switch(uint8_t type){
|
|
switch(type){
|
|
case 0:eng_led_off();break;
|
|
case 1:eng_led_on();break;
|
|
default:break;
|
|
}
|
|
}
|