mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-02 09:35:20 -05:00
Add hardware revision detection function.
This commit is contained in:
parent
600dcb734e
commit
6e5549f127
@ -38,6 +38,8 @@ using wolfson::wm8731::WM8731;
|
|||||||
|
|
||||||
#include "cpld_update.hpp"
|
#include "cpld_update.hpp"
|
||||||
|
|
||||||
|
#include "optional.hpp"
|
||||||
|
|
||||||
namespace portapack {
|
namespace portapack {
|
||||||
|
|
||||||
portapack::IO io {
|
portapack::IO io {
|
||||||
@ -108,6 +110,25 @@ private:
|
|||||||
|
|
||||||
static Power power;
|
static Power power;
|
||||||
|
|
||||||
|
enum class PortaPackModel {
|
||||||
|
R1_20150901,
|
||||||
|
R2_20170522,
|
||||||
|
};
|
||||||
|
|
||||||
|
static PortaPackModel portapack_model() {
|
||||||
|
static Optional<PortaPackModel> model;
|
||||||
|
|
||||||
|
if( !model.is_valid() ) {
|
||||||
|
if( audio_codec_wm8731.detected() ) {
|
||||||
|
model = PortaPackModel::R1_20150901;
|
||||||
|
} else {
|
||||||
|
model = PortaPackModel::R2_20170522;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return model.value();
|
||||||
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
for(const auto& pin : pins) {
|
for(const auto& pin : pins) {
|
||||||
pin.init();
|
pin.init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user