ADD 增加run灯功能;

main
wangbo 1 month ago
parent 74c69befe9
commit 10bddb1480

@ -52,6 +52,10 @@
#define GPIO_DAU5 65 // GPIO2_A1 #define GPIO_DAU5 65 // GPIO2_A1
#define GPIO_DAU6 81 // GPIO2_C1 #define GPIO_DAU6 81 // GPIO2_C1
#define GPIO_RUN 15 // GPIO0_B7
#define GPIO_SYNC 21 // GPIO0_C5
#define GPIO_ALARM 22 // GPIO0_C6
/* Exported types ------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/
/* 记录每个打开的gpio信息 */ /* 记录每个打开的gpio信息 */
typedef struct typedef struct
@ -64,10 +68,11 @@ typedef struct
} gpio_node_t; } gpio_node_t;
/* Exported macro ------------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/
#define GPIO_RUN_LED(_v_) gpio_val_set(gpio_run_idx, _v_)
#define GPIO_485BUS(_v_) gpio_val_set(gpio_485bus_idx, _v_) #define GPIO_485BUS(_v_) gpio_val_set(gpio_485bus_idx, _v_)
#define GPIO_DAU1_VAL() gpio_val_get(gpio_dau1_idx)
/* Extern global variables ---------------------------------------------------*/ /* Extern global variables ---------------------------------------------------*/
extern int32_t gpio_run_idx;
extern int32_t gpio_485bus_idx; extern int32_t gpio_485bus_idx;
extern int32_t gpio_dau1_idx; extern int32_t gpio_dau1_idx;
extern int32_t gpio_dau2_idx; extern int32_t gpio_dau2_idx;

@ -235,6 +235,9 @@ int32_t main(int32_t argc, char **argv)
/* 主循环, 点灯喂狗. */ /* 主循环, 点灯喂狗. */
for(;;) for(;;)
{ {
/* 点 RUN 灯. */
GPIO_RUN_LED(cnt & 0x1);
sleep(1); sleep(1);
start_time++; start_time++;
cnt++; cnt++;

@ -189,8 +189,8 @@ int32_t _debug_recv_info_get(uint8_t *buf, int32_t len)
snprintf(pinfo->hostname, FILE_NAME_LEN, "%s", device_info.hostname); snprintf(pinfo->hostname, FILE_NAME_LEN, "%s", device_info.hostname);
pinfo->factory_date = device_info.factory_date; pinfo->factory_date = device_info.factory_date;
pinfo->deployment_date = device_info.deployment_date; pinfo->deployment_date = device_info.deployment_date;
snprintf((char*)pinfo->app_version, DEV_VERSION_STR_LEN, "%s", device_info.app_version); snprintf((char*)pinfo->app_version, DEV_VERSION_STR_LEN, "%s", host.version);
snprintf((char*)pinfo->app_compile_time, DEV_VERSION_STR_LEN, "%s", device_info.app_compile_time); snprintf((char*)pinfo->app_compile_time, DEV_VERSION_STR_LEN, "%s", host.compile);
snprintf((char*)pinfo->hardware_version, DEV_VERSION_STR_LEN, "%s", device_info.hardware_version); snprintf((char*)pinfo->hardware_version, DEV_VERSION_STR_LEN, "%s", device_info.hardware_version);
snprintf((char*)pinfo->FPGA_version, DEV_VERSION_STR_LEN, "%s", device_info.FPGA_version); snprintf((char*)pinfo->FPGA_version, DEV_VERSION_STR_LEN, "%s", device_info.FPGA_version);
pinfo->ip = device_info.ip; pinfo->ip = device_info.ip;

@ -55,6 +55,9 @@
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
static array_t *gpios = NULL; static array_t *gpios = NULL;
int32_t gpio_run_idx;
int32_t gpio_sync_idx;
int32_t gpio_alarm_idx;
int32_t gpio_485bus_idx; int32_t gpio_485bus_idx;
int32_t gpio_dau1_idx; int32_t gpio_dau1_idx;
int32_t gpio_dau2_idx; int32_t gpio_dau2_idx;
@ -339,6 +342,14 @@ int32_t gpio_init(void)
cmd_install_element(COMMON_NODE, &gpio_show_cmd); cmd_install_element(COMMON_NODE, &gpio_show_cmd);
gpio_run_idx = gpio_export(GPIO_RUN);
if (gpio_run_idx < 0)
{
DBG(DBG_M_GPIO, "ERROR return %d!\r\n", gpio_run_idx);
return E_BAD_PARAM;
}
LD_E_RETURN(DBG_M_GPIO, gpio_dir_set(gpio_run_idx, GPIO_DIR_OUT));
gpio_485bus_idx = gpio_export(GPIO_485_BUS); gpio_485bus_idx = gpio_export(GPIO_485_BUS);
if (gpio_485bus_idx < 0) if (gpio_485bus_idx < 0)
{ {

Loading…
Cancel
Save