A59项目初版工程 1.电压+光感adc采样优化 2.串口逻辑优化
This commit is contained in:
184
app/moto/protocol/gpio_protocol.c
Normal file
184
app/moto/protocol/gpio_protocol.c
Normal file
@ -0,0 +1,184 @@
|
||||
#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(GPIO_LIGHT, TRUE);
|
||||
//R_LED
|
||||
gpio_direction_output(GPIO_LIGHT_R_LED, TRUE);
|
||||
//YG_LED
|
||||
gpio_direction_output(GPIO_LIGHT_YG_LED, TRUE);
|
||||
//ABS_LED
|
||||
gpio_direction_output(GPIO_LIGHT_ABS, 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);
|
||||
//ENG_LED
|
||||
gpio_direction_output(GPIO_LIGHT_ENG_LED, TRUE);
|
||||
//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);
|
||||
//ABS_LED
|
||||
gpio_direction_output(GPIO_LIGHT_ABS, 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);
|
||||
//ENG_LED
|
||||
gpio_direction_output(GPIO_LIGHT_ENG_LED, FALSE);
|
||||
//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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user