prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
E_SECTOR; int start_region = s_last_page_written / PFS_PAGES_PER_ERASE_SECTOR; int end_region = start_region + num_erase_regions; uint16_t gc_erase_block = s_gc_block.gc_start_page / PFS_PAGES_PER_ERASE_SECTOR; for (int region = start_region; region < end_region; region++) { int erase_region = region % nu...
(curr_page)
// Move the icon down by increasing the margin to vertically center things icon_top_margin_px += additional_icon_top_offset_for_single_line_text_px; // Move the text down as well to preserve spacing // The -1 is there to preserve prior functionality ¯\_(ツ)_/¯ text_box.origin.y += additional_icon_top_off...
(text, &text_box)
<= TEXT_MAX_HEIGHT_PX; }
(point.x, point.y + 1)); } else if (alpha == ALPHA_33) { graphics_context_set_stroke_color(ctx, fg_color); graphics_draw_pixel(ctx, point); graphics_context_set_stroke_color(ctx, bg_color); graphics_draw_pixel(ctx, GPoint(point.x + 1, point.y)); graphics_draw_pixel(ctx, GPoint(point.x, point.y + 1...
{ data->alpha = (data->alpha + 0x40) & ALPHA_100; set_text_layers(data); }
else if (data->property == PROPERTY_COLOR_TABLE) { if (s_color_table == color_table_hsv) { s_color_table = color_table_hvs; } else if (s_color_table == color_table_hvs) { s_color_table = color_table_hsv; } } layer_mark_dirty(s_canvas_layer); } static void select_handler(ClickRecognizerRef ...
alloc.auto.h" #include "process_state/app_state/app_state.h" #include "process_state/worker_state/worker_state.h" #include "syscall/syscall.h" #include "syscall/syscall_internal.h" // Time time_t pbl_override_time(time_t *tloc) { time_t t = sys_get_time(); if (tloc) { *tloc = t; } return (t); } // Manuall...
DEFINE_SYSCALL(int, sys_strftime, char* s, size_t maxsize, const char* format, const struct tm* tim_p, char *locale)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(s, maxsize); syscall_assert_userspace_buffer(format, strlen(format)); syscall_assert_userspace_buffer(tim_p, sizeof(struct tm)); } return localized_strftime(s, maxsize, format, tim_p, locale); } void *pbl_memcpy(void *destination, co...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pulse_logging_log_buffer_flush()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
timeline_item_create_with_attributes(now + delta_time_s, 0, TimelineItemTypeNotification, LayoutIdNotification, &list, NULL)
; notification_storage_store(item); timeline_item_destroy(item); attribute_list_destroy_list(&list); } static void prv_add_weather_pin_with_params(int32_t delta_time_s, bool has_timestamp, bool has_short_title, bool has_short_subtitle) { const time_t now = rtc_get_ti...
od of time as to give visual // feedback of the button press. window_multi_click_subscribe(BUTTON_ID_SELECT, 1, 2, 25, true, (ClickHandler)select_click_handler); } static GRect prv_get_text_frame(Layer *window_layer) { const int16_t x_margin = 5; const int16_t label_y_offset = PBL_IF_ROUND_ELSE(40, 16); cons...
WINDOW_NAME(label)
); window_set_window_handlers(&nw->window, &(WindowHandlers) { .load = (WindowHandler) number_window_load, }); layer_set_update_proc(&nw->window.layer, prv_update_proc); ActionBarLayer *action_bar = &nw->action_bar; action_bar_layer_init(action_bar); } NumberWindow* number_window_create(const char *labe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
("Settings file is already open!")
; } return fd; } *file = (SettingsFile) { .name = kernel_strdup_check(name), .max_used_space = max_used_space, .max_space_total = max_space_total, }; settings_raw_iter_init(&file->iter, fd, file->name); SettingsFileHeader file_hdr = file->iter.file_hdr; if (file_hdr_is_uninitialized(&...
b_pebble_tasks_set_current(PebbleTask_KernelMain); s_launcher_task_callback(s_launcher_task_callback_data); BLECharacteristic remote_command = s_characteristics[0][AMSCharacteristicRemoteCommand]; const uint8_t ams_cmd = prv_ams_command_for_music_command(MusicCommandPlay); fake_gatt_client_op_assert_write(remo...
{ prv_connect_ams(); // Receive: playing, 200% playback rate, elapsed time 184.755s // 0000 00 01 00 31 2c 32 2e 30 2c 31 38 34 2e 37 35 35 ...1,2.0 ,184.755 uint8_t playback_info_update[] = { 0x00, 0x01, 0x00, 0x31, 0x2c, 0x32, 0x2e, 0x30, 0x2c, 0x31, 0x38, 0x34, 0x2e, 0x37, 0x35, 0x35, }; prv...
void test_ams__receive_player_playback_info_update_nulls(void) { prv_connect_ams(); // Receive: paused, empty string, empty string // 0000 00 01 00 30 2c 2c ...0,, uint8_t playback_info_update[] = { 0x00, 0x01, 0x00, 0x30, 0x2c, 0x2c, }; prv_receive_entity_update(pla...
0 degrees if (pitch < ((270 * TRIG_MAX_ANGLE) / 360)) { pitch -= (TRIG_MAX_ANGLE / 2); } else { pitch -= TRIG_MAX_ANGLE; } } *rollp = roll; *pitchp = pitch; } static int32_t prv_correct_for_roll_and_pitch(AccelRawData *accel_data, MagData *mag_data, int32_t roll, int32_t pitch) { i...
PBL_LOG(LOG_LEVEL_DEBUG, "subscribers %"PRIu8, s_compass_subscribers_count)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(font_info)
; return NULL; } return font_info; } void fonts_unload_custom_font(GFont font) { // fonts_load_custom_font can return gothic 14 if loading their font didn't // work for whatever reason. We don't let the app know that it failed, so it makes sense that // they'll later try to unload this returned pointer ...
refs_get_health_app_opened_version(void) { return s_activity_prefs_health_app_opened; } void activity_prefs_set_health_app_opened_version(uint8_t version) { if (s_activity_prefs_health_app_opened != version) { s_activity_prefs_health_app_opened = version; prv_pref_set(PREF_KEY_ACTIVITY_HEALTH_APP_OPENED, &...
(shell_prefs_get_display_offset())
; } bool shell_prefs_should_prompt_display_calibration(void) { return s_should_prompt_display_calibration; } void shell_prefs_set_should_prompt_display_calibration(bool should_prompt) { s_should_prompt_display_calibration = should_prompt; prv_pref_set(PREF_KEY_SHOULD_PROMPT_DISPLAY_CALIBRATION, &s_should_prompt...
BITS, .stop = CONFIG_LOG_UART_STOPBITS, .parity = CONFIG_LOG_UART_PARITY, .use_fifo = 1, .rx_dma_channel = CONFIG_LOG_UART_RX_DMA_CHANNEL, .tx_dma_channel = CONFIG_LOG_UART_TX_DMA_CHANNEL, }; hw_uart_init(CONFIG_LOG_UART, &uart_init); hw_gpio_set_pin_fun...
va_start(args, packed_loghash)
; for (unsigned index = 0; index < num_fmt_conversions; ++index) { const char *str = (const char *)va_arg(args, const char *); if ((index + 1 == str_index_1) || (index + 1 == str_index_2)) { unsigned len = strlen(str) + 1; // TODO: remove NULL termination if ((index + 1) == str_index_1) ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ASSERT(emx_resources_get_size(1, id_4) == 4)
; buf = 0; ASSERT(emx_resources_read(1, id_4, 0, (uint8_t *)&buf, 1) == 4); ASSERT(buf == 4); ASSERT(s_read_4_called == 3); ASSERT(s_size_4_called == 2); // remove 4 again emx_resources_remove_custom(id_4); ASSERT(emx_resources_get_size(1, id_4) == 0); ASSERT(s_size_4_called == 2); }
ual_i(fake_event_get_count(), 1); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is...
timeline_event_handle_blobdb_event()
; cl_assert(timeline_add(&item4)); timeline_event_handle_blobdb_event(); timeline_event_init(); cl_assert_equal_i(fake_event_get_count(), 1); cl_assert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert(timer_id != TIMER_INVALID_ID); cl_assert(stub_new_timer_is_schedu...
DBG("Object Send Complete."); prv_object_queue_pop_head(true /* should_free_data_buffer */); } else { OutgoingObject * const obj = s_state.out.object_queue; obj->offset_bytes += sent_chunk_payload_size; } } static void prv_object_queue_send_current_chunk(void) { PBL_ASSERTN(s_state.out.object_queue...
if (chunk->is_first) { // If this is the first message, allocate buffer: uint8_t *const buffer = task_malloc(chunk->total_size_bytes); if (!buffer) { APP_LOG(APP_LOG_LEVEL_ERROR, "Not enough mem to recv postMessage() of %"PRIu32" bytes", (uint32_t) chunk->total_size_bytes); // http...
// Copy the received buffer over: memcpy(s_state.in.reassembly_buffer + s_state.in.received_size_bytes, chunk->chunk_data, payload_size); s_state.in.received_size_bytes += payload_size; DBG("Received (%"PRIu32" / %"PRIu32" bytes)", (uint32_t) s_state.in.received_size_bytes, (uint32_t) s_state....
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_put_area_event(UnobstructedAreaEventType_DidChange, final_y, final_y, ANIMATION_NORMALIZED_MAX)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
window_init(window, "Timeline")
; const GColor color = past ? TIMELINE_PAST_COLOR : TIMELINE_FUTURE_COLOR; window_set_background_color(window, color); prv_init_peek_layer(&s_data.app); prv_setup_no_events_peek(&s_data.app); peek_layer_play(&s_data.app.peek_layer); fake_animation_complete(s_data.app.peek_layer.kino_layer.player.animation)...
ut it, if // max_space_total == max_used_space, then if the file is full, changing a // single value would force the whole file to be rewritten- every single // time! It's probably worth it to "waste" a bit of flash space to avoid // this pathalogical case. int max_space_total = pfs_sector_optimal_size(max_us...
{ hdr->flags |= flags; }
k that the percentage reported is somewhat protected from transient voltage changes void test_battery_monitor__charge_fluctuate_voltage(void) { int high_percent = 70; int low_percent = 20; int high_mv = battery_curve_lookup_voltage_by_percent(high_percent, true); int low_mv = battery_curve_lookup_voltage_by_per...
periodic_timer_trigger(1)
; cl_assert(!s_in_low_power && !battery_monitor_critical_lockout()); cl_assert_equal_i(s_power_state, PowerStateGood); // good -> lpm fake_battery_set_millivolts(low_mv); periodic_timer_trigger(10); cl_assert(s_in_low_power); cl_assert_equal_i(s_power_state, PowerStateLowPower); // lpm -> good fake_...
TODO: PBL-40555 consolidate angle handling here and in rocky_api_path2d.c GPointPrecise center; Fixed_S16_3 radius1, radius2; double angle_1, angle_2; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR( ROCKY_ARG(center.x), ROCKY_ARG(center.y), ROCKY_ARG(radius1), ROCKY_ARG(radius2), ROCKY_ARG_ANG...
rocky_api_graphics_path2d_reset_state()
e "kernel/pbl_malloc.h" #include "os/tick.h" #include "kernel/util/stop.h" #include "kernel/util/wfi.h" #include "process_management/worker_manager.h" #include "services/common/analytics/analytics.h" #include "system/logging.h" #include "util/math.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #define STM32F...
{ cycles_elapsed = systick_start - systick_stop; }
else { cycles_elapsed = (SysTick->LOAD - systick_stop) + systick_start; } s_analytics_device_sleep_cpu_cycles += cycles_elapsed; s_analytics_app_sleep_cpu_cycles += cycles_elapsed; } else { const RtcTicks stop_duration = MIN(xExpectedIdleTime - EARLY_WAKEUP_TICKS, MAX_STOP_TICKS); ...
th the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express o...
prompt_send_response_fmt(buffer, sizeof(buffer), "Connected: %s", connected ? "yes" : "no")
return (NULL); } } DataLoggingSession *logging_session = dls_list_find_active_session(tag, uuid); if (!resume && logging_session != NULL) { dls_finish(logging_session); logging_session = NULL; } if (logging_session == NULL) { logging_session = dls_list_create_session(tag, item_type, ...
{ PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for logging_session to write"); }
dls_unlock_session(logging_session, true /*inactivate*/); exit: dls_send_all_sessions(); } // ---------------------------------------------------------------------------------------- static bool prv_write_session_to_flash(DataLoggingSession* session, void *data) { dls_storage_write_session(session); return t...
prv_handle_ancs_disconnected_event(&ancs_event, NULL); } /////////////////////////////////////////////////////////// // Tests /////////////////////////////////////////////////////////// void test_phone_call__initialize(void) { //fake_comm_session_init(); phone_call_service_init(); prv_call_end(); s_last_pho...
{ // A call start event with ANCS should act as a call end in order to hide the phone ui prv_put_incoming_call_event(PhoneCallSource_ANCS_Legacy, true); ASSERT_LAST_EVENT(PhoneEventType_Incoming); prv_call_start(); ASSERT_LAST_EVENT(PhoneEventType_End); // A call start event with PP should keep the phone ...
// --------------------------------------------------------------------------------------- // Make sure we handle ANCS notification removals properly void test_phone_call__ancs_hide(void) { // Make sure we hide the call when ANCS tells us the notification was removed (but only if the // call id matches the curre...
before the next handshake, so it's ok to do this first. prv_read_ppg_data(HRM, &data.ppg_data); if (should_expect_samples) { interval_timer_take_sample(&s_handshake_interval_timer); } // Send the accel data out to the AS7000 HRMAccelData *accel_data = hrm_manager_get_accel_data(); const uint8_t num_s...
(info->sw_version_major)
, info->sw_version_minor, info->hw_revision); } prv_log_running_apps(dev); return true; } static bool prv_is_app_running(HRMDevice *dev, AS7000AppId app) { uint8_t running_apps = 0; if (!prv_read_register(dev, ADDR_APP_IDS, &running_apps)) { return false; } PBL_LOG(LOG_LEVEL_DEBUG, "Apps ...
ss to the backup // registers has been enabled static void prv_enable_backup_access() { RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); PWR_BackupAccessCmd(ENABLE); // Disable write-protect on RTC_BKP_x registers } void boot_main(void) { prv_configure_system_flash(); prv_enable_backup_access(); dbgseri...
{ if (!switch_to_recovery_fw()) { // We've failed to load recovery mode too many times. prv_sad_watch(ERROR_CANT_LOAD_FW); } }
else { check_update_fw(); } if (prv_check_and_increment_reset_loop_detection_bits()) { prv_sad_watch(ERROR_RESET_LOOP); } watchdog_init(); #ifndef NO_WATCHDOG watchdog_start(); #endif prv_jump_to_fw(); }
(!iter) { *max_client = NULL; return 0; } uint32_t max_data = 0; uint32_t len; while (iter) { len = prv_get_data_length(buffer, (SharedCircularBufferClient *)iter); if (len >= max_data) { *max_client = (SharedCircularBufferClient *)iter; max_data = len; } iter = iter->next...
if (data_length < length) { return false; }
s_length; } } static void prv_will_draw_container(GTextNodeDrawContext *ctx) { GTextNodeContainer *container = (GTextNodeContainer *)ctx->node; prv_set_size(&ctx->box.size, &container->size); if (ctx->render) { prv_align_axis(ctx); } } static void prv_did_draw_container(GTextNodeDrawContext *ctx) { GT...
prv_base(node)->destructor(node)
; } } bool graphics_text_node_container_add_child(GTextNodeContainer *parent, GTextNode *child) { if (!parent) { return false; } return prv_container(&parent->node)->add_child(parent, child); } static void NOINLINE prv_init_draw_context(GTextNodeDrawContext *ctx, GTextNode *node, ...
host_transport_configure_spi_scs_pin(SCSPinFunction_Wakeup_GPIO)
; } } HostTransportEnqueueStatus host_transport_tx_enqueue(const uint8_t *buffer, size_t length) { PBL_ASSERTN(length < HOST_TRANSPORT_CTLR_TX_BUFFER_SIZE && length < HOST_TRANSPORT_HOST_RX_BUFFER_SIZE); prv_lock(); bool success = circular_buffer_write(&s_tx_buffer, buffer, length); prv_unlock...
0); cl_assert_equal_i(job->cached_execute_time, target); cl_assert_equal_i(cron_service_get_job_count(), 1); // Mutate the execute time to see if we actually effect change. job->clock_change_tolerance = 100; prv_clock_change(10, 0, false); cl_assert_equal_i((uintptr_t)job->cb_data, 1); cl_assert_equal_i...
cl_assert_equal_i((uintptr_t)test_cron[l].cb_data, i >= l ? 1 : 0)
; } } } void test_cron__already_elapsed(void) { CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = CRON_MINUTE_ANY, .hour = CRON_HOUR_ANY, .mday = CRON_MDAY_ANY, .month = CRON_MONTH_ANY, .may_be_instant = true, }; prv_basic_test(&s_timezone_gmt, &te...
(ctx, prev_state)
; } void menu_layer_update_proc(Layer *scroll_content_layer, GContext* ctx) { MenuLayer *menu_layer = (MenuLayer*)(((uint8_t*)scroll_content_layer) - offsetof(MenuLayer, scroll_layer.content_sublayer)); const GSize frame_size = menu_layer->scroll_layer.layer.frame.size; const int16_t content_top_y = -scrol...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
fake_system_task_count_callbacks()
; animation_schedule(animation); return animation; } static void prv_push_pin_window(TimelineAppData *data, TimelineIterState *state, bool animated) { TimelineLayout *timeline_layout = timeline_layer_get_current_layout(&data->timeline_layer); if (!timeline_layout) { return; } // Animation structure: ...
(data, TimelineAppStateHideDaySeparator)
) { return; } animation_unschedule(data->current_animation); Animation *day_sep_hide = timeline_layer_create_day_sep_hide(&data->timeline_layer); animation_set_handlers(day_sep_hide, (AnimationHandlers){ .stopped = prv_hide_day_sep_stopped, }, data); data->current_animation = day_sep_hide; anima...
east twice. for (int j=0; j<16; j++) { prv_log_consume_random(logging_sessions[i], item_size, num_bytes); } } } // ---------------------------------------------------------------------------------------- // Filling up the file system. We should be limited to creating DLS_MAX_DATA_BYTES worth // of sto...
(logging_sessions[i], crcs[i], buf_size[i])
; } } // ---------------------------------------------------------------------------------------- static void prv_do_recovery_test(int num_sessions) { unsigned int num_bytes[num_sessions]; uint32_t crcs[num_sessions]; const int item_size = 1; // Log some random data for (int i = 0; i < num_sessions; i++)...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ rcv_msg = qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol); cl_assert(rcv_msg); cl_assert_equal_i(rcv_protocol, QemuProtocol_SPP); cl_assert_equal_i(rcv_bytes, sizeof(msg_data)); cl_assert_equal_m(msg_data, rcv_msg, sizeof(msg_data)); }
// ----------------------------------------------------------------------------- // Check after each part prv_send_hdr(QemuProtocol_SPP, sizeof(msg_data)); cl_assert(!qemu_serial_private_assemble_message(&s_state, &rcv_bytes, &rcv_protocol)); prv_send_bytes(msg_data, sizeof(msg_data)); // Message is avail...
{ -768, 152, 392}, { -768, 136, 72}, { -888, 208, -40}, { -912, 216, 40}, { -944, 176, 104}, { -944, 0, 40}, { -832, -48, -88}, { -992, 152, -248}, { -776, -24, -232}, { -784, 112, -504}, // 72 seconds { -792, 64, -584}, { -768, 0, -600}, { -784, -280, -672}, ...
{ -984, 224, 640}, { -840, 432, 416}, // 77 seconds { -848, 488, 216}, { -928, 424, -40}, { -896, 504, -248}, { -912, 592, -248}, { -880, 456, 8}, { -896, 16, 352}, { -992, -472, 320}, { -920, -624, 296}, { -776, -416, 96}, { -848, -200, -168}, { -840, -56, -312},...
{ -416, -240, -832}, { -520, -208, -936}, { -416, -296, -912}, { -424, -216, -984}, { -536, -200, -1120}, { -440, -336, -968}, { -592, -288, -904}, { -560, -144, -760}, { -616, 0, -632}, { -800, -56, -600}, { -664, -240, -408}, { -888, 56, -352}, { -816, 248, -280}, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(s_list_mutex)
); } // --------------------------------------------------------------------------------------- // Lock a session (if active). If session was active, locks it and returns true. // If session is not active, does no locking and returns false. // // Note regarding the list_mutex and the session->data-mutex: // * sessio...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ signed portBASE_TYPE should_context_switch = false; xSemaphoreGiveFromISR(s_dma_in_progress, &should_context_switch); return should_context_switch != pdFALSE; }
void compositor_dma_run(void *to, const void *from, uint32_t size) { stop_mode_disable(InhibitorCompositor); dma_request_start_direct(COMPOSITOR_DMA, to, from, size, prv_dma_complete_handler, NULL); if (xSemaphoreTake(s_dma_in_progress, 10) != pdTRUE) { PBL_LOG_SYNC(LOG_LEVEL_ERROR, "DMA Compositing never ...
(!animation_private_using_legacy_2(NULL))
; PropertyAnimationPrivate *property_animation = prv_find_property_animation(property_animation_h); if (!property_animation) { return; } uint32_t result = interpolate_uint32(distance_normalized, property_animation->values.from.uint32, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_get_next(iter)
; } } mutex_unlock(s_callback_list_semaphore); } // ------------------------------------------------------------------------------------------- static void timer_callback(void* data) { (void) data; do_callbacks(&s_seconds_callbacks); time_t t = rtc_get_time(); struct tm time; localtime_r(&t, &time...
r_str, "???", sizeof(lr_str)); } char pc_str[16]; if (crash_info->pc_known) { sniprintf(pc_str, sizeof(pc_str), "%p", (void*) crash_info->pc); } else { strncpy(pc_str, "???", sizeof(pc_str)); } char buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&crash_info->app_uuid, buffer); char *proces...
process_manager_put_kill_process_event(task, false /* gracefully */)
; // Wait for the kernel to kill us... vTaskSuspend(xTaskGetCurrentTaskHandle()); } DEFINE_SYSCALL(NORETURN, sys_app_fault, uint32_t stashed_lr) { // This is the privileged side of handling a failed assert/croak from unprivileged code. // Always run on the current task. CrashInfo crash_info = make_crash_i...
path = 37; const unsigned int radius_of_spinner_circles = 9; const GPoint circle_center_point = GPoint(layer->bounds.size.w / 2, center_of_circle_y_val); const unsigned int angle = (TRIG_MAX_ANGLE * data->cur_distance_normalized * LOOPS_PER_ANIMATION) / ANIMATION_NORMALIZED_MAX; c...
(data->spinner_animation)
ck(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_detail_card__render_subtitle_text(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", .primary_value = "value1", .secondary_label = "LABEL2", ...
menu_layer_set_selected_index(&card->menu_layer, MenuIndex(0, 2), MenuRowAlignCenter, false)
; #endif window_render(&card->window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_health_detail_card__render_zone_hide_typical(void) { HealthDetailCardConfig config = { .num_headings = 1, .headings = &(HealthDetailHeading) { .primary_label = "LABEL1", ....
ART_CR1_UE; } // Read / Write APIs //////////////////////////////////////////////////////////////////////////////// void uart_write_byte(UARTDevice *dev, uint8_t data) { PBL_ASSERTN(dev->state->initialized); // wait for us to be ready to send while (!uart_is_tx_ready(dev)) continue; dev->periph->TDR = data...
{ should_context_switch = true; }
d ack_nack_timer_callback(void *data) { AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; outbox->ack_nack_timer = NULL; if (!prv_is_awaiting_ack(outbox->phase)) { // Reply was received and handled in the mean time, or app message was closed. return; } prv_handle_nack_or_ack_time...
{ AppMessageCtxOutbox *outbox = &app_state_get_app_message_ctx()->outbox; return outbox ? outbox->ack_nack_timer : NULL; }
m, NotificationWindowData *window_data, TimelineItemActionSource source) { // Determine action menu properties int num_timeline_actions = 0; TimelineItemAction *dismiss_action = NULL; for (int i = 0;...
{ action_menu_level_add_action(root_level, mute_label_buf, prv_mute_notification_always, window_data); }
else { const uint8_t number_mute_actions = 3; ActionMenuLevel *mute_level = action_menu_level_create(number_mute_actions); action_menu_level_add_child(root_level, mute_level, mute_label_buf); action_menu_level_add_action(mute...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return false; // Info not available }
, to_area.size.h); cl_assert_passert(fake_event_service_handle_last()); } void test_unobstructed_area_service__change(void) { UnobstructedAreaHandlers handlers = { .change = prv_change, }; app_unobstructed_area_service_subscribe(handlers, s_data.context); cl_assert(fake_event_service_get_info(PEBBLE_UNOB...
fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)
app_id = &data->notification_app_id, // This is set earlier when we reload the layout .fallback_id = fallback_icon_id, }; peek_layer_set_icon(data->peek_layer, &data->peek_icon_info); peek_layer_set_background_color(data->peek_layer, colors->bg_color); // This is so that only the banner of the swap_layer i...
{ data->notification_app_id = (Uuid)UUID_INVALID; }
else { data->notification_app_id = pin.header.parent_id; } const LayoutId layout_id = (type == NotificationMobile) ? LayoutIdNotification : LayoutIdReminder; NotificationLayoutInfo layout_info = (NotificationLayoutInfo) { .item = item, .show_notification_timestamp = !prv_should_pop_due_to_inactivity...
ed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/flash/flash_impl.h" #include <stdbool.h> #include <stdint....
if (s_num_flash_uses == 0) { periph_config_disable(FMC_Bank1, RCC_AHB3Periph_FMC); // FIXME }
} void flash_impl_release(void) { flash_impl_release_many(1); } static uint16_t flash_s29vs_read_short(FlashAddress addr) { return *((__IO uint16_t*)(FMC_BANK_1_BASE_ADDRESS + addr)); } FlashAddress flash_impl_get_sector_base_address(FlashAddress addr) { if (addr < BOTTOM_BOOT_REGION_END) { return addr & ...
r\n"); const uint32_t crc = crc32(CRC32_INIT, (const uint8_t *)FIRMWARE_BASE, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print_hex(crc); dbgserial_newli...
boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ event_service_client_unsubscribe(&alarms_glance->alarm_clock_event_info); kino_reel_destroy(alarms_glance->icon); }
app_free(alarms_glance); } static void prv_set_glance_icon(LauncherAppGlanceAlarms *alarms_glance, uint32_t new_icon_resource_id) { if (alarms_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing icon kino_r...
; } PBL_ASSERT(s_activity_state.started, "not started"); while (num_samples) { while (s_activity_state.pending_test_cb) { sys_psleep(1); // Wait for kernelBG to process prior data } uint32_t chunk_size = MIN(ACTIVITY_ALGORITHM_MAX_SAMPLES, num_samples); // Allocate space for the ...
prv_wait_system_task(prv_sleep_file_info_system_cb, &context, &context.success, &context.completed, 30 /*timeout_sec*/)
; if (success) { *num_records = context.num_records; *data_bytes = context.data_bytes; *minutes = context.minutes; } else { *num_records = 0; *data_bytes = 0; *minutes = 0; } return success; } // ------------------------------------------------------------------------------------------...
LL); // We should be able to create one out of c and d Animation *d = prv_create_test_animation(); spawn = animation_spawn_create(c, d, NULL); cl_assert(spawn != NULL); animation_destroy(seq); animation_destroy(spawn); #endif } // Test all the accessors void test_animation__accessors(void) { #ifdef TEST...
(progress, 32768)
; // Rounding occurs within, this is close to MAX / 2 animation_destroy(h); #endif } void test_animation__completed(void) { #ifdef TEST_INCLUDE_BASIC const int duration_a = 300; // Create 1 property animations Animation *a = prv_create_test_animation(); const AnimationHandlers handlers = { .started =...
(dstbuf, 256, "There are % d lights, the absolute value of % d", 4, -4)
; cl_assert_equal_s(dstbuf, "There are 4 lights, the absolute value of -4"); // Plus for positive signed snprintf(dstbuf, 256, "There are %+d lights, the absolute value of %+d", 4, -4); cl_assert_equal_s(dstbuf, "There are +4 lights, the absolute value of -4"); // Minimum digits output snprintf(dstbuf, 2...
set_request(s_characteristics[0][PPoGATTCharacteristicData]); } void test_ppogatt__timeout_waiting_for_reset_complete_self_initiated(void) { prv_discover_and_read_meta_and_reset(); // Timeout waiting for "Reset Complete": for (int i = 0; i < PPOGATT_TIMEOUT_TICKS; ++i) { regular_timer_fire_seconds(PPOGATT_T...
(s_characteristics[0][PPoGATTCharacteristicData], NULL, 0, BLEGATTErrorSuccess)
; // No crash etc, client still alive: cl_assert_equal_i(ppogatt_client_count(), 1); cl_assert_equal_b(ppogatt_has_client_for_uuid(&s_meta_v0_system.app_uuid), true); cl_assert_equal_i(fake_comm_session_close_call_count(), 0); } void test_ppogatt__ack_received_data(void) { test_ppogatt__open_session_when_fou...
Animation *animation_a, Animation *animation_b, Animation *animation_c, ...) { va_list args; va_start(args, animation_c); Animation *animation = prv_create_from_vararg(animation_a, animation_b, animation_c, args); va_end(args); return animation; } Animation *WEAK animat...
((Animation *)animation, progress)
; } } static void prv_call_stopped(AnimationPrivate *animation, uintptr_t finished) { if (animation->handlers.stopped) { animation->handlers.stopped((Animation *)animation, finished, animation->context); } if (animation->implementation && animation->implementation->teardown) { animation->implementation...
_PIN_1, HW_GPIO_MODE_OUTPUT, HW_GPIO_FUNC_UART_TX); } void pbl_log_init(void) { debug_uart_init(); // Let's use all available RAM for the log buffer! // That is, the difference between s_log_buffer_ram and RETENTION_BLE (__ble_vars_start__). // This will always be at least sizeof(s_...
if (num_strings) { va_list args; va_start(args, packed_loghash); for (unsigned index = 0; index < num_fmt_conversions; ++index) { const char *str = (const char *)va_arg(args, const char *); if ((index + 1 == str_index_1) || (index + 1 == str_index_2)) { unsigned len = strlen(str) + 1; //...
// Buffer for UART ASCII log output char expanded_fmt_buffer[64]; memset(expanded_fmt_buffer, 0, sizeof(expanded_fmt_buffer)); // Craft a buffer that will hold HcProtocolMessage followed by BinLogMessage. int msg_buffer_size = MAX((msg_size + sizeof(HcProtocolMessage)), 130); uint8_t msg_buffer[msg_buffe...
http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing pe...
{ mbuf_free(s_read_header_mbuf); s_read_header_mbuf = NULL; }
mutex_unlock(s_read_lock); return result; } static void prv_send_service_discovery(void *context) { const uint16_t service_id = ReservedServiceManagement; const uint16_t attribute_id = ManagementServiceAttributeServiceDiscovery; if (s_reserved_read_mbuf) { // already a read in progress return; } ...
_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 4); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY,...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_xy.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 2); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 3 setup_test_aa_sw(&ctx, fb,...
tblt_bitmap_into_bitmap_tiled(&dest_bitmap, &test_bmp, lower_legend_rect, GPointZero, GCompOpAssign, GColorWhite); test_bmp.addr = test_blend_colors; bitblt_bitmap_into_bitmap_tiled(&dest_bitmap, &test_bmp, lower_rect, GPointZero, GCompOpTint, lower_tint_color); } cl_assert(gbitmap_pbi_eq(&dest_bitmap, "te...
("test_bitblt__8bit_src_origin_offset_wrap.8bit.pbi")
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ prompt_send_response("Root Key hexdumps:"); prompt_send_response(" IRK:"); if (irk) { PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uint8_t *)irk, sizeof(SM128BitKey)); } else { prompt_send_response(" None"); }; prompt_send_response(" ERK:"); if (erk) { PBL_HEXDUMP_D_PROMPT(LOG_LEVEL_DEBUG, (uin...
currently the longest interval we can batch samples for is computed //! as the minimum of (samples to batch / sample rate) out of all the active //! subscribers. This means that if we have two subscribers, subscriber A at //! 200ms, and subscriber B at 250ms, new samples will become available every //! 200ms, so subsc...
{ case PebbleTask_App: case PebbleTask_Worker: case PebbleTask_KernelMain: { PebbleEvent event = { .type = PEBBLE_CALLBACK_EVENT, .callback = { .callback = state->data_cb_handler, .data = state->data_cb_context, }, }; QueueHandle_t queue = pebbl...
} //! This is called every time new samples arrive from the accel driver & every //! time data has been drained by the accel service. Its responsibility is //! populating subscriber storage with new samples (at the requested sample //! frequency) and generating a callback event on the subscriber's queue when //! the ...
ase.orientation; s_alg_next_light = minute_data[i].base.light; s_alg_next_plugged_in = minute_data[i].base.plugged_in; s_activity_next_distance_mm += minute_data[i].distance_cm * 10; s_activity_next_resting_calories += minute_data[i].resting_calories; s_activity_next_active_calories += minute_data[i...
activity_algorithm_deinit()
; activity_algorithm_init(&s_sample_rate); // Write the rest of the data int start_idx = num_minutes / 2; prv_feed_minute_data(num_minutes / 2, minute_data + start_idx, false /*simulate_bg_delays*/); // Retrieve all the minute data and verify the contents HealthMinuteData retrieve[num_minutes]; uint32_t...
nit(VALID_OBJECT_SIZE * num_ops, ObjectFirmware); fake_comm_session_process_send_next(); fake_system_task_callbacks_invoke_pending(); uint8_t buffer[num_ops * VALID_OBJECT_SIZE]; for (size_t i = 0; i < sizeof(buffer); i += VALID_OBJECT_SIZE) { uint32_t towrite = i; memcpy(&buffer[i], &towrite, sizeof(t...
(s_last_response_cookie)
; assert_ack_count(1); assert_nack_count(0); assert_cleanup_event(ObjectFirmware, VALID_OBJECT_SIZE); } //////////////////////////////////////////////////////////////////////////////////////////////////// // Install Message void test_put_bytes__install_message_while_not_idle(void) { prv_receive_init(VALID_OB...
120, 912, -176}, { -120, 912, -176}, { -112, 912, -176}, { -112, 920, -184}, { -112, 920, -176}, { -112, 912, -176}, { -120, 920, -176}, { -120, 912, -176}, { -120, 912, -176}, { -120, 912, -184}, { -120, 920, -176}, { -112, 920, -176}, { -112, 912, -176}, { -120, 920...
{ -112, 912, -184}, { -112, 912, -176}, { -112, 912, -184}, { -112, 936, -176}, { -112, 912, -184}, { -112, 912, -184}, { -112, 920, -184}, { -112, 920, -184}, { -112, 920, -184}, { -112, 904, -176}, // 65 seconds { -112, 904, -192}, { -104, 912, -176}, { -112, 92...
{ -104, 920, -176}, { -112, 912, -184}, { -112, 912, -184}, { -112, 912, -176}, { -112, 920, -176}, { -112, 920, -184}, { -112, 912, -176}, { -112, 920, -184}, { -112, 920, -176}, { -112, 912, -176}, { -112, 920, -176}, { -112, 912, -176}, { -104, 912, -176}, { -...
NORMALIZED_MAX); } GPoint gpoint_attract_to_square(GPoint point, GSize size, int32_t normalized) { // hacky to square - TODO: implement for real point.y += 1; point = GPoint( prv_int_attract_to(point.x, size.w, normalized), prv_int_attract_to(point.y, size.h, normalized)); return point; } typedef ...
atan2_lookup(b->y - ctx->origin.y, b->x - ctx->origin.x)
+ ctx->angle), TRIG_MAX_ANGLE) - TRIG_MAX_ANGLE / 2); return (angle_a > angle_b ? 1 : -1); } GPointIndexLookup *gdraw_command_list_create_index_lookup_by_angle(GDrawCommandList *list, GPoint origin, int32_t angle) { AngleComparatorContext ct...
ile. Used when migrating from version 1 to version 2, where all we // we need to do is recreate the file in a bigger size static void prv_settings_rewrite_cb(SettingsFile *old_file, SettingsFile *new_file, SettingsRecordInfo *info, void *context) { if (info->key_len != sizeof(Activ...
{ SettingsFile *file = activity_private_settings_open(); if (file && (s_activity_state.update_settings_counter <= 0)) { // Peridocically save current stats into settings, so that if watch resets or crashes we // don't lose too much info ACTIVITY_LOG_DEBUG("updating current stats in settings")...
s_activity_state.update_settings_counter = ACTIVITY_SETTINGS_UPDATE_MIN; } if (file) { activity_private_settings_close(file); } } mutex_unlock_recursive(s_activity_state.mutex); } // ------------------------------------------------------------------------------------------------ // Tail ...
erry_delete_property(const jerry_value_t obj_val, const jerry_value_t prop_name_val) { if (!jerry_value_is_object(obj_val) || !jerry_value_is_string(prop_name_val)) { return false; } return (bool)EM_ASM_INT({ var obj = __jerryRefs.get($0); var name = __jerryRefs.get($1); try { return...
{ desc.configurable = Boolean($8 /* is_configurable */); }
Object.defineProperty(obj, name, desc); return __jerryRefs.ref(Boolean(true)); }, pdp->is_value_defined, /* $0 */ pdp->is_get_defined, /* $1 */ pdp->is_set_defined, /* $2 */ pdp->is_writable_defined, /* $3 */ pdp->is_writable, /* $4 */ pdp->is_en...
nse(entity_update, BLEGATTErrorSuccess); ams_handle_write_response(entity_update, BLEGATTErrorSuccess); ams_handle_write_response(entity_update, BLEGATTErrorSuccess); cl_assert_equal_b(ams_is_registered_for_all_entity_updates(), true); fake_gatt_client_op_clear_write_list(); } static uint8_t prv_ams_command_...
(true /* reduced_latency */)
_update_status_async(); } static uint32_t prv_calc_timeout(const TimelineItem *item) { const time_t now = rtc_get_time(); const time_t start = item->header.timestamp; const time_t end = start + (item->header.duration * SECONDS_PER_MINUTE); if (now >= end) { return 0; } const uint32_t timeout_s = ((star...
new_timer_create()
ode; //! The TimerID type used for sys_timers is a non-repeating integer that we also use as our key for finding //! EventedTimers by id. TimerID sys_timer_id; EventedTimerCallback callback; void* callback_data; PebbleTask target_task; bool expired; // This gets set when the timer's callback runs ...
cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT)
/ ------------------------------------------------------------------------------------------------ static void prv_do_activity_session(time_t now_utc, ActivitySession *session) { if (!activity_prefs_activity_insights_are_enabled()) { return; } if (!s_activity_session_settings.enabled) { return; } if...
("Reloading insights settings")
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
storage_release()
; PBL_LOG(LOG_LEVEL_DEBUG, "Added pairing for "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(info->identity.address)); } void bonding_sync_handle_hc_remove(const BleBonding *bonding) { const SMPairingInfo *info = &bonding->pairing_info; uint16_t conn_idx = BLE_CONN_IDX_INVALID; storage_acquire(); ...
as events happen. //! - The watch can decline / hangup the call by sending PP messages to the phone. //! On iOS: //! - The watch gets incomming calls from ANCS (parsed in ancs_notifications.c). //! - After that the watch must poll the phone for its status if not iOS 9+ (using PP messages). //! - On iOS 9, ANCS tells us...
(LOG_LEVEL_INFO, "Ignoring incoming call. Mobile app is not connected. Call source: %d ", event->source)
= localtime(&utc_end); strftime(time_end_text, sizeof(time_end_text), "%F %r", local_tm); if (num_minutes > 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Got %d minutes: %s to %s", num_minutes, time_start_text, time_end_text); } else { APP_LOG(APP_LOG_LEVEL_DEBUG, "No more data"); } n...
time_start_of_today()
; time_t now = time(NULL); HealthServiceAccessibilityMask accessible; accessible = health_service_metric_averaged_accessible( metric, day_start, now, HealthServiceTimeScopeDailyWeekdayOrWeekend); if (!(accessible & HealthServiceAccessibilityMaskAvailable)) { prv_display_alert("NOT ACCESSIBLE"); r...
e <stdio.h> #include <stdlib.h> #include <string.h> #define RETURN_CRASH_TIMEOUT_TICKS (60 * RTC_TICKS_HZ) //! Behold! The file that manages applications! //! //! The code in this file applies to all apps, whether they're third party apps (stored in SPI flash) or first //! party apps stored inside our firmware. //! ...
(LOG_LEVEL_DEBUG, "Starting %s app <%s>", app_type, process_metadata_get_name(app_md))
; // new logging only allows for 2 %s per format string... PBL_LOG(LOG_LEVEL_DEBUG, "Starting app with sdk platform %s", sdk_platform); } #define APP_STACK_ROCKY_SIZE (8 * 1024) #define APP_STACK_NORMAL_SIZE (2 * 1024) static size_t prv_get_app_segment_size(const PebbleProcessMd *app_md) { switch (process_metad...
reason_string = "%s%sLowBattery"; break; case RebootReasonCode_SoftwareUpdate: gatt_service_changed_server_handle_fw_update(); reason_string = "%s%sSoftwareUpdate"; break; case RebootReasonCode_ResetButtonsHeld: // Since we forced the reset, it isn't unexpected show_reset_alert = false; ...
DEBUG_LOG(LOG_LEVEL_INFO, "Unread coredump file is present!")
80, 448, -880}, { 96, 464, -912}, { 72, 536, -912}, { 48, 440, -896}, { 96, 424, -912}, { 104, 432, -904}, { 104, 408, -880}, // 59 seconds { 80, 424, -904}, { 96, 432, -912}, { 104, 400, -880}, { 104, 448, -904}, { 72, 496, -896}, { 24, 448, -856}, { 56, 528, -9...
{ -400, 520, -768}, { -400, 520, -768}, { -408, 528, -776}, { -408, 520, -768}, { -408, 504, -784}, { -392, 512, -792}, { -384, 520, -760}, { -392, 512, -760}, { -400, 512, -776}, { -400, 512, -792}, { -400, 512, -792}, { -392, 512, -768}, { -392, 512, -776}, { -4...
{ -400, 528, -768}, { -392, 536, -776}, { -400, 528, -768}, { -400, 528, -760}, { -400, 528, -768}, { -400, 528, -776}, { -392, 528, -760}, { -400, 528, -768}, // 67 seconds { -392, 528, -768}, { -400, 528, -776}, { -400, 528, -768}, { -400, 536, -768}, { -392, 5...
o_player_play(test_player); animation_set_reverse(test_player->animation, true); animation_set_duration(test_player->animation, 300); animation_set_elapsed(test_player->animation, 20); prv_play_animation_update(test_player->animation, 0); // intentionally bad value cl_assert_equal_i(kino_reel_get_elapsed(t...
animation_is_scheduled(animation)
, false); } void test_kino_player__set_reel_calls_destructor(void) { kino_player_set_reel(test_player, test_reel, true); cl_assert_equal_p(test_player->reel, test_reel); cl_assert_equal_i(s_num_destructor_calls, 0); kino_player_set_reel(test_player, NULL, true); cl_assert_equal_p(test_player->reel, NULL); ...
ing (don't render first *and* last pixel if line length is 1) if (y2.fraction != 0) { prv_blend_color_and_update_mask(ctx, y1.integer, x, x, color, (uint8_t)y2.fraction); } } T_STATIC void prv_mask_recording_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, ...
{ if (x1.integer > clip_box_max_x) { break; } prv_blend_color_and_update_mask(ctx, y, x1.integer, x1.integer, color, (uint8_t)(FIXED_S16_3_ONE.raw_value * (right_aa_offset - i) / right_aa_offset)); x1.integer++...
} } const GDrawRawImplementation g_mask_recording_draw_implementation = { .assign_horizontal_line = prv_mask_recording_assign_horizontal_line, .assign_vertical_line = prv_mask_recording_assign_vertical_line, .blend_horizontal_line = prv_mask_recording_blend_horizontal_line_raw, .blend_vertical_line = prv_ma...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(snprintf(dstbuf, 17, "Hello!\nI am error"), 17)
; cl_assert_equal_m(dstbuf, "Hello!\nI am erro\0\xFF", 18); memset(dstbuf, 0xFF, 256); cl_assert_equal_i(snprintf(dstbuf, 15, "Hello!\nI am error"), 17); cl_assert_equal_m(dstbuf, "Hello!\nI am er\0\xFF", 16); } void test_sprintf__long_conversion(void) { char dstbuf[256]; uint64_t val = 0xFFFFFFFFFFFFFFF...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(rect, 16, 0)
); cl_assert_equal_grect(GRect(10, 40, 30, 0), grect_inset_internal(rect, 0, 20)); cl_assert_equal_grect(GRectZero, grect_inset_internal(rect, 0, 21)); cl_assert_equal_grect(GRectZero, grect_inset_internal(rect, 16, 21)); } void test_gtypes__grect_crop_asserts_for_large_insets(void) { GRect rect = GRect(10, ...
interrupted app to render cl_assert_equal_i(s_count_animation_create, 2); cl_assert_equal_i(s_count_animation_schedule, 1); cl_assert_equal_i(s_count_compositor_init_func_a, 1); cl_assert_equal_i(s_count_compositor_init_func_b, 1); // Make the app render, now the animation should be scheduled compositor_ap...
{ // If a modal window is popped revealing an app that has not yet rendered itself for the first // time we shouldn't render the app immediately. We need to still wait for the app to render // itself for the first time. This is a known issue that doesn't seem to happen too frequently // in practice, but we shou...
void test_compositor__app_not_ready_cancelled_animation_deferred(void) { // Show a modal window s_modal_window_present = true; compositor_transition(NULL); // Now pop it with a transition s_modal_window_present = false; compositor_transition(&s_transition_a); cl_assert_equal_i(s_count_animation_create,...
down to the sampling // frequency (samples * baud_rate) and store it in USART_BBR as a fixed-point number with a // franctional component equal to the number of samples per symbol. In other words, if OVER8=0, // the fractional component will be 4 bits, and if OVER8=1, it will be 3 bits. // The formula works out...
if (enabled) { dev->state->tx_int_enabled = true; dev->periph->CR1 |= USART_CR1_TXEIE; prv_set_interrupt_enabled(dev, true); } else { // disable interrupt if RX is also disabled prv_set_interrupt_enabled(dev, dev->state->rx_int_enabled); dev->periph->CR1 &= ~USART_CR1_TXEIE; dev->state->tx...
} void uart_irq_handler(UARTDevice *dev) { PBL_ASSERTN(dev->state->initialized); bool should_context_switch = false; if (dev->state->rx_irq_handler && dev->state->rx_int_enabled) { const UARTRXErrorFlags err_flags = { .overrun_error = uart_has_rx_overrun(dev), .framing_error = uart_has_rx_framin...
default: WTF; } bma255_write_register(BMA255Register_PMU_RANGE, value); s_raw_unit_to_mgs = scale; } static int16_t prv_raw_to_mgs(int16_t raw_val) { int16_t mgs = ((int32_t)raw_val * s_raw_unit_to_mgs) / 1000; return mgs; } static int16_t prv_conv_raw_to_12bit(const uint8_t registers[2]) { int1...
prv_read_curr_accel_data(&data)
; accel_cb_new_sample(&data); } static void prv_handle_motion_interrupts(void) { s_accel_outstanding_motion_work = false; const uint8_t int0_status = bma255_read_register(BMA255Register_INT_STATUS_0); const uint8_t int2_status = bma255_read_register(BMA255Register_INT_STATUS_2); bool anymotion = (int0_stat...
30 seconds { 968, 320, 128}, { 976, 176, 40}, { 1040, -56, 152}, { 984, 72, 224}, { 904, 128, 112}, { 808, 64, 144}, { 744, 8, 136}, { 704, -80, 192}, { 712, -56, 168}, { 832, -24, 128}, { 1032, 16, 72}, { 1160, 72, 8}, { 1640, -152, 232}, { 1448, 40, 208}, { ...
{ 504, -96, 80}, { 584, -80, 40}, { 784, -64, 8}, { 1032, 32, -24}, { 1272, 16, 56}, // 36 seconds { 1752, -160, 360}, { 1696, 232, 256}, { 1560, 648, -168}, { 1336, 504, -8}, { 968, 112, 296}, { 928, 112, 272}, { 936, 176, 208}, { 888, 184, 240}, { 840, 392, ...
{ 776, 312, 64}, { 848, 360, 8}, { 968, 272, 72}, { 1256, 328, 48}, { 1272, 136, 128}, { 1712, 168, 72}, { 1440, 352, 16}, { 920, 232, 48}, { 1056, 136, 64}, { 1176, -56, 136}, // 39 seconds { 1136, 40, 176}, { 1032, 152, 120}, { 944, 208, 48}, { 704, -32, -8...
\ ) #define IF_ICON_AT_TOP_ELSE(at_top, if_not) \ PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault, \ /* This is the same as Medium until Small is designed */ \ /* small */ PBL_IF_RECT_ELSE(if_not, at_top), \ /* medium */ PBL...
(PreferredContentSizeDefault, //! @note this is the same as Medium until Small is designed /* small */ 3, /* medium */ 3, /* large */ 0, //! @note this is the same as Large until ExtraLarge is designed /* extralarge */ 0)
, // icon margin height }; static const LayoutNodeTextAttributeConfig s_glance_location_config = { .attr_id = AttributeIdLocationName, .text.style = LayoutContentSizeDefault, .text.style_font = TextStyleFont_Header, .text.fixed_lines = 1, // glance location fixed lines .text.alignment = LayoutTe...
ader->common.timestamp) || (notification->header.layout != header->common.layout) || (header->payload_length != payload_size)) { return false; } bool found = false; if (header->payload_length == payload_size) { uint8_t *read_buffer = kernel_malloc_check(payload_size); int result = pfs_re...
pfs_seek(iter_state.fd, iter_state.header.payload_length, FSeekCur)
num { HandlerA = 0, HandlerB, HandlerC, NumHandlers } FakeProtocolHandlers; static int s_handler_call_count[NumHandlers] = { 0 }; typedef struct { size_t len; uint8_t *buf; } ExpectedData; static ExpectedData s_expected_data; static void prv_set_expected_data(void *data, size_t len) { s_expected_data....
{ cl_assert_equal_i(kernel_main_schedule_count_before + 1, s_kernel_main_schedule_count); }
, { -464, 736, -440}, { -440, 760, -480}, { -456, 704, -480}, { -472, 672, -456}, { -480, 680, -488}, { -472, 624, -472}, { -464, 616, -496}, { -448, 608, -472}, { -504, 568, -528}, { -536, 576, -520}, { -544, 576, -560}, { -544, 584, -536}, { -544, 560, -544}, { ...
{ -80, 952, -536}, { -96, 880, -528}, { -104, 864, -464}, { -112, 832, -472}, { -120, 776, -424}, { -104, 776, -464}, { -120, 776, -528}, { -176, 784, -512}, { -232, 768, -512}, { -248, 792, -528}, { -264, 792, -504}, { -240, 904, -624}, { -48, 1024, -472}, // 107...
{ 264, 1264, -600}, { 360, 1304, -456}, { 296, 920, -656}, { 248, 744, -504}, { 312, 824, -464}, { 256, 784, -360}, { 200, 560, -224}, { 56, 392, -288}, { -8, 360, -232}, { -16, 624, -344}, { -56, 760, -448}, { -24, 912, -464}, { 80, 1072, -688}, { 176, 1272, -60...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
health_detail_card_create(&config)
; } void health_hr_detail_card_destroy(Window *window) { HealthDetailCard *card = (HealthDetailCard *)window; HealthHrDetailCardData *card_data = card->data; for (int i = 0; i < card_data->num_headings; i++) { app_free(card_data->headings[i].primary_value); } for (int i = 0; i < card_data->num_zones; i++...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(0, 0, data->text_layer_size.w, data->text_layer_size.h)
); text_layer_set_background_color(&data->text_layer, GColorWhite); text_layer_set_text_color(&data->text_layer, GColorBlack); text_layer_set_text(&data->text_layer, TEXT_DELTA_BUF); data->gothic_14_bold = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD); text_layer_set_font(&data->text_layer, data->gothic_14...
("a_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10)
; cl_assert(fd >= 0); fd = pfs_open("b_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); fd = pfs_open("b_test_1", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); // Get a directory listing with no filtering PFSFileListEntry *dir_list; dir_list = pfs_create_file_list(NULL); ...
if (len != sizeof(*hdr)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length"); return; } QEMU_LOG_DEBUG("Got bluetooth connection msg: connected:%d", hdr->connected); bool current_status = qemu_transport_is_connected(); bool new_status = (hdr->connected != 0); if (new_status != current_status && ...
ARRAY_LENGTH(s_qemu_endpoints)
; ++i) { const QemuMessageHandler* handler = &s_qemu_endpoints[i]; if (!handler || handler->protocol_id > protocol_id) { break; } if (handler->protocol_id == protocol_id) { return handler; } } return NULL; } // ---------------------------------------------------------------------...
animation_unschedule(layer->animation); layer->animation = NULL; // reset the day separator layer_set_hidden((Layer *)&layer->day_separator, true); TimelineResourceInfo timeline_res = { .res_id = TIMELINE_RESOURCE_DAY_SEPARATOR, }; peek_layer_set_icon(&layer->day_separator, &timeline_res); // re...
{ GRect frame; prv_get_frame(layer, i + 1, &frame); animations[num_animations++] = prv_create_bounce_back_animation((Layer *)layout, &frame, direction); }
} const GRect *day_sep_from = &((Layer *)&layer->day_separator)->frame; animations[num_animations++] = prv_create_bounce_back_animation((Layer *)&layer->day_separator, day_sep_from, direction); const GRect *fin_from = &layer->end_of_timeline.l...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ *hour_angle = (tick_time->tm_hour % 12) * TRIG_MAX_ANGLE / 12 + tick_time->tm_min * TRIG_MAX_ANGLE / 60 / 12; *minute_angle = tick_time->tm_min * TRIG_MAX_ANGLE / 60; }
NULL) { change_type = Connected; s_music_ctx.implementation = implementation; PBL_LOG(LOG_LEVEL_INFO, "Music server connected: %s", implementation->debug_name); } else { PBL_LOG(LOG_LEVEL_ERROR, "Server <0x%p> connected, but another <0x%p> is already registered", implementation...
{ mutex_lock_recursive(s_music_ctx.mutex); s_music_ctx.track_pos_ms = track_pos_ms; s_music_ctx.track_pos_updated_at = rtc_get_ticks(); mutex_unlock_recursive(s_music_ctx.mutex); prv_put_pos_changed_event(); }
void music_update_track_duration(uint32_t track_duration_ms) { mutex_lock_recursive(s_music_ctx.mutex); s_music_ctx.track_length_ms = track_duration_ms; mutex_unlock_recursive(s_music_ctx.mutex); prv_put_pos_changed_event(); } void music_get_now_playing(char *title, char *artist, char *album) { mutex_lo...
cognizers(k_rec_count); RecognizerManager manager; recognizer_manager_init(&manager); // ensure this runs without crashing even if there are no recognizer lists prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL); RecognizerList app_list = {}; s_app_list = &app_list; Window window ...
prv_dispatch_touch_event(r, &ctx)
); cl_assert(!handled); cl_assert(!ctx.triggered); r->state = RecognizerState_Completed; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(!handled); cl_assert(!ctx.triggered); r->state = RecognizerState_Started; cl_assert(prv_dispatch_touch_event(r, &ctx)); cl_assert(handled); cl_assert_equ...