void hw_debug_mask(uint32_t mask)
{
    for(int i = 0; i < DEBUG_PIN_NUM; i++)
    {
        if(mask & (1<<i))
            hw_gpio_set(debug_pins[i]);
        else
            hw_gpio_clr(debug_pins[i]);
    }
}
void hw_debug_mask(uint32_t mask)
{
  for(int i = 0; i < PLATFORM_NUM_DEBUGPINS; i++)
	{
		if(mask & (1<<i))
			hw_gpio_set(debug_pins[i]);
		else
			hw_gpio_clr(debug_pins[i]);
	}
}
int main()
{
	//BSP_TraceProfilerSetup();
    // Only when using bootloader
	//SCB->VTOR=0x4000;

	//activate VCOM
#ifdef PLATFORM_USE_VCOM
	hw_gpio_configure_pin(VCOM_ENABLE, false, gpioModePushPull, 1);
	hw_gpio_set(VCOM_ENABLE);
#endif

    //initialise the platform itself
	__platform_init();
    //do not initialise the scheduler, this is done by __framework_bootstrap()
    __framework_bootstrap();
    //initialise platform functionality that depends on the framework
    __platform_post_framework_init();
    scheduler_run();
    return 0;
}
void led_on(uint8_t led_nr)
{
    if(led_nr < HW_NUM_LEDS)
    	hw_gpio_set(leds[led_nr]);
}
void hw_debug_set(uint8_t pin_id)
{
    if(pin_id < DEBUG_PIN_NUM)
        hw_gpio_set(debug_pins[pin_id]);
}
void hw_debug_set(uint8_t pin_nr)
{
    if(pin_nr < PLATFORM_NUM_DEBUGPINS)
      hw_gpio_set(debug_pins[pin_nr]);
}
// *****************************************************************************
// @fn          spi_deselect_chip
// @brief       Deselect the chip
// @param       none
// @return      none
// *****************************************************************************
void spi_deselect_chip(void)
{
	hw_gpio_set(SPI_PIN_CS);
    //GPIO_PinOutSet( SPI_PORT_CS, SPI_PIN_CS );
}