Пример #1
0
static void stopwatch_remember_n_lap_start(uint32_t store_lap_no, uint32_t store_lap_start) {
		if (current_lap_no-store_lap_no >= STOPWATCH_RECALL_SIZE) {
				return;
		}
		uint32_t slot_no = (store_lap_no - 2)%STOPWATCH_RECALL_SIZE;
		ext_ram_write_data(EXT_RAM_DATA_STOPWATCH_RECALL + slot_no * 4, (uint8_t *)&store_lap_start, 4);
}
Пример #2
0
void config_init(void) {
		uint8_t buf[5];
		ext_ram_read_data(EXT_RAM_CONFIG + OFFSET_MAGIC, buf, 5);
		bool force_reset;
		app_button_is_pushed(3, &force_reset); // force reset if back button is pressed
	
		if (force_reset || buf[0] != buf[2] || buf[0] != 0x05 || buf[1] != buf[3] || buf[1] != 0x5E) {
				// set up clear config
				buf[0] = 0x05;
				buf[1] = 0x5E;
				buf[2] = 0x05;
				buf[3] = 0x5E;
				buf[4] = 0x0;
				ext_ram_write_data(EXT_RAM_CONFIG + OFFSET_MAGIC, buf, 5);
				ext_ram_fill(EXT_RAM_CONFIG + OFFSET_DEFAULT_WATCH_FACE, 0, 1);
				for (int i=0; i<CUSTOM_WATCHSET_NUMBER; i++) {
						ext_ram_fill(EXT_RAM_CONFIG + OFFSET_CUSTOM_WATCHSET+(SPIFFS_OBJ_NAME_LEN*i), 0, 1);
				}
				config_reset_global_actions();
				config_reset_watchface_actions();
		} else {
				config_load_global_actions();
				config_load_watchface_actions();
		}
}
Пример #3
0
static void config_store_watchface_actions(void) {
		ext_ram_write_data(EXT_RAM_CONFIG + OFFSET_WATCH_FACE_ACTION_HANLDERS, (uint8_t*)default_watchface_actions, sizeof(default_watchface_actions));
}
Пример #4
0
static void config_store_global_actions(void) {
		ext_ram_write_data(EXT_RAM_CONFIG + OFFSET_GLOBAL_ACTION_HANLDERS, (uint8_t*)default_global_actions, sizeof(default_global_actions));
}
Пример #5
0
void config_clear_dafault_watch_face(void) {
		uint8_t data = 0;
		ext_ram_write_data(EXT_RAM_CONFIG + OFFSET_DEFAULT_WATCH_FACE, &data, 1);
}
Пример #6
0
void config_set_default_watch_face(char* file_name) {
		ext_ram_write_data(EXT_RAM_CONFIG + OFFSET_DEFAULT_WATCH_FACE, (uint8_t*)file_name, SPIFFS_OBJ_NAME_LEN);
}
Пример #7
0
static void handle_notification_upload_part(uint8_t *data, uint32_t size) {
	  ext_ram_write_data(notification_upload_ptr, data, size);
	  notification_upload_ptr += size;
}