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

undefined reference to `alarm_pool_get_default' #51

Open
pedrorovi opened this issue Jun 15, 2023 · 1 comment
Open

undefined reference to `alarm_pool_get_default' #51

pedrorovi opened this issue Jun 15, 2023 · 1 comment

Comments

@pedrorovi
Copy link

pedrorovi commented Jun 15, 2023

I can't use the timer irq with the rp2040 and the arduino framework. Some help or recommendations?

#define PICO_TIME_DEFAULT_ALARM_POOL_DISABLED 0

#include <string.h>
#include "unity.h"

#include <stdio.h>
#include "pico/stdlib.h"
extern "C" {
#include <hardware/timer.h>
#include <hardware/watchdog.h>
#include "pico/multicore.h"
};
#include "pio_tx_controller.h"

#include "gpio.h"
#include "pico/time.h"

#include "test_utils.h"
// Implements
#include "tests.h"

void setUp(){};

void tearDown(){};

bool led_state{false};

bool led_callback(repeating_timer_t* rt) {
    Pio_tx_controller::get()->write("Hey Jude!\r\n");
    gpio_put(PICO_DEFAULT_LED_PIN, led_state);
    led_state = !led_state;
    return true;
}

void test_timer_irq() {
    _gpio_init(PICO_DEFAULT_LED_PIN);
    gpio_set_dir(PICO_DEFAULT_LED_PIN, GPIO_OUT);

    struct repeating_timer timer;
    bool ok = add_repeating_timer_ms(1000, led_callback, NULL, &timer);

    while (true)
        tight_loop_contents();
};
@Tykyo
Copy link

Tykyo commented Jan 24, 2024

That's because the Arduino framework use MBED library precompiled with #define PICO_TIME_DEFAULT_ALARM_POOL_DISABLED=1
So the function doesn't exist in the library and you can't link it.

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

2 participants