Skip to content
Snippets Groups Projects
Select Git revision
  • 19ca6393336da8d2a33f85dbaaf547dcab6b1bf7
  • master default protected
  • reboot-to-bootloader
  • fix-off-by-one
  • genofire/ble-personal_state
  • ios-workarounds
  • schneider/maxim-sdk-update
  • rahix/simple_menu
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • koalo/wip/i2c-for-python
  • renze/safe_mode
  • renze/hatchery_apps
  • schneider/fundamental-test
  • koalo/factory-reset
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • schneider/bonding
  • schneider/bootloader-update-9a0d158
  • schneider/bsec
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
29 results

main.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    main.c 3.10 KiB
    #include "modules/modules.h"
    #include "modules/log.h"
    #include "modules/filesystem.h"
    #include "card10-version.h"
    #include "bootloader_update.h"
    
    #include "FreeRTOS.h"
    #include "task.h"
    #include "mxc_delay.h"
    
    #include <stdlib.h>
    #include <string.h>
    
    int main(void)
    {
    	watchdog_init();
    
    	LOG_INFO("startup", "Epicardium startup ...");
    	LOG_INFO("startup", "Version " CARD10_VERSION);
    
    	LOG_DEBUG("startup", "Initializing hardware ...");
    	hardware_early_init();
    
    	update_bootloader();
    
    	/*
    	 * Version Splash
    	 */
    	const char *version_buf = CARD10_VERSION;
    	const int offset = (160 - (int)strlen(version_buf) * 14) / 2;
    	epic_disp_clear(0x3b7);
    	epic_disp_print(10, 20, "Epicardium", 0x290, 0x3b7);
    	epic_disp_print(offset > 0 ? offset : 0, 40, version_buf, 0x290, 0x3b7);
    	epic_disp_update();
    	mxc_delay(2000000);
    
    	LOG_DEBUG("startup", "Initializing tasks ...");
    
    	/* Serial */
    	if (xTaskCreate(
    		    vSerialTask,
    		    (const char *)"Serial",
    		    configMINIMAL_STACK_SIZE * 2,
    		    NULL,
    		    tskIDLE_PRIORITY + 1,
    		    NULL) != pdPASS) {
    		LOG_CRIT("startup", "Failed to create %s task!", "Serial");
    		abort();
    	}
    
    	/* PMIC */
    	if (xTaskCreate(
    		    vPmicTask,
    		    (const char *)"PMIC",
    		    configMINIMAL_STACK_SIZE,
    		    NULL,
    		    tskIDLE_PRIORITY + 4,
    		    NULL) != pdPASS) {
    		LOG_CRIT("startup", "Failed to create %s task!", "PMIC");
    		abort();
    	}
    
    	/* BHI160 */
    	if (xTaskCreate(
    		    vBhi160Task,
    		    (const char *)"BHI160 Driver",
    		    configMINIMAL_STACK_SIZE * 2,
    		    NULL,
    		    tskIDLE_PRIORITY + 1,
    		    NULL) != pdPASS) {