upiwin/src/main.c
2019-12-09 13:33:23 -07:00

45 lines
990 B
C

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "scode.h"
#include "log.h"
#include "config.h"
#include "gpio.h"
#include "fbinit.h"
#include "fontengine.h"
#include "time_func.h"
#include "ep_init.h"
#include "sysinput.h"
int main(int argc, char *argv[])
{
HRESULT hr;
/* initialization sequence */
Time_init();
hr = Config_setup(argc, argv);
if (FAILED(hr))
return EXIT_FAILURE;
else if (hr != S_OK)
return EXIT_SUCCESS;
if (FAILED(Fb_setup()))
return EXIT_FAILURE;
if (FAILED(FontEng_setup()))
return EXIT_FAILURE;
if (FAILED(Gpio_setup()))
return EXIT_FAILURE;
if (FAILED(Epython_setup()))
return EXIT_FAILURE;
if (FAILED(Sys_enable_input()))
return EXIT_FAILURE;
Log(LINFO, "Pausing at startup.");
sleep(2); /* wait to show off splash screen */
Fb_clear();
if (FAILED(Epython_run()))
return EXIT_FAILURE;
Log(LINFO, "Script returned with exit code %d", Sys_Exit_Code);
return Sys_Exit_Code;
}