prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
12, 96, -120}, { 1144, 120, -192}, { 1248, 144, -336}, { 1008, 128, -200}, { 800, 64, -40}, { 912, 152, -64}, { 976, 232, -24}, { 1048, 280, -24}, { 1040, 296, -64}, { 1208, 328, -8}, { 1280, 504, 16}, { 808, 704, 24}, { 1392, 552, -56}, { 1264, 400, -80}, { 1384,...
{ 984, 144, 16}, { 1096, 168, 104}, { 1144, 296, 184}, { 1432, 432, 376}, { 1120, 576, 488}, { 1152, 752, 288}, // 30 seconds { 1072, 512, 136}, { 896, 304, 56}, { 1112, 408, 160}, { 1560, 560, 248}, { 1704, 384, 176}, { 1528, 176, 224}, { 1504, -8, 248}, { 13...
/* * 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...
(inverter_layer)
; applib_free(inverter_layer); } Layer* inverter_layer_get_layer(InverterLayer *inverter_layer) { if (inverter_layer == NULL) { return NULL; } return &inverter_layer->layer; }
that our container contains values for the origin, but we want to ignore them. // This is because orginally we just serialized GBitmap to disk, // but these fields don't really make sense for static images. // These origin fields are only used when reusing a byte buffer in a sub bitmap. // This allows us to hav...
(size, format)
) { bitmap->data_row_infos = g_gbitmap_spalding_data_row_infos; } #endif } return bitmap; } static bool prv_platform_supports_format(GSize size, GBitmapFormat format) { switch (format) { #if PBL_BW case GBitmapFormat1Bit: case GBitmapFormat1BitPalette: case GBitmapFormat2BitPalette: ...
; attribute_list_add_cstring(&list, AttributeIdNameAway, "GSW"); attribute_list_add_cstring(&list, AttributeIdRecordAway, "114-152"); attribute_list_add_cstring(&list, AttributeIdScoreAway, "86"); attribute_list_add_cstring(&list, AttributeIdNameHome, "CHI"); attribute_list_add_cstring(&list, AttributeIdRecor...
attribute_list_add_cstring(&list, AttributeIdBody, "Body message")
bscribed(false); cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, 1); } void test_ble_hrm__sub_unsub_resub(void) { // Device A subscribes: bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // Expect permissions UI to be presented: prv_assert_permissions_ui_and_respond(true /* is_gra...
ble_hrm_deinit()
; bt_driver_cb_hrm_service_update_subscription(s_device_a, true); prv_assert_event_service_subscribed(false); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 0); ble_hrm_handle_disconnection(&s_conn_a); prv_assert_event_service_subscribed(false); cl_assert_equal_i(s_hrm_manager_subscri...
rl_reg = mode & ~MODE_MASK; fifo_ctrl_reg |= (MODE_BYPASS & MODE_MASK); if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, fifo_ctrl_reg)) { return; } if (!prv_write_register(LIS3DH_FIFO_CTRL_REG, mode)) { return; } } } static void prv_reset(void) { lis3dh_lock(); if (i2c_bitbang_reco...
{ PBL_ASSERTN(s_initialized); if (s_running) { disable_accel_interrupts(); clear_accel_interrupts(); i2c_release(I2C_LIS3DH); enable_accel_interrupts(); s_running = false; } }
void lis3dh_init_mutex(void) { s_accel_mutex = mutex_create(); } void lis3dh_lock(void) { mutex_lock(s_accel_mutex); } void lis3dh_unlock(void) { mutex_unlock(s_accel_mutex); } static void prv_handle_tap(void *data) { IMUCoordinateAxis axis; int direction; if (s_running) { uint8_t click_src; ...
w(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_clip_nxny.${BIT_DEPTH_NAME}.pbi")); #endif } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__origin_sw(void) { GContext...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 // SW = 11 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw11_...
AR_WIDTH + x_margin, 0, x_margin)); GRect frame = grect_inset(window_layer->bounds, insets); frame.origin.y = label_y_offset; return frame; } //! Drawing function for our Window's base Layer. Draws the background, the label, and the value, //! which is e...
{ NumberWindow* window = applib_type_malloc(NumberWindow); if (window) { number_window_init(window, label, callbacks, callback_context); } return window; }
static void number_window_deinit(NumberWindow *number_window) { action_bar_layer_deinit(&number_window->action_bar); window_deinit(&number_window->window); } void number_window_destroy(NumberWindow *number_window) { if (number_window == NULL) { return; } number_window_deinit(number_window); applib_fr...
/* * 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 (!connection) { PBL_LOG(LOG_LEVEL_INFO, "HcGap: no connection for "BT_DEVICE_ADDRESS_FMT, BT_DEVICE_ADDRESS_XPLODE(resp->addr.address)); return; }
// The value is a non-zero-terminated UTF-8 string int device_name_buffer_length = MIN(resp->name_length + 1, BT_DEVICE_NAME_BUFFER_SIZE); char *device_name = (char *)kernel_zalloc_check(device_name_buffer_length); if (!device_name) { return; } memcpy(device_name, resp->name, device_name_buffer_length...
he "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, software * distributed under the License is distributed on an "AS IS" BASIS...
memcpy(sys_buffer, app_buffer, FRAMEBUFFER_BYTES_PER_ROW * s_data.cur_modal_offset_y)
; // Render transparent modals over only the revealed app portion ctx->draw_state.clip_box.size.h = s_data.cur_modal_offset_y; compositor_render_modal(); framebuffer_dirty_all(sys_frame_buffer); } static void prv_transition_animation_update(GContext *ctx, Animation *animation, ...
nder_subtitle_round(const MenuCellLayerConfig *config, bool is_selected) { // If the cell isn't selected and there's no value text, then no subtitle text should be shown return ((is_selected || config->value) && (config->subtitle != NULL)); } static ALWAYS...
{ subtitle_text_frame_height = 0; }
} else { icon_frame_size = GSizeZero; } } // We'll reuse this rect to conserve stack space; here it is used as the title text frame GRect rect = (GRect) { .origin = cell_layer_bounds->origin, .size = GSize(cell_layer_bounds_size.w, title_text_frame_height), }; // Update the title text...
state.current, &text_box_params)); cl_assert(line.height_px == 10); cl_assert(line.width_px == 3 * HORIZ_ADVANCE_PX); // reset line line = (Line) { 0 }; line.max_width_px = text_box_params.box.size.w; line.height_px = text_box_params.box.size.h; cl_assert(line_add_word(&s_ctx, &line, &word_iter_state.cu...
(line.suffix_codepoint == 0)
; cl_assert(*line.start == '\n'); // \n cl_assert(*word_iter_state.current.start == '\n'); cl_assert(*word_iter_state.current.end == 'a'); cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 0); line_reset(&line, utf8_bounds.start); cl_assert(line_add_words(&line, &word_iter, NULL)); cl_a...
{ 656, 576, 240}, // 98 seconds { 664, 648, 248}, { 648, 608, 208}, { 664, 592, 168}, { 672, 656, 184}, { 656, 600, 152}, { 656, 592, 144}, { 664, 576, 120}, { 664, 592, 136}, { 664, 688, 136}, { 648, 640, 104}, { 640, 616, 120}, { 656, 608, 96}, { 664, 656, 96},...
{ 632, 680, 16}, { 632, 688, 8}, // 104 seconds { 632, 672, -8}, { 624, 672, 0}, { 640, 672, 0}, { 624, 672, 0}, { 624, 656, 8}, { 632, 696, 0}, { 632, 664, 0}, { 640, 656, -16}, { 640, 664, 8}, { 640, 664, -16}, { 640, 656, 0}, { 648, 672, -8}, { 640, 648...
{ 608, 416, 568}, { 592, 488, 544}, { 592, 552, 512}, { 616, 584, 680}, { 600, 560, 584}, { 600, 456, 544}, // 107 seconds { 584, 400, 544}, { 568, 456, 496}, { 600, 408, 448}, { 752, 608, -16}, { 688, 784, 352}, { 600, 696, 624}, { 520, 680, 424}, { 544, 280...
, -184}, { 960, 160, -152}, { 960, 168, -144}, { 968, 168, -112}, { 968, 160, -72}, { 1088, 144, -16}, { 1120, 128, -40}, { 1168, 104, -24}, { 1144, 112, -64}, { 1104, 72, -16}, // 101 seconds { 1072, 56, -16}, { 1000, 48, -24}, { 1040, 72, -8}, { 1080, 104, -16},...
{ 1184, -272, -208}, { 1104, -272, -88}, { 992, -176, -40}, { 856, -168, -112}, { 776, -120, -152}, { 784, -160, -216}, { 872, -160, -240}, { 832, -120, -312}, { 856, -96, -360}, { 920, -112, -360}, { 1016, -96, -352}, { 1064, -64, -288}, { 1312, -32, -272}, { 148...
_arr, .curr_msg_idx = 0, .num_items = (num_items + 1), // + 1 for build id line .num_processed = 0, }; s_msg = newmsg; s_completed = false; bool success = flash_dump_log_file(log_gen, prv_flash_log_line_dump, prv_flash_log_dump_completed_cb); cl_assert(succes...
setup_and_test_expected_msg(&log, 0, 0, 1)
; for (int gen = 0; gen < MIN(gens_avail, i); gen++) { // Check to make sure the most recent log gens are around snprintf(log, 100, "Generation 0x%x", i - gen); setup_and_test_expected_msg(&log, gen, 1, 1); } } free(log); } //! Test the case where the most recent log generation has wrap...
/* * 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...
PBL_LOG(LOG_LEVEL_DEBUG, "invalid length, num_uuids does not match with the length of message")
; prv_send_result(session, APP_ORDER_RES_INVALID); } write_uuid_list_to_file((const Uuid *)&data[1], num_uuids); prv_send_result(session, APP_ORDER_RES_SUCCESS); } void app_order_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t length) { // header includes APP_ORDER_CMD and a num_uu...
nst int duration_a = 300; const int duration_b = 500; const int play_count_b = 2; int duration_total = duration_a + play_count_b * duration_b; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation...
(&s_started_handler_calls, b)
, 2); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 2); cl_assert_equal_i(prv_last_update_distance(b), ANIMATION_NORMALIZED_MAX); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 1);...
{ 1888, 584, 24}, { 1776, 520, -16}, { 1856, 360, 56}, { 1752, 360, -32}, { 1608, 296, -176}, { 1360, -16, -128}, { 1000, -344, -72}, { 664, -400, -224}, { 704, -320, -288}, { 1136, -112, -96}, { 1560, 184, -216}, { 1856, 192, -208}, { -1904, 296, -264}, { 1768, 49...
{ 1784, 456, -80}, { 1576, 608, -192}, { 1432, 616, -56}, { 1408, 560, -88}, { 1288, 632, -168}, { 1408, 896, -176}, { 1208, 1192, 24}, { 688, 848, -128}, { 1256, 984, -96}, { 880, 808, -264}, { 1208, 648, -232}, { 1904, 776, -56}, { 1888, 680, -96}, { 2008, 504, ...
{ -248, -288, -912}, { -184, -208, -944}, { -296, -176, -952}, { -312, -152, -984}, { 56, -544, -880}, { -120, -360, -848}, { -176, -352, -896}, { -48, -352, -944}, { -328, -272, -1016}, { 32, -736, -912}, { -152, -384, -944}, { -224, -368, -904}, { -128, -400, -928}...
; // Test ble_ad_copy_service_uuids, destination array sized larged enough: const uint8_t count = 4; Uuid copied_uuids[count]; uint8_t found = ble_ad_copy_service_uuids(s_ad_data, copied_uuids, count); cl_assert_equal_i(found, 1); // Test ble_ad_copy_service_uuids, destination array too small: found = b...
(ble_ad_set_service_uuids(ad, uuid, 2), true)
; cl_assert_equal_i(memcmp(expected_ad_data, ad->data, sizeof(expected_ad_data)), 0); cl_assert_equal_i(ad->ad_data_length, sizeof(expected_ad_data)); cl_assert_equal_i(ad->scan_resp_data_length, 0); ble_ad_destroy(ad); // 7x 32-bit UUIDs should fit, expect true: ad = ble_ad_crea...
; ROCKY_ARGS_ASSIGN_OR_RETURN_ERROR( ROCKY_ARG(prect), ); GContext *const ctx = rocky_api_graphics_get_gcontext(); const GRect rect = prv_grect_from_precise(&prect); func(ctx, &rect); return jerry_create_undefined(); } JERRY_FUNCTION(prv_fill_rect) { return prv_rect_call(argc, argv, graphics_fill_re...
graphics_fill_radial_precise_internal(ctx, center, inner_radius, outer_radius, (int32_t)angle_1, (int32_t)angle_2)
; return jerry_create_undefined(); } JERRY_FUNCTION(prv_save) { Context2DStoredState *const new_head = task_zalloc(sizeof(*new_head)); new_head->draw_state = rocky_api_graphics_get_gcontext()->draw_state; list_insert_before(&s_canvas_context_2d_stored_states->node, &new_head->node); s_canvas_context_2d_store...
>call_status_text_layer.layer, false); layer_add_child(&s_phone_ui_data->core_ui_container, &s_phone_ui_data->call_status_text_layer.layer); // Shrink the bounds but not the frame size to allow for centering when action bar removed s_phone_ui_data->call_status_text_layer.layer.bounds.size.w = wi...
if (disconnected) { prv_set_status_text(DISCONNECTED); } else { prv_set_status_text(DECLINED); }
} prv_window_pop_with_delay(CALL_END_DELAY_MS); } void phone_ui_handle_call_hide(void) { // Just pop the window - it'll handle all the cleanup prv_window_pop(); } void phone_ui_handle_caller_id(PebblePhoneCaller *caller) { if (!s_phone_ui_data) { PBL_LOG(LOG_LEVEL_ERROR, "Can't update caller id, UI is...
{ goto unlock; }
prv_mic_power_enable(); circular_buffer_init(&s_circ_buffer, s_circ_buf_store, sizeof(s_circ_buf_store)); s_subscriber = (struct Subscriber) { .callback = data_handler, .buffer = audio_buffer, .context = context, .size = audio_buffer_len, .idx = 0 }; s_overflow_cnt = 0; s_discarded = ...
/* * 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...
(fd, buffer, length)
/* * 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...
(&edit_attr_list)
; task_free(action_group.actions); if (uuid_out) { *uuid_out = item->header.id; } timeline_item_destroy(item); } // ---------------------------------------------------------------------------------------------- void alarm_pin_remove(Uuid *alarm_id) { pin_db_delete((uint8_t *)alarm_id, sizeof(Uuid)); }
ST_NAMED_PBI_FILE("draw_line_inside_origin_layer"))); layer_set_update_proc(&layer, &white_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("white_over_black", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &in...
gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_checkerboard_no_clip"))
); // Clipping on even boundaries - no offset setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_EVEN, ORIGIN_RECT_NO_CLIP, false, 1); for (int16_t row = 0; row < MAX_NUM_ROWS; row++) { graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS); } cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
T_SIZE; if (curr_sector != new_sector) { // have we crossed into a new erase region ? prv_erase_unit(prv_get_unit_base_address(new_flash_addr)); } s_curr_state.page_start_addr = new_flash_addr; prv_allocate_page_for_use(); done: s_curr_state.log_start_addr = s_curr_state.offset_in_log_page + s_cur...
{ state->page_index++; state->page_offset = sizeof(FlashLoggingHeader); if (state->page_index >= state->num_pages) { status = DumpStatus_DoneSuccess; } else { status = DumpStatus_InProgress; PBL_LOG(LOG_LEVEL_DEBUG, "Dumping page %d of %d", state->page_index, state->num_pages-1); }...
exit: if (status == DumpStatus_DoneFailure || status == DumpStatus_DoneSuccess) { state->completed_cb(status == DumpStatus_DoneSuccess); kernel_free(state); } else { // Keep going system_task_add_callback(prv_dump_log_system_cb, state); } } bool flash_dump_log_file(int generation, DumpLineCall...
0_enable_spi_mode(); } else { PBL_LOG(LOG_LEVEL_WARNING, "Failed to query BMI160"); } prv_set_accel_scale(BMI160_SCALE_4G); } bool bmi160_query_whoami(void) { uint8_t whoami = bmi160_read_reg(BMI160_REG_CHIP_ID); PBL_LOG(LOG_LEVEL_DEBUG, "Read BMI160 whoami byte 0x%"PRIx8", expecting 0x%"PRIx8, ...
bmi160_read_reg(BMI160_REG_SELF_TEST)
| delay_c | duration_c | // | delay_s | delay_d | duration_d | // ----------------------------------------------------------------------------------- // | spawn scheduled here void test_animation__spawn_of_a...
{ animation_unschedule_all(); }
} // -------------------------------------------------------------------------------------- // Test unscheduling animations arbitrarily in an update handler. static void prv_unschedule_all_in_update_handler(bool auto_destroy) { const int duration_a = 300; // This one will complete const int delay_a = 10; prv...
raphs = StringListLiteral("Ryan Case\nBrad Murray\0Sarah Otten"); attribute_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs); attribute_list_add_cstring(&list, AttributeIdBody, "Body message"); attribute_list_add_uint32(&list,...
(30 * 60, 3 * 24 * 60, is_all_day, !recurring, TIMELINE_RESOURCE_SCHEDULED_EVENT, 0)
; prv_add_calendar_pin(60 * 60, 3 * 24 * 60, is_all_day, recurring, TIMELINE_RESOURCE_RADIO_SHOW, TIMELINE_RESOURCE_STOCKS_EVENT); prv_add_calendar_pin(90 * 60, 60, !is_all_day, !recurring, 0, 0); prv_add_weather_pin(50 * 60); prv_add_sports_pin(2 * 60 * 60, GColorWhit...
/* * 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...
(fmt, i18n_owner)
, minutes, seconds); } } int health_util_format_minutes_and_seconds(char *buffer, size_t buffer_size, int duration_s, void *i18n_owner) { int minutes = duration_s / SECONDS_PER_MINUTE; int seconds = duration_s % SECONDS_PER_MINUTE; return snprintf(buffer, buffer_size,...
y + DAYS_PER_WEEK) % DAYS_PER_WEEK) - 1; // Calculate the number of seconds until the start of the next schedule, update then seconds_until_update = time_util_get_seconds_until_daily_time(&time, 0, 0) + (num_full_days * SECONDS_PER_DAY); } else { // Current schedule is enabled c...
prv_toggle_smart_dnd(NULL)
; } } void do_not_disturb_get_schedule(DoNotDisturbScheduleType type, DoNotDisturbSchedule *schedule_out) { alerts_preferences_dnd_get_schedule(type, schedule_out); } void do_not_disturb_set_schedule(DoNotDisturbScheduleType type, DoNotDisturbSchedule *schedule) { alerts_prefere...
/* * 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 0; }
int64_t interpolate_moook_soft(int32_t normalized, int64_t from, int64_t to, int32_t num_frames_mid) { return to; } uint32_t interpolate_moook_soft_duration(int32_t num_frames_mid) { return 0; } // Fakes ///////////////////// #include "fake_animation.h" #include "fake_app_state.h...
/* * 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 (!result->next) { // Found the last result, unlink and free it: prev->next = NULL; free(result); return; }
prev = result; result = result->next; } } //! Finds ScanResult based on BTDevice. If found, unlink and return ScanResult. static ScanResult *list_unlink(const BTDevice *device) { ScanResult *prev = NULL; ScanResult *result = s_head; while (result) { if (bt_device_equal(&result->device, device)) { ...
/* * 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 (!(screen = SDL_SetVideoMode(DISP_COLS, DISP_ROWS, 8 /* bits/pixel */, SDL_HWSURFACE))) { return false; } framebuffer_init(&fb, &(GSize) {DISP_COLS, DISP_ROWS}); s_gcontext = (GContext) { .dest_bitmap = (GBitmap) { .addr = screen->pixels, .row_size_bytes = DISP_COLS, .info = (Bit...
GContext *sdl_graphics_get_gcontext(void) { return &s_gcontext; } void sdl_graphics_render(void) { SDL_Flip(screen); }
wData *data = window_get_user_data(window); if (notifications_presented_list_current_idx() < 0) { prv_pop_notification_window_after_delay(data, 0); return; } prv_setup_reminder_watchdog(data); prv_refresh_pop_timer(data); // update status bar to the current info prv_update_status_layer(data); //...
PBL_IF_ROUND_ELSE(10, 2)
; const GRect dnd_frame = (GRect) { .origin = GPoint(icon_layer_x_offset, icon_layer_y_offset), .size = icon_rect.size, }; layer_set_frame(&data->dnd_icon_layer, &dnd_frame); data->dnd_icon_visible = is_visible; } static void prv_dnd_status_changed(bool dnd_is_active) { if (s_notification_window_dat...
18n_get(snooze_text, dialog), alarm_get_snooze_delay()); i18n_free(snooze_text, dialog); dialog_set_text(dialog, snooze_buf); dialog_set_icon(dialog, RESOURCE_ID_GENERIC_CONFIRMATION_LARGE); dialog_set_background_color(dialog, GColorJaegerGreen); dialog_set_timeout(dialog, DIALOG_TIMEOUT_DEFAULT); return si...
task_free((void *)root_level->items[DetailMenuItemIndexSnooze].next_level)
t one because of the "+" cell int list_idx = 1; while (cur_node) { if (cur_node->id == id) { return list_idx; } list_idx++; cur_node = (AlarmNode* )list_get_next((ListNode*) cur_node); } return 0; } static void prv_update_menu_layer(AlarmsAppData* data, AlarmId select_alarm) { MenuInd...
{ // Trying to add a new alarm when list is already full const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle); box = GRect(0, 0, cell_layer->bounds.size.w, fonts_get_font_height(font)); const char *text = i18n_get("Limit reache...
, { 1016, 352, -24}, { 1064, 448, 32}, { 1304, 368, 88}, { 1216, 248, 80}, { 1104, 120, 144}, // 93 seconds { 1200, -16, 120}, { 1272, -56, 48}, { 1248, 8, -8}, { 1104, 40, 24}, { 1144, 0, -8}, { 1016, -144, 8}, { 760, -200, 0}, { 1056, -256, 80}, { 1344, -48,...
{ 944, 0, -40}, { 960, -32, 48}, { 1016, -80, 24}, { 840, -104, -64}, { 1040, -208, 88}, { 1304, 8, -64}, { 1336, 160, -160}, { 1336, 80, -48}, { 1248, 8, -96}, { 952, 72, -88}, { 928, 128, -88}, { 1024, 176, 56}, // 99 seconds { 1144, 248, 104}, { 1128, 288, ...
{ -264, -152, -848}, { -288, -80, -912}, { -168, -192, -984}, { -248, -272, -1032}, { -160, -168, -1096}, { -128, -56, -1184}, { -64, 104, -1328}, { 24, -8, -1272}, { -184, -80, -1152}, { -208, 40, -1096}, { -80, 88, -1032}, { -24, -32, -888}, { -64, -144, -792}, ...
{ 984, 144, 16}, { 1096, 168, 104}, { 1144, 296, 184}, { 1432, 432, 376}, { 1120, 576, 488}, { 1152, 752, 288}, // 30 seconds { 1072, 512, 136}, { 896, 304, 56}, { 1112, 408, 160}, { 1560, 560, 248}, { 1704, 384, 176}, { 1528, 176, 224}, { 1504, -8, 248}, { 13...
{ 1080, 24, -56}, { 888, 40, -40}, { 928, -24, 48}, { 1008, -48, 16}, { 664, -48, -64}, { 904, 0, -160}, { 1024, -32, -56}, { 1240, 64, 0}, { 1472, 144, -120}, { 1592, 208, -232}, { 1288, 248, -112}, { 912, 168, -88}, // 33 seconds { 856, 112, 16}, { 1048, 15...
animation_unschedule((Animation *)data->mic_window.progress_anim); loading_layer_pause(&data->mic_window.progress_bar); layer_set_hidden((Layer *)&data->mic_window.progress_bar, true); } static void prv_voice_confirm_cb(void *context) { prv_exit_and_send_result_event((VoiceUiData *)context, DictationSessionStat...
if (next_state == StateRecording) { return StateStopWaitForReady; }
break; case StateStopWaitForReady: if ((next_state == StateRecording) || (next_state == StateWaitForResponse)) { return next_state; } break; case StateRecording: if ((next_state == StateWaitForResponse) || (next_state == StateTransitionToText)) { return StateStop...
/* * 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_prescalar_to_frequency(bus->hal->duty_cycle, prescalar)
; I2C_init_struct.I2C_ClockSpeed = frequency; I2C_init_struct.I2C_Ack = I2C_Ack_Enable; I2C_Init(bus->hal->i2c, &I2C_init_struct); I2C_Cmd(bus->hal->i2c, ENABLE); } void i2c_hal_disable(I2CBus *bus) { periph_config_disable(bus->hal->i2c, bus->hal->clock_ctrl); I2C_DeInit(bus->hal->i2c); } bool i2c_hal_i...
irectionDown, &content_indicator_config); #endif // Wait to add the menu layer until after we might have added the content indicators because // the indicator arrows only get positioned properly if their layers overlap with the menu layer's // edges layer_add_child(conta...
menu_layer_get_selected_index(&launcher_menu_layer->menu_layer)
; prv_play_glance_for_row(launcher_menu_layer, selected_index.row); } else { launcher_app_glance_service_rewind_current_glance(&launcher_menu_layer->glance_service); } } void launcher_menu_layer_deinit(LauncherMenuLayer *launcher_menu_layer) { if (!launcher_menu_layer) { return; } launcher_app_g...
ystem/bootbits.h" #include "system/passert.h" #include "system/reset.h" #include "system/logging.h" #include "system/version.h" #include "util/attributes.h" #include "util/build_id.h" #include "util/math.h" #include "util/net.h" #include "util/size.h" #include "util/string.h" #define STM32F2_COMPATIBLE #define STM32F...
flash_write_bytes(buffer_ptr, start_addr, buffer_size)
; return buffer_size; } } static void prv_flash_erase_region(uint32_t start_addr, uint32_t total_bytes) { if (s_use_cd_flash_driver) { cd_flash_erase_region(start_addr, total_bytes); } else { uint32_t end = start_addr + total_bytes; flash_region_erase_optimal_range_no_watchdog(start_addr, start_a...
ound_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY, RADIUS...
(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 5); graphics_draw_round_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_offset_r4_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // AA = true, SW = 11 setup_test_...
ent_service, [TimelineEventService_Peek] = timeline_peek_get_event_service, }; // This mutex protects all state, but is only used for factory resetting synchronously, therefore // it should not significantly increase blocking time. static PebbleMutex *s_mutex; static TimelineEventState s_states[TimelineEventService...
if (has_item) { timeline_item_deserialize_header(&item, state->filter_header); }
const uint32_t other_timeout_ms = state->impl->update(has_item ? &item : NULL, &state->context); if (other_timeout_ms) { timeout_ms = timeout_ms ? MIN(timeout_ms, other_timeout_ms) : other_timeout_ms; } } // Did update for (int i = 0; i < TimelineEventServiceCount; i++) { TimelineE...
itmap_sequence->png_decoder_data.palette_entries = gbitmap_png_load_palette(upng, &bitmap_sequence->png_decoder_data.palette); if (bitmap_sequence->png_decoder_data.palette_entries == 0) { APP_LOG(APP_LOG_LEVEL_ERROR, "Failed to load palette"); goto cleanup; } } bitmap_sequence->header_...
{ goto cleanup; }
line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 23), MAX_NUM_COLS ...
graphics_draw_vertical_line_dotted(&ctx, GPoint(21, 0), MAX_NUM_ROWS - 1)
; graphics_draw_vertical_line_dotted(&ctx, GPoint(23, 0), MAX_NUM_ROWS + 1 ); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_vert_dotted_line_origin_odd_cols_no_clip"))); // Test to make sure drawing on all cols creates checkerboard pattern setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO...
en the animation stopping and starting it again. To minimize // this, make the animation contain multiple loops (360 degree rotations) instead of 1. // This means that the the lag occurs once less frequently and is less noticable #define LOOPS_PER_ANIMATION 10 #define LOOP_DURATION_MS 1500 static void prv_draw_spinner...
PBL_IF_RECT_ELSE(GAlignTopLeft, GAlignCenter)
); layer_set_frame(&bitmap_layer->layer, &spinner_bounds); data->bitmap = gbitmap_create_with_resource(RESOURCE_ID_SPINNER_BACKGROUND); bitmap_layer_set_bitmap(bitmap_layer, data->bitmap); layer_add_child(&window->layer, &bitmap_layer->layer); // Animation setup Layer *anim_layer = &data->anim_layer; lay...
i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); // Second alarm goes off. First one should be up again, but not until Monday s_current_hour = 11; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 4); cl_assert_equal_i(s_num_alarm_events_put, 4); cl_asser...
(s_num_alarms_fired, 6)
; } void test_alarm__custom_alarm_weekends_and_weekday(void) { AlarmId id1; bool schedule_1[7] = {true, false, false, true, false, false, true}; id1 = alarm_create(&(AlarmInfo) { .hour = 10, .minute = 30, .kind = ALARM_KIND_CUSTOM, .scheduled_days = &schedule_1 }); prv_assert_alarm_config(id1, 10, 30, 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...
{ // cache full, evict LRU new = c->least_recent; c->least_recent = new->more_recent; }
new->more_recent = NULL; new->key = key; memcpy(new->data, item, c->item_size); *cur_ptr = new; }
/* * 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...
text_layer_set_text_alignment(text_layer, GTextAlignmentCenter)
blePairingServiceGATTError_ConnParamsInvalidRemoteDesiredState; } return ATT_ERROR_OK; } static att_error_t prv_handle_ple_update_request( uint16_t conn_idx, const PebblePairingServicePacketLengthExtension *ple_req, size_t length) { if (length < sizeof(PebblePairingServicePacketLengthExtension)) { return...
connection_is_subscribed_to_gatt_mtu_notifications(connection)
n ? AnalyticsEvent_PebbleProtocolSystemSessionEnd : AnalyticsEvent_PebbleProtocolAppSessionEnd); event_blob.pp_common_session_close.close_reason = reason; event_blob.pp_common_session_close.duration_minutes = session_duration_mins; if (!is_system_session && optional_app_...
("health insight created event: timestamp: %"PRIu32", type:%"PRIu8, timestamp, insight_type)
; #endif analytics_logging_log_event(&event_blob); } // ------------------------------------------------------------------------------------------ // Log a health insight response event. void analytics_event_health_insight_response(time_t timestamp, ActivityInsightType insight_type, ...
reed 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 the License. */ #include "clar.h" #include "services...
(true, s_close_called)
; } void test_app_session_capabilities__cache_file_but_no_key_and_not_connected(void) { bool has_cap = comm_session_current_app_session_cache_has_capability(CommSessionInfiniteLogDumping); cl_assert_equal_b(false, has_cap); cl_assert_equal_b(true, s_get_called); cl_assert_equal_b(true, s_close_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...
(LOG_LEVEL_ERROR, "HcGap: unhandled message id: %d", msg->command_id)
/* * 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, str, strlen(str))
; } void debug_print_hex(int val) { char buffer[12] = { }; itoa(val, buffer, sizeof(buffer)); debug_print_str(buffer); } void debug_print_str_and_int(char *str, int value) { debug_print_str(str); debug_print_hex(value); debug_print_str("\n"); }
t(sysclk_XTAL16M); cm_apb_set_clock_divider(apb_div1); cm_ahb_set_clock_divider(ahb_div1); cm_lp_clk_init(); /* Prepare the hardware to run this demo. */ prvSetupHardware(); /* Set system clock */ cm_sys_clk_set(sysclk_XTAL16M); // Set the desired sleep mode. // It's important to do this *AFTER* se...
( ulInterruptStackSize > 350UL )
; /* Fill the stack used by main() and interrupts to a known value, so its use can be manually checked. */ memcpy( ( void * ) _pvHeapStart, ucExpectedInterruptStackValues, sizeof( ucExpectedInterruptStackValues ) ); #endif }
push(&data->finished_dialog, app_state_get_window_stack()); app_timer_cancel(data->timer); } static void prv_update_progress_text(ProgressUIData *data) { sniprintf(data->percent_done_text_buffer, sizeof(data->percent_done_text_buffer), "%u%%", data->percent_complete); layer_mark_dirty(&data->percent...
app_timer_register(UPDATE_FREQ_MS, prv_refresh_progress, data)
; prv_update_progress(data); } static void prv_progress_ui_window_push(void) { ProgressUIData *data = app_zalloc_check(sizeof(ProgressUIData)); Window* window = &data->window; window_init(window, WINDOW_NAME("Progress UI App")); window_set_user_data(window, data); window_set_overrides_back_button(window, ...
x11; BTBondingID id_1 = bt_persistent_storage_store_bt_classic_pairing(&addr_1, &link_key_1, name_1, &platform_bits_1); cl_assert(id_1 != BT_BONDING_ID_INVALID); // It should be the active gateway ret = bt_persistent_storage_get_active_gateway(&id_o...
cl_assert(ret)
; } void test_bluetooth_persistent_storage__test_is_faithful(void) { bool ret; // No pairing yet, we should be unfaithful ret = bt_persistent_storage_is_unfaithful(); cl_assert(ret); // Add a pairing, still unfaithful BTDeviceAddress addr_1 = {{0x11, 0x12, 0x13, 0x14, 0x15, 0x16}}; SM128BitKey link_key...
(fraction & 0x7); } else { // 4 bits of fraction dev->periph->BRR = (mantissa << 4) | (fraction & 0xF); } } // Read / Write APIs //////////////////////////////////////////////////////////////////////////////// void uart_write_byte(UARTDevice *dev, uint8_t data) { PBL_ASSERTN(dev->state->initialized); ...
{ should_context_switch = true; }
if (++dev->state->rx_dma_index == dma_length) { dev->state->rx_dma_index = 0; } } // explicitly clear error flags since we're not reading from the data register uart_clear_all_interrupt_flags(dev); } else { const bool has_byte = uart_is_rx_ready(dev); // read...
if (!data) { // Sanity check return; }
// Overwrite the old timer handle, it's no longer valid data->timer = app_timer_register(UPDATE_FREQ_MS, prv_refresh_progress, data); prv_update_progress(data); } //////////////////////////////////////////////////////////// // Window loading, unloading, initializing static void prv_dialog_unloaded(void *cont...
_dialog.h" #include "applib/ui/text_layer.h" #include "applib/ui/window_private.h" #include "resource/resource.h" #include "resource/resource_ids.auto.h" #include "services/normal/timeline/timeline_resources.h" #include "shell/system_theme.h" #include "util/buffer.h" #include "util/graphics.h" #include "util/hash.h" #i...
prv_create_layout_for_forecast_and_render(&forecast)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } static void prv_render_long_strings_test(bool is_current_location) { const WeatherLocationForecast forecast = { .location_name = "QWERTYUIO ASEDDFFGHHJ", .is_current_location = is_current_location, .current_temp = 68, .today_h...
/* * 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_vibe_score_find_info(id)
; return info ? info->name : ""; } static int prv_get_index(VibeScoreId id) { for (unsigned int x = 0; x < VIBE_MAP_SIZE; x++) { if (S_VIBE_MAP[x].id == id) { return x; } } return 0; } VibeScoreId vibe_score_info_cycle_next(VibeClient client, VibeScoreId curr_id) { AlertType alert_type; swit...
, GColorBlack); text_layer_set_background_color(&data->direction_layer, GColorWhite); text_layer_set_text_color(&data->word_wrap_layer, GColorBlack); text_layer_set_background_color(&data->word_wrap_layer, GColorWhite); if (data->select_index == SelectIndexDirection) { text_layer_set_text_color(&data->dire...
(window, WINDOW_NAME("Text Clipping"))
; window_set_user_data(window, data); window_set_click_config_provider(window, (ClickConfigProvider) config_provider); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App ...
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; idx++) { prefs->locations[idx] = s_keys[idx]; } return prefs; } static WeatherDBEntry *prv_create_entry(const WeatherDBEntry *base_entry, char *l...
cl_assert_equal_i(to_check->tomorrow_weather_type, original->tomorrow_weather_type)
; cl_assert_equal_i(to_check->tomorrow_high_temp, original->tomorrow_high_temp); cl_assert_equal_i(to_check->tomorrow_low_temp, original->tomorrow_low_temp); cl_assert_equal_i(to_check->last_update_time_utc, original->last_update_time_utc); PascalString16List pstring16_list; pstring_project_list_on_serialize...
/* * 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...
((uintptr_t)periph)
ck(); } void accessory_use_dma(bool use_dma) { prv_lock(); s_use_dma = use_dma; if (s_use_dma) { prv_enable_dma(); } else { prv_disable_dma(); } prv_unlock(); } bool accessory_bus_contention_detected(void) { return s_bus_contention_detected; } static uint32_t prv_get_baudrate(AccessoryBaud baud...
{ accessory_set_power(true); }
); } void accessory_send_data(const uint8_t *data, size_t length) { // NOTE: this may be run within an ISR prv_lock(); // When sending data, we need to temporarily disable input, as there's only one data line for // both directions and any data we send on that line will also be interpreted as data we can // ...
(prv_get_baudrate(baud_select), false /* !force_update */)
; prv_unlock(); } void accessory_set_power(bool on) { if (on == s_power_enabled) { return; } PBL_LOG(LOG_LEVEL_DEBUG, "Setting accessory power %s", on?"on":"off"); s_power_enabled = on; gpio_output_set(&BOARD_CONFIG_ACCESSORY.power_en, on); } bool accessory_is_present(void) { accessory_set_power(tru...
/* * 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...
(info->type == PEBBLE_SMARTSTRAP_EVENT)
; s_event_handler = NULL; } bool process_manager_send_event_to_process(PebbleTask task, PebbleEvent *e) { cl_assert(task == PebbleTask_App); cl_assert(e->type == PEBBLE_SMARTSTRAP_EVENT); cl_assert(s_event_handler); s_event_handler(e, NULL); return true; } void smartstrap_cancel_send(void) { } // Helper...
NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_across_nx); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset...
(&canvas, &ctx)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_nx.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_x); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitma...
VEL_DEBUG, "", 0, "Test"); cl_assert_equal_i(s_num_event_puts, 0); cl_assert_equal_i(s_num_packets_sent, 1); cl_assert_equal_i(s_num_bytes_sent, LOG_METADATA_LENGTH + 4); cl_assert_equal_s(s_log_message_buffer, "Test"); s_num_bytes_sent = 0; pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTest...
(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestF")
; cl_assert_equal_i(s_num_event_puts, 1); cl_assert_equal_i(s_num_packets_sent, 0); pulse_logging_log(LOG_LEVEL_DEBUG, "", 0, "TestTestTestTestTestTestTestTestTestTestG"); s_last_event.callback.callback(NULL); cl_assert_equal_i(s_num_packets_sent, 7); cl_assert_equal_s(s_log_message_buffer, "ISR Message D...
); prv_assign_next_transaction_id(request_message); HcExpectation *expectation = prv_set_expectation_for_request(request_message); if (!prv_enqueue(request_message)) { prv_cleanup_expectation(expectation); return NULL; } HcProtocolMessage *response_message = prv_expect(expectation); prv_cleanup_e...
while (rx_length) { if (rx_length < sizeof(HcProtocolMessage)) { // Header not received completely yet return; } bool should_free = false; HcProtocolMessage *header = prv_get_message(sizeof(HcProtocolMessage), &should_free); const size_t message_length = header->message_length; if (...
} void hc_protocol_buffer_gained_space(void) { PBL_ASSERTN(s_retry_semph); xSemaphoreGive(s_retry_semph); } //! Should be called only once at boot. void hc_protocol_boot(void) { if (s_hc_lock) { return; } s_hc_lock = mutex_create_recursive(); } //! Should be called when stack is brought up. void hc_pr...
NY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "health_progress.h" #include "applib/graphics/gpath_builder.h" #include "system/logging.h" // Scales a total shape offset to an individual segment offset. // @par...
(end, amount_traversed + segment->amount_of_total)
- amount_traversed; const int from = prv_total_offset_to_segment_offset(segment, from_total); const int to = prv_total_offset_to_segment_offset(segment, to_total); prv_fill_segment(ctx, segment, color, from, to); amount_traversed += segment->amount_of_total; if (segment == &progress_bar->segmen...
xed_S16_3 radius, int32_t angle_start, int32_t angle_end) {} void graphics_draw_rect_precise(GContext *ctx, const GRectPrecise *rect) {} void graphics_fill_radial_precise_internal(GContext *ctx, GPointPrecise center, Fixed_S16_3 radius...
prv_init()
; } static char *prv_load_js(char *suffix) { char path[512] = {0}; snprintf(path, sizeof(path), "%s/js/tictoc~rect~%s.js", CLAR_FIXTURE_PATH, suffix); FILE *f = fopen(path, "r"); cl_assert(f); fseek(f, 0, SEEK_END); size_t length = (size_t)ftell(f); fseek (f, 0, SEEK_SET); char *buffer = malloc(length ...
t_equal_point(GPoint(2, 3), lc->path.points[1]); cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]); s_gpath_draw_filled.call_count = 0; EXECUTE_SCRIPT( "ctx.lineTo(11.5, 12.7);\n" "ctx.fill();\n" ); // still only the first part (before the .moveTo()) as the second only has two points cl_asser...
cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[1].type)
; cl_assert_equal_i(RockyAPIPathStepType_LineTo, s_rocky_path_steps[5].type); cl_assert_equal_i(RockyAPIPathStepType_MoveTo, s_rocky_path_steps[6].type); cl_assert_equal_point_precise((GPointPrecise(20, 28)), s_rocky_path_steps[1].pt.xy); cl_assert_equal_point_precise((GPointPrecise(60, 76)), s_rocky_path_step...
e_t timestamp) { clock_get_time_number(number_buffer, number_buffer_size, timestamp); clock_get_time_word(word_buffer, word_buffer_size, timestamp); } static void prv_get_relative_all_day_string(char *buffer, int buffer_size, time_t timestamp) { time_t today = time_util_get_midnight_of(rtc_get_time()); if (tim...
if ((hour < cal.tm_hour) || (hour == cal.tm_hour && minute <= cal.tm_min)){ // Always return a future timestamp, so if day was today, and // minutes and hours already occurred, just make it tomorrow cal.tm_mday++; // normalized by mktime }
cal.tm_hour = hour; cal.tm_min = minute; return mktime(&cal); } void command_timezone_clear(void) { rtc_timezone_clear(); } void command_get_time(void) { char buffer[80]; char time_buffer[26]; prompt_send_response_fmt(buffer, 80, "Time is now <%s>", rtc_get_time_string(time_buffer)); } void command_...
racteristic handle_out = ~0; uint8_t out[1]; uint16_t value_length = sizeof(out); bool has_more = true; const uint16_t next_length = gatt_client_subscriptions_consume_notification(&handle_out, out, &value_length, GAPLEClientApp, &has_more); cl...
(GAPLEClientKernel)
/* * 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...
firmware_storage_read_firmware_description(FLASH_REGION_SAFE_FIRMWARE_BEGIN)
-800}, { 176, 664, -792}, // 220 seconds { 184, 672, -800}, { 184, 672, -784}, { 184, 664, -808}, { 192, 664, -800}, { 168, 776, -728}, { 192, 656, -776}, { 136, 736, -744}, { 184, 640, -848}, { 192, 696, -776}, { 200, 768, -776}, { 176, 648, -792}, { 144, 624, -...
{ -472, 880, -64}, { -464, 896, -80}, { -472, 904, -32}, { -488, 952, -32}, { -464, 888, -40}, { -456, 864, -64}, { -456, 904, -64}, { -448, 920, -48}, { -456, 904, -56}, { -464, 912, -72}, { -472, 896, -64}, { -488, 920, -64}, // 226 seconds { -488, 888, -56}, ...
{ -496, 912, 16}, { -480, 864, 8}, { -488, 912, 0}, { -488, 904, 0}, { -480, 912, -16}, { -472, 896, -16}, { -488, 904, -8}, { -480, 888, 8}, { -480, 888, 8}, { -472, 896, 8}, { -480, 912, -8}, { -480, 896, -16}, { -480, 888, -32}, { -480, 904, -32}, { -480, ...
container_session->len_m * SECONDS_PER_MINUTE); last_deep_session_len_m = session->len_m; // Accumulate restful sleep stats results->deep.value += session->len_m; if (deep_exit_utc == 0 || session_exit_utc > deep_exit_utc) { deep_exit_utc = session_exit_utc; } } } // Fill...
rtc_get_time()
; time_t test_start_utc = now; for (int i = 0; i < entry->num_samples; i++) { uint16_t vmc = entry->samples[i].v5_fields.vmc; if (entry->version == 1) { // Convert from the old compressed VMC to the new uncompressed one vmc = vmc * vmc * 1850 / 1250; } const bool shutting...
owStackItem *pop_item = (WindowStackItem *)window_stack->list_head; Window *window = NULL; if (pop_item) { window = prv_remove_item(pop_item, transition); } return window; } void window_stack_pop_all(WindowStack *window_stack, const bool animated) { if (window_stack->list_head == NULL) { return; } ...
{ window_set_on_screen(window_from, false /* not new */, true /* call handlers */); }
prv_unload_removed_windows(window_from->parent_window_stack); } void window_transition_context_appear(WindowTransitioningContext *context) { Window *window_to = context->window_to; if (!window_manager_is_window_visible(window_to)) { return; } prv_set_new_window_on_screen(window_to); ClickManager *c...
/* * 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...
load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */)
ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "comm/ble/kernel_le_client/ancs/ancs.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" #include "comm/ble/kernel_le_client/ancs/a...
(b, s_chunked_dict_part_one, sizeof(s_chunked_dict_part_one))
, sizeof(s_chunked_dict_part_one)); cl_assert_equal_i(buffer_add(b, s_chunked_dict_part_two, sizeof(s_chunked_dict_part_two)), sizeof(s_chunked_dict_part_two)); bool error = false; cl_assert(ancs_util_is_complete_notif_attr_response(b->data, b->bytes_written, &error)); cl_assert(!error); ANCSAttribute *attr...
(v) >> 8) & 0xff, ((v) & 0xff)) // if performance ever becomes an issue with this, we can sort the names and to a binary search T_STATIC const RockyAPIGraphicsColorDefinition s_color_definitions[] = { // taken from https://developer.mozilla.org/en-US/docs/Web/CSS/color_value {"black", GColorARGB8FromHEX(0x000000)}...
GColorARGB8FromHEX(0xe0ffff)
}, {"lightgoldenrodyellow", GColorARGB8FromHEX(0xfafad2)}, // {"lightgray", GColorARGBFromHEX(0xd3d3d3)}, inconsistent with Pebble color {"lightgreen", GColorARGB8FromHEX(0x90ee90)}, // {"lightgrey", GColorARGBFromHEX(0xd3d3d3)}, inconsistent with Pebble color {"lightpink", GColorARGB8FromHEX(0xffb6c1)}, {"li...
anel //! This stops any further updates being registered by //! the display, preventing corruption on shutdown / boot static void prv_display_enter_static(void) { prv_enable_display_access(); prv_display_write_byte(DISP_MODE_STATIC); prv_display_write_byte(0x00); prv_display_write_byte(0x00); prv_disable_di...
(error_url_bits, 16, 144, error_url_width, error_url_height, buffer)
; prv_display_buffer(buffer); } //! Do whatever is necessary to prevent visual artifacts when resetting //! the watch. void display_prepare_for_reset(void) { prv_display_enter_static(); } //! Display the progress of a firmware update. //! //! The progress is expressed as a rational number less than or equal to 1...
bool prv_analytics_op(AlarmId id, AlarmConfig *config, void *context); static bool prv_set_alarm_kind_op(AlarmId id, AlarmConfig *config, void *context); static bool prv_set_alarm_custom_op(AlarmId id, AlarmConfig *config, void *context); // Private globals static bool s_alarms_enabled = false; static time_t s_next_al...
(fd, &key, sizeof(key), buffer, size)
== S_SUCCESS) { for (int i = 0; i < size / UUID_SIZE; i++) { Uuid *pinid = (Uuid *) &buffer[UUID_SIZE * i]; if (uuid_is_invalid(pinid)) { continue; } alarm_pin_remove(pinid); settings_file_delete(fd, &key, sizeof(key)); success = true; } } } ...
/* * 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...
((memcmp(&tn, &test_num, sizeof(GTransformNumber)) == 0))
; tn = GTransformNumberFromNumber(-3.5); test_num = (int32_t)((float)-3.5 * (1 << FIXED_S32_16_PRECISION)); cl_assert((memcmp(&tn, &test_num, sizeof(GTransformNumber)) == 0)); t_c = GTransform(GTransformNumberFromNumber(1), GTransformNumberFromNumber(2), GTransformNumberFromNumber(3), GTra...
{ -1232, 536, -56}, { -1352, 416, -24}, { -1544, 376, 0}, { -1256, 264, 8}, { -1096, 256, 40}, { -992, 216, 48}, { -984, 216, 56}, { -944, 200, 88}, { -1144, 176, 24}, { -1264, -128, 64}, { -1024, -328, -48}, { -1456, 88, -152}, { -1632, 328, -160}, { -1408, 480, -312...
{ -1696, 328, 344}, { -1384, 216, 208}, { -1208, 168, 240}, { -1208, 136, 248}, { -1224, 152, 248}, { -1120, 144, 240}, { -1152, 72, 280}, { -1432, 0, 312}, { -1352, -272, 336}, { -1296, -304, 200}, { -1600, 368, -184}, // 26 seconds { -1312, 280, -200}, { -1352, ...
/* * 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...
crc_calculate_flash(flash_address, desc->firmware_length)
ITHOUT 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 "clar.h" #include "services/common/cron.h" #include "util/size.h" #include <pebbleos/cron.h> #include "stubs_logging.h" #inclu...
(INT32_MAX, 0, false)
ssor functions property_animation_get_from_grect(prop_h, &r); cl_assert_equal_rect(from_r, r); property_animation_get_to_grect(prop_h, &r); cl_assert_equal_rect(to_r, r); property_animation_get_subject(prop_h, &subject); cl_assert(subject == &layer); GRect set_r = GRect(1, 2, 3, 4); property_animati...
(test_value, end_value)
; int16_t set_value; set_value = 42; property_animation_set_from_int16(prop_h, &set_value); property_animation_get_from_int16(prop_h, &test_value); cl_assert_equal_i(test_value, set_value); set_value = 43; property_animation_set_to_int16(prop_h, &set_value); property_animation_get_to_int16(prop_h, &t...
elin__data_logging_test(void) { const int k_num_records = 2; const int num_minutes = k_num_records * ALG_MINUTES_PER_DLS_RECORD; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Call the minute handler, which computes the minute stats and sav...
{ const int num_minutes = ALG_SLEEP_HISTORY_HOURS_FOR_TODAY * MINUTES_PER_HOUR; // The test data AlgMinuteDLSSample minute_data[num_minutes]; prv_create_test_data(num_minutes, minute_data); // Fill with garbage for more than ALG_MINUTE_DATA_FILE_LEN to force us to // chop off old data. s_capture_dls_rec...
cl_assert(minutes > ALG_MINUTE_FILE_MAX_ENTRIES * ALG_MINUTES_PER_FILE_RECORD / 2); // Now, put in our expected data // Call the minute handler, which computes the minute stats and saves them to data logging // as well as the sleep PFS file. time_t start_of_data_utc = rtc_get_time(); prv_feed_minute_data...
ubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COLS, DISP_ROWS}); } // Teardown void test_graphics_draw_stroke_${BIT_DEPTH_NAME}__cleanup(v...
(&ctx.dest_bitmap, "draw_stroke_across_x_origin_layer.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, STROKE_WIDTH); graphics_draw_line(&ctx, START_ON_ORIGIN_RECT_NXNY, END_ON_ORIGIN_RECT_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_stroke_across_nxny_origin_layer.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx,...
/* * 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...
{ PBL_LOG_SYNC(LOG_LEVEL_WARNING, "No system task callback in progress."); return; }
PBL_LOG_SYNC(LOG_LEVEL_WARNING, "System task callback: %p", current_cb); reboot_reason->watchdog.stuck_task_callback = (uint32_t)current_cb; } static void prv_log_stuck_task(RebootReason *reboot_reason, PebbleTask task) { TaskHandle_t *task_handle = pebble_task_get_handle_for_task(task); void *current_lr = (...
/* * 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_flush_size, 0x02)
; cl_assert_equal_i(s_invalidate_addr, 0x1F); cl_assert_equal_i(s_invalidate_size, 0x02); cl_assert_equal_i(s_addr_result, UserSpaceBuffer_Invalid); } void test_cpu_cache__userspace_fail_from_addr(void) { cl_will_return(icache_is_enabled, true); cl_will_return(dcache_is_enabled, true); cl_will_return(ica...
; cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should allow all notifications to go through cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notificati...
alerts_should_enable_backlight_for_type(AlertPhoneCall)
); cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(al...
ndFrame *frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 0); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_index(sequence, 0)); cl_assert_equal_p(frame, gdraw_command_sequence_get_frame_by_elapsed(sequence, 14)); frame = gdraw_command_sequence_get_frame_by_elapsed(sequence, 15); cl...
(sequence)
/* * 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...
( ROCKY_ARG(str_buffer), ROCKY_ARG(x), ROCKY_ARG(y), )
assert_usable_state(void) { PBL_ASSERTN(s_flash_state.mutex != 0); } static void enable_flash_dma_clock(void) { // TINTINHACK: Rather than update this file to use the new DMA driver, just rely on the fact that // this is the only consumer of DMA2. periph_config_enable(DMA2, RCC_AHB1Periph_DMA2); } static voi...
{ flash_deep_sleep_exit(); }
} void flash_power_down_for_stop_mode(void) { if (s_flash_state.sleep_when_idle) { if (s_flash_state.enabled) { enable_flash_spi_clock(); flash_deep_sleep_enter(); disable_flash_spi_clock(); } } } void flash_power_up_after_stop_mode(void) { // no need here as this platform doesn't sup...
/* * 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...
(LOG_LEVEL_DEBUG, "deinit timeout expired, killing app forcefully")
; PebbleTask task = (PebbleTask)data; process_manager_put_kill_process_event(task, false /*gracefully*/); } // --------------------------------------------------------------------------------------------- static bool prv_force_stop_task_if_unprivileged(ProcessContext *context) { vTaskSuspend((TaskHandle_t) con...