prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
excess_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) ...
{ if (node) { 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, ...
rt(tuple->length == sizeof(uint8_t)); cl_assert(tuple->value->uint8 == 8); uint8_found = true; break; case SOME_UINT16_KEY: cl_assert(tuple->length == sizeof(uint16_t)); cl_assert(tuple->value->uint16 == 16); uint16_found = true; break; case SOME_UINT3...
memcmp(new_tuple->value->data, old_tuple->value->data, sizeof(SOME_DATA))
qual_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert...
(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)
; // A should end high distance = prv_last_update_distance(a); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // B should start high distance = prv_last_update_distance(b); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // Execute to the end of B prv_advance_to_ms_with_timers(start_ms ...
/* * 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...
rtc_get_time_ms(&s, &ms)
log.h" #include "applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/expandable_dialog.h" #include "applib/ui/window_stack.h" #include "kernel/event_loop.h" #include "kernel/pbl_malloc.h" #include "kernel/ui/modals/modal_manager.h" #include "process_management/app_install_manager.h" #include "process_man...
gbitmap_init_with_resource(x_icon, RESOURCE_ID_ACTION_BAR_ICON_X)
; // Initialize and configure the worker crash dialog's action bar ActionBarLayer *action_bar = &data->action_bar; action_bar_layer_init(action_bar); action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, check_icon); action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, x_icon); action_bar_layer_set_click_co...
raw_filled_with_cb(ctx, path, prv_gpath_draw_filled_cb, NULL); } void gpath_draw_outline(GContext* ctx, GPath* path) { gpath_draw_stroke(ctx, path, false); } void gpath_draw_outline_open(GContext* ctx, GPath* path) { gpath_draw_stroke(ctx, path, true); } void gpath_draw_stroke(GContext* ctx, GPath* path, bool op...
(&path->points[i], path->rotation, &path->offset)
00, 400, 16}, { 888, 464, 56}, { 992, 472, -96}, { 1192, 96, 400}, { 1112, 248, 160}, { 936, 104, 224}, { 768, 32, 208}, { 712, 24, 112}, { 624, -8, 88}, { 616, 32, 88}, { 720, 16, 48}, { 880, 40, -16}, { 1096, 64, 56}, { 1584, -16, 224}, { 1936, 48, 376}, { 1...
{ 992, 144, 328}, { 1024, -72, -112}, // 39 seconds { 960, -440, 408}, { 728, -328, 248}, { 720, -88, -8}, { 752, 288, -160}, { 888, 328, -176}, { 832, 280, -112}, { 800, 256, 64}, { 1024, 392, 128}, { 1208, 376, 208}, { 1312, 88, 216}, { 1096, -352, 264}, { 1...
*raw_buffer; // raw buffer allocated by subscriber in it's heap uint16_t raw_buffer_size; // size of buffer uint16_t num_samples; // number of samples in raw_buffer } AccelSubscriberState; // --------------------------------------------------------------------------...
(highest_rate)
; s_accel_sampling_rate = highest_rate; uint32_t num_samples = lowest_ms_per_update / (1000 / highest_rate); if (num_fifo_subscribers == 0) { num_samples = 0; // This is used if all subscribers are peek mode only, no FIFO needed } else if (num_samples == 0) { // Min FIFO setting is 1 deep num_s...
_DeInit(FLASH_TX_DMA_STREAM); /* RX DMA config */ DMA_StructInit(&dma_config); dma_config.DMA_Channel = FLASH_DMA_CHANNEL; dma_config.DMA_DIR = DMA_DIR_PeripheralToMemory; dma_config.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; dma_config.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; dma_config....
flash_read_next_byte()
; flash_end_cmd(); return reg; } // This will read the flag status register and check it for the SectorLockStatus flag void prv_check_protection_flag() { uint8_t flag_status_register = prv_flash_get_register(FLASH_CMD_READ_FLAG_STATUS_REG); // assert if we found the flag to be enabled PBL_ASSERTN(!(flag_stat...
r, mode, &center, &radius); cl_assert_gpoint_precise(center, 2.5, 2.5); cl_assert_fixedS16_3(radius, 2.5); r = GRect(0, 0, 10, 10); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 4.5, 4.5); cl_assert_fixedS16_3(radius, 4.5); r = GRect(1, 1, 9, 9); grect_polar_cal...
(DEG_TO_TRIGANGLE(-180), -TRIG_PI)
intID endpoint_id, HcCommandID command_id, const uint8_t *request_payload, size_t request_payload_length) { size_t message_length = sizeof(HcProtocolMessage) + request_payload_length; HcProtocolMessage *message = (HcProtocolMe...
{ return false; }
// Don't allow because we'd deadlock otherwise: PBL_ASSERTN(!host_transport_is_current_task_host_transport_task()); prv_assign_next_transaction_id(request_message); HcExpectation *expectation = prv_set_expectation_for_request(request_message); if (!prv_enqueue(request_message)) { prv_cleanup_expectati...
/* * 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_clip_x_values_to_data_row_info(&current_data_row_info, &min_x, &max_x)
) { return; } // Update the relevant mask row pixel values for (int x = min_x; x <= max_x; x++) { const GPoint p = GPoint(x, y); // Calculate the new mask pixel value const GColor8Component src_color_luminance = gcolor_get_luminance(color); const uint8_t current_mask_value = graphics_private...
SE-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 permissions and * limitations under th...
cl_assert(callback_called)
/* * 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_get_clock_cmd((uintptr_t)periph)
; #if PERIPH_CONFIG_DEBUG if (prv_string_for_cmd(clock_cmd)) PERIPH_CONFIG_LOG("Disabling clock %s", prv_string_for_cmd(clock_cmd)); #endif portENTER_CRITICAL(); clock_cmd(rcc_bit, DISABLE); portEXIT_CRITICAL(); }
/* * 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...
{ MfgData data = prv_fetch_struct(); data.rtc_freq = rtc_freq; prv_update_struct(&data); }
/* * 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...
(buffer, size)
/* * 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...
if (data == 0) { return 0; }
const uint8_t * restrict bytes = data; crc ^= 0xffffffff; while (length--) { crc = (crc >> 4) ^ s_lookup_table[(crc ^ *bytes) & 0xf]; crc = (crc >> 4) ^ s_lookup_table[(crc ^ (*bytes >> 4)) & 0xf]; bytes++; } crc ^= 0xffffffff; return crc; }
COLOR_START_POINT GPointPrecise(5, 35) #define COLOR_END_POINT GPointPrecise(45, 40) void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__color(void) { // TODO: Fix blending and reenable this - PBL-16509 /* GContext ctx; test_graphics_context_init(&ctx, fb); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, ...
(&ctx, p, p, radius)
; p.x.raw_value += 1; p.y.integer += 16; } } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_precise_same_points_pattern_aa.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_stroke_precise_${BIT_DEPTH_NAME}__same_point_non_aa(void) { GContext ctx; test_graphics_context_init(&ct...
++) { attribute_list_destroy_list(&attr_lists[i].attr_list); } kernel_free(attr_lists); return rv; } ////////////////////////////////// // Serialized Slice Validation ////////////////////////////////// static bool prv_is_serialized_slice_valid(const SerializedAppGlanceSliceHeader *serialized_slice) { if (...
if (!uuid || !time_out) { return E_INVALID_ARGUMENT; }
SerializedAppGlanceHeader serialized_glance_header = {}; const status_t rv = app_glance_db_read((uint8_t *)uuid, UUID_SIZE, (uint8_t *)&serialized_glance_header, sizeof(serialized_glance_header)); if (rv == S_SUCCESS) { *time_...
pt.y += RADIUS_BIG * 4; } } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_aa_end_angle_on_divider.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_circle_8bit__arc_colors(void){ GContext ctx; test_graphics_context_init(&ctx, fb); // Letter C uint32_t angle_end = TRIG_MAX_ANGLE + (TRIG...
(prv_calc_draw_config_ellipsis(TO_TRIG(20), TO_TRIG(1000)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone}, .full_quadrants = GCornersAll, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerNone} }))
; cl_assert_equal_edc(prv_calc_draw_config_ellipsis(TO_TRIG(360), TO_TRIG(370)), ((EllipsisDrawConfig){ .start_quadrant = (EllipsisPartDrawConfig){TO_TRIG(0),GCornerTopRight}, .full_quadrants = GCornerNone, .end_quadrant = (EllipsisPartDrawConfig){TO_TRIG(10),GCornerTopRight} })); // # Section with ...
// ------------------------------------------------------------------------------------ void activity_algorithm_minute_handler(time_t utc_sec, AlgMinuteRecord *record_out) { if (!prv_lock()) { return; } prv_activity_update_states(utc_sec, record_out, false /* shutting_down */); // Handle storage and logg...
ambient_light_level_to_enum(raw_light)
; HealthMinuteData record = { .steps = base_fields->steps, .orientation = base_fields->orientation, .vmc = base_fields->vmc, .light = health_light_level, .heart_rate_bpm = heart_rate_bpm, }; context->minute_data[dst_index] = record; // Return false to look for more return false; } // --...
urr_schedule_type); time_t seconds_until_update; bool is_enable_next; int curr_day = time.tm_wday; if (!curr_schedule_enabled) { // Only next schedule is enabled is_enable_next = true; // Depending on the current schedule, determine the first day index of the next schedule int next_schedule_day = (...
{ FirstUseSource first_use_source = (FirstUseSource)source; if (!alerts_preferences_check_and_set_first_use_complete(first_use_source)) { prv_push_manual_dnd_first_use_dialog(source); } else { if (source == ManualDNDFirstUseSourceSettingsMenu) { prv_toggle_manual_dnd_from_settings_menu(NULL); } ...
bool do_not_disturb_is_smart_dnd_enabled(void) { return alerts_preferences_dnd_is_smart_enabled(); } void do_not_disturb_toggle_smart_dnd(void) { if (!alerts_preferences_check_and_set_first_use_complete(FirstUseSourceSmartDND)) { prv_push_smart_dnd_first_use_dialog(); } else { prv_toggle_smart_dnd(NULL...
(ctx, command->stroke_width)
; gpath_draw_stroke(ctx, &path, command->path_open); } } static void prv_draw_circle(GContext *ctx, GDrawCommand *command) { // draw all values of alpha, except fully transparent if ((command->fill_color.a != 0) && (command->radius > 0)) { graphics_context_set_fill_color(ctx, command->fill_color); gr...
/* * 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...
gpio_af_init(&dev->cs_gpio, GPIO_OType_PP, GPIO_Speed_100MHz, GPIO_PuPd_NOPULL)
ontext; cl_assert(ctx->idx < ARRAY_LENGTH(ctx->touch_events)); ctx->touch_events[ctx->idx++] = *event; } void test_touch__dispatch_touch_events_single_finger(void) { TouchEventContext ctx = { .idx = 0 }; touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx); cl_assert_equal_i(ctx.idx, 0); ...
(event.type, PEBBLE_TOUCH_EVENT)
; cl_assert_equal_i(event.touch.type, PebbleTouchEvent_TouchesAvailable); TouchEventContext ctx = { .idx = 0 }; // handle first TouchesAvailable event touch_dispatch_touch_events(0, prv_touch_event_dispatch_cb, &ctx); cl_assert_equal_i(ctx.idx, 0); // handle second TouchesAvailable event touch_dis...
4, -928}, { 72, -328, -880}, { 48, -376, -840}, // 121 seconds { 48, -472, -792}, { 72, -464, -824}, { 88, -480, -800}, { 96, -528, -728}, { 88, -400, -920}, { 88, -360, -896}, { 88, -336, -904}, { 88, -360, -896}, { 80, -368, -888}, { 80, -392, -856}, { 72, -368,...
{ 104, -72, -928}, { 104, -80, -928}, { 96, -72, -928}, { 88, -120, -920}, { 96, -64, -928}, { 96, -112, -920}, { 88, -48, -936}, { 96, -56, -928}, { 96, -64, -912}, { 96, -32, -928}, { 88, -64, -928}, // 127 seconds { 72, -128, -952}, { 88, 32, -920}, { 80, -...
600, 424, -536}, { 560, 848, -776}, { 576, 1136, -944}, { 544, 1776, -1528}, { 328, 1192, -624}, { 320, 936, -200}, { 408, 856, -200}, { 448, 904, -112}, { 472, 840, -8}, { 376, 1160, -8}, { 384, 1104, -16}, { 392, 1032, -80}, { 408, 944, -160}, { 440, 904, -240}, ...
{ 448, 968, -24}, { 440, 960, -32}, { 448, 952, -40}, // 582 seconds { 440, 936, -56}, { 440, 944, -64}, { 432, 960, -72}, { 440, 968, -56}, { 448, 968, -40}, { 448, 968, -24}, { 448, 968, -24}, { 448, 944, -40}, { 440, 936, -56}, { 440, 944, -72}, { 440, 960,...
{ 136, 616, -904}, { 176, 648, -872}, { 200, 584, -824}, { 216, 584, -800}, { 224, 560, -816}, { 208, 560, -896}, { 184, 488, -928}, { 160, 496, -904}, // 585 seconds { 176, 544, -928}, { 200, 544, -888}, { 216, 584, -880}, { 248, 624, -904}, { 232, 544, -880}, ...
] = { 42 }; const size_t num_data = ARRAY_LENGTH(data); const StatsBasicOp op = (StatsBasicOp_Sum | StatsBasicOp_Average | StatsBasicOp_Min | StatsBasicOp_Max | StatsBasicOp_Count | StatsBasicOp_Consecutive | StatsBasicOp_ConsecutiveFirst | StatsBasicOp_Median); struct { int32_t sum;...
ARRAY_LENGTH(test_cases)
; i++) { int32_t w_median = stats_calculate_weighted_median(test_cases[i].values, test_cases[i].weights, test_cases[i].num_values); printf("W_Median test case: %d\n", (int)i); cl_assert_equal_i(test...
ubscription_type; ret_val = gatt_client_op_write_descriptor_cccd(cccd_ref, &value); if (ret_val != BTErrnoOK) { // Write failed, bail out! if (did_create_new_subscription) { // Clean up... prv_remove_subscription(connection, subscription); } else { // ... or restore pr...
for (GAPLEClient c = 0; c < GAPLEClientNum; ++c) { if (node->subscriptions[c] != BLESubscriptionNone) { if (should_unsubscribe) { // The connection is not gone, so unsubscribe for this client, this will also // free the GATTClientSubscriptionNode when both clients are unsubscri...
if (!should_unsubscribe) { // Just free the node and don't bother unsubscribing: kernel_free(node); } node = next; } connection->gatt_subscriptions = NULL; } bt_unlock(); } void gatt_client_subscription_cleanup_by_att_handle_range( struct GAPLEConnection *connection,...
herAppPrefs *prefs) {} SerializedWeatherAppPrefs *watch_app_prefs_get_weather(void) { SerializedWeatherAppPrefs *prefs = (SerializedWeatherAppPrefs *) s_weather_app_prefs; prefs->num_locations = WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; for (int idx = 0; idx < WEATHER_DATA_SHARED_WEATHER_DB_NUM_DB_ENTRIES; ...
cl_assert_equal_i(to_check->today_high_temp, original->today_high_temp)
/* * 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...
if (format[0] == '\n' && strlen(format) == 1) { return; }
va_list args; va_start(args, format); app_log_vargs(LOG_LEVEL_DEBUG, "JERRY-CONSOLE", 0, format, args); va_end(args); } void jerry_port_fatal(jerry_fatal_code_t code, void *lr) { if (ERR_OUT_OF_MEMORY == code) { app_heap_analytics_log_rocky_heap_oom_fault(); } jerry_port_log(JERRY_LOG_LEVEL_ERROR, ...
dius, (TRIG_MAX_ANGLE * 3 / 4)); cl_assert_equal_gpoint(result, GPoint(-4, 1)); } void test_graphics_circle__gpoint_from_polar_normalizes_input_angles(void) { const uint16_t radius = 5; const GPoint center = GPointZero; GPoint result; // -180 degrees should be (0, 5) result = gpoint_from_polar_internal(&...
cl_assert_equal_grect(GRect(5, 5, 1, 2), grect_centered_internal(&p3, GSize(-1, -2)))
UN), }, .header = { .version = BINLOGMSG_VERSION_STRING_V1, .length = 8, }, .string = "OVERRUN\0", }; void pbl_log_set_level(uint8_t level) { s_log_buffer.level = level; } uint8_t pbl_log_get_level(void) { return s_log_buffer.level; } int printf(const char *__restrict format, ...) { char line_buff...
{ // Out of memory! Attempt to print an overrun message circular_buffer_write(&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header, sizeof(OVERRUN) - sizeof(HcProtocolMessage)); }
/* * 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...
(buffer, "test_model")
; }
/* * 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...
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(buffer, buffer_size); } LOCK_AND_GET_STORE(store); const int len = settings_file_get_len(store, &key, sizeof(key)); if (len == 0) { return E_DOES_NOT_EXIST; } else if (FAILED(len)) { RETURN_STATUS_UP(len); } const size_t restr...
// Legacy version to prevent previous app breakage, __deprecated preserves order int persist_read_data__deprecated(const uint32_t key, const size_t buffer_size, void *buffer) { return persist_read_data(key, buffer, buffer_size); } int persist_read_string(const uint32_t key, ...
20}, {-10, -20}, {-10, -40}, {-30, -40}, {-30, -20}, {50, -20}, {50, 40}, {-10, 40}, {-10, 0}, {10, 0}, {10, 20}, {30, 20}, {30, 0} } }; static const GPathInfo s_aa_clipping_path_info = { .num_points = 4, .points = (GPoint []) {{0,0}, {200, 0}, {200, 30}, {0, 30}} ...
(NULL, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_right_clipped.${BIT_DEPTH_NAME}.pbi")); } // outside with no clipping -- results should be identical to the regular filled test void test_graphics_gpath_${BIT_DEPTH_NAME}__filled_outside(void) { GContext ctx; Layer layer; printf("-- top\n"); ...
/* * 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...
(APP_LOG_LEVEL_INFO, "Subscription to Characteristic %s (subscription_type=%u, error=%u)", uuid_buffer, subscription_type, error)
; } static void service_change_handler(BTDevice device, const BLEService services[], uint8_t num_services, BTErrno status) { const BTDeviceAddress address = bt_device_get_address(device); char uuid_buffer[UUID...
/* * 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...
(PebbleTask_Unknown)
; state->handler = handler; state->tick_units = tick_units; state->first_tick = true; event_service_client_subscribe(&state->tick_service_info); // TODO: make an effort to get this closer to the "actual" second tick } void tick_timer_service_unsubscribe(void) { TickTimerServiceState *state = prv_get_state(...
eatList *app_hbs) { dls_log(s_device_heartbeat_session, device_hb->data, 1); #ifdef ANALYTICS_DEBUG analytics_heartbeat_print(device_hb); #endif kernel_free(device_hb); AnalyticsHeartbeatList *app_hb_node = app_hbs; while (app_hb_node) { AnalyticsHeartbeat *app_hb = app_hb_node->heartbeat; #ifdef ANALYTI...
PBL_LOG(LOG_LEVEL_INFO, "Event dropped because session not created yet")
; return; } // Log it dls_log(s_event_session, event_blob, 1); } static void prv_handle_async_event_logging(void *data) { AnalyticsEventBlob *event_blob = (AnalyticsEventBlob *)data; prv_handle_log_event(event_blob); kernel_free(event_blob); } void analytics_logging_log_event(AnalyticsEventBlob *even...
prv_lock()
; has_inbox = (prv_find_inbox_by_storage(storage) != NULL); prv_unlock(); return has_inbox; } bool app_inbox_service_is_being_written_for_tag(AppInboxServiceTag tag) { bool is_written = false; prv_lock(); AppInboxNode *inbox = prv_find_inbox_by_tag(tag); if (inbox) { is_written = (inbox->writer != NU...
/* * 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...
(BOOTLOADER_VERSION_REGISTER, s_bootloader_timestamp)
; } uint32_t boot_version_read(void) { return RTC_ReadBackupRegister(BOOTLOADER_VERSION_REGISTER); }
/* * 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...
(SYSTEM_APP, RESOURCE_ID_FONT_FALLBACK_INTERNAL, 0, &s_system_fonts_info_table[NUM_SYSTEM_FONTS])
); } return &s_system_fonts_info_table[NUM_SYSTEM_FONTS]; } for (int i = 0; i < (int) NUM_SYSTEM_FONTS; ++i) { if (0 == strcmp(font_key, s_font_resource_keys[i].key_name)) { FontInfo *fontinfo = &s_system_fonts_info_table[i]; uint32_t resource = s_font_resource_keys[i].resource_id; ui...
he menu cell specifying that we're allowing word wrapping const GTextOverflowMode overflow_mode = GTextOverflowModeWordWrap; menu_cell_basic_draw_custom(ctx, mutable_cell_layer, font, item->label, font, indicator, font, NULL, NULL, false, overflow_mode); // Restore the cell layer's ...
{ GRect label_text_container = cell_layer->bounds; // bottom_inset won't be used on black and white, using UNUSED here quiets the linter UNUSED int16_t bottom_inset = 0; #if PBL_ROUND // On round displays, inset the box from the bottom to account for drawing the indicator at the // bottom center, and then dra...
// force it to clip around the shadow. if (draw_top_shading) { ctx->draw_state.clip_box.origin.y += VERTICAL_PADDING; ctx->draw_state.clip_box.size.h -= VERTICAL_PADDING; } if (draw_bottom_shading) { ctx->draw_state.clip_box.size.h -= VERTICAL_PADDING + bottom_inset; } // Prev...
68}, { 920, 344, -88}, { 1104, 280, 16}, { 1456, 312, 144}, { 1616, 208, 96}, { 1352, 64, 88}, { 1216, -56, 136}, { 1128, -48, 48}, { 1048, 24, -24}, { 936, 64, -40}, { 824, 16, 0}, { 1016, -32, 96}, { 848, -8, 64}, { 896, 32, -56}, { 1160, 40, -8}, { 1152, 96...
// 60 seconds // elapsed: 1 minutes { 1328, -64, 56}, { 1104, -24, 56}, { 880, -24, 64}, { 1016, -24, 112}, { 696, -112, 0}, { 584, -8, -16}, { 952, -64, -160}, { 1272, -64, -224}, { 1392, -144, -200}, { 1368, -160, -144}, { 1056, -104, -200}, { 792, -128, 0}, ...
{ 912, 424, -192}, { 904, 320, -64}, { 976, 48, -16}, { 984, 16, 56}, { 1112, 144, 40}, { 1080, 344, 32}, { 1040, 368, 208}, { 1320, 552, 64}, // 63 seconds { 1072, 880, -128}, { 1128, 160, 88}, { 1296, 152, 256}, { 1528, 232, 136}, { 1344, 80, 16}, { 1192, -...
gcolor_equal(lookup_table_out[3], GColorWhite)); // Setting the tint color to blue should result in a gradient from blue to yellow tint_color = GColorBlue; gcolor_tint_luminance_lookup_table_init(tint_color, lookup_table_out); cl_assert(gcolor_equal(lookup_table_out[0], GColorBlue)); cl_assert(gcolor_equal(l...
gcolor_component_multiply(3, 2)
, 2); cl_assert_equal_i(gcolor_component_multiply(2, 2), 1); cl_assert_equal_i(gcolor_component_multiply(1, 3), 1); cl_assert_equal_i(gcolor_component_multiply(2, 1), 1); }
tic Window s_app_window_stack_get_top_window; Window *app_window_stack_get_top_window() { return &s_app_window_stack_get_top_window; } GContext s_context; // mocks static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { record_mock_call(s_gr...
("#00zz10", NULL)
nds { 928, -360, -80}, { 1056, -256, -24}, { 1056, -296, 24}, { 1216, -192, 96}, { 1080, -120, 208}, { 1072, -120, 224}, { 1120, -80, 296}, { 1040, -16, 208}, { 1104, -72, 184}, { 1384, -128, 232}, { 1232, -56, 104}, { 792, 56, -88}, { 848, -136, -240}, { 1072, -1...
{ -808, -448, -576}, { -808, -424, -664}, { -672, -416, -672}, { -584, -360, -576}, { -600, -296, -608}, { -608, -256, -632}, { -536, -272, -616}, { -528, -304, -544}, { -568, -320, -464}, { -584, -336, -464}, { -616, -320, -448}, { -688, -312, -480}, { -720, -296, -5...
{ 960, 208, -424}, { 1152, 232, -352}, { 1256, 312, -392}, { 1136, 400, -472}, { 832, 304, -496}, { 696, 200, -408}, { 800, 112, -344}, { 880, 48, -232}, { 936, 8, -176}, { 944, 24, -200}, { 848, -16, -176}, { 744, -16, -176}, { 800, 48, -224}, { 920, 128, -264},...
/* * 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; }
return true; } bool WEAK animation_get_elapsed(Animation *animation, int32_t *elapsed_ms) { if (!animation) { return false; } // For use in this stub, start time is 0, so anything past 0 is elapsed *elapsed_ms = ((AnimationPrivate*)animation)->abs_start_time_ms; return true; } bool WEAK animation_set_d...
( struct Layer *layer, GRect *from_frame, GRect *to_frame)
{ return property_animation_create(NULL, layer, from_frame, to_frame); } PropertyAnimation *WEAK property_animation_create( const PropertyAnimationImplementation *implementation, void *subject, void *from_value, void *to_value) { PropertyAnimationPrivate *animation = malloc(sizeof(PropertyAnimationPrivate...
idnight_of(timestamp); if (today_midnight != timestamp_midnight) { prv_clock_get_full_relative_time(buffer, buf_size, timestamp, capitalized, with_fulltime); } else if (difference >= (SECONDS_PER_HOUR * max_relative_hrs)) { prv_clock_get_full_relative_time(buffer, buf_size, timestamp, capitalized, with_fu...
{ const time_t now = rtc_get_time(); const time_t clamped_timestamp = MIN(now, timestamp); prv_clock_get_relative_time_string(buffer, buf_size, clamped_timestamp, false, HOURS_PER_DAY, true); }
void clock_get_until_time(char *buffer, int buf_size, time_t timestamp, int max_relative_hrs) { prv_clock_get_relative_time_string(buffer, buf_size, timestamp, false, max_relative_hrs, true); } void clock_get_until_time_capitalized(char *buffer, int buf_size, time_t timestamp, ...
/* * 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(resource_id != UINT32_MAX)
; KinoReel *kino_reel = kino_reel_create_with_resource(resource_id); cl_assert(kino_reel); cl_assert(kino_reel_get_type(kino_reel) == KinoReelTypeGBitmap); cl_assert_equal_i(kino_reel_get_data_size(kino_reel), 2308); kino_reel_draw(kino_reel, &ctx, GPointZero); } void test_kino_reel__resource_gbitmap_seque...
checks that the CRC is present on the platform. Yay DRM periph_config_enable(CRC, RCC_AHB1Periph_CRC); CRC_ResetDR(); PDM_Filter_Init(&s_pdm_filter); periph_config_disable(CRC, RCC_AHB1Periph_CRC); //Enable I2S PLL RCC_PLLI2SCmd(ENABLE); while (RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY) == RESET) {} // Ena...
PROFILER_NODE_START(mic)
buf_end); if (!rv) { timeline_item_free_allocated_buffer(item_out); return false; } } return true; } bool timeline_item_create_from_serial_data(TimelineItem *item, uint8_t num_attributes, uint8_t num_actions, const uint8_t *data, size_t size, size_t *string_alloc_size, uint8_t **...
(LOG_LEVEL_ERROR, "Failed to deserialize payload")
s_serial.h" #include "stubs_sleep.h" #include "stubs_syscall_internal.h" #include "stubs_syscalls.h" #include "stubs_system_reset.h" #include "stubs_task_watchdog.h" #include "stubs_ui_window.h" #include "stubs_unobstructed_area.h" /////////////////////////////////////////////////////////// // Tests static FrameBuffe...
for (int sx = -((steps_x - 1) / 2) ; sx <= steps_x / 2; sx++) { for (int sy = -((steps_y - 1) / 2); sy <= steps_y / 2; sy++) { // as draw_text internally uses absolute coordinates to derive its state we cannot // simply adjust the draw_box to accomplish a side-by-side comparison ctx.dest_bitmap.ad...
} void test_graphics_draw_text_flow__flow_no_paging(void) { TextLayoutExtended layout = { .flow_data = { .perimeter.impl = &(GPerimeter){.callback=perimeter_for_display_round}, .perimeter.inset = 8, }, }; render_steps(&layout, RenderMoveTextBox, DELTA, DISP_ROWS, NULL); cl_check(gbitmap_pb...
lories_str, calories_buf_size, "%d", active_calories); string_list_add_string(headings, headings_buf_size, i18n_get("Active Calories", headings), headings_buf_size); string_list_add_string(values, values_buf_size, calories_str, values_buf_size); } static void prv_add_hr_metric_info(String...
(headings, headings_buf_size, values, values_buf_size, session)
; prv_add_avg_pace_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_distance_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_step_metric_info(headings, headings_buf_size, values, values_buf_size, session); prv_add_active_calories_met...
/* * 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...
{ // Change to new status if we're not in airplane mode qemu_transport_set_connected(new_status); }
} // ----------------------------------------------------------------------------------------- // Handle incoming compass packet data (QemuProtocol_Compass) static void prv_compass_msg_callback(const uint8_t *data, uint32_t len) { QemuProtocolCompassHeader *hdr = (QemuProtocolCompassHeader *)data; if (len != si...
and expect a did_read handler call prv_prepare_for_did_read(attr, 10); smartstrap_attribute_send_event(SmartstrapDataReceivedEvent, SmartstrapProfileGenericService, SmartstrapResultOk, 0x1111, 0x2222, 10); cl_assert(!s_pending_did_read.active); // destroy the attribute app_s...
prv_prepare_for_did_read(attr, 100)
; smartstrap_attribute_send_event(SmartstrapDataReceivedEvent, SmartstrapProfileGenericService, SmartstrapResultOk, 0x1111, 0x2222, 100); cl_assert(!s_pending_did_read.active); // destroy the attribute app_smartstrap_attribute_destroy(attr); } void test_app_smartstrap__notify...
uest(request_message); if (!prv_enqueue(request_message)) { prv_cleanup_expectation(expectation); return NULL; } HcProtocolMessage *response_message = prv_expect(expectation); prv_cleanup_expectation(expectation); return response_message; } #endif bool hc_protocol_enqueue_response(const HcProtocol...
prv_get_message(message_length, &should_free)
; if (!prv_try_handle_expectation(message, &should_free)) { prv_dispatch_message_to_static_handler(message, &should_free); } host_transport_rx_consume(message_length); if (should_free) { kernel_free(message); } rx_length -= message_length; } } void hc_protocol_buffer_gained_spac...
(&pin_window->blobdb_event_info)
; timeline_item_destroy(pin_window->item_detail_layer.item); prv_pin_window_unload(window); kernel_free(window); } static void prv_blobdb_event_handler(PebbleEvent *event, void *context) { TimelinePinWindow *pin_window = context; PebbleBlobDBEvent *blobdb_event = &event->blob_db; if (blobdb_event->db_id !...
; crcs[i] = prv_get_random_buffer(&(buf[i]), buf_size[i]); } bool did_some = true; while (did_some) { did_some = false; for (int i = 0; i < 10; i++) { unsigned int nb = rand() % 300; nb = MIN(nb, bytes_left[i]); if (!nb) { continue; } did_some = true; prv_d...
(data_logging_log(NULL, data, ARRAY_LENGTH(data)), DATA_LOGGING_INVALID_PARAMS)
rces(void) { // Setup resources fake_spi_flash_init(0, 0x1000000); pfs_init(false); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); } // Corner Tests void draw_text_single_line_ellipsis...
{ graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, 20, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); }
void draw_text_single_line_wordwrap_clip_across_y_second_line(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(4, -10, 72, 50), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_si...
f BT Settings is open, update BLE device name upon connecting device: if (event->bluetooth.connection.is_ble && event->bluetooth.connection.state == PebbleBluetoothConnectionEventStateConnected) { // https://pebbletechnology.atlassian.net/browse/PBL-22176 // iOS seems to respond with 0x0...
(data->remote_list_head)
; PBL_ASSERT(device_index < num_remotes, "Got index %" PRId16 " only have %" PRId32, device_index, num_remotes); StoredRemote* remote = (StoredRemote*) list_get_at(data->remote_list_head, device_index); bool connected = is_remote_connected(remote); const char *le_string = NULL; if (remote->type ...
w_set_focusable(windows[2][1], false); window_stack_push(window_stacks[2], windows[2][1], false); // An unfocusable window is now the top window // Test: Opaque windows that are not the top window have no affect on unfocusable // Test: One unfocusable top window results in Unfocused modal_manager_event_loop_...
{ window_stack_remove(windows[idx][i], false); window_destroy(windows[idx][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...
layer_init(&l, &GRect(10, 20, 30, 40))
{ // Erase one sector 0x10000 - 0x20000 flash_region_erase_optimal_range(64 * 1024, 64 * 1024, 2 * 64 * 1024, 2 * 64 * 1024); cl_assert_equal_i(s_command_list_index, 1); cl_assert_equal_i(s_command_list[0].addr, 64 * 1024); cl_assert_equal_i(s_command_list[0].type, SectorEraseCommand); s_command_list_inde...
(s_command_list[2].addr, 40 * 1024)
; cl_assert_equal_i(s_command_list[2].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[3].addr, 44 * 1024); cl_assert_equal_i(s_command_list[3].type, SubsectorEraseCommand); cl_assert_equal_i(s_command_list[4].addr, 48 * 1024); cl_assert_equal_i(s_command_list[4].type, SubsectorEraseCommand); ...
; static TimelineItem title_item2 = { .header = { .id = {0xac, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c, 0x98, 0x68, 0xa4, 0x36, 0x79, 0x7d, 0xe2, 0x05}, .timestamp = 1, .duration = 0, .type = TimelineItemTypeReminder, .layout = LayoutIdTest, }, .attr_list = (AttributeList) { ...
((uint8_t *) &item4, sizeof(Uuid))
== 0); memset(&temp, 0, sizeof(TimelineItem)); cl_assert(S_SUCCESS == reminder_db_next_item_header(&temp)); temp.attr_list.attributes = NULL; cl_assert(memcmp(&item3, &temp, sizeof(TimelineItem)) == 0); cl_assert(S_SUCCESS == reminder_db_delete_item(&temp.header.id, true /* send_event */)); cl...
/* * 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...
(10, 20, 300, 400)
); cl_assert_equal_grect(l.bounds, GRect(0, 0, 300, 400)); // keeps size in sync layer_set_frame(&l, &GRect(10, 20, 200, 500)); cl_assert_equal_grect(l.bounds, GRect(0, 0, 200, 500)); // act as 2.x once bounds.origin is different from (0, 0) layer_set_bounds(&l, &GRect(1, 1, 200, 500)); layer_set_frame(...
ctx->outbox.user_context = context; return retval; } AppMessageInboxReceived app_message_register_inbox_received( AppMessageInboxReceived received_callback) { AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx(); AppMessageInboxReceived retval = app_message_ctx->inbox.received_callback; app_mes...
(&app_message_ctx->inbox)
ocol_cb_dispatch_handler(handler, message, should_free); } static bool prv_expectation_for_message_list_filter_cb(ListNode *found_node, void *data) { HcExpectation *expectation = (HcExpectation *)found_node; const HcProtocolMessage *message = (const HcProtocolMessage *)data; if (!expectation->request) { // A...
xSemaphoreGive(expectation->semaphore)
; expectation = (HcExpectation *) list_get_next(&expectation->node); } prv_unlock(); }
/* * 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...
("Incoming Calls")
; client = VibeClient_PhoneCalls; break; } case VibeSettingsRow_Alarms: { title = i18n_noop("Alarms"); client = VibeClient_Alarms; break; } case VibeSettingsRow_System: { /// Refers to the class of all non-score vibes, e.g. 3rd party app vibes title = i18n_noop(...
_assert(job); } } void test_session_send_queue__copy_empty_queue(void) { uint8_t data_out[2]; cl_assert_equal_i(0, comm_session_send_queue_copy(s_valid_session, 0, sizeof(data_out), data_out)); } void test_session_send_queue__copy_less_than_head_job_zero_offset(void) { int num_jobs = 3; ...
(s_free_count, 0)
; // Add a couple jobs: int num_jobs = 3; prv_add_jobs(num_jobs); // When the session is disconnected, comm_session_send_queue_cleanup() is called: comm_session_send_queue_cleanup(s_valid_session); cl_assert_equal_i(s_free_count, num_jobs); } void test_session_send_queue__session_closed_when_add_is_call...
e, key, key_len); } } printf("Making sure we handle running out of storage gracefully...\n"); memcpy(key, "k255", 5); memcpy(val, "v255", 5); cl_assert_equal_i(settings_file_set(&file, key, key_len, val, val_len), E_OUT_OF_STORAGE); int val_len_out = settings_file_get_len(&file, key, key_len); cl_must...
("new! %d\n", new_value_length)
; cl_assert_equal_m(new_value, val_out, val_len_out); free(val_out); return RecordResultNew; } // Should not get here! This means that neither the old nor the new value // could be retreived, and thus the atomicity is broken! Aaaaaaaaaaaaaah!! cl_assert(false); } fake_spi_flash_for...
const bool reload = bus->state->transfer.direction == I2CTransferDirection_Write; bus->hal->i2c->CR2 = (bus->state->transfer.device_address & I2C_CR2_SADD) | (1 << CR2_NBYTES_OFFSET) | (reload ? I2C_CR2_RELOAD : 0) | I2C_CR2_START; } els...
portEND_SWITCHING_ISR(prv_event_irq_handler(bus))
ght 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 in writing, s...
window_single_click_subscribe(BUTTON_ID_DOWN, prv_detected_workout_down_click_handler)
STRCOPY_I18N(time_locale->month[t->tm_mon % MONTHS_PER_YEAR]); break; case 'c': FMT_RECURSE_I18N(time_locale->c_fmt); _fmt_recurse: if (!use_i18n && i18nstr) { cpystr = i18nstr; i18nstr = NULL; } if (i18nstr) { cpystr = i18n_get(i18nstr, dest_s...
sprintf(dest_str, "%+.2d%02u", t->tm_gmtoff / 3600, (abs(t->tm_gmtoff) / 60) % 60)
; dest_str += 5; left -= 5; break; } case 'Z': FMT_STRCOPY(t->tm_zone); break; case 'n': // SU *dest_str++ = '\n'; goto _fmt_chcopy; case 't': // SU *dest_str++ = '\t'; goto _fmt_chcopy; // Copy stuff case '%': ...
/* * 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...
(AlertMobile)
return avg >> VOLTAGE_FILTER_BETA; } static bool prv_is_stable(const BatteryState *state) { // After a reboot, we typically source a lot of current which can drastically impact // our mV readings due to the internal resistance of the battery. We use the // system_likely_stabilized flag as an indicator of how ...
{ battery_state_put_change_event(prv_get_precise_charge_state(&s_last_battery_state)); }
} static void prv_update_callback(void *data) { // Running the battery monitor on the timer task is not a good idea because // we could be sampling right in the middle of a flash erase, etc. Therefore, // dispatch to a lower priority task system_task_add_callback(prv_update_state, data); // Reschedule ours...
ect(5, 5, 1, 2), grect_centered_internal(&p3, GSize(-1, -2))); // handles fixed point cl_assert_equal_grect(GRect(5, 5, 2, 2), grect_centered_internal(&p3, GSize(2, 2))); p3.x.raw_value += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(5, 5, 2, 2), grect_centered_internal(&p3, GSize(2, 2))); // Rep...
grect_polar_calc_values(&r, mode, &center, &radius)
/* * 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...
(addr_out)
; } void bt_driver_set_local_address(bool allow_cycling, const BTDeviceAddress *pinned_address) { hc_endpoint_gap_service_set_local_address(allow_cycling, pinned_address); } void bt_driver_id_copy_chip_info_string(char *dest, size_t dest_size) { DialogChipID chip_id; if (!hc_end...
{ return s_battery_mv; }
bool battery_charge_controller_thinks_we_are_charging_impl(void) { return s_usb_connected && (s_percent < 100); } bool battery_is_usb_connected_impl(void) { return s_usb_connected; } void battery_set_charge_enable(bool charging_enabled) { s_usb_connected = false; } void battery_set_fast_charge(bool fast_char...
nu_up_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = true; const bool animated = true; menu_layer_set_selected_next(menu_layer, up, MenuRowAlignCenter, animated); } void menu_down_click_handler(ClickRecognizerRef recognizer, MenuLayer *menu_layer) { const bool up = false;...
menu_layer->callbacks.draw_separator(ctx, cell_layer, &cursor->index, menu_layer->callback_context)
; // Restore current drawing state: graphics_context_set_drawing_state(ctx, prev_state); // Restore the layer bounds: layer_set_bounds(cell_layer, &prev_bounds); } else { graphics_fill_rect( ctx, &GRect(0, y, menu_layer->scroll_layer.layer.bounds.size.w, cursor->sep)); } } static void...
send_job_impl_free(SessionSendQueueJob *send_job) { prv_destroy_send_buffer((SendBuffer *)send_job); } T_STATIC const SessionSendJobImpl s_default_kernel_send_job_impl = { .get_length = prv_send_job_impl_get_length, .copy = prv_send_job_impl_copy, .get_read_pointer = prv_send_job_impl_get_read_pointer, .cons...
(s_default_kernel_sender_write_semaphore)
------------------------------- // Enable/disable activity service KernelBG callback. Used by activity_set_enabled(). static void prv_set_enable_cb(void *context) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); mutex_lock_recursive(s_activity_state.mutex); { const bool enable = prv_activity_allowed_to_be_enab...
settings_file_set(file, &key, sizeof(key), &version, sizeof(version))
{ -32, 904, 296}, { -40, 912, 280}, { -40, 904, 312}, { -40, 904, 328}, { -40, 896, 312}, { -40, 896, 312}, { -40, 896, 312}, { -40, 896, 320}, { -32, 896, 304}, { -32, 896, 320}, { -40, 888, 336}, { -40, 888, 336}, { -56, 880, 360}, { -40, 888, 344}, { -40, 8...
{ -40, 880, 352}, { -40, 880, 360}, { -40, 880, 352}, { -40, 880, 360}, { -48, 888, 352}, { -40, 880, 352}, { -40, 888, 344}, { -40, 872, 344}, { -40, 880, 344}, { -48, 888, 360}, { -48, 896, 320}, { -40, 888, 336}, { -48, 880, 352}, { -40, 888, 360}, { -32, ...
e "services/normal/filesystem/pfs.h" #include "services/normal/settings/settings_raw_iter.h" #include "system/logging.h" #define MAX_CHILDREN_PER_PIN 3 typedef struct { Uuid parent_id; Uuid children_ids[MAX_CHILDREN_PER_PIN]; int num_children; bool find_all; } FindChildrenInfo; typedef struct { time_t curr...
if (rv) { goto cleanup; }
/* * 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...
mutex_lock(s_svc_register_mutex)
; prv_gatt_local_services_register(); mutex_unlock(s_svc_register_mutex); } void gatt_local_services_re_register_if_needed(void) { if (!s_has_registered) { // Avoid registering at this time, gatt_local_services_register() hasn't been called before. return; } mutex_lock(s_svc_register_mutex); // Un...
/* * 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...
if (!s_animations) { s_animations = (ListNode *)animation; } else { list_append(s_animations, (ListNode *)animation); }
(LOG_LEVEL_DEBUG, "State: Draw Antialiased; SW: N/A (but currently: %d)", data->stroke_width); break; case APP_STATE_DRAW_NON_AA_SW: PBL_LOG(LOG_LEVEL_DEBUG, "State: Draw Non-Antialiased; SW: %d", data->stroke_width); break; case APP_STATE_DRAW_AA_SW: PBL_LOG(LOG_LEVEL_DEBU...
{ data->square_velocity_x = data->square_velocity_x * -1; }
data->square.origin.y += (data->square_velocity_y * PIXEL_SPEED_PER_FRAME); if (data->square.origin.y < 0 || data->square.origin.y + data->square.size.h > data->window.layer.bounds.size.h) { data->square_velocity_y = data->square_velocity_y * -1; } } else if (shape == RECTANGLE...
EN)); setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_rect(&context, &GRect(10, 20, 40, 10)); ASSERT_CALLED(prv_draw_rect_stroked(&context, &GRect(10, 20, 40, 10), SW_EVEN)); setup_test(&context, false, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_circle(&con...
(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_EVEN))
; #endif setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, false); graphics_draw_round_rect(&context, &GRect(20, 80, 40, 10), 4); #if PBL_COLOR ASSERT_CALLED(prv_draw_round_rect_aa_stroked(&context, &GRect(20, 80, 40, 10), 4, SW_EVEN)); #else ASSERT_CALLED(prv_draw_round_rect_stroked(&context, &GRe...
/* * 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...
i2c_use(EWD1000->i2c)
_window)) { return false; } TimelineIterState *current_state = timeline_model_get_current_state(); if (current_state == NULL) { return false; } return uuid_equal(&current_state->pin.header.id, uuid); } static void prv_refresh_pin(TimelineAppData *data, int idx) { PBL_ASSERTN(idx >= 0); Timeline...
(DAY_SEP_TIMEOUT_MS, false, prv_hide_day_sep, data)
; } static void prv_day_sep_show_stopped(Animation *animation, bool finished, void *context) { TimelineAppData *data = context; if (!finished || !prv_set_state(data, TimelineAppStateDaySeparator)) { return; } // Pins will reappear after the day separator completes hiding in `prv_hide_day_sep_stopped` ti...
yer, MenuIndex *cell_index, void *data) { #if PBL_ROUND MenuIndex selected_index = menu_layer_get_selected_index(menu_layer); bool is_selected = menu_index_compare(cell_index, &selected_index) == 0; if (is_selected) { return MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT; } #en...
(ctx, cell_layer, title, subtitle, loaded_node->icon)
; } // Display the appropriate layer static void prv_update_text_layer_visibility(NotificationsData *data) { NotificationNode *node = data->notification_list; // Toggle which layer is visible if (node == NULL) { layer_set_hidden((Layer *) &data->menu_layer, true); layer_set_hidden((Layer *) &data->text_...
/* * 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...
RCC_GetClocksFreq(&clocks)
; uint32_t timer_clock = clocks.PCLK1_Frequency; // Hz uint32_t prescale = RCC->CFGR & RCC_CFGR_PPRE1; if (prescale != RCC_CFGR_PPRE1_DIV1) { // per the stm32 'clock tree' diagram, if the prescaler for APBx is not 1, then // the timer clock is at double the APBx frequency timer_clock *= 2; } // ...
ert(!prv_get_calendar_ongoing()); TimerID timer_id = stub_new_timer_get_next(); cl_assert_equal_i(timer_id, TIMER_INVALID_ID); cl_assert(!stub_new_timer_is_scheduled(timer_id)); cl_assert(timeline_add(&item1)); timeline_event_handle_blobdb_event(); cl_assert_equal_i(fake_event_get_count(), 2); cl_assert(...
cl_assert(prv_get_calendar_ongoing())
; cl_assert(stub_new_timer_is_scheduled(timer_id)); cl_assert_equal_i(10*60, stub_new_timer_timeout(timer_id) / 1000); rtc_set_time(20 * 60); cl_assert(stub_new_timer_fire(timer_id)); cl_assert_equal_i(fake_event_get_count(), 3); cl_assert(prv_get_calendar_ongoing()); cl_assert(stub_new_timer_is_schedule...
/* * 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_analytics_lock = mutex_create_recursive(); // create and populate list of all Analytics for (uint32_t i = 0; i < num_nodes; i++) { prv_add_analytic_node(i); } }
void analytics_init(void) { analytics_init_private(DialogAnalyticMetric_Count); } void analytics_reset_nodes(void) { prv_lock(); // Zero out all values ListNode *iter = s_analytics_list; while (iter) { AnalyticsNode *node = (AnalyticsNode *)iter; node->value = 0; iter = iter->next; } prv_...
/* * 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...
printf("%s:%d %s\n", filename, line, string)
---------------------------------------- DEFINE_SYSCALL(void, sys_accel_manager_data_unsubscribe, AccelSessionRef session) { mutex_lock_recursive(s_mutex); { AccelSubscriberState* state = prv_subscriber_state(session); if (state != NULL) { // Remove this subscriber and free up it's state variables ...
prompt_send_response_fmt(buffer, sizeof(buffer), "Y: %"PRId16, data.y)
; prompt_send_response_fmt(buffer, sizeof(buffer), "Z: %"PRId16, data.z); if (temporarily_start) { accel_stop(); } } #endif // The accelerometer should issue a shake/tap event with any slight movements when stationary. // This will allow the watch to immediately return to normal mode, and attempt to reconne...
= 0x00; s_user_size = 0x20; memory_cache_flush((void*)0x0F, 0x2); cl_assert_equal_i(s_flush_addr, 0x00); cl_assert_equal_i(s_flush_size, 0x20); cl_assert_equal_i(s_invalidate_addr, 0x00); cl_assert_equal_i(s_invalidate_size, 0x20); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Valid); } void test_c...
cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid)
; } void test_cpu_cache__without_cache(void) { cl_will_return(icache_is_enabled, false); cl_will_return(dcache_is_enabled, false); cl_will_return(icache_line_size, 1); cl_will_return(dcache_line_size, 1); s_invalidate_addr = s_flush_addr = 0xAA55; s_invalidate_size = s_flush_size = 0x55AA; cl_will_ret...
/* * 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...
{ *((bool *)context) = true; return false; }
/* * 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...
if (dialog->show_status_layer) { dialog_add_status_bar_layer(dialog, &GRect(x, y, w, h)); }
x = left_margin_px; w = bounds->size.w - left_margin_px - right_margin_px; GTextAttributes *text_attributes = NULL; #if PBL_ROUND // Create a GTextAttributes for the TextLayer. Note that the matching // graphics_text_attributes_destroy() will not need to be called here, as the ownership // of text_attrib...