prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(animation_a, animation_b, animation_c, args)
; va_end(args); return animation; } Animation *WEAK animation_spawn_create_from_array(Animation **animation_array, uint32_t array_len) { return prv_create_from_array(animation_array, array_len); } typedef void (*AnimationEachCallback)(AnimationPrivate *animation...
ut.sessions[1].start_utc); cl_assert_equal_i(s_prv_activity_cb__args[3].time_start, s_sys_activity_get_sessions_values.out.sessions[2].start_utc); // order direction future s_prv_activity_cb__call_count = 0; health_service_activities_iterate(HealthActivityMaskAll, now - (200 * SECONDS_PER_M...
ARRAY_LENGTH(data)
, NULL, &time_end); cl_assert_equal_i(0, written); // empty end before start time_t early_end = time_start - 20 * SECONDS_PER_MINUTE; written = health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, &early_end); cl_assert_equal_i(0, written); // empty end works just fine s_sys_activity...
handle_deinit()
; } const PebbleProcessMd* flash_diagnostic_app_get_info() { static const PebbleProcessMdSystem s_flash_diagnostic_app_info = { .common.main_func = s_main, .name = "Flash Diagnostic" }; return (const PebbleProcessMd*) &s_flash_diagnostic_app_info; }
4), } PmicGpio; typedef enum { PmicRegisters_SD1_VOLTAGE = 0x01, PmicRegisters_LDO1_VOLTAGE = 0x02, PmicRegisters_LDO2_VOLTAGE = 0x03, PmicRegisters_GPIO1_CNTL = 0x09, PmicRegisters_GPIO2_CNTL = 0x0a, PmicRegisters_GPIO3_CNTL = 0x0b, PmicRegisters_GPIO4_CNTL = 0x0c, PmicRegisters_GPIO5_CNTL = 0x0d, ...
((set_mask & clear_mask) == 0)
; uint8_t new_output_state = s_pmic_gpio_output_state; new_output_state |= set_mask; new_output_state &= ~clear_mask; if (prv_write_register(PmicRegisters_GPIO_SIG_OUT, new_output_state)) { s_pmic_gpio_output_state = new_output_state; return true; } return false; } static void prv_init_pmic_gpio_ou...
/* * 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...
(four_third, half, ANIMATION_NORMALIZED_MAX)
); }
{ src_y = src_bitmap->bounds.origin.y; }
const GBitmapDataRowInfo dest_row_info = gbitmap_get_data_row_info(dest_bitmap, dest_y); uint8_t *dest = dest_row_info.data; const int16_t dest_delta_begin_x = MAX(dest_row_info.min_x - dest_rect.origin.x, 0); const int16_t dest_begin_x = dest_delta_begin_x ? dest_row_info.min_x : dest_rect.origin.x; ...
} r = strftime(buf, buf_size, "%D", &good_data); if (r == 0 || strncmp(buf, "05/05/15", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"D\": %s", buf); } r = strftime(buf, buf_size, "%e", &good_data); if (r == 0 || strncmp(buf, " 5", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Err...
APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"y\": %s", buf)
; } r = strftime(buf, buf_size, "%Y", &good_data); if (r == 0 || strncmp(buf, "2015", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"Y\": %s", buf); } // r = strftime(buf, buf_size, "%z", &good_data); // if (r == 0 || strncmp(buf, "", buf_size) != 0) { // APP_LOG(APP_LOG_LEVEL_DEBUG,...
itStruct.DFSDM_CLKAbsenceDetector = DFSDM_CLKAbsenceDetector_Disable; DFSDM_InitStruct.DFSDM_ShortCircuitDetector = DFSDM_ShortCircuitDetector_Enable; DFSDM_TransceiverInit(this->channel, &DFSDM_InitStruct); DFSDM_FilterInitTypeDef DFSDM_FilterInitStruct; DFSDM_FilterStructInit(&DFSDM_FilterInitStruct); DFS...
(LOG_LEVEL_DEBUG, "Stopped microphone, dropped samples: %"PRIu32" bytes received: %"PRIu32, this->state->overflow_cnt, this->state->bytes_received)
/* * 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...
{ struct tm francois_birthday = { .tm_sec = 0, .tm_min = 44, .tm_hour = 10, .tm_mday = 30, .tm_mon = 4, .tm_year = 89, }; cl_assert_equal_i(mktime(&francois_birthday), 612528240); struct tm rons_birthday = { .tm_sec = 17, .tm_min = 1, .tm_hour = 9, .tm_mday = 10, .t...
void test_mktime__epoch(void) { struct tm epoch = { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_mon = 0, .tm_year = 70, }; cl_assert_equal_i(mktime(&epoch), 0); } void test_mktime__leap(void) { struct tm real_leap = { .tm_sec = 0, .tm_min = 0, .tm_hour = 10, ...
nimation(AnimationState* state, const uint32_t now, AnimationPrivate *animation, int32_t add_delay_ms) { bool success = true; int child_idx; PBL_ASSERTN(animation != NULL); if (animation->play_count == 0) { // Play count of 0, no need to schedule it. return true; } ...
uint32_t child_start_time = now - child_position_inc_delay; if (serial_distance32(child_start_time, earliest_start_time) > 0) { // computes (earliest_start_time - child->abs_start_time_ms) earliest_start_time = child_start_time; } child_end_time = child_start_time + c...
prv_add_hr_metric_info(headings, headings_buf_size, values, values_buf_size, avg_hr, hr_zone_time_s)
; } else { // Unsupported activity type goto cleanup; } const NotificationConfig config = { .notif_time = notif_time, .insight_type = type, .icon_id = icon, .body = body, .headings = headings, .values = values, .open_app = { .enabled = true, .health_card_type = He...
_equal(&store->uuid, uuid); } static PersistStore * prv_find_open_store(const Uuid *uuid) { return (PersistStore *)list_find(s_client_stores, prv_uuid_list_filter, (void *)uuid); } static ALWAYS_INLINE void prv_lock(void) { mutex_lock_with_lr(s_mutex, (uint32_t)__builtin_ret...
(s_client_stores, &store->list_node)
ck(sizeof(*state)); *state = (HRMSubscriberState) { .session_ref = session_ref, .app_id = app_id, .task = current_task, .queue = pebble_task_get_to_queue(current_task), .callback_handler = callback, .callback_context = context, .update_interval_s = update_interval_s, .expire_utc = (exp...
(s_manager_state.lock)
; } static HRMSessionRef s_console_session = HRM_INVALID_SESSION_REF; static uint8_t s_tia_count = 0; static void prv_console_unsubscribe_callback(void *data) { sys_hrm_manager_unsubscribe(s_console_session); s_console_session = HRM_INVALID_SESSION_REF; prompt_command_finish(); } static void prv_console_read_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...
{ break; }
} } #endif
**************************/ /******************* Window Related Functions **************/ /***********************************************************/ static void handle_timer(struct tm *tick_time, TimeUnits units_changed) { struct FlashTestData *data = app_state_get_user_data(); // simply marking the window dirty...
fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)
); layer_add_child(&window->layer, &msg_text_layer->layer); TextLayer *status_text_layer = &data->status_text_layer; text_layer_init(status_text_layer, &GRect(0, 106, window->layer.bounds.size.w, 40)); text_layer_set_text_alignment(status_text_layer, GTextAlignmentCenter); text_layer_set_background_color(sta...
he License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specifi...
if (pattern_list[i] >= num_note_types) { return false; }
} GenericAttribute *repeat_delay_attribute = generic_attribute_find_attribute(&score->attr_list, VibeAttributeId_RepeatDelay, score->attr_list_size); if (repeat_delay_attribute) { if (repeat_delay_attribute->length != sizeof(uint16_t)) { return false; }...
_notification, false); } void test_gatt_client_subscriptions__notification_app_and_kernel_subscribers(void) { // Subscribe app: BLECharacteristic characteristic = prv_get_indicatable_characteristic(); BTErrno e = gatt_client_subscriptions_subscribe(characteristic, BLESubscriptionIndications, ...
(s_connection, s_handle, value, fill_entirely_size)
; prv_assert_notification_event_ext(characteristic, value, fill_entirely_size, false /* kernel */, true /* app */, false /* should_consume */); // Receive another GATT notification. Won't fit until consumed. Consuming is taking to long: fake_queue_set_yield_callback(gatt_clien...
pache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and...
if (app_id != INSTALL_ID_INVALID) { PebbleLaunchAppEventExtended* data = kernel_malloc_check(sizeof(PebbleLaunchAppEventExtended)); *data = (PebbleLaunchAppEventExtended) { .common.reason = APP_LAUNCH_WAKEUP, .wakeup.wakeup_id = wakeup_id, .wakeup.wakeup_reason = entry.reas...
} else { // If app running, send event PebbleEvent event = { .type = PEBBLE_WAKEUP_EVENT, .wakeup = { .wakeup_info = { .wakeup_id = wakeup_id, .wakeup_reason = entry.reason } } }; event_put(&event); } prv_wakeup_timer_next_pending(); } // Th...
.cb_data = data, }; regular_timer_add_minutes_callback(&data->reminder_watchdog_timer_id); } /////////////////////// // Clicks /////////////////////// static bool prv_should_show_action_in_action_menu(NotificationWindowData *data, const TimelineItem *item, ...
(window_data)
; const char *app_id = attribute_get_string(&item->attr_list, AttributeIdiOSAppIdentifier, ""); if (!*app_id) { PBL_LOG(LOG_LEVEL_ERROR, "Could not mute notification. Unknown app_id"); return; } const int app_id_len = strlen(app_id); iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_prefs((uint8_t ...
nt16_t); i++) { if ((services[i] > ReservedServiceMax) || (services[i] == ReservedServiceControl)) { has_valid_service = true; smartstrap_connection_state_set_by_service(services[i], true); } else { PBL_LOG(LOG_LEVEL_DEBUG, "Skipping invalid service_id 0x%x", services[i]); } ...
{ success = false; // TODO: We just got a bad frame, but time-out is the best error we have right now. Ideally, // we could validate the generic service header and drop this frame before we stop the read // timeout and then keep looking for a valid frame until the timeout is hit. result = Smartstrap...
else if (success && (header->error != GenericServiceResultOk)) { // The response was completely valid, but there was a non-Ok error returned success = false; // translate the error code to the appropraite SmartstrapResult if (header->error == GenericServiceResultNotSupported) { result = Smartstra...
/* * 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 (pfs_seek(fd, offset, FSeekSet) >= 0) { bytes_read = pfs_read(fd, data, num_bytes); // prevent invalid resource API return values if (bytes_read < 0) { bytes_read = 0; } }
pfs_close(fd); return bytes_read; } /////////////////////////////////////////////////////////////////////////////// // ResourceStoreTypeFile implementation static int prv_file_open_by_name(const char *name, uint8_t op_flags) { int fd = pfs_open(name, op_flags, FILE_TYPE_STATIC, 0); if ((fd < 0) && (fd != E...
/* * 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(GColorGreen.r == 0b00)
; cl_assert(GColorGreen.g == 0b11); cl_assert(GColorGreen.b == 0b00); cl_assert(GColorGreen.a == 0b11); } void test_graphics_colors__blue(void) { cl_assert(GColorBlue.r == 0b00); cl_assert(GColorBlue.g == 0b00); cl_assert(GColorBlue.b == 0b11); cl_assert(GColorBlue.a == 0b11); } void test_graphics_color...
to the app stack has lost focus // We do this by checking the last event, which should have been a focus // lost event. PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT); cl_assert_equal_i(event.app_focus.in_focus, false); cl_assert_equal_i(window_...
(window1, true)
ng) { GRect bottom_bounds = label_text_container; bottom_bounds.size.h = fade_height; bottom_bounds.origin.y = grect_get_max_y(&label_text_container) - (fade_height + VERTICAL_PADDING); graphics_draw_bitmap_in_rect(ctx, &aml->item_animation.fade_bottom, &bottom_bounds); } ...
prv_aml_is_short(aml)
) { return line_height; } #if PBL_ROUND return menu_layer_is_index_selected(menu_layer, cell_index) ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT; #else const int16_t max_visible_height = line_height * MAX_NUM_VISIBLE_LINES; const int16_t a...
for (int16_t y = start_y; y != end_y; y -= iterate_dir) { const GBitmapDataRowInfo dst_row_info = gbitmap_get_data_row_info(bitmap, y + delta_y); const GBitmapDataRowInfo src_row_info = gbitmap_get_data_row_info(bitmap, y); switch (bpp) { case 1: { // Note: this doesn't care about the boundin...
} GColor graphics_private_sample_line_color(const GBitmap *bitmap, GColorSampleEdge edge, GColor fallback) { if (!bitmap) { return fallback; } GColor color = fallback; const int bpp = gbitmap_get_bits_per_pixel(bitmap->info.format); const int16_t min_x = bitm...
// Verify count cl_assert_equal_i(prv_count_scheduled_animations(), 7); // Unschedule all animation_unschedule_all(); cl_assert_equal_i(prv_count_scheduled_animations(), 0); // Make sure just the setup and teardown handlers were called cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls...
animation_set_implementation(h, &implementation2.base)
; cl_assert(animation_get_implementation(h) != &implementation.base); cl_assert(animation_get_implementation(h) == &implementation2.base); // Custom Curve cl_assert(animation_get_custom_curve(h) != prv_custom_curve); animation_set_custom_curve(h, prv_custom_curve); cl_assert(animation_get_custom_curve(h) =...
d); cl_assert(rv == S_SUCCESS); rv = pfs_close(fd); // should not be able to double close an fd cl_assert(rv == E_INVALID_ARGUMENT); } void test_pfs__remove(void) { cl_assert(pfs_remove(NULL) == E_INVALID_ARGUMENT); char *fname = "abc"; int fd = pfs_open(fname, OP_FLAG_WRITE, FILE_TYPE_STATIC, 10 * 1024);...
pfs_active_in_region(0, pfs_get_size())
); // erase every page and make sure pfs is active pfs_format(true); cl_assert(pfs_active_in_region(0, pfs_get_size())); // write something on every page and make sure pfs is active char file_name[10]; for (int i = 0; i < num_pages(); i++) { snprintf(file_name, sizeof(file_name), "file%d", i); int...
le_line_ellipsis_clip_across_ny_descender); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_ny_descender.${BIT_DEPTH_NAME}.pbi")); // Ellipsis tests test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_l...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_x.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_outside_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb)...
charging(void) { uint8_t val; if (!prv_read_register(PmicRegisters_STATUSA, &val)) { #if defined (TARGET_QEMU) // NOTE: When running on QEMU, i2c reads return false. For now, just assume a failed // i2c read means we are charging return true; #else PBL_LOG(LOG_LEVEL_DEBUG, "Failed to read charging ...
(&BOARD_CONFIG_POWER.rail_6V6_ctrl, BOARD_CONFIG_POWER.rail_6V6_ctrl_otype, GPIO_Speed_50MHz)
; } // Interrupt config gpio_input_init_pull_up_down(&BOARD_CONFIG_POWER.pmic_int_gpio, GPIO_PuPd_UP); periph_config_release_lock(); return true; } static void prv_initialize_interrupts(void) { exti_configure_pin(BOARD_CONFIG_POWER.pmic_int, ExtiTrigger_Falling, pmic_interrupt_handler); exti_enable(BO...
ng firmware update"); uint32_t crc = crc_calculate_flash(flash_address, desc->firmware_length); return crc == desc->checksum; } static void prv_display_erase_progress( uint32_t progress, uint32_t total, void *ctx) { display_firmware_update_progress(progress, total * 2); } static bool erase_old_firmware(uint...
{ case UPDATE_FW_SUCCESS: break; case UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED: // Our firmware update failed in a way that didn't break our previous // firmware. Just run the previous code, whether that was normal firmware // or the recovery firmware. break; case UPDATE_FW_ERROR_MICRO_FLASH_MANG...
uint8_t bufcmp[PFS_SECTOR_SIZE * 2]; memset(&bufcmp[0], i, sizeof(bufcmp)); int fd = pfs_open(file_small, OP_FLAG_READ, FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); cl_assert_equal_i(pfs_read(fd, &buf[0], sizeof(buf)), sizeof(buf)); cl_assert(memcmp(buf, bufcmp, sizeof(buf)) == 0); cl_assert_equ...
(filename, "test%d", i + start_page_offset)
; int fd = pfs_open(filename, OP_FLAG_READ, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); pfs_close(fd); } } void test_pfs__remove_files(void) { pfs_format(true); pfs_init(false); // Create some files int fd; fd = pfs_open("a_test_0", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); ...
arator_mode(status_layer, OPTION_MENU_STATUS_SEPARATOR_MODE); status_bar_layer_set_colors(status_layer, GColorWhite, GColorBlack); layer_add_child(&window->layer, status_bar_layer_get_layer(status_layer)); } // Deinit the common status bar component. static void prv_deinit_status_bar(StatusBarLayer *status_layer) ...
("Core Dump Reset")
; Dialog *dialog = expandable_dialog_get_dialog(s_dialog); dialog_set_text(dialog, i18n_get("The core dump was created successfully. " "Please create a support request as usual.", s_dialog)); dialog_set_text_color(dialog, GColorWhite); dialog_set_background_color(dialog, GColorRed); i18n_free_all(s_di...
me(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(4))); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5))); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); cl_check(gbitmap_pbi_...
(gbitmap_pbi_eq(bitmap, GET_PBI_NAME(5)))
; #endif } // Tests APNG file with 8-bit color, 5 frames and loop = 1 // Tests gbitmap_sequence_update_bitmap_by_elapsed with 0 delay frames for 1, 4 and 5 // and 2 & 3 have delay 1000ms // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit_coin_round(void) { #if PLATFORM_SPAL...
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE))
; } void test_health_activity_summary_card__render_current_above_typical4(void) { HealthData health_data = { .step_data = 866, .step_averages = {10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ...
if (!buffer_size) { return NULL; }
if (!min_num_messages) { return NULL; } buffer_size += (min_num_messages * sizeof(AppInboxMessageHeader)); uint8_t *buffer = applib_zalloc(buffer_size); if (!buffer) { PBL_LOG(LOG_LEVEL_ERROR, "Not enough memory to allocate App Inbox of size %"PRIu32, (uint32_t)buffer_size); return 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...
{ for (int i = 0; i < NumConnectionsToDebounce; i++) { s_debounce_timers[i].cb = prv_handle_disconnection_debounced; s_debounce_timers[i].cb_data = (void *)(uintptr_t)i; } // initial state of the connections s_debounced_state_is_connected[MobileAppDebounce] = (comm_session_get_system_session() != NULL)...
DEFINE_SYSCALL(bool, sys_mobile_app_is_connected_debounced, void) { return s_debounced_state_is_connected[MobileAppDebounce]; } DEFINE_SYSCALL(bool, sys_pebblekit_is_connected_debounced, void) { return s_debounced_state_is_connected[PebbleKitDebounce]; } #define DISCONNECT_HIDE_DURATION_SECS 25 void debounced_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...
enter_standby(RebootReasonCode_MfgShutdown)
; } void command_color_read(void) { char buffer[10]; prompt_send_response_fmt(buffer, sizeof(buffer), "%d", mfg_info_get_watch_color()); } void command_color_write(const char* color_num) { char *end; int color = strtol(color_num, &end, 10); if (*end) { prompt_send_response("Invalid color"); return;...
/* * 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...
malloc(sizeof(FrameBuffer))
ASSERT_CALLED(graphics_circle_draw_stroked_aa(&context, GPoint(50, 50), 10, SW_ODD))
; #else ASSERT_CALLED(graphics_circle_draw_stroked_non_aa(&context, GPoint(50, 50), 10, SW_ODD)); #endif setup_test(&context, true, SW_ODD, 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, &GRec...
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, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expres...
{ return false; }
((AnimationPrivate*)animation)->abs_start_time_ms = 0; ((AnimationPrivate*)animation)->scheduled = true; return true; } bool WEAK animation_unschedule(Animation *animation) { if (!animation) { return false; } ((AnimationPrivate*)animation)->scheduled = false; return true; } void WEAK animation_unsc...
flags_set = false; return_status = FLASH_COMPLETE; flash_written_data = NULL; flash_written_flag = NULL; flash_data_start = 0; flash_data_length = 0; callback_called = false; } void test_system_flash__cleanup(void) { free(flash_written_data); free(flash_written_flag); } void test_system_flash__erase_z...
cl_assert(callback_called)
; } void test_system_flash__write_error(void) { return_status = FLASH_ERROR_OPERATION; malloc_flash_data(10); flash_data_start = FLASH_BASE; cl_assert(!system_flash_write(FLASH_BASE, "abc", 3, NULL, NULL)); cl_assert(flash_locked); assert_flash_unwritten(0, 10); } extern void FLASH_Lock(void) { flash_lo...
==================================================================================================== // Public functions // ------------------------------------------------------------------------------------------------- // Setup a very high priority interrupt to fire periodically. This ISR will call task_watchdog_fe...
TIM_Cmd(TIM2, DISABLE)
; s_ticks_since_successful_feed += timer_ticks_elapsed; TIM_Cmd(TIM2, ENABLE); } TIM2->CNT = timer_ticks % TIME_PERIOD; prv_task_watchdog_feed(); } #define WATCHDOG_WARN_TICK_CNT (5 * TIMER_INTERRUPT_HZ) /* 5s */ #define WATCHDOG_COREDUMP_TICK_CNT ((65 * TIMER_INTERRUPT_HZ) / 10) /* 6.5 s ...
int32_t flash_new_fw_addr) { display_firmware_update_progress(0, 1); boot_bit_set(BOOT_BIT_NEW_FW_UPDATE_IN_PROGRESS); FirmwareDescription firmware_description = firmware_storage_read_firmware_description(flash_new_fw_addr); if (!firmware_storage_check_valid_firmware_description(&firmware_description)) ...
boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)
; boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); system_reset(); } else if (!boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)) { dbgserial_putstr("Failed to load recovery firmware, strike two. Try again."); boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); boot_bit_set(BOOT...
heck_buffer_for_content_indicator(i, content_indicator); } // Creating more content indicators than the buffer can hold should return NULL cl_assert_equal_p(content_indicator_create(), NULL); } void test_content_indicator__init_should_add_to_buffer(void) { ContentIndicator content_indicator; for (size_t i =...
{ ContentIndicator content_indicator; content_indicator_init(&content_indicator); ContentIndicatorDirectionData *direction_data = content_indicator.direction_data; const ContentIndicatorConfig dummy_config = helper_get_dummy_config(); const ContentIndicatorDirection direction = ContentIndicatorDirectionUp; ...
void test_content_indicator__creating_for_scroll_layer(void) { ScrollLayer scroll_layer; ContentIndicator *content_indicator = content_indicator_get_or_create_for_scroll_layer( &scroll_layer); cl_assert(content_indicator); // Should save a reference to the scroll layer cl_assert_equal_p(content_indicato...
void prv_handle_incoming_call(const PebblePhoneEvent *event) { // Only 1 call at a time is supported if (s_call_in_progress) { PBL_LOG(LOG_LEVEL_INFO, "Ignoring incoming call. A call is already in progress"); return; } // If we're not on iOS9+, we need to be connected to the mobile app since it tells u...
new_timer_scheduled(s_call_watchdog, NULL)
)) { // Be careful not to spam the logs with the new iOS polling implementation PBL_LOG(LOG_LEVEL_INFO, "PebblePhoneEvent: %d, Call in progress: %s, Connected: %s", event.type, s_call_in_progress ? "T": "F", s_mobile_app_is_connected ? "T": "F"); } switch (event.type) { case PhoneEventType_Incomi...
text) { TimelineActionMenu *timeline_action_menu = context; const TimelineItem *pin = timeline_action_menu->item; const TimelineItemAction *action = action_menu_item->action_data; // The new time is: // 12pm if created before 10am, // 6pm if created before 4pm, // 2 hours from time of creation otherwise ...
kernel_ui_set_current_timeline_item_action_source(source)
; ActionMenuLevel *root_level = prv_create_level(num_items, NULL); root_level->separator_index = separator_index; prv_request_responsive_session(); return root_level; } static void prv_cleanup_action_menu(ActionMenu *action_menu) { ActionMenuLevel *root_level = action_menu_get_root_level(action_menu); a...
RIGIN_RECT_CLIP_XY, true, 3); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_aa_sw3_clip_xy.${BIT_DEPTH_NAME}.pbi")); #en...
(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, false, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw1_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // SW = 2 setup_test_aa_sw(&ctx, fb...
} return 0; } static int prv_app_override_comparator(AppInstallId app_id, AppInstallId new_id) { return (prv_override_index(app_id) - prv_override_index(new_id)); } static int prv_comparator_ascending_zero_last(unsigned int a, unsigned int b) { return ((a != 0) && (b != 0)) ? (b - a) : // Sort in ascending orde...
{ data_source->callbacks.changed(data_source->callback_context); }
} static void prv_do_app_added(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_removed(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_icon_name_updated(AppMenuDataSource *source, AppInstallId install_id); static void prv_do_app_db_cleared(AppMenuDataSource *sou...
E_RESOLUTION_US; return time_since_data_collection_us; } // determines if a new sample was collected between the two sensor timestamps // provided static bool prv_new_sample_collected(uint8_t sensor_timestamp_before[3], uint8_t sensor_timestamp_after[3]) { uint32_t start_time = prv_sensortime_to_timestamp(se...
{ int32_t direction; IMUCoordinateAxis axis = prv_get_axis_direction(int0_status, int2_status, BMI160_INT_STATUS_2_TAP_SIGN, BMI160_INT_STATUS_2_TAP_FIRST_X, &direction); if (double_tap) { BMI160_DB...
else if (!anymotion) { BMI160_DBG("Wahh, no motion/tap?: INT0: 0x%"PRIx8", INT2: 0x%"PRIx8, int0_status, int2_status); prv_dump_int_stats(); } if (toggled_power_mode) { bmi160_set_accel_power_mode(BMI160_Accel_Mode_Low); } } // TODO: strictly for debug, remove when done static void prv_dump_int_sta...
bmp->palette; src_color = palette[cindex]; } return src_color; } #endif void graphics_draw_rotated_bitmap(GContext* ctx, GBitmap *src, GPoint src_ic, int rotation, GPoint dest_ic) { PBL_ASSERTN(ctx); if (rotation == 0) { graphics_draw_bitmap_in_rect( ctx, src, &(...
for (int x = dest_clip.origin.x; x < dest_clip.origin.x + dest_clip.size.w; ++x) { // only draw if within the dest range const GBitmapDataRowInfo dest_info = gbitmap_get_data_row_info(dest_bitmap, y); if (!WITHIN(x, dest_info.min_x, dest_info.max_x)) { continue; } const int32_t co...
const int32_t vert_contrib[3] = { src_vector_y.rem < 0 ? (-src_vector_y.rem) >> 3 : 0, src_vector_y.rem < 0 ? (TRIG_MAX_RATIO + src_vector_y.rem) >> 3 : (TRIG_MAX_RATIO - src_vector_y.rem) >> 3, src_vector_y.rem < 0 ? 0 : (src_vector_y.rem) >> 3 }; ...
w_text_single_line_wordwrap_clip_across_nx(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(-44, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_cl...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_across_x.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_ellipsis_clip_outside_ny); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_ellipsis_clip_outside_ny.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb)...
n_attr_list, AttributeIdShortSubtitle, short_subtitle); attribute_list_add_cstring(&pin_attr_list, AttributeIdSubtitle, elapsed); const char *title_i18n = PBL_IF_RECT_ELSE(i18n_noop("YOU NAPPED"), i18n_noop("Of napping")); attribute_list_add_cstring(&pin_attr_list, ...
(now_utc, session, &pin_uuid)
8}, { -8, 1048, -320}, { -56, 912, -344}, { -80, 656, -344}, { -120, 376, -224}, { -88, 152, -184}, { -32, 136, -144}, { -32, 96, -128}, { -120, 144, -128}, { -344, 536, -136}, { -704, 1112, -304}, { -936, 984, -384}, { -1256, 608, -288}, // 42 seconds { -1872, 61...
{ -256, 904, -80}, { -120, 656, -72}, // 47 seconds { -24, 480, -32}, { 96, 408, 56}, { 184, 368, -16}, { 368, 472, 0}, { 312, 536, -48}, { 368, 696, -88}, { 440, 856, -72}, { 536, 912, -56}, { 568, 1136, 56}, { 496, 1144, 64}, { 504, 1128, 72}, { 408, 1032, -...
{ -1464, 440, -32}, { -1416, 296, -88}, { -1112, 208, -48}, { -1032, -136, 112}, { -1064, 72, 32}, { -1128, 8, 8}, { -1104, 56, -8}, { -1168, 64, 40}, { -1184, 48, -48}, { -968, -56, -160}, { -1256, -8, -200}, // 50 seconds { -1088, 96, -304}, { -1096, 8, -328}, ...
Fakes /////////////////////////////////////////////////////////// #include "fake_events.h" #include "fake_rtc.h" #include "fake_session.h" #include "fake_system_task.h" #include "stubs_app_manager.h" #include "stubs_app_install_manager.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_bt_loc...
cl_assert_equal_i(e.type, PEBBLE_NULL_EVENT)
/* * 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...
(dstbuf, "There are 4 lights, -4")
-232}, { -1112, 128, -96}, { -968, 88, -16}, { -992, 88, 16}, { -928, 80, 56}, { -928, 88, 80}, { -920, 96, 96}, { -1024, 120, 200}, { -1040, 80, 136}, { -1080, 120, 80}, { -1320, 120, 24}, // 52 seconds { -1368, 176, -304}, { -1080, 96, -336}, { -1120, -160, -25...
{ -1112, 104, -128}, { -968, 72, -24}, { -760, 0, -80}, { -648, 80, -88}, { -560, 128, -104}, { -584, 136, -40}, { -752, 320, -40}, { -840, 624, -128}, { -1200, 760, -64}, { -1272, 1152, -176}, { -1032, 1152, -216}, { -896, 776, -136}, { -808, 616, -40}, { -752, 5...
{ 240, 1056, -96}, { 160, 1176, -232}, // 60 seconds // elapsed: 1 minutes { 272, 1000, -224}, { 152, 904, -432}, { 88, 536, -560}, { -80, 64, -656}, { -176, -8, -880}, { -200, -96, -840}, { -248, -296, -792}, { -240, -536, -856}, { -272, -296, -904}, { -192, -45...
on *session, const uint8_t* data, unsigned int length) { char sub_command = *data++; switch (sub_command) { // Get time request: case 0x00: { time_t t = rtc_get_time(); // Send Get time response (0x01): const unsigned int response_buffer_length = 1 + 4; uint8_t response_buffer[resp...
i18n_noop("%l:%M")
/* * 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...
bt_ctl_is_bluetooth_active()
/* * 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...
vSemaphoreDelete(info.interlock)
; if (info.count > 0 && !info.dump) { prompt_send_response("Couldn't allocate buffers for window stack data"); goto cleanup; } char buffer[128]; prompt_send_response_fmt( buffer, sizeof(buffer), "Window Stack, top to bottom: (%zu)", info.count); for (size_t i = 0; i < info.count; ++i) { ...
imation, false, (void *)(uintptr_t)distance /*context*/); DPRINTF("%"PRIu64" ms: Executing update handler for %d, distance: %d\n", prv_now_ms(), (int)animation, (int)distance); } // -------------------------------------------------------------------------------------- static int s_...
{ // Make sure no animations were left over cl_assert_equal_i(prv_count_animations(), 0); }
// -------------------------------------------------------------------------------------- // Test a basic layer_frame property animation // Test that the started and stopped handlers get called at the right time void test_animation__property_layer_frame(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h;...
LOCK_SMALL, RESOURCE_ID_ALARM_CLOCK_LARGE }, [TimelineResourceTestTimelineId_Basketball] = { RESOURCE_ID_BASKETBALL_TINY, RESOURCE_ID_BASKETBALL_SMALL, RESOURCE_ID_BASKETBALL_LARGE }, }; typedef struct TimelineResourceTestAppData { AppInstallEntry install_entry; const uint32_t (*resource_lut)[TimelineRes...
{ const TimelineResourceTestAppData *data = prv_get_data_for_app_with_uuid(uuid); return NULL_SAFE_FIELD_ACCESS(data, install_entry.install_id, INSTALL_ID_INVALID); }
bool app_install_get_entry_for_install_id(AppInstallId install_id, AppInstallEntry *entry) { if (!entry) { return false; } const TimelineResourceTestAppData *data = prv_get_data_for_app_with_id(install_id); if (!data) { return false; } *entry = data->install_entry; return true; } ResAppNum app...
peek_animations_draw_timeline_speed_lines(ctx, offset); } const int16_t sidebar_width = timeline_layer->sidebar_width; const GRect sidebar_rect = GRect(bounds->size.w - sidebar_width, 0, sidebar_width, bounds->size.h); graphics_context_set_fill_color(ctx, timeline_layer-...
for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1; i++) { layer->layouts[i] = layer->layouts[i + 1]; layer->layouts_info[i] = layer->layouts_info[i + 1]; }
layer->layouts[TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1] = NULL; layer->layouts_info[TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER - 1] = NULL; } else if (delta == -1) { if (layer->layouts[s_nonvisible_items[1]]) { prv_destroy_layout(layer, s_nonvisible_items[1]); } for (int i = TIMELINE_NUM_ITEMS_I...
emu_serial_private.h" #include "drivers/qemu/qemu_settings.h" #include "drivers/uart.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "popups/timeline/peek.h" #include "process_management/app_manager.h" #include "shell/system_theme.h" #include "services/common/clock.h" #include "services/common/sys...
timeline_peek_set_enabled(hdr->enabled)
; #endif } static void prv_content_size_msg_callback(const uint8_t *data, uint32_t len) { QemuProtocolContentSizeHeader *hdr = (QemuProtocolContentSizeHeader *)data; if (len != sizeof(*hdr)) { PBL_LOG(LOG_LEVEL_ERROR, "Invalid packet length"); return; } PBL_LOG(LOG_LEVEL_DEBUG, "Got content size msg:...
in active cl_assert_equal_b(s_app_idle, false); // Assert that the window pushed onto the app stack has lost focus // We do this by checking the last event, which should have been a focus // lost event. PebbleEvent event = fake_event_get_last(); cl_assert_equal_i(event.type, PEBBLE_APP_WILL_CHANGE_FOCUS_EV...
window_stack_count(app_stack)
, 0); window_destroy(window1); window_destroy(window2); } // Description: // This test ensures that the flow of adding a window to the window stack is followed // correctly. That is, we add the window to the window stack, its load handler is // called, it calls to set the click config, and the click config is se...
graphics_text_node_create_vertical(max_vertical_container_nodes)
; vertical_container_node->vertical_alignment = GVerticalAlignmentCenter; graphics_text_node_container_add_child(&vertical_container_node->container, node); return &vertical_container_node->container.node; } static GTextNode *prv_create_subtitle_node(LauncherAppGlanceStructured *structured_glance) { PBL_ASSE...
} else { cl_assert_equal_p(NULL, info->handler); } } void test_ble_hrm__cleanup(void) { ble_hrm_deinit(); prv_assert_event_service_subscribed(false); // hrm manager sub vs unsub calls should be the same, there should be no subscription any more // after de-initing: cl_assert_equal_i(s_sys_hrm_manage...
ble_hrm_is_sharing_to_connection(&s_conn_b)
); prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_b)); prv_assert_event_service_subscribed(true); cl_assert_equal_i(s_hrm_manager_subscribe_with_callback_call_count, 1); cl_assert_equal_i(s_sys_hrm_manager_unsubscribe_call_count, ...
ken) + 1, "%d", &state->test_entry.in_deep_sleep.value); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.in_deep_sleep.min); } else if (strcmp(token, "TEST_IN_DEEP_SLEEP_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d"...
sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.value)
; } else if (strcmp(token, "TEST_ACTIVITY_TYPE_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.min); } else if (strcmp(token, "TEST_ACTIVITY_TYPE_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.activity_type.max); } else ...
lue += FIXED_S16_3_HALF.raw_value; cl_assert_equal_grect(GRect(5, 4, 2, 2), grect_centered_internal(&p2, GSize(2, 2))); // Repeat for a positive offset center point with 0.5 fractions GPointPrecise p3 = GPointPreciseFromGPoint(GPoint(5, 5)); p3.x.raw_value += FIXED_S16_3_HALF.raw_value; p3.y.raw_value += FIX...
grect_polar_calc_values(&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_calc_values(&r, mode, &center...
parse_func = parse_power_level; } break; case BLEAdTypeManufacturerSpecific: if (callbacks->manufacturer_cb) { parse_func = parse_manufact_spec; } break; default: // parse_func == NULL break; } // switch() if (parse_func) { if (!...
(ctx->size, length + 1 /* zero terminator */)
; memcpy(ctx->buffer, local_name_bytes, copied_size - 1); ctx->buffer[copied_size - 1] = 0; // zero terminator ctx->copied_size = copied_size; return false; // stop parsing } size_t ble_ad_copy_local_name(const BLEAdData *ad, char *buffer, size_t size) { struct LocalNameCtx ctx = { .buffer = buffer, ...
t16_t prv_information_get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { return PBL_IF_RECT_ELSE(menu_cell_basic_cell_height(), (menu_layer_is_index_selected(menu_layer, cell_index) ? ...
i18n_get("Information", data)
); // Create the menu MenuLayer *menu_layer = &data->menu_layer; GRect bounds = data->window.layer.bounds; const GEdgeInsets menu_layer_insets = (GEdgeInsets) { .top = STATUS_BAR_LAYER_HEIGHT, .bottom = PBL_IF_RECT_ELSE(0, STATUS_BAR_LAYER_HEIGHT) }; bounds = grect_inset(bounds, menu_layer_insets);...
48}, { -352, -72, -1200}, { -520, 24, -1072}, { -752, 168, -968}, { -800, 264, -904}, { -896, 360, -752}, { -912, 216, -472}, { -920, 168, -464}, { -784, 72, -456}, { -792, -232, -368}, { -752, -32, -520}, { -592, 56, -480}, { -432, 72, -680}, { -240, 8, -520}, { ...
{ -416, -104, -368}, { -320, 264, -160}, { -504, 896, -456}, { -864, 720, -208}, { -1288, 1272, -336}, { -1376, -104, -704}, { -704, 632, -216}, { -568, 768, -472}, { -280, -192, -712}, { -832, 312, -744}, { -504, -24, -752}, { -464, -248, -744}, { -304, -416, -720}, ...
{ -96, -736, -808}, { -144, -720, -752}, { -216, -776, -848}, { -224, -696, -840}, { -352, -672, -888}, { -336, -768, -856}, { -400, -752, -872}, { -368, -736, -920}, { -312, -520, -896}, { -448, -648, -912}, { -584, -424, -752}, { -376, -728, -872}, { -544, -424, -7...
n dls_lock_session). dls_assert_own_list_mutex(); if (session->status != DataLoggingStatusActive) { // Already inactive return true; } PebbleTask task = (PebbleTask)(uintptr_t)data; // System data logging sessions are responsible for killing themselves Uuid system_uuid = UUID_SYSTEM; if (!uuid_e...
(task == PebbleTask_Worker || task == PebbleTask_KernelMain || task == PebbleTask_KernelBackground)
; buffer = kernel_malloc_check(buf_size); logging_session->data->buffer_in_kernel_heap = true; } logging_session->data->buffer_storage = buffer; shared_circular_buffer_init(&logging_session->data->buffer, logging_session->data->buffer_storage, buf_size...
lease_helper(slave); } void spi_slave_burst_read_write_scatter(const SPISlavePort *slave, const SPIScatterGather *sc_info, size_t num_sg) { prv_spi_acquire_helper(slave); spi_ll_slave_burst_read_write_scatter(slave, sc_info, num_sg); prv_spi_release_helpe...
prv_spi_send_data(slave->spi_bus, *(cptr++))
t8_t *data_out; uint16_t contiguous_num_bytes_left = circular_buffer_write_prepare(&buffer, &data_out); cl_assert_equal_i(contiguous_num_bytes_left, 4); memcpy(data_out, "456", 3); circular_buffer_write_finish(&buffer, 3); cl_assert_equal_i(circular_buffer_get_write_space_remaining(&buffer), 1); cl_assert_...
(&buffer, storage, sizeof(storage))
; uint8_t letterA = 'A'; cl_assert(circular_buffer_write(&buffer, &letterA, sizeof(letterA))); uint8_t *data_buf; uint16_t num_bytes = circular_buffer_write_prepare(&buffer, &data_buf); cl_assert_equal_i(sizeof(storage) - sizeof(letterA), num_bytes); uint8_t letterB = 'B'; data_buf[0] = letterB; cl_...
ulated_crc = crc_calculate_bytes( (const uint8_t*) FIRMWARE_BASE, firmware_description->firmware_length); dbgserial_print("Checksum - wanted "); dbgserial_print_hex(firmware_description->checksum); dbgserial_print(" got "); dbgserial_print_hex(calculated_crc); dbgserial_putstr(""); return calculated...
boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE)
) { dbgserial_putstr("Failed to load recovery firmware, strike one. Try again."); boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); system_reset(); } else if (!boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)) { dbgserial_putst...
, mfg_info_get_disp_offsets().y); } void command_disp_offset_write(const char* offset_x_str, const char* offset_y_str) { char *nonnumeric_x, *nonnumeric_y; int8_t offset_x = strtol(offset_x_str, &nonnumeric_x, 10); if (*nonnumeric_x) { prompt_send_response("Invalid x offset"); } ...
("Not configured for bootloader test")
; } #endif
status_notifications(connection); } else if (handle == s_pps_ctx.att_hdl.gatt_mtu_cccd) { notifications_enabled = connection_is_subscribed_to_gatt_mtu_notifications(connection); } const uint16_t cccd_value = notifications_enabled ? GATT_CCC_NOTIFICATIONS : 0; memcpy(response_buffer, &cccd_value, sizeof(cccd...
hc_endpoint_pebble_pairing_service_send_ios_app_termination_detected()
; } } else if (evt->handle == s_pps_ctx.att_hdl.gatt_mtu_cccd) { connection_set_subscribed_to_gatt_mtu_notifications(connection, is_subscribed); value_handle = s_pps_ctx.att_hdl.gatt_mtu; } else if (evt->handle == s_pps_ctx.att_hdl.conn_params_cccd) { connection_set_subscribed_to_conn_param_notifica...
e_rtc_time_state_exact(TICKS_IN_AN_INTERVAL - (RTC_TICKS_HZ - (before_ticks % RTC_TICKS_HZ)), ticks_to_time(s_coarse_ticks)); //save_rtc_time_state(0); } void rtc_init(void) { periph_config_acquire_lock(); rtc_enable_backup_regs(); periph_config_release_lock(); restore_rtc_time_state(); initialize_fast_mo...
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &alarm_config)
; RTC_ITConfig(RTC_IT_ALRA, ENABLE); RTC_AlarmCmd(RTC_Alarm_A, ENABLE); RTC_ClearFlag(RTC_FLAG_ALRAF); EXTI_ClearITPendingBit(EXTI_Line17); RTC_ClearITPendingBit(RTC_IT_ALRA); } RtcTicks rtc_alarm_get_elapsed_ticks(void) { return rtc_get_ticks() - s_alarm_set_time; } bool rtc_alarm_is_initialized(void) ...
/* * 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_Init(GPIOC, &GPIO_InitStructure)
; /* USART configuration */ USART_InitStructure.USART_BaudRate = SERIAL_BAUD_RATE; USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_Parity = USART_Parity_No; USART_InitStructure.USART_HardwareFlowControl = USART_Har...
/* * 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(APP_LOG_LEVEL_DEBUG, "localtime: %s", localtime_strftime_buf)
256}, { 768, -88, -360}, { 760, -88, -336}, { 1104, -72, -224}, { 1424, 24, -320}, { 1648, 80, -264}, // 45 seconds { 1792, 168, -448}, { 1392, 400, -472}, { 984, 360, -208}, { 880, 336, -200}, { 1088, 328, -216}, { 1184, 352, -136}, { 1168, 368, -168}, { 1576, 43...
{ 1240, 216, -448}, { 912, 200, -408}, { 728, 200, -296}, { 760, 184, -296}, { 824, 208, -248}, { 904, 240, -224}, { 912, 272, -256}, { 1320, 256, -304}, { 1344, 376, -240}, { 1280, 456, -240}, { 1368, 568, -440}, { 976, 600, -472}, { 1000, 504, -416}, { 1328, 400...
{ 1456, 328, -544}, { 1704, 352, -336}, // 53 seconds { 1432, 224, -136}, { 1208, 144, -112}, { 1048, 128, 80}, { 896, 56, -16}, { 872, -16, 24}, { 856, 344, 144}, { 1168, 16, -56}, { 1168, 24, -56}, { 1104, 80, -96}, { 1224, 24, -152}, { 1336, 56, -184}, { 1...
ate(start_page, TMP_STATE_OFFSET, TMP_STATE_DONE)); } static uint32_t compute_pg_header_crc(PageHeader *hdr) { PageHeader crc_hdr = *hdr; // don't factor fields which can change after file write into crc calc crc_hdr.last_written = 0xff; return legacy_defective_checksum_memory(&crc_hdr, ...
{ if (read_header(pg, &pg_hdr, &file_hdr) == HdrCrcCorrupt) { PBL_LOG(LOG_LEVEL_WARNING, "%d: CRC corrupt", pg); continue; } *page = pg; return (S_SUCCESS); }
er.h" #include "launcher_menu_layer_private.h" #include "applib/app_glance.h" #include "applib/ui/kino/kino_reel.h" #include "kernel/events.h" #include "kernel/pbl_malloc.h" #include "system/passert.h" #include "util/attributes.h" #include "util/size.h" #include "util/struct.h" #include "util/uuid.h" //! Cache twice ...
_Static_assert((offsetof(LauncherAppGlanceCacheEntry, node) == 0), "ListNode is not the first field of LauncherAppGlanceCacheEntry")
; static void prv_glance_cache_destroy_entry(LauncherAppGlanceService *service, LauncherAppGlanceCacheEntry *entry) { if (!entry) { return; } if (service) { PBL_ASSERTN(entry->glance); KinoReel *glance_reel = entry->glance->reel; // Set the glance reel...
/* * 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 (!strcmp(model, "1002")) { // SilkHR return true; }
return false; #endif } #endif #if MFG_INFO_RECORDS_TEST_RESULTS void mfg_info_write_test_result(MfgTest test, bool pass) { MfgData data = prv_fetch_struct(); data.test_results[test] = pass; prv_update_struct(&data); } bool mfg_info_get_test_result(MfgTest test) { MfgData data = prv_fetch_struct(); return...
rap_layer, GColorWhite); if (data->select_index == SelectIndexDirection) { text_layer_set_text_color(&data->direction_layer, GColorWhite); text_layer_set_background_color(&data->direction_layer, GColorBlack); } else if (data->select_index == SelectIndexOverflow) { text_layer_set_text_color(&data->word_...
(window, &(WindowHandlers) { .load = prv_window_load, })
; const bool animated = true; app_window_stack_push(window, animated); } //////////////////// // App boilerplate static void handle_init(void) { struct AppState* data = app_malloc_check(sizeof(struct AppState)); app_state_set_user_data(data); push_window(data); } static void handle_deinit(void) { struc...
/* * 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 (!failure_occurred) { // Don't overwrite failure_occurred if a failure has already occurred failure_occurred = boot_bit_test(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); }
// Skip safe teardown if doing so the first time already caused a second reset attempt; or // if we're in a critical section, interrupt or if the scheduler has been suspended if (!already_failed && !mcu_state_is_isr() && !portIN_CRITICAL() && (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)) { syst...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pulse_link_send_begin(this->protocol_number)
; memcpy(packet, bad_packet, ntoh16(bad_packet->length)); packet->code = ControlCode_ConfigureReject; pulse_link_send(packet, ntoh16(bad_packet->length)); } static void prv_send_terminate_request(PPPControlProtocol *this) { this->state->restart_count--; prv_start_timer(this); uint8_t id = this->state->next...
/* * 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...
modal_manager_get_properties()
& ModalProperty_Transparent); } typedef struct { GDrawCommandProcessor draw_command_processor; GContext *ctx; GColor stroke_color; // replace red to this GColor key_color; // replace this color with overdraw_color GColor overdraw_color; // replace key_color with this GColor app_fb_key_color; // replace wi...
, DLS_SESSION_MAX_BUFFERED_ITEM_SIZE); chunk_size -= (chunk_size % item_size); } PBL_ASSERTN(chunk_size <= num_bytes); data_logging_log(logging_session, buf, chunk_size / item_size); fake_system_task_callbacks_invoke_pending(); buf += chunk_size; num_bytes -= chunk_size; } } // --------...
cl_assert(logging_sessions[i])
; } // Log Consume for (int i = 0; i < 10; i++) { prv_log_consume_random(logging_sessions[i], item_size, rand() % 16); } } // ---------------------------------------------------------------------------------------- void test_data_logging__log_consume_large_items(void) { DataLoggingSessionRef logging_se...
if (left <= length) { goto _out_of_size; } memcpy(dest_str, fmt, length); dest_str += length; left -= length; fmt = ptr + 1; // End of string if (*ptr == '\0' || *fmt == '\0') { break; } char pad = '\0'; size_t width = 0; // Process flags // These are th...
(prv_iso8601_year(t) % 100, 2, INTFMT_PADZERO)
{ new_timer_stop(s_read_timer); }
} // Receive functions //////////////////////////////////////////////////////////////////////////////// static void prv_read_complete_system_task_cb(void *context_ptr) { PBL_ASSERT_TASK(PebbleTask_KernelBackground); ReadCompleteContext context = { .context_ptr = context_ptr }; smartstrap_state_lock(); if (s...
down to the sampling // frequency (samples * baud_rate) and store it in USART_BBR as a fixed-point number with a // franctional component equal to the number of samples per symbol. In other words, if OVER8=0, // the fractional component will be 4 bits, and if OVER8=1, it will be 3 bits. // The formula works out...
if (enabled) { dev->state->tx_int_enabled = true; dev->periph->CR1 |= USART_CR1_TXEIE; prv_set_interrupt_enabled(dev, true); } else { // disable interrupt if RX is also disabled prv_set_interrupt_enabled(dev, dev->state->rx_int_enabled); dev->periph->CR1 &= ~USART_CR1_TXEIE; dev->state->tx...
{ 1560, 320, 64}, { 1448, 312, 16}, { 1424, 272, 32}, { 1456, 344, 8}, { 1304, 288, 56}, { 1152, 232, 104}, { 1176, 240, 32}, { 904, 216, 16}, { 1120, 136, 112}, { 920, 80, 144}, { 1096, 296, -48}, { 1136, 288, -40}, { 1328, 328, -72}, { 1352, 376, -152}, { 11...
{ 640, -328, -1216}, { 440, -64, -1208}, { 656, 856, -992}, { 680, 736, -608}, { 504, 352, -344}, { 296, 0, -216}, { 160, 40, -384}, { 136, 120, -192}, { 544, 408, -296}, { 832, 488, -592}, { 1088, 416, -416}, { 1680, 200, -56}, // 16 seconds { 2360, 248, -72}, ...
{ 1192, 336, -184}, { 992, 200, -112}, { 1120, 256, -144}, { 1272, 328, -128}, { 1264, 448, -120}, { 1032, 520, -104}, { 1352, 592, -88}, { 1184, 696, 24}, { 952, 592, -104}, { 1384, 656, -136}, { 1376, 728, -128}, { 1104, 576, -32}, { 1248, 576, 8}, { 1416, 536,...
/* * 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...
{ workout_data->avg_pace = health_util_get_pace(workout_data->duration_s, workout_data->distance_m); }
} void workout_data_fill_metric_value(WorkoutMetricType type, char *buffer, size_t buffer_size, void *i18n_owner, void *data) { int32_t metric_value = workout_data_get_metric_value(type, data); switch (type) { case WorkoutMetricType_Hr: case WorkoutMetricType_Steps: ...
btitle = "Kaboom, Redwood City", .icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR, }, &(TimelineItemConfig) { .relative_timestamp = 12 * SECONDS_PER_HOUR, .duration = MINUTES_PER_HOUR, .title = "Design Review Meeting", .subtitle = "Batavia, Palo Alto", .icon = TIMELINE_R...
{ prv_create_and_render_pin_and_fin(false /* past */); FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE(); }
ctivitySleepStateLightSleep); // Awake for 2 hours which puts us at 1am prv_feed_cannned_accel_data(120 * SECONDS_PER_MINUTE, 20, ActivitySleepStateAwake); // Now if we get sleep history, we should have 2.5 hours yesterday, and 2 hours today ASSERT_EQUAL_METRIC_HISTORY(ActivityMetricSleepTotalSeconds, (...
(captured_data, k_raw_samples)
; cl_assert_equal_m(raw_data, captured_data, k_raw_samples * sizeof(AccelRawData)); } } // --------------------------------------------------------------------------------------- // Test getting the sleep sessions void test_activity__get_sleep_sessions(void) { int32_t value; // Start activity tracking. Thi...
new_connectivity_icon_id = RESOURCE_ID_CONNECTIVITY_BLUETOOTH_CONNECTED; // probably need an All Muted icon here } // replace the image if the connectivity ResourceId has changed if (data->connectivity_icon_id != new_connectivity_icon_id) { data->connectivity_icon_id = new_connectivity_icon_id; kino...
app_menu_data_source_init(&data->data_source, &(AppMenuDataSourceCallbacks) { .changed = prv_data_changed, .filter = prv_app_filter_callback, }, data)
; app_menu_data_source_enable_icons(&data->data_source, RESOURCE_ID_MENU_LAYER_GENERIC_WATCHAPP_ICON); menu_layer_set_callbacks(menu_layer, data, &(MenuLayerCallbacks) { .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback, .draw_row = (Men...
ions.read_status, &status_reg, 1); if (!(status_reg & dev->state->part->status_bit_masks.busy)) { // no erase in progress qspi_release(QSPI); return S_NO_ACTION_REQUIRED; } prv_write_cmd_no_addr(dev, dev->state->part->instructions.erase_suspend); qspi_release(QSPI); if (dev->state->part->suspen...
prv_read_register(dev, dev->state->part->instructions.read_status, &status_reg, 1)
; qspi_release(dev->qspi); return (status_reg & dev->state->part->status_bit_masks.busy) ? E_BUSY : S_SUCCESS; } void qspi_flash_set_lower_power_mode(QSPIFlash *dev, bool active) { qspi_use(dev->qspi); uint8_t instruction; uint32_t delay; if (active) { instruction = dev->state->part->instructions.enter...
ue_t e1 = prv_js_global_get_value("e1"); jerry_value_t e2 = prv_js_global_get_value("e2"); jerry_value_t e3 = prv_js_global_get_value("e3"); // error s_log_internal__expected = (const char *[]){ "Exception while e1", "Error: test", NULL, }; rocky_log_exception("e1", e1); cl_assert(*s_log_internal__ex...
jerry_get_global_builtin((const jerry_char_t *)"_not_builtin_")
/* * 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(list_get_prev(&c) == &b)
; cl_assert(list_get_next(&c) == NULL); } void test_list__prepend(void) { ListNode a = LIST_NODE_NULL, b = LIST_NODE_NULL, c = LIST_NODE_NULL; ListNode *head; head = list_prepend(&c, &b); cl_assert(head == &b); head = list_prepend(&b, &a); cl_assert(head == &a); cl_assert(list_get_prev(&a) == NULL); ...