Ejemplo n.º 1
0
static int pwm_driver_init(void)
{
	int retval;
	
	/* 開始のメッセージ */
	printk(KERN_INFO "%s: loading...\n", PWMDRV_DEVNAME );
	
	/* GPIOレジスタがマップ可能か調べる */
	retval = rpi_gpio_map();
	if( retval != 0 ) {
		printk( KERN_ALERT "Can not use GPIO registers.\n");
		return -EBUSY;
	}
	/* GPIO初期化 */
	gpio_setup();
	
	if( pwm_driver_register_dev() != 0 ) {
		printk( KERN_ERR "Can not register ssled4d\n");
		return -EBUSY;
	}
	/* スピンロック初期化 */
	spin_lock_init(&pwm_driver_spinlock);
	register_refresh_timer();

	printk( KERN_INFO "pwm_driver: driver register sccessed.\n");
	
	return 0;
}
Ejemplo n.º 2
0
int main(void)
{
        rcc_clock_setup_in_hse_16mhz_out_72mhz();
	gpio_setup();
	nvic_setup();

	gpio_clear(GPIOB, GPIO7);	/* LED1 on */
	gpio_set(GPIOB, GPIO6);		/* LED2 off */
	
	rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_TIM2EN);

	/* the goal is to let the LED2 glow for a second and then be off for a second */	

	/* Set timer start value */
	TIM_CNT(TIM2) = 1;

	/* Set timer prescaler. 72MHz/1440 => 50000 counts per second */
	TIM_PSC(TIM2) = 1440;

	/* End timer value. If this value is reached an interrupt is generated */
	TIM_ARR(TIM2) = 50000;

	/* Update interrupt enable */
	TIM_DIER(TIM2) |= TIM_DIER_UIE;

	/* Start timer */
	TIM_CR1(TIM2) |= TIM_CR1_CEN;

	while(1); /* Halt. */

	return 0;
}
Ejemplo n.º 3
0
int main(void)
{
        rcc_clock_setup_in_hse_16mhz_out_72mhz();
	gpio_setup();

	gpio_clear(GPIOB, GPIO7);	/* LED1 on */
	gpio_set(GPIOB, GPIO6);		/* LED2 off */
	
	temp32 = 0;

	/* 72MHz / 8 => 9000000 counts per second */
	systick_set_clocksource(STK_CTRL_CLKSOURCE_AHB_DIV8); 

	/* 9000000/9000 = 1000 overflows per second - every 1ms one interrupt */
	systick_set_reload(9000);

	systick_interrupt_enable();

	/* start counting */
	systick_counter_enable();
	
	while(1); /* Halt. */

	return 0;
}
Ejemplo n.º 4
0
int main(void)
{
    int i;

    gpio_setup();

    /* Blink LED1 (PC9) on the board. */
    while (1) {
        /* Manually: */
        // GPIOC_BSRR = GPIO9;		/* LED off */
        // for (i = 0; i < 800000; i++)	/* Wait a bit. */
        // 	__asm__("nop");
        // GPIOC_BRR = GPIO9;		/* LED on */
        // for (i = 0; i < 800000; i++)	/* Wait a bit. */
        // 	__asm__("nop");

        /* Using API functions gpio_set()/gpio_clear(): */
        // gpio_set(GPIOC, GPIO9);	/* LED off */
        // for (i = 0; i < 800000; i++)	/* Wait a bit. */
        // 	__asm__("nop");
        // gpio_clear(GPIOC, GPIO9);	/* LED on */
        // for (i = 0; i < 800000; i++)	/* Wait a bit. */
        // 	__asm__("nop");

        /* Using API function gpio_toggle(): */
        gpio_toggle(GPIOC, GPIO11);

        for (i = 0; i < 800000; i++)	/* Wait a bit. */
            __asm__("nop");
    }

    return 0;
}
Ejemplo n.º 5
0
int main(void)
{
	int i;

	clock_setup();
	button_setup();
	gpio_setup();

	/* Blink the LED (PD12) on the board. */
	while (1) {
		gpio_toggle(GPIOD, GPIO12);

		/* Upon button press, blink more slowly. */
		if (gpio_get(GPIOA, GPIO0)) {
			for (i = 0; i < 3000000; i++) {	/* Wait a bit. */
				__asm__("nop");
			}
		}

		for (i = 0; i < 3000000; i++) {		/* Wait a bit. */
			__asm__("nop");
		}
	}

	return 0;
}
Ejemplo n.º 6
0
Archivo: blink.c Proyecto: synergia/arm
int main(void){
	volatile int i;

	gpio_setup();

	/* Blink the LED (PC12) on the board. */
	while (1) {
		/* Manually: */
		// GPIOC_BSRR = GPIO12;		/* LED off */
		// for (i = 0; i < 80000; i++);	/* Wait (needs -O0 CFLAGS). */
		// GPIOC_BRR = GPIO12;		/* LED on */
		// for (i = 0; i < 80000; i++);	/* Wait (needs -O0 CFLAGS). */

		/* Using API functions gpio_set()/gpio_clear(): */
		// gpio_set(GPIOC, GPIO12);	/* LED off */
		// for (i = 0; i < 80000; i++);	/* Wait (needs -O0 CFLAGS). */
		// gpio_clear(GPIOC, GPIO12);	/* LED on */
		// for (i = 0; i < 80000; i++);	/* Wait (needs -O0 CFLAGS). */

		/* Using API function gpio_toggle(): */
		gpio_toggle(GPIOB, GPIO2);	/* LED on/off */
		gpio_toggle(GPIOB, GPIO5);	/* LED on/off */
		for (i = 0; i < 80000; i++);	/* Wait (needs -O0 CFLAGS). */
	}

	return 0;
}
Ejemplo n.º 7
0
static int setup_devices() {
	// Basic prerequisites for everything else
	miu_setup();
	power_setup();
	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();

	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();
	wdt_setup();

	// Other devices
	usb_shutdown();
	uart_setup();
	i2c_setup();

	dma_setup();

	spi_setup();

	return 0;
}
Ejemplo n.º 8
0
int main(void)
{
	clock_setup();
	gpio_setup();
	hal_tick_init();
	debug_usart_setup();
	bluetooth_setup();

	// start with BTstack init - especially configure HCI Transport
    btstack_memory_init();
    run_loop_init(RUN_LOOP_EMBEDDED);
    
    // init HCI
    hci_transport_t    * transport = hci_transport_h4_dma_instance();
    bt_control_t       * control   = bt_control_cc256x_instance();
    remote_device_db_t * remote_db = (remote_device_db_t *) &remote_device_db_memory;
    hci_init(transport, (void*) &hci_uart_config_cc256x, control, remote_db);

    // enable eHCILL
    bt_control_cc256x_enable_ehcill(1);

	// hand over to btstack embedded code 
    btstack_main();

    // go
    run_loop_execute();

	return 0;
}
Ejemplo n.º 9
0
int main(void)
{
	int i;

	gpio_setup();

	/* Blink the LED (PC8) on the board. */
	while (1) {
		/* Manually: */
		// GPIOD_BSRR = GPIO12;		/* LED off */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		// 	__asm__("nop");
		// GPIOD_BRR = GPIO12;		/* LED on */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		// 	__asm__("nop");

		/* Using API functions gpio_set()/gpio_clear(): */
		// gpio_set(GPIOD, GPIO12);	/* LED off */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		// 	__asm__("nop");
		// gpio_clear(GPIOD, GPIO12);	/* LED on */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		// 	__asm__("nop");

		/* Using API function gpio_toggle(): */
		gpio_toggle(PORT_LED, PIN_LED);	/* LED on/off */
		for (i = 0; i < 1000000; i++)	/* Wait a bit. */
			__asm__("nop");
	}

	return 0;
}
Ejemplo n.º 10
0
int main(void)
{
	int i;

	clock_setup();
	gpio_setup();
	button_setup();

	/* Blink the LED (PC9) on the board. */
	while (1) {
		gpio_toggle(GPIOC, GPIO9);

		/* Upon button press, blink more slowly. */
		exti_line_state = GPIOA_IDR;
		if ((exti_line_state & (1 << 0)) != 0) {
			for (i = 0; i < 800000; i++)	/* Wait a bit. */
				__asm__("nop");
		}

		for (i = 0; i < 800000; i++)		/* Wait a bit. */
			__asm__("nop");
	}

	return 0;
}
int main(void)
{
	rcc_clock_setup_in_hse_8mhz_out_72mhz();
	gpio_setup();

	gpio_clear(GPIOA, GPIO7);	/* LED1 on */
	gpio_set(GPIOA, GPIO6);		/* LED2 off */

	temp32 = 0;

	/* 72MHz / 8 => 9000000 counts per second */
	systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8);

	/* 9000000/9000 = 1000 overflows per second - every 1ms one interrupt */
	/* SysTick interrupt every N clock pulses: set reload to N-1 */
	systick_set_reload(8999);

	systick_interrupt_enable();

	/* Start counting. */
	systick_counter_enable();

	while (1); /* Halt. */

	return 0;
}
Ejemplo n.º 12
0
int main(void)
{
	int counter = 0;
	uint16_t rx_value = 0x42;

	clock_setup();
	gpio_setup();
	usart_setup();
	spi_setup();


	/* Blink the LED (PA8) on the board with every transmitted byte. */
	while (1) {
		/* LED on/off */
		gpio_toggle(GPIOA, GPIO8);

		/* printf the value that SPI should send */
		printf("Counter: %i  SPI Sent Byte: %i", counter, (uint8_t) counter);
		/* blocking send of the byte out SPI1 */
		spi_send(SPI1, (uint8_t) counter);
		/* Read the byte that just came in (use a loopback between MISO and MOSI
		 * to get the same byte back)
		 */
		rx_value = spi_read(SPI1);
		/* printf the byte just received */
		printf("    SPI Received Byte: %i\r\n", rx_value);

		counter++;
		
	}

	return 0;
}
Ejemplo n.º 13
0
int main(void)
{
    int i;
    gpio_setup();

    /* Set 1V8 */
    gpio_set(PORT_EN1V8, PIN_EN1V8);

    /* Blink LED1 on the board and Read BOOT0/1/2/3 pins. */
    while (1)
    {
        boot0 = BOOT0_STATE;
        boot1 = BOOT1_STATE;
        boot2 = BOOT2_STATE;
        boot3 = BOOT3_STATE;

        gpio_set(PORT_LED1_3, (PIN_LED1)); /* LED on */
        for (i = 0; i < 2000000; i++)	/* Wait a bit. */
            __asm__("nop");
        gpio_clear(PORT_LED1_3, (PIN_LED1)); /* LED off */
        for (i = 0; i < 2000000; i++)	/* Wait a bit. */
            __asm__("nop");
    }

    return 0;
}
Ejemplo n.º 14
0
int main(void)
{
	clock_setup();
	gpio_setup();
	usart_setup();
	spi_setup();
	buffer_init(send_buffer,BUFFER_SIZE);
	buffer_init(receive_buffer,BUFFER_SIZE);
	usart_enable_tx_interrupt(USART1);

/* Send a greeting message on USART1. */
	usart_print_string("SD Card SPI Mode Test\r\n");

	while (1)
	{
/* Command interface */
        if (buffer_input_available(receive_buffer))
        {
            char character = buffer_get(receive_buffer);
            if (character == 0x0D)
            {
                line[characterPosition] = 0;
                characterPosition = 0;
                parseCommand(line);
            }
            else line[characterPosition++] = character;
        }
	}

	return 0;
}
Ejemplo n.º 15
0
int main(void)
{
	clock_setup();
	usart_clock_setup();
	gpio_setup();
	usart_setup();

	printf("\r\nstarting i2c scan.\r\n");

	int i, j;
	for (i = 1; i < 0x80; i++) {
		i2c_init();
		msleep(50);
		for (j = 0; j < 0x100; j++) {
			int data; // = 0;
			data = i2c_read(I2C3, i, j);
			if (data > -1) {
				if (data) {
					printf("device on address 0x%02X : reg = 0x%02X with data == 0x%02X\r\n", i, j, data);
				}
			} else {
				printf("errerr!!\r\n");
				break;
			}
			//i2c_send_stop(I2C3);
		}
		i2c_deinit();
		msleep(50);
	}
	printf("scan ended!\r\n");
	return 0;
}
Ejemplo n.º 16
0
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();

	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();

	// Other devices
	usb_shutdown();
	uart_setup();
	i2c_setup();

	// DMA currently f***s up. Need to check why. -- Bluerise
	// dma_setup();

	LeaveCriticalSection();

	framebuffer_hook(); // TODO: Remove once LCD implemented -- Ricky26
	framebuffer_setdisplaytext(TRUE);
}
Ejemplo n.º 17
0
int main(void)
{
	int i, j = 0, c = 0;

	clock_setup();
	gpio_setup();
	usart_setup();

	/* Blink the LED (PE10) on the board with every transmitted byte. */
	while (1) {
		gpio_toggle(GPIO_PE10);			/* LED on/off */
		usart_send_blocking(USART1, c + '0');	/* USART1: Send byte. */
		usart_send_blocking(USART2, c + '0');	/* USART2: Send byte. */
		usart_send_blocking(USART3, c + '0');	/* USART3: Send byte. */
		c = (c == 9) ? 0 : c + 1;	/* Increment c. */
		if ((j++ % 80) == 0) {	/* Newline after line full. */
			usart_send_blocking(USART1, '\r');
			usart_send_blocking(USART1, '\n');
			usart_send_blocking(USART2, '\r');
			usart_send_blocking(USART2, '\n');
			usart_send_blocking(USART3, '\r');
			usart_send_blocking(USART3, '\n');
		}
		for (i = 0; i < 800000; i++)	/* Wait a bit. */
			__asm__ ("nop");
	}

	return 0;
}
Ejemplo n.º 18
0
void mcu_main()
{
	int version = api_version();
	debug_print(DBG_INFO, "API version: %d.%d\n", version/100, version%100);

	gpio_setup(GPIO_DHT, OUTPUT);
	gpio_write(GPIO_DHT, HIGH);

	/* do not send instructions within 1S after power on to pass the unstable state */
	mcu_sleep(100);

	uint8_t data[DHT_DATA_LEN];
	while (1) {
		int rc;
		uint8_t humidity, temperature;
		if ((rc = dht11_read(GPIO_DHT, data, sizeof(data))) == DHT_SUCCESS) {
			humidity = data[0], temperature = data[2];
			debug_print(DBG_INFO, "Humidity: %d%, Temperature: %d C\n", humidity, temperature);
//			debug_print(DBG_INFO, "%d %d %d %d %d\n",
//						data[0], data[1], data[2], data[3], data[4]);
		} else {
			debug_print(DBG_ERROR, "dht11_read() error [%d]\n", rc);
		}

		unsigned char buf[LEN_IPCBUF];
		if ((rc = host_receive(buf, sizeof(buf))) > 0 && buf[0] == '?') {
			rc = mcu_snprintf((char*)buf, LEN_IPCBUF, "RH=%d,T=%d\n", humidity, temperature);
			host_send(buf, rc);
		}

		mcu_sleep(300);
	}
}
Ejemplo n.º 19
0
int main(void)
{

    uint16_t printer_data = 0xff;
    clock_setup();
    gpio_setup();
    mco_setup();
    usart_setup();
    spi_setup();
    //timer_setup();
    systick_setup(SYSTICK_FREQ);
    print("Hello from STM32F0\n");
   // StepperMotor engine(GPIOA, M1,M2,M3,M4);
    //gpio_port_write(GPIOA,0);
//    gpio_set(GPIOA,GPIO1);
    //engine.step(100);
    while (1) {
        printer_send(printer_data);
        engine.step(1);
        delay(200);
       //engine.step(1);
       /*
    for(i = 0; i < sizeof(steps)/sizeof(steps[0]);i++) {
    gpio_port_write(GPIOA,steps[i]);
    delay(3);
    }
    */
    };
}
int main(void)
{
	rcc_clock_setup_in_hse_8mhz_out_72mhz();
	gpio_setup();
	timer_setup();


/*
 * The goal is to let the LED2 glow for a second and then be
 * off for a second.
 */

	while (1) /* Halt. */
	{
/* Update interrupt enable. */
		timer_enable_irq(TIM2, TIM_DIER_UIE);

/* Start timer. */
		timer_enable_counter(TIM2);

//		gpio_toggle(GPIOB, GPIO9);	/* LED on/off */
/* Delay for 1 second LED flashes */
//		int i;
//		for (i = 0; i < 6400000; i++)	/* Wait a bit. */
//			__asm__("nop");
	}

	return 0;
}
Ejemplo n.º 21
0
int main(void)
{
	int i;

	button_boot();

	gpio_setup();

	/* Blink the LED (PA8) on the board. */
	while (1) {
		/* Manually: */
		// GPIOA_BSRR = GPIO8;		/* LED off */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		//	__asm__("nop");
		// GPIOA_BRR = GPIO8;		/* LED on */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		//	__asm__("nop");

		/* Using API functions gpio_set()/gpio_clear(): */
		// gpio_set(GPIOA, GPIO8);	/* LED off */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		//	__asm__("nop");
		// gpio_clear(GPIOA, GPIO8);	/* LED on */
		// for (i = 0; i < 1000000; i++)	/* Wait a bit. */
		//	__asm__("nop");

		/* Using API function gpio_toggle(): */
		gpio_toggle(GPIOA, GPIO8);	/* LED on/off */
		for (i = 0; i < 1000000; i++) {	/* Wait a bit. */
			__asm__("nop");
		}
	}

	return 0;
}
Ejemplo n.º 22
0
int main(void)
{
#if defined(BOOTLOADER8K)
	SCB_VTOR = (uint32_t) 0x08002000;
#endif

	int i;

	clock_setup();
	gpio_setup();

	/* Blink the LED on the board. */
	while (1) {
		gpio_toggle(LED_GPIO, LED_PIN);

		/* Upon button press, blink more slowly. */
		if (gpio_get(BUTTON_GPIO, BUTTON_PIN)) {
			for (i = 0; i < 2000000; i++) {	/* Wait a bit. */
				__asm__("nop");
			}
		}

		for (i = 0; i < 2000000; i++) {		/* Wait a bit. */
			__asm__("nop");
		}
	}

	return 0;
}
Ejemplo n.º 23
0
int main(void)
{
	int i;

	struct color colors[COLOR_COUNT];

	clock_setup();
	gpio_setup();

	reset_colors(colors, COLOR_COUNT);
	init_colors(colors, COLOR_COUNT);

	while (1) {
		gpio_toggle(GPIOC, GPIO12);	/* LED on/off */

		send_colors(colors, COLOR_COUNT);

		step_colors(colors, COLOR_COUNT);

		for (i = 0; i < 1000000; i++)	/* Wait a bit. */
			__asm__("nop");
	}

	return 0;
}
Ejemplo n.º 24
0
int main(void)
{
	clock_setup();
	gpio_setup();

	// provides time_curr_us to usbh_poll function
	tim6_setup();

#ifdef USART_DEBUG
	usart_init(USART6, 921600);
#endif
	LOG_PRINTF("\n\n\n\n\n###################\nInit\n");

	/**
	 * device driver initialization
	 *
	 * Pass configuration struct where the callbacks are defined
	 */
	hid_driver_init(&hid_config);
	hub_driver_init();
	gp_xbox_driver_init(&gp_xbox_config);
	midi_driver_init(&midi_config);

	gpio_set(GPIOD,  GPIO13);
	/**
	 * Pass array of supported low level drivers
	 * In case of stm32f407, there are up to two supported OTG hosts on one chip.
	 * Each one can be enabled or disabled in usbh_config.h - optimization for speed
	 *
	 * Pass array of supported device drivers
	 */
	usbh_init(lld_drivers, device_drivers);
	gpio_clear(GPIOD,  GPIO13);

	LOG_PRINTF("USB init complete\n");

	LOG_FLUSH();

	while (1) {
		// set busy led
		gpio_set(GPIOD,  GPIO14);

		uint32_t time_curr_us = tim6_get_time_us();

		usbh_poll(time_curr_us);

		// clear busy led
		gpio_clear(GPIOD,  GPIO14);

		LOG_FLUSH();

		// approx 1ms interval between usbh_poll()
		delay_ms_busy_loop(1);
	}

	return 0;
}
Ejemplo n.º 25
0
void platform_init()
{
	arm_setup();
	mmu_setup();
	tasks_setup();

	// Basic prerequisites for everything else
	miu_setup();
	power_setup();

	clock_setup();

	// Need interrupts for everything afterwards
	interrupt_setup();
	
	gpio_setup();

	// For scheduling/sleeping niceties
	timer_setup();
	event_setup();
	wdt_setup();

	// Other devices
//	uart_setup();
	i2c_setup();

//	dma_setup();

	spi_setup();

	LeaveCriticalSection();

	aes_setup();

	nor_setup();
	syscfg_setup();
	images_setup();
	nvram_setup();

//	lcd_setup();
	framebuffer_hook();	// TODO: Remove once LCD implemented
	framebuffer_setup();

//	audiohw_init();

	framebuffer_setdisplaytext(TRUE);


	gpio_register_interrupt(BUTTONS_HOLD_IRQ, BUTTONS_HOLD_IRQTYPE, BUTTONS_HOLD_IRQLEVEL, BUTTONS_HOLD_IRQAUTOFLIP, gpio_test_handler, 0);
	gpio_interrupt_enable(BUTTONS_HOLD_IRQ);
	gpio_register_interrupt(BUTTONS_HOME_IRQ, BUTTONS_HOME_IRQTYPE, BUTTONS_HOME_IRQLEVEL, BUTTONS_HOME_IRQAUTOFLIP, gpio_test_handler, 1);
	gpio_interrupt_enable(BUTTONS_HOME_IRQ);
	gpio_register_interrupt(BUTTONS_VOLUP_IRQ, BUTTONS_VOLUP_IRQTYPE, BUTTONS_VOLUP_IRQLEVEL, BUTTONS_VOLUP_IRQAUTOFLIP, gpio_test_handler, 2);
	gpio_interrupt_enable(BUTTONS_VOLUP_IRQ);
	gpio_register_interrupt(BUTTONS_VOLDOWN_IRQ, BUTTONS_VOLDOWN_IRQTYPE, BUTTONS_VOLDOWN_IRQLEVEL, BUTTONS_VOLDOWN_IRQAUTOFLIP, gpio_test_handler, 3);
	gpio_interrupt_enable(BUTTONS_VOLDOWN_IRQ);
}
Ejemplo n.º 26
0
void on_ready()
{
  gpio_setup(LED_1, GPIO_OUTPUT);

  run_after_delay(led_on_task, NULL, 100);

  ble_device_set_name("JUMA_ECHO_DEMO");
  ble_device_start_advertising();
}
Ejemplo n.º 27
0
/******************************************************************************
 * @brief  Main function
 *****************************************************************************/
int main(void)
{
  /* Initialize chip */
  CHIP_Init();
  
  /* Enable code view */
  setupSWO();

  /* Initialize LCD */
  SegmentLCD_Init(false);

  /* Enable the HFPER clock */
  CMU_ClockEnable(cmuClock_HFPER, true);

  /* Configure RTC and GPIO */
  rtc_setup();
  gpio_setup();

  /* Stay in this loop forever */
  while (1)
  {
    /* Wait for Push Button 1 to be pressed */
    while (GPIO_PinInGet(PB0_PORT, PB0_PIN)) ;
    /* and released, so that we do not exit the while loop below immediately */
    while (!GPIO_PinInGet(PB0_PORT, PB0_PIN)) ;

    /* Reset time */
    time = 0;

    /* Disable LCD */
    LCD_Enable(true);

    /* Update time until Push Button 1 is pressed again */
    while (1)
    {
      if (RTC_CounterGet() == 0)
      {
        SegmentLCD_Number(++time);
      }

      if (!GPIO_PinInGet(PB0_PORT, PB0_PIN))
        break;
    }

    /* Delay while showing the result on the LCD */
    for (uint32_t delay = 0; delay < 30; delay++)
    {
      /* Wait for the RTC to overflow once */
      while (RTC_CounterGet() != 0) ;
      while (RTC_CounterGet() == 0) ;
    }

    /* Disable LCD */
    LCD_Enable(false);
  }
}
Ejemplo n.º 28
0
void ble_device_on_disconnect(uint8_t reason)
{
  gpio_setup(2, GPIO_OUTPUT);
  gpio_write(2, 1);
  
  left_cycle_stop();
  right_cycle_stop();
  
  ble_device_start_advertising();
}
Ejemplo n.º 29
0
int main() {
    sleep_setup(0b110);
    gpio_setup();
    NVIC_setup();
     music_play_song(&ONEUP, 0x71f);
    while(1) {
		__asm__("wfi");
	}
    return 0;
}
void usbh_kbd_init(void)
{
	clock_setup();
	gpio_setup();

	tim_setup();

	usart_init();
	gpio_set(GPIOD,  GPIO13);
}