hurricane/arducam/main.c

/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#include "common.h"
#include "hurricane.h"
static hurricane_demo_t demo_info =
{
.demo_name = "Arducam",
.start_demo_callback = start_demo_handler,
.stop_demo_callback = NULL,
.draw_splash_screen_callback = HURRICANE_SPLASH_DEFAULT_FUNCTION,
.demo_splash_screen_arg = NULL,
.splash_font_color = HURRICANE_SPLASH_DEFAULT_FONT_COLOR,
};
/*************************************************************************************************/
void gos_app_init(void)
{
gos_result_t result;
// Load the application settings
if (GOS_FAILED(result, settings_init()))
{
GOS_LOG("Failed to load settings, err:%d", result);
return;
}
hurricane_init(&demo_info);
}
/*************************************************************************************************/
static void start_demo_handler(void *arg)
{
gos_result_t result;
GOS_LOG("Starting Arducam demo");
if(GOS_FAILED(result, hurricane_discover_daughter_card(HURRICANE_CARD_CAMERA_GPS)))
{
GOS_LOG("Failed to discover the camera daughter card");
hurricane_display_write_msg(&GUI_Font16B_1, "Failed to discover the camera daughter card");
return;
}
else if(GOS_FAILED(result, camera_init()))
{
GOS_LOG("Failed to initialize camera, err:%d", result);
hurricane_display_write_msg(&GUI_Font16B_1, "Failed to init camera: %d", result);
return;
}
else if(GOS_FAILED(result, network_init()))
{
GOS_LOG("Failed to initialize network, err:%d", result);
hurricane_display_write_msg(&GUI_Font16B_1, "Failed to init network: %d", result);
return;
}
}