Skip to content
Snippets Groups Projects
Select Git revision
  • f8c5454b6e4c4252f711ad4665c8cfd5e108b36c
  • master default protected
  • Stormwind
  • patch-1
  • schneider/bsec
  • dx/meh-bdf-to-stm
  • dx/somewhat-more-dynamic-config
  • rahix/proper-sleep
  • 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
37 results

core1-dispatcher.c

Blame
  • Forked from card10 / firmware
    1807 commits behind the upstream repository.
    Rahix's avatar
    rahix authored
    Signed-off-by: default avatarRahix <rahix@rahix.de>
    f8c5454b
    History
    core1-dispatcher.c 850 B
    #include "board.h"
    #include "gpio.h"
    #include "mxc_delay.h"
    #include "api.h"
    #include "tmr_utils.h"
    
    #include "api/api_dispatcher.h"
    
    static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
    
    void api_set_buzzer(uint8_t state)
    {
    	if (state) {
    		printf("API: Turning motor ON!\n");
    		GPIO_OutSet(&motor_pin);
    	} else {
    		printf("API: Turning motor OFF!\n");
    		GPIO_OutClr(&motor_pin);
    	}
    }
    
    void api_set_led(uint8_t led, led_color_t color)
    {
    	printf("API: Changing color of led %d.\n", led);
    	leds_set(led, color.red, color.green, color.blue);
    }
    
    int main(void)
    {
    	api_init(NULL);
    
    	while (1) {
    		api_dispatcher();
                    TMR_Delay(MXC_TMR1, MSEC(100), 0);
    	}
    
    #if 0
    	// Enable rxev on core1
    	MXC_GCR->evten |= 0x20;
    	for (int i = 0; 1; i++) {
    		__asm volatile("wfe");
    		printf("core1: Hello! %d\n", i);
    	}
    #endif
    }