Skip to content

Commit 06c4d1f

Browse files
ljahnNeroBurner
authored andcommitted
fixes for Always On Display and SPI flash ID
1 parent 1c35771 commit 06c4d1f

8 files changed

Lines changed: 30 additions & 6 deletions

File tree

InfiniTime

Submodule InfiniTime updated 63 files

main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ Pinetime::Applications::DisplayApp displayApp(lcd,
376376
alarmController,
377377
brightnessController,
378378
touchHandler,
379-
fs);
379+
fs,
380+
spiNorFlash);
380381

381382
Pinetime::System::SystemTask systemTask(spi,
382383
spiNorFlash,

sim/components/brightness/BrightnessController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Pinetime {
66
namespace Controllers {
77
class BrightnessController {
88
public:
9-
enum class Levels { Off, Low, Medium, High };
9+
enum class Levels { Off, AlwaysOn, Low, Medium, High };
1010
void Init();
1111

1212
void Set(Levels level);

sim/drivers/SpiNorFlash.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ SpiNorFlash::~SpiNorFlash() {
2626
}
2727

2828
void SpiNorFlash::Init() {
29-
device_id = ReadIdentificaion();
29+
device_id = ReadIdentification();
3030
NRF_LOG_INFO(
3131
"[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d", device_id.manufacturer, device_id.type, device_id.density);
3232
}
@@ -42,7 +42,7 @@ void SpiNorFlash::Wakeup() {
4242
NRF_LOG_INFO("[SpiNorFlash] Wakeup")
4343
}
4444

45-
SpiNorFlash::Identification SpiNorFlash::ReadIdentificaion() {
45+
SpiNorFlash::Identification SpiNorFlash::ReadIdentification() {
4646
return {};
4747
}
4848

@@ -91,6 +91,10 @@ bool SpiNorFlash::EraseFailed() {
9191
return false;
9292
}
9393

94+
SpiNorFlash::Identification SpiNorFlash::GetIdentification() const {
95+
return device_id;
96+
}
97+
9498
void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) {
9599
if (address + size * sizeof(uint8_t) > memorySize) {
96100
throw std::runtime_error("SpiNorFlash::Write out of bounds");

sim/drivers/SpiNorFlash.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ namespace Pinetime {
2121
uint8_t density = 0;
2222
};
2323

24-
Identification ReadIdentificaion();
2524
uint8_t ReadStatusRegister();
2625
bool WriteInProgress();
2726
bool WriteEnabled();
@@ -34,13 +33,17 @@ namespace Pinetime {
3433
bool ProgramFailed();
3534
bool EraseFailed();
3635

36+
Identification GetIdentification() const;
37+
3738
void Init();
3839
void Uninit();
3940

4041
void Sleep();
4142
void Wakeup();
4243

4344
private:
45+
Identification ReadIdentification();
46+
4447
enum class Commands : uint8_t {
4548
PageProgram = 0x02,
4649
Read = 0x03,

sim/nrfx/hal/nrf_gpio.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,7 @@ void nrfx_gpiote_in_init(uint32_t pin_number, nrfx_gpiote_in_config_t *config, n
5252
void nrfx_gpiote_in_event_enable(uint32_t pin_number, bool enable) {}
5353
void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pin_pull, nrf_gpio_pin_sense_t sense) {}
5454

55+
bool nrfx_gpiote_is_init() { return true; }
56+
void nrfx_gpiote_init() {}
57+
5558
void APP_GPIOTE_INIT(uint32_t max_users) {}

sim/nrfx/hal/nrf_gpio.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ void nrfx_gpiote_in_init(uint32_t pin_number, nrfx_gpiote_in_config_t *config, n
145145
void nrfx_gpiote_in_event_enable(uint32_t pin_number, bool enable);
146146
void nrf_gpio_cfg_sense_input(uint32_t pin_number, nrf_gpio_pin_pull_t pin_pull, nrf_gpio_pin_sense_t sense);
147147

148+
bool nrfx_gpiote_is_init();
149+
void nrfx_gpiote_init();
150+
148151
void APP_GPIOTE_INIT(uint32_t max_users);
149152

150153
#endif // NRF_GPIO_H__

sim/portmacro_cmsis.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
#ifndef PORTMACRO_CMSIS_H
3030
#define PORTMACRO_CMSIS_H
3131

32+
// ########## macro taken from app_util.h
33+
/**@brief Macro for performing rounded integer division (as opposed to truncating the result).
34+
*
35+
* @param[in] A Numerator.
36+
* @param[in] B Denominator.
37+
*
38+
* @return Rounded (integer) result of dividing A by B.
39+
*/
40+
#define ROUNDED_DIV(A, B) (((A) + ((B) / 2)) / (B))
41+
3242
#ifdef __cplusplus
3343
extern "C" {
3444
#endif

0 commit comments

Comments
 (0)