prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
rn app_install_entry_is_hidden(&entry); } bool app_install_entries_equal(AppInstallEntry *one, AppInstallEntry *two) { bool id = (one->install_id == two->install_id); bool type = (one->type == two->type); bool visibility = (one->visibility == two->visibility); bool process_type = (one->process_type == two->pro...
(menu_layer_id, menu_layer_size /* size */)
; cl_assert_equal_i(2, menu_layer_id); // load second app app_storage_get_file_name(filename_buf, sizeof(filename_buf), 2, PebbleTask_App); load_fixture_on_pfs(APP2_APP_FIXTURE_NAME, filename_buf); resource_storage_get_file_name(filename_buf, sizeof(filename_buf), 2); load_fixtu...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (s_initialized) { return; }
s_led_enable = 0; if (BOARD_CONFIG_BACKLIGHT.options & ActuatorOptions_Ctl) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_BACKLIGHT.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, false); periph_config_release_lock(); s_initialized = 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...
{ char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&notification->header.id, uuid_buffer); PBL_LOG(LOG_LEVEL_ERROR, "Failed to load action for dismissal from %s", uuid_buffer); }
} static void prv_handle_new_ancs_notif(TimelineItem *notification) { uuid_generate(&notification->header.id); notifications_add_notification(notification); timeline_item_destroy(notification); } static void prv_handle_ancs_update(TimelineItem *notification, CommonTimelineIte...
/* * 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_zalloc_check(sizeof(HealthData))
; } void health_data_destroy(HealthData *health_data) { app_free(health_data); } void health_data_update_quick(HealthData *health_data) { const time_t now = rtc_get_time(); struct tm local_tm; localtime_r(&now, &local_tm); // Get the current steps health_service_private_get_metric_history(HealthMetricSte...
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language gover...
dict_write_uint8(app_data->out_iter, AppMessageKey_Status, AppStatus_Enabled_1HZ)
; #if CAPABILITY_HAS_BUILTIN_HRM if (mfg_info_is_hrm_present()) { AS7000InfoRecord hrm_info = {}; as7000_get_version_info(HRM, &hrm_info); dict_write_uint8(app_data->out_iter, AppMessageKey_HRMProtocolVersionMajor, hrm_info.protocol_version_major); dict_write_uint8(app_data->out_...
ve been pressed."); s_num_buttons_down = 0; } if (s_num_buttons_down == 0 && s_light_state == LIGHT_STATE_ON && !s_user_controlled_state) { // no more buttons pressed: wait for a bit and then start the fade-out timer prv_change_state(LIGHT_STATE_ON_TIMED); } mutex_unlock(s_mutex); } v...
(ANALYTICS_DEVICE_METRIC_SETTING_SHAKE_TO_LIGHT, is_motion_enabled, AnalyticsClient_System)
; analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_BACKLIGHT_INTENSITY_PCT, backlight_intensity_pct, AnalyticsClient_System); analytics_set(ANALYTICS_DEVICE_METRIC_SETTING_BACKLIGHT_TIMEOUT_SEC, backlight_timeout_sec, AnalyticsClient_System); }
/* * 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...
GPoint(35, 70)
); } void across_ny_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(5, -30), GPoint(45, 30)); } void test_graphics_draw_line__origin_layer(void) { GContext ctx; Layer layer; ...
/* * 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...
GRect(4, 20, 72, 32)
, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL); } void draw_text_single_line_ellipsis_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), ...
/* * 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_DEVICE_ADDRESS_XPLODE_PTR(&addr)
); } SM128BitKey link_key; uint8_t platform_bits; if (bt_driver_supports_bt_classic()) { if (shared_prf_storage_get_bt_classic_pairing_data(&addr, &name[0], &link_key, &platform_bits)) { bluetooth_persistent_storage_debug_dump_classic_pairing_in...
er, direction, is_repeating); return; } #endif // pause at the top of a notification if ((offset == 0) && (is_repeating) && (swap_layer->swap_delay_remaining > 0)) { swap_layer->swap_delay_remaining--; return; } swap_layer->swap_delay_remaining...
(BUTTON_ID_DOWN, prv_raw_click_handler, NULL, context)
; window_single_repeating_click_subscribe(BUTTON_ID_DOWN, SCROLL_REPEAT_MS, prv_single_click_handler); window_multi_click_subscribe(BUTTON_ID_DOWN, 2, 2, 100, false, prv_down_multi_click_handler); SwapLayer *swap_layer = context; if (swap_layer->callbacks.click_config_...
/* * 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...
(REBOOT_REASON_DROPPED_EVENT)
; } void reboot_reason_clear(void) { RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_1, 0); RTC_WriteBackupRegister(REBOOT_REASON_REGISTER_2, 0); RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_PC, 0); RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_LR, 0); RTC_WriteBackupRegister(REBOOT_REASON_STUCK_TASK_C...
or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "drivers/flash.h" #include "kernel/util/delay.h" #include "system/passert.h" #include "util/units.h" #include <inttypes.h> #include <stdbool.h> #include <stdio.h> #include "drivers/flash/...
flash_send_and_receive_byte(FLASH_CMD_READ_STATUS_REG)
; uint8_t status_register = 0; do { if (cycles_to_wait-- < 1) { break; } status_register = flash_read_next_byte(); } while (status_register & N25QStatusBit_WriteInProgress); flash_end_cmd(); } void flash_wait_for_write(void) { flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_RE...
; gpio_init_struct.GPIO_Speed = GPIO_Speed_2MHz; gpio_init_struct.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(pin_config.gpio, &gpio_init_struct); gpio_release(pin_config.gpio); } //! Configure bus pin as output //! Lock bus and peripheral config access before use static void bus_pin_cfg_output(AfConfig pin_confi...
bus_pin_cfg_input(BOARD_CONFIG.i2c_bus_configs[bus_idx].i2c_sda)
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...
{ case ANALYTICS_METRIC_ELEMENT_TYPE_NIL: WTF; case ANALYTICS_METRIC_ELEMENT_TYPE_UINT8: return *(uint8_t*)location; case ANALYTICS_METRIC_ELEMENT_TYPE_UINT16: return *(uint16_t*)location; case ANALYTICS_METRIC_ELEMENT_TYPE_UINT32: return *(uint32_t*)location; case ANALYTICS_METRIC_ELEMENT_TYP...
WTF; // Should not get here! } ////////// // Set void analytics_heartbeat_set(AnalyticsHeartbeat *heartbeat, AnalyticsMetric metric, int64_t val) { uint8_t *location = prv_heartbeat_get_location(heartbeat, metric); prv_location_set_value(location, val, analytics_metric_element_type(metric)); } void analytics_h...
stedData; static LauncherAppPersistedData s_launcher_app_persisted_data; ///////////////////////////// // AppFocusService handlers static void prv_did_focus(bool in_focus) { LauncherAppWindowData *data = app_state_get_user_data(); if (in_focus) { launcher_menu_layer_set_selection_animations_enabled(&data->la...
(sizeof(*data))
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ added_units |= s_events[i].time_units; break; }
} if (added_units == 0) { return false; } s_units |= added_units; tick_timer_service_subscribe(s_units, prv_tick_handler); // contract is: we call handler immediately after subscribe once JS_VAR event = prv_create_event(event_name, NULL); rocky_util_call_user_function_and_log_uncaught_error(handl...
governing permissions and * limitations under the License. */ #include "weather_app.h" #include "weather_app_layout.h" #include "weather_app_splash_screen.h" #include "weather_app_warning_dialog.h" #include "applib/app.h" #include "applib/event_service_client.h" #include "applib/ui/click.h" #include "applib/ui/con...
event_service_client_subscribe(&data->weather_event_info)
; } static void prv_main_window_load(Window *window) { WeatherAppData *data = app_state_get_user_data(); layer_add_child(&window->layer, &data->layout.root_layer); } static void prv_main_window_disappear(Window *window) { WeatherAppData *data = app_state_get_user_data(); event_service_client_unsubscribe(&data...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pfs_init(false)
; pfs_format(false); // Load pre-migration wakeup entry onto pfs SettingsFile file; const int32_t timestamp = TIMESTAMP; // Create the Migration Entry w_entry = (WakeupEntryV1) { .uuid = app_uuid, .reason = WAKEUP_REASON, .repeating = false, .repeat_hours_missed = 0, .notify_if_missed ...
/* * 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(s_outbox_size)
from the failed_callback. prv_send_test_data_expecting_result(APP_MSG_OK); // Make fake remote send any outstanding data (none expected) prv_process_sent_data(); cl_assert_equal_i(s_out_sent_call_count, 0); // failed_callback not called yet: cl_assert_equal_i(s_out_failed_call_count, 0); // Now proces...
cl_assert_equal_b(s_in_received_is_called, false)
; cl_assert_equal_b(s_in_dropped_is_called, false); cl_assert_equal_b(s_nack_received_for_id_2, true); // Check that the state is reset check_in_accepting_again(); } void test_app_message__receive_app_uuid_mismatch(void) { // Change the current app uuid prv_set_app_uuid(UuidMake(0xF6, 0x2C, 0xB7, 0xBA, ...
inance_lookup_table); dest[dest_x] = gcolor_alpha_blend(actual_color, dest_color).argb; break; } default: PBL_LOG(LOG_LEVEL_DEBUG, "OP: %d NYI", (int)compositing_mode); return; } } } } void bitblt_bitmap_into_bitmap_tiled_8bit_to_8bit(GBitmap *dest_bi...
(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; const int16_t dest_end_x = MIN(grect_get_max_x(&dest_rect), dest_row_info.max_x + 1); if (dest_end_x < dest_begin_x) { continue; } const GBitmapDataRowInfo src_row_info = gbit...
_get_system_session(), BtConsumerTimelineActionMenu, ResponseTimeMax, 0); } static WindowStack *prv_get_window_stack(ActionResultData *data) { return window_manager_get_window_stack(data->voice_data ? ModalPriorityVoice : M...
action_menu_set_result_window(data->action_menu, &dialog->window)
; } else { dialog_push(dialog, prv_get_window_stack(data)); } cleanup: prv_cleanup_action_result(data, succeeded); } static bool prv_set_dialog_message(ActionResultData *data, TimelineResourceId timeline_res_id, const char *message, bool success) { const size_t message_b...
* 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 in w...
{ return false; }
return ((AnimationPrivate*)animation)->context; } bool WEAK animation_schedule(Animation *animation) { if (!animation) { return false; } ((AnimationPrivate*)animation)->abs_start_time_ms = 0; ((AnimationPrivate*)animation)->scheduled = true; return true; } bool WEAK animation_unschedule(Animation *an...
f the motor used when one is not specified // explicitly, and can be changed in the notification vibration strength setting. static int32_t s_vibe_strength_default = VIBE_STRENGTH_MAX; static PebbleMutex *s_vibe_pattern_mutex = NULL; static VibePatternStep *s_vibe_queue_head = NULL; void vibes_init() { s_vibe_histo...
(duration_ms, on ? s_vibe_strength_default : VIBE_STRENGTH_OFF)
since we have no data int32_t last_median; int32_t last_update_utc; activity_get_metric(ActivityMetricHeartRateFilteredBPM, 1, &last_median); activity_get_metric(ActivityMetricHeartRateFilteredUpdatedTimeUTC, 1, &last_update_utc); cl_assert_equal_i(last_median, 0); cl_assert_equal_i(last_update_utc, 0); ...
(s_num_hr_events, 3)
; cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.current_bpm, 0); cl_assert_equal_i(s_last_hr_event.data.heart_rate_update.quality, HRMQuality_OffWrist); // Should fire off an event. Good HR and Good Quality prv_advance_time_hr(1 /*sec*/, 120 /*hr*/, HRMQuality_Excellent, true /*force_continuous*/); ...
n NULL; } clone_h = animation_private_animation_init(clone); } // Copy the values into the clone clone->implementation = from->implementation; clone->handlers = from->handlers; clone->context = from->context; clone->delay_ms = from->delay_ms; clone->duration_ms = from->duration_ms; clone->play_...
(state->aux->last_frame_time_ms, now)
; const int32_t error_ms = frame_interval_ms - ANIMATION_TARGET_FRAME_INTERVAL_MS; const int32_t theoretic_delay_ms = state->aux->last_delay_ms - error_ms; const uint32_t delay_ms = CLIP(theoretic_delay_ms, (int32_t) 0, (int32_t) ANIMATION_TARGET_FRAME_INTERVAL_MS); prv_reschedu...
k(); return; } analytics_inc(ANALYTICS_APP_METRIC_FLASH_SUBSECTOR_ERASE_COUNT, AnalyticsClient_CurrentTask); power_tracking_start(PowerSystemFlashErase); enable_flash_spi_clock(); handle_sleep_when_idle_begin(); flash_write_enable(); flash_start_cmd(); flash_send_and_receive_byte(FLASH_CMD_ERASE...
check_whoami(spi_flash_id)
t_background_color(TextLayer *text_layer, GColor color) { PBL_ASSERTN(text_layer); const GColor bg_color = text_layer->background_color; if (gcolor_equal(color, bg_color)) { return; } text_layer->background_color = color; layer_mark_dirty(&(text_layer->layer)); } void text_layer_set_text_color(TextLaye...
(text_layer->layout_cache)
; graphics_text_attributes_restore_default_paging(text_layer->layout_cache); layer_mark_dirty(&text_layer->layer); } }
e(int fd); void test_pfs__garbage_collection(void) { char file_small[10]; uint16_t start_page = 0; // create a sectors worth of files for (int i = 0; i < 16; i++) { snprintf(file_small, sizeof(file_small), "file%d", i); uint8_t buf[PFS_SECTOR_SIZE * 2]; memset(&buf[0], i, sizeof(buf)); int fd =...
(pfs_write(fd, (uint8_t *)buf_small, len) == len)
new cache entry, add it to the head of the cache list, and return it LauncherAppGlanceCacheEntry *new_cache_entry = app_zalloc_check(sizeof(*new_cache_entry)); *new_cache_entry = (LauncherAppGlanceCacheEntry) { .glance = glance, }; service->glance_cache = list_insert_before(service->glance_cache, &new_cach...
{ return NULL; }
Uuid *uuid = &node->uuid; LauncherAppGlance *glance = NULL; // Try to find the requested glance in the cache LauncherAppGlanceCacheEntry *cache_entry = prv_find_glance_entry_in_cache(service, uuid); if (cache_entry) { // Move the found cache entry to the front of the cache list (to mark it as "MRU") ...
ics_draw_vertical_line_dotted(&ctx, GPoint(131, 91), 10); graphics_draw_horizontal_line_dotted(&ctx, GPoint(131, 96), 5); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, TEST_NAMED_PBI_FILE("draw_dotted_line_cross"))); } void test_graphics_draw_line_8bit__dotted_cross_color(void) { GContext ctx; test_graphics_conte...
graphics_draw_line(ctx, GPoint(30,30), GPoint(30,30))
; graphics_context_set_antialiased(ctx, true); graphics_context_set_stroke_width(ctx, 2); graphics_draw_line(ctx, GPoint(40,40), GPoint(40,40)); graphics_context_set_antialiased(ctx, false); graphics_context_set_stroke_width(ctx, 3); graphics_draw_line(ctx, GPoint(50,50), GPoint(50,50)); graphics_conte...
/* * 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...
pfs_format(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); // Setup content indicator ContentIndicatorsBuffer *buffer = content_indicator_get_current_buffer(); content_indicator_init_buffer(buffer); } void t...
ld_pass; } AppInstallEntryTestCase; static AppInstallEntryTestCase s_test_cases[] = { { .entry = (AppInstallEntry) { .install_id = 1, .sdk_version = (Version) { .major = PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, .minor = PROCESS_INFO_CURRENT_SDK_VERSION_MINOR } }, .should_...
{ s_app_install_get_md__result = NULL; s_process_metadata_get_res_bank_num__result = 123; s_rocky_app_validate_resources__result = RockyResourceValidation_NotRocky; s_app_manager_launch_new_app__callcount = 0; s_app_manager_launch_new_app__config = (__typeof__(s_app_manager_launch_new_app__config)){}; s_eve...
ent pin"); } kernel_free(parent_id); } static void prv_perform_health_response_action(const TimelineItem *item, const TimelineItemAction *action) { const uint8_t insight_type = attribute_get_uint8(&item->attr_list, AttributeIdHealthInsightType, ...
{ *parent_id = item->header.parent_id; launcher_task_add_callback(prv_get_pin_and_push_pin_window, parent_id); PBL_LOG(LOG_LEVEL_INFO, "Opening parent pin %s", uuid_buffer); }
/* * 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...
(30, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL)
; cl_assert_equal_i(item->header.layout, LayoutIdTest); cl_assert_equal_i(item->header.timestamp, 30); timeline_item_destroy(item); } void test_timeline_api__pin_two_items(void) { TimelineItem *item1 = timeline_item_create_with_attributes(30, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL); fake_rtc_i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gcolor_equal(bg_color, GColorClear)
)) { graphics_context_set_fill_color(ctx, bg_color); graphics_fill_rect(ctx, &text_layer->layer.bounds); } if (text_layer->text && strlen(text_layer->text) > 0) { graphics_context_set_text_color(ctx, text_layer->text_color); graphics_draw_text(ctx, text_layer->text, text_layer->font, text_la...
/* * 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 (dir == CompositorTransitionDirectionLeft) { graphics_fill_radial_internal(ctx, circle_center, circle_radius, DISP_COLS - circle_center.x + 1, 0, TRIG_MAX_ANGLE); } else { graphics_fill_circle(ctx, circle_center, circle_radius); }
} else { const int16_t flip_boundary_from_x = display_center.x + (flip_overlap_region_width / 2); const int16_t flip_boundary_to_x = 0; const int16_t current_flip_boundary_x = interpolate_int16(distance_normalized, flip_boundary_from_x, ...
/* * 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_manager_get_task_context()
->closing_state == ProcessRunState_Running) { data->button_pressed = e->button.button_id; switch (e->type) { case PEBBLE_BUTTON_DOWN_EVENT: click_recognizer_handle_button_down(&data->click_manager.recognizers[e->button.button_id]); break; case PEBBLE_BUTTON_UP_EVENT: click_recognizer_h...
_menu_data_source_get_node_icon(&data->data_source, node); const char *subtitle = (data->active_watchface_id == node->install_id) ? i18n_get("Active", data) : NULL; const GCompOp op = (gbitmap_get_format(bitmap) == GBitmapFormat1Bit) ? GCompOpTint : GCompOpSet; graphics_context_set_compositing_mode(ctx, op...
handle_init()
ing (scheduled) this value will be zero. RtcTicks expire_time; RtcTicks period_ticks; TaskTimerID id; //<! ID assigned to this timer //! client provided callback function and argument TaskTimerCallback cb; void* cb_data; //! True if this timer should automatically be rescheduled for period_...
(manager->idle_timers, &timer->list_node)
); list_remove(&timer->list_node, &manager->idle_timers /* &head */, NULL /* &tail */); } // Set timer variables timer->cb = cb; timer->cb_data = cb_data; timer->expire_time = current_time + timeout_ticks; timer->repeating = flags & TIMER_START_FLAG_REPEATING; timer->period_ticks = timeout_ticks; ...
down(bus); } else { prv_bus_pins_cfg_input(bus); } } //! Perform a soft reset of the bus //! Always lock the bus before reset static void prv_bus_reset(I2CBus *bus) { prv_bus_disable(bus); prv_bus_enable(bus); } /*---------------INIT/USE/RELEASE/RESET FUNCTIONS----------------------*/ void i2c_init(I2CBu...
{ psleep(WAIT_DELAY); if (i2c_hal_is_busy(bus)) { PBL_LOG(LOG_LEVEL_ERROR, "Timed out waiting for bus %s to become non-busy", bus->name); return false; } }
return true; } //! Set up and start a transfer to a bus, wait for it to finish and clean up after the transfer //! has completed static bool prv_do_transfer(I2CBus *bus, TransferDirection direction, uint16_t device_address, uint8_t register_address, uint32_t size, uint8_t *data, ...
card.h" #include "test_health_app_includes.h" // Setup and Teardown //////////////////////////////////// static GContext s_ctx; static FrameBuffer s_fb; const int s_now_utc = 1467763200; // July 6, 2016 GContext *graphics_context_get_current_context(void) { return &s_ctx; } void test_health_sleep_summary_card__...
time_util_get_midnight_of(s_now_utc)
; HealthData health_data = { // Used for text .sleep_data[0] = (8 * SECONDS_PER_HOUR) + (12 * SECONDS_PER_MINUTE), .typical_sleep = (10 * SECONDS_PER_HOUR), .monthly_sleep_average = (300 * SECONDS_PER_HOUR), // Used for typical .sleep_start = 0 * SECONDS_PER_HOUR, .sleep_end = 7 * SECOND...
egister_TEMPERATURE_SENSOR_CTRL, BMA255_TEMPERATURE_SENSOR_DISABLE); bma255_write_register(BMA255Register_EXTENDED_MEMORY_MAP, BMA255_EXTENDED_MEMORY_MAP_CLOSE); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[0], ExtiTrigger_Rising, prv_bma255_IRQ1_handler); exti_configure_pin(BOARD_CONFIG_ACCEL.accel_ints[1],...
bma255_end_txn()
; // Timestamp & Dispatch data for (int i = 0; i < num_samples_available; ++i) { // Make a timestamp approximation based on the current time, the sample // being processed and the sampling interval. data[i].timestamp_us = timestamp_us - ((num_samples_available - i) * sampling_interval_us); BMA255_D...
left_text_inset)); #endif if (option_menu->callbacks.draw_row) { option_menu->callbacks.draw_row(option_menu, ctx, cell_layer, &remaining_rect, cell_index->row, is_selected, option_menu->context); } } static void prv_select_callback(M...
(option_menu, config->choice)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
event_service_init(PEBBLE_TICK_EVENT, &tick_timer_add_subscriber, &tick_timer_remove_subscriber)
; } void tick_timer_service_subscribe(TimeUnits tick_units, TickHandler handler) { TickTimerServiceState *state = prv_get_state(PebbleTask_Unknown); state->handler = handler; state->tick_units = tick_units; state->first_tick = true; event_service_client_subscribe(&state->tick_service_info); // TODO: make a...
; hdr.log_file_id = s_curr_state.log_file_id; hdr.log_chunk_id = s_curr_state.log_chunk_id; hdr.log_flags = ~(LOG_FLAGS_VALID); s_curr_state.log_chunk_id++; size_t len; const uint8_t *build_id = version_get_build_id(&len); memcpy(hdr.build_id, build_id, sizeof(hdr.build_id)); flash_write_bytes((uint8_...
{ // 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_curr_state.page_start_addr; s_curr_state.bytes_remaining = msg_length; prv_write_flash_log_record_header(msg_length); return (s_curr_state.log_start_a...
d // by the platform. For the dialog part 32 IRQs are provided. There is also a // patch area used by the dialog BT ROM which must be loaded and comes directly // after the vector table, it's 128 bytes #define IVT_TABLE_SIZE (0x40 + 32 * 4 + 0x80) static uint8_t s_vector_table[IVT_TABLE_SIZE]; static volatile bool s_e...
{ uint8_t cmd[2] = { }; prv_write_or_read_bytes(cmd, sizeof(cmd), false); if (cmd[0] == 'H' && cmd[1] == 'I') { prv_handle_hi_command(); } else if (cmd[0] == 'L' && cmd[1] == 'D') { prv_handle_load_data_command(); } else if (cmd[0] == 'V' && cmd[1] == 'T') { prv_handle_vector_tabl...
} static void prv_configure_pins_for_spi_transfer(void) { hw_gpio_set_pin_function(HOST_SPI->spi.cs.port, HOST_SPI->spi.cs.pin, HW_GPIO_MODE_INPUT, HOST_SPI->spi.cs.function); hw_gpio_set_pin_function(HOST_SPI->spi.cs_2.port, HOST_SPI->spi.cs_2.pin, HW_GPIO_MO...
lags_visibility(app_header->flags), // PebbleTask_App because the flag parsing function needs it, and we can assume all // applications registered with the manager are applications, not workers. .process_type = process_metadata_flags_process_type(app_header->flags, PebbleTask_App), .has_worker = process...
{ case AppInstallStorageFw: // If its a FW app, just return the Md return reg_entry->md_fn(); case AppInstallStorageResources: { // If its a RESOURCE app, we much read from the resource pack and populate an Md PebbleProcessInfo app_header; if (resource_load_byte_range_system(SYSTEM...
this was never exposed on 2.x PropertyAnimation *result = property_animation_create(&s_bounds_layer_implementation, layer, NULL, NULL); GRect value = layer->bounds; if (from) { value.origin = *from; } property_animation_set_from_grect(result, &value); value = layer->bounds; if (to) { valu...
(&property_animation->values.from, value, size)
; } else { memcpy(value, &property_animation->values.from, size); } return true; } // ----------------------------------------------------------------------------------------- bool property_animation_to(PropertyAnimation *property_animation_h, void *value, size_t size, bool set) ...
leepTestResults *results; for (int i = 0; i < num_tests; i++, entry++, results++) { results = &test_results[entry->test_idx]; // Generate the status string const char *status = prv_status_str(results->all_passed); if (results->all_passed) { pass_count++; } else { fail_count++; } ...
kalg_activities_update(s_kalg_state, now, entry->samples[i].v5_fields.steps, 0 /*vmc*/, 0 /*orientation*/, false /*plugged_in*/, 0 /*rest_cals*/, 0 /*active_cals*/, 0 /*distance*/, shutting_down, prv_activity_session_callback, ...
ent(0, 0); prv_test_touch_event(touch_event, 0, TouchEvent_Liftoff, &GPointZero, 3686380, 0, &GPoint(15, 100), 20, 0, true); // Ensure nothing recorded for second touch touch_event = touch_event_queue_get_event(1, 0); cl_assert_equal_p(touch_event, NULL); // Test second touch touch_...
GPoint(18, 5)
, 60, 1, true); } void test_touch__handle_update_merge_liftoff(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch_event(touch_eve...
direction, bool available) { s_content_available[direction] = available; } void graphics_context_set_compositing_mode(GContext* ctx, GCompOp mode) {} void graphics_draw_bitmap_in_rect(GContext *ctx, const GBitmap *bitmap, const GRect *rect){} int16_t menu_cell_basic_cell...
(&selected_index, cell_index)
== 0; return is_selected ? MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT : menu_cell_basic_cell_height(); } void test_menu_layer__default_ignores_row_height_for_selection(void) { MenuLayer l; const int height = 180; menu_layer_init(&l, &GRect(10, 10, height, 180)); menu_layer_set_callbacks(&l, NULL, &(MenuLayerC...
/* * 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...
((void *)&header, BOOT_FPGA_FLASH_ADDR, sizeof header)
; return (header.fpga_len != 0xffff && header.fpga_len_complemented != 0xffff); } void mfg_info_write_boot_fpga_bitstream(void) { // Store the bootloader FPGA in the MFG info flash region so that the // bootloader can find it. _Static_assert(sizeof s_boot_fpga < 1<<16, "FPGA bitstream too big"); Bo...
ww.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions...
(100, false, stub_evented_timer_callback, 0)
; // We've started the timer, but it hasn't fired yet. TimerID sys_timer_id = timer; cl_assert(stub_new_timer_is_scheduled(sys_timer_id)); cl_assert_equal_i(s_last_event.type, PEBBLE_NULL_EVENT); cl_assert(!s_times_callback_executed); // Now cancel the timer, this should delete the system timer stub_new...
itblt__8bit_src_origin_offset_wrap(void) { GBitmap *src_bitmap = get_gbitmap_from_pbi("test_bitblt__8bit_src_origin_offset_wrap.8bit.pbi"); uint8_t dest_data[100*100]; GBitmap dest_bitmap = { .addr = dest_data, .row_size_bytes = 100, .info.format = GBitmapFormat8Bit, .info.version = GBITMAP_VERSIO...
cl_check(gbitmap_pbi_eq(&dest_bitmap, "test_bitblt__1bit_to_8bit_compor-expect.8bit.pbi"))
; gbitmap_destroy(src_bitmap); } // Setup: // - Source is a 1bit image of a white cross with a black background // Result: // - The image names describe the expected result of each destination color / tint color // combination void test_bitblt__1bit_to_8bit_comptint(void) { GBitmap *src_bitmap = get_gbitm...
c 1, 13:00:00 { 11,-1,13,-1, WDAY_ANY, 1448974800}, // month+hour+minute // 2015 Dec 1, 13:45:00 { 11,-1,13,45, WDAY_ANY, 1448977500}, // month+mday // 2015 Dec 13, 00:00:00 { 11,12,-1,-1, WDAY_ANY, 1449964800}, // month+mday+minute // 2015 Dec 13, 00:45:00 { 11,12,-1,45, WDAY_ANY, 1449967500}, ...
{ // Dec 21st, 01:00:00 local CronJob test_cron = { .cb = prv_cron_callback, .cb_data = (void*)0, .minute = 0, .hour = 1, .mday = 20, .month = 11, .may_be_instant = true, }; // 2015 Dec 21, 01:00:00 GMT const time_t advance = 1450659600 - s_2015_dec19_123456_gmt; prv_basic_test...
(LOG_LEVEL_INFO, "Requested to pin address to "BT_DEVICE_ADDRESS_FMT " match=%u", BT_DEVICE_ADDRESS_XPLODE_PTR(addr), addresses_match)
; } void bt_local_addr_handle_bonding_change(BTBondingID bonding, BtPersistBondingOp op) { bool has_pinned_ble_pairings = bt_persistent_storage_has_pinned_ble_pairings(); if (has_pinned_ble_pairings != s_cycling_paused_due_to_dependent_bondings) { if (has_pinned_ble_pairings) { bt_local_addr_pause_cyclin...
bi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r16_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY, true, 1); graphics_draw_circle(&ctx, CENTER_OF_OFFSET_RECT_NXNY, RADIUS_BIG); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_aa_r16_clip_nxn...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1)
; graphics_circle_quadrant_draw_1px_non_aa(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM, GCornersRight); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_circle_offset_r8_quads_right.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_circle_quadrant_...
/* * 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...
TINTIN_MODEL("pebble_orange")
; break; case WATCH_INFO_COLOR_GRAY: model_name = TINTIN_MODEL("pebble_gray"); break; case WATCH_INFO_COLOR_STAINLESS_STEEL: model_name = TINTIN_MODEL("pebble_steel_silver"); break; case WATCH_INFO_COLOR_MATTE_BLACK: model_name = TINTIN_MODEL("pebble_ste...
(&id, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); cl_assert(notification_storage_get(&id, &r)); compare_notifications(&e, &r); free(r.allocated_buffer); Uuid invalid_uuid; uuid_generate(&invalid_uuid); cl_assert_equal_b(notification_storage_get(&invalid_uuid, &r), false); } void te...
(e.header.timestamp, r.header.timestamp)
ould 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 Notifications though cl_assert(!alerts_should_notify_for_type(AlertI...
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(alerts_should_notify_for_type(AlertReminder)); cl_assert(!a...
_icon(LauncherAppGlanceAlarms *alarms_glance, uint32_t new_icon_resource_id) { if (alarms_glance->icon_resource_id == new_icon_resource_id) { // Nothing to do, bail out return; } // Destroy the existing icon kino_reel_destroy(alarms_glance->icon); // Set the new icon ...
launcher_app_glance_structured_create(&node->uuid, &s_alarms_structured_glance_impl, should_consider_slices, alarms_glance)
; PBL_ASSERTN(structured_glance); // Get the first state of the glance prv_update_glance_for_next_alarm(alarms_glance); // Subscribe to alarm clock events for updating the glance alarms_glance->alarm_clock_event_info = (EventServiceInfo) { .type = PEBBLE_ALARM_CLOCK_EVENT, .handler = prv_alarm_clock...
ck state to be set to MusicPlayStateUnknown. int32_t value_out = (idx == AMSPlaybackInfoIdxState) ? -1 : 0; const int32_t multiplier[] = { // First value is the AMSPlaybackState enum, so unity multiplier: [AMSPlaybackInfoIdxState] = 1, // Second value is the playback rate [0.0, 1.0]. We store as perce...
(LOG_LEVEL_DEBUG, "Queue count update: %"PRId32, count)
; // TODO: Do something with this info } static void prv_handle_queue_shuffle_mode_update(const AMSEntityUpdateNotification *update, const uint16_t value_length) { const AMSShuffleMode shuffle_mode = prv_parse_queue_value(update->value_str, value_length); PBL_LOG(...
///////////////////////////////////////////////////////////// // Stubs & Fakes #include "fake_event_service.h" #include "fake_pebble_tasks.h" #include "fake_pbl_malloc.h" #include "fake_regular_timer.h" #include "stubs_analytics.h" #include "stubs_bt_lock.h" #include "stubs_logging.h" #include "stubs_passert.h" void...
{ return true; }
Fire the timeout and send the data app_timer_trigger(app_message_ack_timer_id()); prv_process_sent_data(); cl_assert_equal_i(s_out_sent_call_count, 0); cl_assert_equal_i(s_out_failed_call_count, 1); cl_assert_equal_i(s_failure_result, APP_MSG_SEND_TIMEOUT); // Check the state is reset properly cl_asser...
(app_message_is_closed_outbound(), true)
_info, sizeof(log_info)); MessageContents *contents = pulse_push_send_begin(PULSE_PROTOCOL_LOGGING); const size_t header_length = prv_serialize_log_header( contents, log_info.log_level, log_info.timestamp_ms, PebbleTask_Unknown, "", 0); const size_t message_length = log_length - sizeof(ui...
(contents, payload_length)
; }
: [initial_sp] "r" (initial_stack_pointer), [reset_handler] "r" (reset_handler) ); __builtin_unreachable(); } static bool check_and_increment_reset_loop_detection_bits(void) { uint8_t counter = (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_THREE) << 2) | (boot_bit_test(BOOT_BIT_RESET_LOOP_DETECT_TW...
{ dbgserial_putstr("Firmware is erased"); return true; }
return false; } static void sad_watch(uint32_t error_code) { dbgserial_putstr("SAD WATCH"); char error_code_buffer[12]; itoa_hex(error_code, error_code_buffer, sizeof(error_code_buffer)); dbgserial_putstr(error_code_buffer); display_error_code(error_code); static uint8_t prev_button_state = 0; prev...
t_framebuffer.h" // Stubs //////////////////////////////////// #include "graphics_common_stubs.h" #include "stubs_applib_resource.h" static FrameBuffer *fb = NULL; // Setup void test_graphics_fill_rect_${BIT_DEPTH_NAME}__initialize(void) { fb = malloc(sizeof(FrameBuffer)); framebuffer_init(fb, &(GSize) {DISP_COL...
test_graphics_context_init(&ctx, fb)
; layer_init(&layer, &GRect(10, 15, 20, 10)); layer_set_update_proc(&layer, &inside_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_inside_offset_layer.${BIT_DEPTH_NAME}.pbi")); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer...
s_now_playing_requested; static void prv_assert_now_playing_requested_cb(uint16_t endpoint_id, const uint8_t* data, unsigned int data_length) { cl_assert_equal_i(data_length, 1); cl_assert_equal_i(data[0], 0x08); // MusicEndpointCmdIDGetAllInfo s_now_playing_reques...
cl_assert_equal_b(music_has_now_playing(), true)
; uint8_t zero_length_now_playing[] = { 0x10, 0, 0, 0 }; prv_receive_pp_data(zero_length_now_playing, sizeof(zero_length_now_playing)); cl_assert_equal_b(music_has_now_playing(), false); } void test_music_endpoint__ignore_malformatted_messages(void) { // Android app connects: prv_receive_app_info_event(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...
strtol(" 573888", NULL, 10)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert_equal_i(12, gbitmap_get_data_row_info(&bmp, 3).max_x)
; }
ate it and it will be reassigned to one that exists next time around. PBL_LOG(LOG_LEVEL_WARNING, "Default watchface fetch failed, setting INVALID as default"); watchface_set_default_install_id(INSTALL_ID_INVALID); } else if ((worker_manager_get_default_install_id() == data->install_entry.install_id) && ...
(&data->window)
/* * 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...
(0b00111111, BITS_BETWEEN(0, 5))
; cl_assert_equal_i(0b00111000, BITS_BETWEEN(3, 5)); cl_assert_equal_i(0b00010000, BITS_BETWEEN(4, 4)); } // Flash memory is organized into twelve sectors of unequal sizes. // Sectors 0-3 are 16 KiB. Sector 4 is 64 KiB. // The remaining sectors are 128 KiB. // Bitset of sectors that have been "erased" static uint...
hics_context_init(&ctx, fb); // Test horizontal and vertical lines cross appropriately setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_context_set_stroke_color(&ctx, GColorRed); // cross - even vert, odd horiz graphics_draw_vertical_line_dotted(&ctx, GPoint(10, 10), 1...
(ctx, GPoint(50,50), GPoint(50,50))
ke_system_task_callbacks_invoke_pending(); cl_assert_equal_i(fake_system_task_count_callbacks(), 0); cl_assert_equal_i(s_send_next_count, 0); } static bool prv_schedule_send_next(CommSession *session) { return true; } static bool s_is_current_task_schedule_task = false; static bool prv_is_current_task_schedule_...
{ CommSessionCapability capability = (1 << i); cl_assert_equal_b(true, comm_session_has_capability(session, capability)); }
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection); }
es/normal/settings/settings_file.h" #include "services/common/shared_prf_storage/shared_prf_storage.h" #include "comm/ble/kernel_le_client/kernel_le_client.h" #include "system/logging.h" #include <bluetooth/bluetooth_types.h> #include <bluetooth/bonding_sync.h> #include <bluetooth/features.h> #include <btutil/bt_dev...
shared_prf_storage_get_ble_pairing_data(&data, NULL, &requires_address_pinning, &flags)
) { PBL_LOG(LOG_LEVEL_ERROR, "Tried to store device name, but pairing no longer around."); return false; } // In PRF, only the gateway should get paired, so default to "true": return (BT_BONDING_ID_INVALID != prv_bt_persistent_storage_store_ble_pairing(&data, true /* is_gateway */, ...
_TICKS_REGISTER); } static void save_rtc_time_state_exact(RtcIntervalTicks current_rtc_ticks, time_t time) { RTC_WriteBackupRegister(CURRENT_TIME_REGISTER, time); RTC_WriteBackupRegister(CURRENT_INTERVAL_TICKS_REGISTER, current_rtc_ticks); // Dbgserial instead of PBL_LOG to avoid infinite recursion due to PBL_L...
get_ticks()
); } void rtc_get_time_ms(time_t* out_seconds, uint16_t* out_ms) { RtcTicks ticks = get_ticks(); RtcTicks ticks_since_time_base = (ticks - s_time_tick_base); *out_seconds = s_time_base + (ticks_since_time_base / RTC_TICKS_HZ); RtcTicks ticks_this_second = ticks_since_time_base % RTC_TICKS_HZ; *out_ms = (ti...
st(PPPControlProtocol *this, struct LCPPacket *packet) { if (ntoh16(packet->length) == LCP_HEADER_LEN) { // The request has no options prv_send_configure_ack(this, packet); return true; } else { // Packet has options but we don't support any options yet. prv...
prv_handle_nak_or_reject(this, packet)
; break; default: break; } } static void prv_on_terminate_request(PPPControlProtocol *this, struct LCPPacket *packet) { if (this->state->link_state == LinkState_AckReceived || this->state->link_state == LinkState_AckSent) { prv_transition_to(this, Link...
} } static void down_click_handler(ClickRecognizerRef recognizer, void *unusued) { struct FlashTestData *data = app_state_get_user_data(); // Only stop stress test if ((data->test_case == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (data->test_case_status == FLASH_TEST_STATUS_RUNNING)) { data->test_case_st...
simple_menu_layer_get_layer(&data->simple_menu_layer)
); } static void handle_init(void) { struct FlashTestData* data_ptr = app_malloc_check(sizeof(struct FlashTestData)); memset(data_ptr, 0, sizeof(struct FlashTestData)); app_state_set_user_data(data_ptr); window_init(&data_ptr->window, WINDOW_NAME("Flash Test")); window_set_user_data(&data_ptr->window, dat...
20}, { 1304, 248, -80}, { 1224, 248, 0}, { 1016, 168, -32}, { 768, 120, -24}, { 680, 88, -32}, { 696, 80, -32}, { 736, 64, 8}, { 784, 64, 16}, { 920, 88, -24}, { 1016, 128, -56}, { 1104, 120, -112}, { 1288, 160, -96}, { 1264, 152, -56}, { 1112, 168, -104}, { 1...
{ 672, 160, -120}, { 856, 216, -216}, // 91 seconds { 1056, 248, -336}, { 1120, 216, -352}, { 1112, 216, -360}, { 1208, 216, -240}, { 1304, 216, -256}, { 1048, 232, -256}, { 1064, 208, -168}, { 1160, 184, -120}, { 1104, 184, -80}, { 960, 208, -24}, { 744, 136, -40...
{ 1184, 352, -208}, { 1056, 264, -136}, { 1040, 256, -96}, { 1136, 240, -88}, { 1032, 216, -56}, { 872, 176, -40}, { 744, 144, -48}, { 704, 128, -24}, { 744, 112, -8}, { 824, 136, -8}, // 94 seconds { 968, 152, -72}, { 1104, 56, 8}, { 1064, 24, 32}, { 1136, 6...
data->point_p0.y += (data->point_velocity_y * PIXEL_SPEED_PER_FRAME); if (data->point_p0.y < 0 || data->point_p0.y > data->window.layer.bounds.size.h) { data->point_velocity_y = data->point_velocity_y * -1; } } else if (shape == LINE) { // Move the line 2*X per Y data->line_p0.x += (...
if (data->triangle_offset.x < 0 || data->triangle_offset.x > data->window.layer.bounds.size.w) { data->triangle_velocity_x = data->triangle_velocity_x * -1; }
data->triangle_offset.y += (data->triangle_velocity_y * PIXEL_SPEED_PER_FRAME); if (data->triangle_offset.y < 0 || data->triangle_offset.y > data->window.layer.bounds.size.h) { data->triangle_velocity_y = data->triangle_velocity_y * -1; } gpath_move_to(data->triangle, data->t...
cs_alive_launcher_task_cb(void *data) { if (!s_ancs_client) { return; } if (s_ancs_client->state == ANCSClientStateIdle) { prv_check_ancs_alive(); } else { s_ancs_client->alive_check_pending = true; } } static void prv_is_ancs_alive_cb(void *data) { launcher_task_add_callback(prv_is_ancs_alive_...
prv_reset_and_next()
; return; } } static void prv_reassemble_ds_notification(uint32_t length, const uint8_t *data) { const bool is_first_message = !prv_is_reassembly_in_progress(); if (is_first_message) { if (s_ancs_client->state != ANCSClientStateRequestedNotification || !prv_reassembly_start(data, 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...
(test_image_color, 30, 2)
/* * 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...
{ display_firmware_update_progress(progress/2 + total/2, total); }
static bool write_new_firmware( uint32_t firmware_start_address, uint32_t firmware_length) { dbgserial_putstr("write_new_firmware"); return system_flash_write( FIRMWARE_BASE, (void *)(FMC_BANK_1_BASE_ADDRESS + firmware_start_address), firmware_length, prv_display_write_progress, 0); } static bool...
tus = BTErrnoOK }; info->services_removed_data.num_services_removed = 1; PebbleBLEGATTClientServiceHandles *remove_hdl = &info->services_removed_data.handles[0]; remove_hdl->service = service; remove_hdl->uuid = service_node->service->uuid; remove_hdl->num_characteristics = service_node->service->num_cha...
list_append(*head, &node->node)
; } else { *head = &node->node; } } bt_unlock(); } bool bt_driver_cb_gatt_client_discovery_complete(GAPLEConnection *connection, BTErrno errno) { bool finalize_discovery = true; bt_lock(); { if (errno == BTErrnoServiceDiscoveryTimeout) { if (prv_discovery_handle_timeout(connection, &e...
co-ords! .max_width_px = text_box->box.size.w, .height_px = fonts_get_font_height(text_box->font) }; Iterator line_iter; line_iter_init(&line_iter, &ctx->text_draw_state.line_iter_state, ctx); prv_walk_lines_down(&line_iter, layout, callbacks); } static void prv_graphics_text_layout_update(GContext*...
prv_graphics_text_layout_update(ctx, text, font, box, overflow_mode, alignment, text_layout)
; return text_layout->max_used_size; } void graphics_draw_text(GContext* ctx, const char* text, GFont const font, GRect box, const GTextOverflowMode overflow_mode, const GTextAlignment alignment, GTextLayoutCacheRef const layout) { if (ctx->lock) { return; } ...
animation_schedule(layer_bounce); } ///////////////////////////////////// // Public API ///////////////////////////////////// Animation *timeline_animate_back_from_card(void) { TimelineAppData *data = s_app_data; PBL_ASSERTN(data); if (!prv_set_state(data, TimelineAppStatePopCard)) { return NULL; } ...
data->launch_into_deep_pin = true; if (!timeline_model_iter_next(NULL, NULL)) { // for some reason we can't find the pin we were asked to launch into char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; uuid_to_string(&args->pin_id, uuid_buffer); PBL_LOG(LOG_LEVEL_ERROR, "Asked to la...
T_STATIC void NOINLINE prv_init(void) { bool do_push_pin_window = prv_setup_timeline_app(); app_window_stack_push(&s_app_data->timeline_window, true /* animated */); if (do_push_pin_window) { prv_push_pin_window(s_app_data, timeline_model_get_current_state(), false /* animated */); } #if CAPABILITY_HAS...
/* * 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...
dbgserial_print(" got ")
; dbgserial_print_hex(crc); dbgserial_newline(); return crc == firmware_description->checksum; } typedef enum UpdateFirmwareResult { UPDATE_FW_SUCCESS = 0, UPDATE_FW_ERROR_MICRO_FLASH_UNTOUCHED = 1, UPDATE_FW_ERROR_MICRO_FLASH_MANGLED = 2 } UpdateFirmwareResult; static UpdateFirmwareResult update_fw(uint...
yright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing...
{ // Make a local copy of dict since ios_notif_pref_db_insert() modifies val uint8_t val[sizeof(s_ios_pref_db_insert_dict)]; memcpy(val, s_ios_pref_db_insert_dict, sizeof(s_ios_pref_db_insert_dict)); ios_notif_pref_db_insert(key, sizeof(key), val, sizeof(val)); uint32_t flags = ios_notif_pref_db_get_flags(k...
zone_time_s[HRZone_Zone2], 0); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone3], 0); prv_inc_time(10); prv_put_bpm_event(ZONE_2_HR, HRMQuality_Good); cl_assert(workout_service_get_current_workout_hr_zone_time(hr_zone_time_s)); cl_assert_equal_i(hr_zone_time_s[HRZone_Zone0], 0); cl_assert_equal_i(hr_zone_time...
(200, HRMQuality_Good)
/* * 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...
periph_config_acquire_lock()
; gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, !shutdown); periph_config_release_lock(); } static void prv_init_pins(void) { periph_config_acquire_lock(); gpio_output_init(&BOARD_CONFIG_BACKLIGHT.ctl, GPIO_OType_PP, GPIO_Speed_2MHz); gpio_output_set(&BOARD_CONFIG_BACKLIGHT.ctl, false); periph_config_releas...
d *id) { TimelineItem notification; if (!notification_storage_get(id, &notification)) { return; } prv_add_notification(s_data, id); // NOTE: To avoid having two flash reads, we only read and validate the notification once. // We do it here, instead of in the function call below. If the above /...
WINDOW_NAME("Notifications")
or.argb | ALPHA_100) }; graphics_context_set_fill_color(ctx, bg_color); graphics_fill_round_rect(ctx, &GRect(36, 48, 30, 20), 4, GCornersAll); } #define COLOR_BAR_WIDTH 4 #define COLOR_BAR_HEIGHT 24 #define ROW_LENGTH 32 static void draw_color_wheel_box(GContext* ctx, AppData *data) { GPoint origin = GPoint(8, 1...
(s_window)
_get_slot_address(i); flash_read_bytes((uint8_t *)&region_hdr, base_address, sizeof(region_hdr)); if (region_hdr.last_used > max_last_used) { max_last_used = region_hdr.last_used; last_used_idx = i; } } if (max_last_used == 0) { return false; } *addr = core_dump_get_slot_address(l...
for (uint32_t i = 1; i < request->length; i++) { if (buffer[i + 1] != same_byte) { is_all_same = false; break; } }
bus); bus->state->transfer_nack_count = 0; bool result = false; bool complete = false; do { i2c_hal_start_transfer(bus); // Wait on semaphore until it is released by interrupt or a timeout occurs if (prv_semaphore_wait(bus->state)) { if ((bus->state->transfer_event == I2CTransferEvent_Trans...
PBL_ASSERTN(buffer)
/* * 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, "Invalid packet length")
; return; } QEMU_LOG_DEBUG("Got tap msg: axis: %d, direction: %d", hdr->axis, hdr->direction); PebbleEvent e = { .type = PEBBLE_ACCEL_SHAKE_EVENT, .accel_tap = { .axis = hdr->axis, .direction = hdr->direction, }, }; event_put(&e); } // ------------------------------------------...
t) { .origin = GPoint((offscreen_left ? last_column_x : first_column_x), 0), .size = GSize(1, DISP_ROWS), }; GBitmap column_to_replicate_sub_bitmap; gbitmap_init_as_sub_bitmap(&column_to_replicate_sub_bitmap, &src_bitmap, column_to_replicate); const int16_t from = (int16_t)(offscreen_left ? ...
((is_right ? s_data.prev_delta_x_before_cut : start), selection_vertical_range.origin_y, DISP_COLS, selection_vertical_range.size_h)
; // We know we're before the moook cut if our delta for after the cut hasn't "moooked" beyond // where we will finish the animation const bool before_cut = (delta_x_after_cut < start); if (before_cut) { if (is_right) { // Manipulate the launcher's pixels in the system framebuffer so the selection mo...
- 1) { grect_align(&arrow_rect, aml_bounds, GAlignTop, true /* clip */); content_indicator_draw_arrow(ctx, &arrow_rect, ContentIndicatorDirectionUp, fg_color, bg_color, GAlignTop); } if (num_rows - row >= SHORT_ITEM_MAX_ROWS_SPALDING) { grect_align(&arrow_re...
if (aml->layout_cache.item_heights) { applib_free(aml->layout_cache.item_heights); }
*sender = title; if (has_multimedia) { // Move the title (sender) to the body for MMS if (ancs_notifications_util_is_group_sms(app_id, subtitle)) { // Promote the subtitle (group name) for Group MMS title = subtitle; subtitle = NULL; } else { title = NULL; } } if (title &...
(buffer, action, ActionIDNegative, negative_action, app_id, properties)
; action++; } if (pebble_actions) { for (int i = 0; i < pebble_actions->num_actions; i++) { TimelineItemAction *pbl_action = &pebble_actions->actions[i]; if (prv_should_hide_reply_because_group_sms(pbl_action, app_id, subtitle)) { continue; } *buffer = prv_fill_pebble_ancs_a...
/* * 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 FRAMEBUFFER_SIZE_BYTES; }
Window *app_window_stack_get_top_window(void) { return s_top_window; } void app_window_stack_push(Window *window, bool animated) { PBL_ASSERT(!s_top_window, "Already have a window"); s_top_window = window; } GContext *graphics_context_get_current_context(void) { return &s_gcontext; } // TODO: PBL-43467 Sup...