Skip to content
Snippets Groups Projects
Select Git revision
  • esp32-nimble-wiki
  • rahix/hw-lock-new-mutex
  • master default protected
  • dx/somewhat-more-dynamic-config
  • schneider/sdk-0.2.1-7
  • schneider/bsec
  • dx/meh-bdf-to-stm
  • dx/flatten-config-module
  • genofire/ble-follow-py
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • v1.12
  • v1.11
  • v1.10
  • 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
36 results

api_caller.c

Blame
  • Forked from card10 / firmware
    1807 commits behind the upstream repository.
    api_caller.c 650 B
    #include <stdlib.h>
    
    #include "api/api_caller.h"
    #include "tmr_utils.h"
    
    void* api_call_start (uint32_t id, void* args, uint32_t size)
    {
    	// aquire semaphore
    	while (E_BUSY == SEMA_GetSema (API_CALL_SEMA)) ;
    
    	ApiCallSpace->id = id;
    	ApiCallSpace->returning = 0;
    	return ApiCallSpace->buf;
    }
    
    void* api_call_bother_dispatcher (void* buf)
    {
    	SEMA_FreeSema (API_CALL_SEMA);
    	// TODO: set event
    
    	while(1) {
    		// aquire semaphore
    		while (E_BUSY == SEMA_GetSema (API_CALL_SEMA)) ;
    		if (ApiCallSpace->returning == 1) {
    			break;
    		}
    		SEMA_FreeSema(API_CALL_SEMA);
    		TMR_Delay(MXC_TMR2, MSEC(100), 0);
    	}
    	SEMA_FreeSema(API_CALL_SEMA);
    
    	return NULL;
    }