-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from PharosMarcusB/config_pids
Config PIDs
- Loading branch information
Showing
37 changed files
with
484 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* personalities.h | ||
* | ||
* Created on: 20 Nov 2023 | ||
* Author: marcusbirkin | ||
*/ | ||
|
||
#ifndef INCLUDE_PERSONALITIES_H_ | ||
#define INCLUDE_PERSONALITIES_H_ | ||
|
||
#include <cstdint> | ||
#include <type_traits> | ||
|
||
#include "pixeltype.h" | ||
|
||
namespace Personalities | ||
{ | ||
|
||
enum class Personality : uint8_t { | ||
#if defined(ENABLE_CONFIG_PIDS) | ||
WS2801, | ||
WS2811, | ||
WS2812, | ||
WS2812B, | ||
WS2813, | ||
WS2815, | ||
SK6812, | ||
SK6812W, | ||
UCS1903, | ||
UCS2903, | ||
CS8812, | ||
APA102, | ||
SK9822, | ||
P9813, | ||
#else | ||
DEFAULT, | ||
CONFIG_MODE, | ||
#endif | ||
// Last item | ||
COUNT | ||
}; | ||
#define PERSONALITY_COUNT static_cast<std::underlying_type<Personalities::Personality>::type>(Personalities::Personality::COUNT) | ||
|
||
uint8_t toPersonalityIdx(Personality personality); | ||
Personality fromPersonalityIdx(uint8_t nPersonality); | ||
|
||
pixel::Type toPixelType(Personality personality); | ||
Personality fromPixelType(pixel::Type type); | ||
|
||
} // namespace Personalities | ||
|
||
#endif /* INCLUDE_PERSONALITIES_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* personalities.h | ||
* | ||
* Created on: 20 Nov 2023 | ||
* Author: marcusbirkin | ||
*/ | ||
|
||
#include "personalities.h" | ||
|
||
#include <cassert> | ||
|
||
uint8_t Personalities::toPersonalityIdx(Personality personality) | ||
{ | ||
return static_cast<uint8_t>(personality) + 1; | ||
} | ||
|
||
Personalities::Personality Personalities::fromPersonalityIdx(uint8_t nPersonality) | ||
{ | ||
assert(nPersonality >= 1); | ||
return static_cast<Personalities::Personality>(nPersonality - 1); | ||
} | ||
|
||
pixel::Type Personalities::toPixelType(Personalities::Personality personality) | ||
{ | ||
assert(static_cast<uint8_t>(personality) < static_cast<uint8_t>(pixel::Type::UNDEFINED)); | ||
return static_cast<pixel::Type>(personality); | ||
} | ||
|
||
Personalities::Personality Personalities::fromPixelType(pixel::Type type) | ||
{ | ||
assert(static_cast<uint8_t>(type) < PERSONALITY_COUNT); | ||
return static_cast<Personalities::Personality>(type); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.