Skip to content
Snippets Groups Projects
Select Git revision
  • 6b4396d02520604bd975c99c04c6dea2536b20b4
  • master default protected
  • button_gestures
  • ecg-button-gestures
  • fix-bhi160-axes
  • ecg-bpm-counter
  • patch-1
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • genofire/ble-follow-py
  • hauke/ble-cleanups
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • genofire/haule-ble-fs-deactive
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • ios-workarounds
  • schneider/fundamental-test
  • schneider/ble-buffers
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
33 results

bhi160.py

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    main.c 1.91 KiB
    #include "modules/modules.h"
    #include "modules/log.h"
    #include "modules/filesystem.h"
    #include "card10-version.h"
    
    #include "FreeRTOS.h"
    #include "task.h"
    
    #include <stdlib.h>
    #include <string.h>
    
    int main(void)
    {
    	LOG_INFO("startup", "Epicardium startup ...");
    	LOG_INFO("startup", "Version " CARD10_VERSION);
    
    	LOG_INFO("startup", "Initializing hardware ...");
    	hardware_early_init();
    
    	LOG_INFO("startup", "Initializing tasks ...");
    
    	/* Serial */
    	if (xTaskCreate(
    		    vSerialTask,
    		    (const char *)"Serial",
    		    configMINIMAL_STACK_SIZE,
    		    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();
    	}
    
    	/* API */
    	if (xTaskCreate(
    		    vApiDispatcher,
    		    (const char *)"API Dispatcher",
    		    configMINIMAL_STACK_SIZE * 16,
    		    NULL,
    		    tskIDLE_PRIORITY + 2,
    		    &dispatcher_task_id) != pdPASS) {
    		LOG_CRIT(
    			"startup",
    			"Failed to create %s task!",
    			"API Dispatcher"
    		);
    		abort();
    	}
    
    	/* BLE */
    	if (ble_shall_start()) {
    		if (xTaskCreate(
    			    vBleTask,
    			    (const char *)"BLE",
    			    configMINIMAL_STACK_SIZE * 10,
    			    NULL,
    			    tskIDLE_PRIORITY + 1,
    			    NULL) != pdPASS) {
    			LOG_CRIT("startup", "Failed to create %s task!", "BLE");
    			abort();
    		}
    	}
    
    	/* Lifecycle */
    	if (xTaskCreate(
    		    vLifecycleTask,
    		    (const char *)"Lifecycle",
    		    configMINIMAL_STACK_SIZE * 4,
    		    NULL,
    		    tskIDLE_PRIORITY + 1,
    		    NULL) != pdPASS) {
    		LOG_CRIT("startup", "Failed to create %s task!", "Lifecycle");
    		abort();
    	}
    
    	LOG_INFO("startup", "Starting FreeRTOS ...");
    	vTaskStartScheduler();
    
    	LOG_CRIT("startup", "FreeRTOS did not start due to unknown error!");
    	abort();
    }