Skip to content

Commit

Permalink
fixes for Always On Display and SPI flash ID
Browse files Browse the repository at this point in the history
  • Loading branch information
ljahn committed Aug 21, 2024
1 parent 1c35771 commit 3e632a4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,8 @@ Pinetime::Applications::DisplayApp displayApp(lcd,
alarmController,
brightnessController,
touchHandler,
fs);
fs,
spiNorFlash);

Pinetime::System::SystemTask systemTask(spi,
spiNorFlash,
Expand Down
2 changes: 1 addition & 1 deletion sim/components/brightness/BrightnessController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Pinetime {
namespace Controllers {
class BrightnessController {
public:
enum class Levels { Off, Low, Medium, High };
enum class Levels { Off, AlwaysOn, Low, Medium, High };
void Init();

void Set(Levels level);
Expand Down
8 changes: 6 additions & 2 deletions sim/drivers/SpiNorFlash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SpiNorFlash::~SpiNorFlash() {
}

void SpiNorFlash::Init() {
device_id = ReadIdentificaion();
device_id = ReadIdentification();
NRF_LOG_INFO(
"[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d", device_id.manufacturer, device_id.type, device_id.density);
}
Expand All @@ -42,7 +42,7 @@ void SpiNorFlash::Wakeup() {
NRF_LOG_INFO("[SpiNorFlash] Wakeup")
}

SpiNorFlash::Identification SpiNorFlash::ReadIdentificaion() {
SpiNorFlash::Identification SpiNorFlash::ReadIdentification() {
return {};
}

Expand Down Expand Up @@ -91,6 +91,10 @@ bool SpiNorFlash::EraseFailed() {
return false;
}

SpiNorFlash::Identification SpiNorFlash::GetIdentification() const {
return device_id;
}

void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) {
if (address + size * sizeof(uint8_t) > memorySize) {
throw std::runtime_error("SpiNorFlash::Write out of bounds");
Expand Down
5 changes: 4 additions & 1 deletion sim/drivers/SpiNorFlash.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace Pinetime {
uint8_t density = 0;
};

Identification ReadIdentificaion();
uint8_t ReadStatusRegister();
bool WriteInProgress();
bool WriteEnabled();
Expand All @@ -34,13 +33,17 @@ namespace Pinetime {
bool ProgramFailed();
bool EraseFailed();

Identification GetIdentification() const;

void Init();
void Uninit();

void Sleep();
void Wakeup();

private:
Identification ReadIdentification();

enum class Commands : uint8_t {
PageProgram = 0x02,
Read = 0x03,
Expand Down

0 comments on commit 3e632a4

Please sign in to comment.