Compare commits

...

5 Commits

7 changed files with 51 additions and 11 deletions

View File

@ -32,8 +32,16 @@
* @brief Added the brand new altimeter app, updated the way the accelerometer is initialized
*
*/
#define FIRMWARE_VERSION "0.0.5"
//#define FIRMWARE_VERSION "0.0.5"
/**
* @brief Reworked the altimeter app to display the time and date on the altitude screen,
* added a PMU related function to start the 32k OSC calibration routine.
* Added 'û' and 'Û' characters to the LVGL font.
* Other minor changes.
*
*/
#define FIRMWARE_VERSION "0.0.6"
#define FIRMWARE_COMPILATION_TIME_DATE (__TIME__" "__DATE__)

View File

@ -897,8 +897,9 @@ void gfx_task(void *param)
}
/* Perform the periodic background tasks */
APP_LOG_INFO("Periodic timer wakeup !");
APP_LOG_INFO("Periodic timer wakeup :"NEW_LINE
"\t - RTC calibration : %d", tls_pmu_32k_calibrate());
} while (watch_peripherals_wakeup_source_is_timer());
/* On wake up, we force the watch face to sync up with the rtc /!\ RTC update delay WTF ? */
@ -910,7 +911,7 @@ void gfx_task(void *param)
_perform_deferred_display_wake_up_set_timestamp();
}
// Necessary to not enter the if condition over and over again
// Necessary TO NOT enter the if condition over and over again
lv_disp_trig_activity(NULL);
}

View File

@ -9,7 +9,7 @@
* @brief The address in flash storage where the settings are saved.
*
*/
#define WATCH_SETTINGS_FLASH_STORAGE_ADDRESS (0x1E0000)
#define WATCH_SETTINGS_FLASH_STORAGE_ADDRESS (0x1F8400)
/**
* @brief Time and Date Settings.

View File

@ -148,14 +148,14 @@ void tls_pmu_clk_select(u8 bypass);
/** NOT PART OF THE OFFICIAL SDK **/
/**
* @brief Starts the internal 32K oscillator calibration cycle.
* @brief Starts the internal 32K oscillator calibration cycle using the PMU's calibration circuit.
*
* @param None
* @param None
*
* @return None
* @return true if successful, false otherwise
*
*/
void tls_pmu_clk_calibrate(void);
bool tls_pmu_32k_calibrate(void);
/**********************************/

View File

@ -24,8 +24,9 @@
/******************************************************************************
* Linker script addresses modified, now the memory map is the following :
* Run Image Header (1KB) starts at 0x0801 0000
* Application Run Image starts at 0x0801 0400 and is 1,952 MB
* User Area is 112KB and starts at 0x081E 0000
* Application Run Image starts at 0x0801 0400 and is 1,952 MB,
ends at 0x081F 83FF
* User Area is 15KB, starts at 0x081F 8400 and ends at 0x081F C000
******************************************************************************/
MEMORY
{

View File

@ -188,6 +188,34 @@ void tls_pmu_clk_select(u8 bypass)
tls_reg_write32(HR_PMU_PS_CR, val);
}
/** NOT PART OF THE OFFICIAL SDK **/
bool tls_pmu_32k_calibrate(void)
{
/* To start the calibration procedure, the bit 3 needs to be set to 0 and then 1 */
unsigned int pmu_ps_cr = tls_reg_read32(HR_PMU_PS_CR);
/* First make sure the bit 3 is 0 */
if((pmu_ps_cr & BIT(3)) != 0)
{
pmu_ps_cr &= ~(BIT(3));
tls_reg_write32(HR_PMU_PS_CR, pmu_ps_cr);
}
pmu_ps_cr = tls_reg_read32(HR_PMU_PS_CR);
if((pmu_ps_cr & BIT(3)) == 0)
{
/* Then flip it to one */
pmu_ps_cr |= BIT(3);
tls_reg_write32(HR_PMU_PS_CR, pmu_ps_cr);
}
else
{
return false;
}
return true;
}
/**********************************/
/**
* @brief This function is used to start pmu timer0

View File

@ -84,12 +84,14 @@ void tls_get_rtc(struct tm *tblock)
tblock->tm_sec = ctrl1 & 0x0000003f;
}
/** NOT PART OF THE OFFICIAL SDK **/
bool tls_is_rtc_running(void)
{
int ctrl2 = tls_reg_read32(HR_PMU_RTC_CTRL2);
return ctrl2 & (1 << 16) ? true : false;
}
/**********************************/
void PMU_RTC_IRQHandler(void)
{