Skip to content

Commit

Permalink
fixed pair functions for spark
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 23, 2024
1 parent 60e0f39 commit c672982
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ static_assert(LED_COUNT == (PAIR_COUNT * 2), "Incorrect number of Pairs for Leds
#define PAIR_4 PAIR_1

// check if an led is even or odd
#define isEven(pos) ((pos % 2) == 0)
#define isOdd(pos) ((pos % 2) != 0)
#define isEven(pos) (pos < 3)
#define isOdd(pos) (pos >= 3)

// convert a pair to even or odd led position
#define pairEven(pair) (LedPos)((uint32_t)pair * 2)
#define pairOdd(pair) (LedPos)(((uint32_t)pair * 2) + 1)
#define pairEven(pair) (LedPos)((uint32_t)pair)
#define pairOdd(pair) (LedPos)(((uint32_t)pair) + 3)

// convert an led position to a pair
#define ledToPair(pos) (Pair)((uint32_t)pos / 2)
#define ledToPair(pos) (Pair)((uint32_t)pos >= 3 ? 1 : 0)

// LedMap is a bitmap of leds, used for expressing whether to turn certain leds on
// or off with a single integer
Expand Down

0 comments on commit c672982

Please sign in to comment.