M0S_BL616_example icon indicating copy to clipboard operation
M0S_BL616_example copied to clipboard

Add blinking led as helloworld

Open hndrbrm opened this issue 2 years ago • 2 comments
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);
    }
}

hndrbrm avatar Feb 04 '23 15:02 hndrbrm

I create getting started gist

https://gist.github.com/hndrbrm/73713e2c33fb193685863ecde3440df7

hndrbrm avatar Feb 04 '23 16:02 hndrbrm

@hndrbrm Just do a PR, mate: https://github.com/bouffalolab/bl_mcu_sdk/pull/90 ;)

brainstorm avatar Feb 18 '23 12:02 brainstorm