Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal_led_off/on set wrong LED state #267

Open
tmcintos opened this issue Jun 14, 2020 · 1 comment
Open

metal_led_off/on set wrong LED state #267

tmcintos opened this issue Jun 14, 2020 · 1 comment

Comments

@tmcintos
Copy link

On HiFive1 RevB with current Freedom Studio, metal_led_on turns the LED OFF and metal_led_off turns the LED ON. GPIOs are being set to the wrong polarity; reversing GPIO states (0,1) in the driver produced the expected behavior:

void __metal_driver_led_on (struct metal_led *led)
{
    int pin;
    struct metal_gpio *gpio;

    pin = __metal_driver_sifive_gpio_led_pin(led);
    gpio =  __metal_driver_sifive_gpio_led_gpio(led);

    if (gpio != NULL) {
        metal_gpio_set_pin((struct metal_gpio *) gpio, pin, 0);
    }
}

void __metal_driver_led_off (struct metal_led *led)
{
    int pin;
    struct metal_gpio *gpio;

    pin = __metal_driver_sifive_gpio_led_pin(led);
    gpio =  __metal_driver_sifive_gpio_led_gpio(led);

    if (gpio != NULL) {
        metal_gpio_set_pin((struct metal_gpio *) gpio, pin, 1);
    }
}

@tmcintos
Copy link
Author

Looks like a duplicate of #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant