upiwin/src/main.c

45 lines
990 B
C
Raw Normal View History

2019-11-29 02:05:30 -07:00
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "scode.h"
2019-12-09 13:33:23 -07:00
#include "log.h"
#include "config.h"
2019-11-29 02:05:30 -07:00
#include "gpio.h"
2019-12-01 18:53:54 -07:00
#include "fbinit.h"
2019-12-07 23:37:21 -07:00
#include "fontengine.h"
#include "time_func.h"
#include "ep_init.h"
#include "sysinput.h"
2019-11-29 02:05:30 -07:00
int main(int argc, char *argv[])
{
2019-12-06 22:37:20 -07:00
HRESULT hr;
2019-12-07 13:07:59 -07:00
/* initialization sequence */
2019-12-01 15:43:05 -07:00
Time_init();
2019-12-06 22:37:20 -07:00
hr = Config_setup(argc, argv);
if (FAILED(hr))
return EXIT_FAILURE;
2019-12-06 22:37:20 -07:00
else if (hr != S_OK)
return EXIT_SUCCESS;
if (FAILED(Fb_setup()))
2019-12-01 18:53:54 -07:00
return EXIT_FAILURE;
if (FAILED(FontEng_setup()))
return EXIT_FAILURE;
if (FAILED(Gpio_setup()))
2019-11-29 02:05:30 -07:00
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 */
2019-11-29 02:05:30 -07:00
Fb_clear();
if (FAILED(Epython_run()))
return EXIT_FAILURE;
2019-12-01 20:57:36 -07:00
Log(LINFO, "Script returned with exit code %d", Sys_Exit_Code);
return Sys_Exit_Code;
2019-11-29 02:05:30 -07:00
}