Skip to content

Commit

Permalink
cpu/native: mark gpio_mock function as weak
Browse files Browse the repository at this point in the history
This allows developpers to override gpio behavior into their
applications.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
  • Loading branch information
gdoffe committed Feb 24, 2024
1 parent 994de51 commit 76576cc
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cpu/native/periph/gpio_mock.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

#include "periph/gpio.h"

int gpio_init(gpio_t pin, gpio_mode_t mode) {
__attribute__((weak)) int gpio_init(gpio_t pin, gpio_mode_t mode) {
(void) pin;
(void) mode;

return 0;
}

int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
__attribute__((weak)) int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
gpio_cb_t cb, void *arg)
{
(void) pin;
Expand All @@ -38,35 +38,35 @@ int gpio_init_int(gpio_t pin, gpio_mode_t mode, gpio_flank_t flank,
return 0;
}

void gpio_irq_enable(gpio_t pin)
__attribute__((weak)) void gpio_irq_enable(gpio_t pin)
{
(void) pin;
}

void gpio_irq_disable(gpio_t pin)
__attribute__((weak)) void gpio_irq_disable(gpio_t pin)
{
(void) pin;
}

int gpio_read(gpio_t pin) {
__attribute__((weak)) int gpio_read(gpio_t pin) {
(void) pin;

return 0;
}

void gpio_set(gpio_t pin) {
__attribute__((weak)) void gpio_set(gpio_t pin) {
(void) pin;
}

void gpio_clear(gpio_t pin) {
__attribute__((weak)) void gpio_clear(gpio_t pin) {
(void) pin;
}

void gpio_toggle(gpio_t pin) {
__attribute__((weak)) void gpio_toggle(gpio_t pin) {
(void) pin;
}

void gpio_write(gpio_t pin, int value) {
__attribute__((weak)) void gpio_write(gpio_t pin, int value) {
(void) pin;
(void) value;
}
Expand Down

0 comments on commit 76576cc

Please sign in to comment.