Skip to content

Commit

Permalink
Merge pull request #20831 from chrysn-pull-requests/ek-lm4f120x-led-r…
Browse files Browse the repository at this point in the history
…ust-const-avoidance

boards/ek-lm4f120x: Change internal LED macro for C2Rust compatibility
  • Loading branch information
mguetschow authored Aug 26, 2024
2 parents 0e7636a + b802a19 commit d7669fa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
24 changes: 14 additions & 10 deletions boards/ek-lm4f120xl/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@ extern "C" {
#define LED1_PIN GPIO_PIN(5, 2)
#define LED2_PIN GPIO_PIN(5, 3)

#define LED_PORT (GPIO_PORTF_DATA_R)
/**
* @brief Port used for `LED0_ON` and similar implementations
* @internal
* */
#define LED_PORT() (GPIO_PORTF_DATA_R)
#define LED0_MASK (1 << 7)
#define LED1_MASK (1 << 2)
#define LED2_MASK (1 << 1)

#define LED0_ON (LED_PORT |= LED0_MASK)
#define LED0_OFF (LED_PORT &= ~LED0_MASK)
#define LED0_TOGGLE (LED_PORT ^= LED0_MASK)
#define LED0_ON (LED_PORT() |= LED0_MASK)
#define LED0_OFF (LED_PORT() &= ~LED0_MASK)
#define LED0_TOGGLE (LED_PORT() ^= LED0_MASK)

#define LED1_ON (LED_PORT |= LED1_MASK)
#define LED1_OFF (LED_PORT &= ~LED1_MASK)
#define LED1_TOGGLE (LED_PORT ^= LED1_MASK)
#define LED1_ON (LED_PORT() |= LED1_MASK)
#define LED1_OFF (LED_PORT() &= ~LED1_MASK)
#define LED1_TOGGLE (LED_PORT() ^= LED1_MASK)

#define LED2_ON (LED_PORT |= LED2_MASK)
#define LED2_OFF (LED_PORT &= ~LED2_MASK)
#define LED2_TOGGLE (LED_PORT ^= LED2_MASK)
#define LED2_ON (LED_PORT() |= LED2_MASK)
#define LED2_OFF (LED_PORT() &= ~LED2_MASK)
#define LED2_TOGGLE (LED_PORT() ^= LED2_MASK)
/** @} */

/**
Expand Down
4 changes: 0 additions & 4 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,4 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module

FEATURES_REQUIRED += rust_target

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl

include $(RIOTBASE)/Makefile.include
4 changes: 0 additions & 4 deletions examples/rust-hello-world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module

FEATURES_REQUIRED += rust_target

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl

include $(RIOTBASE)/Makefile.include
4 changes: 0 additions & 4 deletions tests/rust_libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ USEMODULE += ztimer_msec

FEATURES_REQUIRED += rust_target

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl

include $(RIOTBASE)/Makefile.include
4 changes: 0 additions & 4 deletions tests/rust_minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module

FEATURES_REQUIRED += rust_target

# Currently unknown, something related to the LED_PORT definition that doesn't
# pass C2Rust's transpilation
BOARD_BLACKLIST := ek-lm4f120xl

include $(RIOTBASE)/Makefile.include

0 comments on commit d7669fa

Please sign in to comment.