summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-09-23 21:05:09 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-09-23 21:05:09 +0200
commit30a29dcd0d064ab8403a9afb32c59800bb346840 (patch)
tree8e4d5c2c7d7575762a6af6833098a7f673ad1e0f /include
parent102e6f03e9d1ab9dc213b021b1dbe81d7fda332a (diff)
GPIO: Specify default LED ID
Diffstat (limited to 'include')
-rw-r--r--include/arch/arduino-nano/driver/gpio.h6
-rw-r--r--include/arch/atmega2560/driver/gpio.h6
-rw-r--r--include/arch/blinkenrocket/driver/gpio.h6
-rw-r--r--include/arch/esp8266/driver/gpio.h6
-rw-r--r--include/arch/lm4f120h5qr-stellaris/driver/gpio.h6
-rw-r--r--include/arch/lora32u4ii/driver/gpio.h6
-rw-r--r--include/arch/msp430fr5969lp/driver/gpio.h6
-rw-r--r--include/arch/msp430fr5994lp/driver/gpio.h6
-rw-r--r--include/arch/posix/driver/gpio.h6
-rw-r--r--include/arch/stm32f446re-nucleo/driver/gpio.h6
10 files changed, 30 insertions, 30 deletions
diff --git a/include/arch/arduino-nano/driver/gpio.h b/include/arch/arduino-nano/driver/gpio.h
index 47cb7dc..4fc9c63 100644
--- a/include/arch/arduino-nano/driver/gpio.h
+++ b/include/arch/arduino-nano/driver/gpio.h
@@ -57,13 +57,13 @@ class GPIO {
return _BV(pin % 8);
}
#pragma GCC diagnostic ignored "-Wunused-parameter"
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
PORTB |= _BV(PB5);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
PORTB &= ~_BV(PB5);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
PINB = _BV(PB5);
}
inline void input(unsigned char const pin) {
diff --git a/include/arch/atmega2560/driver/gpio.h b/include/arch/atmega2560/driver/gpio.h
index b163ea0..fa400a1 100644
--- a/include/arch/atmega2560/driver/gpio.h
+++ b/include/arch/atmega2560/driver/gpio.h
@@ -123,13 +123,13 @@ class GPIO {
return _BV(pin % 8);
}
#pragma GCC diagnostic ignored "-Wunused-parameter"
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
PORTB |= _BV(PB7);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
PORTB &= ~_BV(PB7);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
PINB = _BV(PB7);
}
inline void input(unsigned char const pin) {
diff --git a/include/arch/blinkenrocket/driver/gpio.h b/include/arch/blinkenrocket/driver/gpio.h
index 0d76521..af2648d 100644
--- a/include/arch/blinkenrocket/driver/gpio.h
+++ b/include/arch/blinkenrocket/driver/gpio.h
@@ -51,13 +51,13 @@ class GPIO {
PORTD = 0x7f;
DDRD = 0xff;
}
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
PORTB |= _BV(id);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
PORTB &= ~_BV(id);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
PORTB ^= _BV(id);
}
inline void input(unsigned char const pin) {
diff --git a/include/arch/esp8266/driver/gpio.h b/include/arch/esp8266/driver/gpio.h
index b609f76..29e7950 100644
--- a/include/arch/esp8266/driver/gpio.h
+++ b/include/arch/esp8266/driver/gpio.h
@@ -20,9 +20,9 @@ class GPIO {
};
void setup();
- void led_on(unsigned char id);
- void led_off(unsigned char id);
- void led_toggle(unsigned char id);
+ void led_on(unsigned char id = 0);
+ void led_off(unsigned char id = 0);
+ void led_toggle(unsigned char id = 0);
void input(unsigned char const pin);
void input(unsigned char const pin, bool pullup);
void output(unsigned char const pin);
diff --git a/include/arch/lm4f120h5qr-stellaris/driver/gpio.h b/include/arch/lm4f120h5qr-stellaris/driver/gpio.h
index f71164e..3c99eb9 100644
--- a/include/arch/lm4f120h5qr-stellaris/driver/gpio.h
+++ b/include/arch/lm4f120h5qr-stellaris/driver/gpio.h
@@ -30,13 +30,13 @@ class GPIO {
inline void setup() {
mp_gpio_setup();
}
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
mp_gpio_write(pf_1 + id, 1);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
mp_gpio_write(pf_1 + id, 0);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
mp_gpio_write(pf_1 + id, !mp_gpio_read(pf_1 + id));
}
inline void input(unsigned char const pin) {
diff --git a/include/arch/lora32u4ii/driver/gpio.h b/include/arch/lora32u4ii/driver/gpio.h
index 8bbaa40..7c03f3d 100644
--- a/include/arch/lora32u4ii/driver/gpio.h
+++ b/include/arch/lora32u4ii/driver/gpio.h
@@ -62,13 +62,13 @@ class GPIO {
return _BV(pin % 8);
}
#pragma GCC diagnostic ignored "-Wunused-parameter"
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
PORTC |= _BV(PC7);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
PORTC &= ~_BV(PC7);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
PINC = _BV(PC7);
}
inline void input(unsigned char const pin) {
diff --git a/include/arch/msp430fr5969lp/driver/gpio.h b/include/arch/msp430fr5969lp/driver/gpio.h
index 0b8058b..7f2a3f7 100644
--- a/include/arch/msp430fr5969lp/driver/gpio.h
+++ b/include/arch/msp430fr5969lp/driver/gpio.h
@@ -47,21 +47,21 @@ class GPIO {
P4REN = 0xff & ~BIT6; // red LED
PJREN = BIT6 | BIT7; // HFXT (not populated)
}
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
if (id == 0) {
P1OUT |= BIT0;
} else {
P4OUT |= BIT6;
}
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
if (id == 0) {
P1OUT &= ~BIT0;
} else {
P4OUT &= ~BIT6;
}
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
if (id == 0) {
P1OUT ^= BIT0;
} else {
diff --git a/include/arch/msp430fr5994lp/driver/gpio.h b/include/arch/msp430fr5994lp/driver/gpio.h
index c3f1abf..d8048c0 100644
--- a/include/arch/msp430fr5994lp/driver/gpio.h
+++ b/include/arch/msp430fr5994lp/driver/gpio.h
@@ -63,21 +63,21 @@ class GPIO {
P8REN = 0xff;
PJREN = BIT6 | BIT7; // HFXT (not populated)
}
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
if (id == 0) {
P1OUT |= BIT0;
} else {
P1OUT |= BIT1;
}
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
if (id == 0) {
P1OUT &= ~BIT0;
} else {
P1OUT &= ~BIT1;
}
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
if (id == 0) {
P1OUT ^= BIT0;
} else {
diff --git a/include/arch/posix/driver/gpio.h b/include/arch/posix/driver/gpio.h
index c630b46..b1a7706 100644
--- a/include/arch/posix/driver/gpio.h
+++ b/include/arch/posix/driver/gpio.h
@@ -66,19 +66,19 @@ class GPIO {
inline void setup() {
pin_dir |= 0x0000ff;
}
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
if (id <= pl7) {
pin_out |= (1 << id);
}
print_pinstate();
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
if (id <= pl7) {
pin_out &= ~(1 << id);
}
print_pinstate();
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
if (id <= pl7) {
if (pin_out & (1 << id)) {
led_off(id);
diff --git a/include/arch/stm32f446re-nucleo/driver/gpio.h b/include/arch/stm32f446re-nucleo/driver/gpio.h
index d2fb40a..c07f96d 100644
--- a/include/arch/stm32f446re-nucleo/driver/gpio.h
+++ b/include/arch/stm32f446re-nucleo/driver/gpio.h
@@ -35,13 +35,13 @@ class GPIO {
gpio_mode_setup(GPIOA, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, GPIO5);
}
#pragma GCC diagnostic ignored "-Wunused-parameter"
- inline void led_on(unsigned char id) {
+ inline void led_on(unsigned char id = 0) {
gpio_set(GPIOA, GPIO5);
}
- inline void led_off(unsigned char id) {
+ inline void led_off(unsigned char id = 0) {
gpio_clear(GPIOA, GPIO5);
}
- inline void led_toggle(unsigned char id) {
+ inline void led_toggle(unsigned char id = 0) {
gpio_toggle(GPIOA, GPIO5);
}
#pragma GCC diagnostic pop