M0S_BL616_example
M0S_BL616_example copied to clipboard
Add blinking led as helloworld
trafficstars
Could you please add this blinking led as helloworld example. I copy the code from twitter @eMbeddedHome Its helpful for me to getting started the board.
#include "bflb_gpio.h"
#include "board.h"
struct bflb_device_s *gpio;
int main(void)
{
board_init();
gpio = bflb_device_get_by_name("gpio");
printf("gpio output\r\n");
bflb_gpio_init(gpio, GPIO_PIN_27, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
bflb_gpio_init(gpio, GPIO_PIN_28, GPIO_OUTPUT | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_0);
while (1) {
bflb_gpio_set(gpio, GPIO_PIN_27);
bflb_gpio_reset(gpio, GPIO_PIN_28);
bflb_mtimer_delay_ms(500);
bflb_gpio_reset(gpio, GPIO_PIN_27);
bflb_gpio_set(gpio, GPIO_PIN_28);
bflb_mtimer_delay_ms(500);
}
}
I create getting started gist
https://gist.github.com/hndrbrm/73713e2c33fb193685863ecde3440df7
@hndrbrm Just do a PR, mate: https://github.com/bouffalolab/bl_mcu_sdk/pull/90 ;)