Skip to content
Snippets Groups Projects
Select Git revision
  • 18da37fb24981b0855dd34dc1f7c9dbf7bdd0ac5
  • master default protected
  • backslash
  • nickname-match-configs
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • genofire/ble-follow-py
  • 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
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • koalo/bhi160-works-but-dirty
  • koalo/wip/i2c-for-python
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
34 results

main.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    main.c 1.96 KiB
    #include <stdio.h>
    #include <stdlib.h>
    
    #include "max32665.h"
    #include "uart.h"
    #include "cdcacm.h"
    
    #include "card10.h"
    #include "pmic.h"
    #include "leds.h"
    #include "api/dispatcher.h"
    #include "modules/modules.h"
    #include "modules/log.h"
    
    #include <Heart.h>
    #include "GUI_Paint.h"
    
    #include "FreeRTOS.h"
    #include "task.h"
    
    TaskHandle_t dispatcher_task_id;
    
    /*
     * API dispatcher task.  This task will sleep until an API call is issued and
     * then wake up to dispatch it.
     */
    void vApiDispatcher(void *pvParameters)
    {
    	while (1) {
    		if (api_dispatcher_poll()) {
    			api_dispatcher_exec();
    		}
    		ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
    	}
    }
    
    int main(void)
    {
    	card10_init();
    	card10_diag();
    
    	Paint_DrawImage(Heart, 0, 0, 160, 80);
    	LCD_Update();
    
    	/* TODO: Move this to its own function */
    	SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
    
    	cdcacm_init();
    	fatfs_init();
    
    	LOG_DEBUG("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,