prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 11); graphics_dra...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_no_clip.${BIT_DEPTH_NAME}.pbi"))
; setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, fals...
(&session, (uint8_t*)&msg, sizeof(msg))
; cl_assert_equal_i(s_launcher_deprecated_messages, 0); cl_assert_equal_i(s_app_run_state_messages, msg_count); } app_run_state_protocol_msg_callback(NULL, (uint8_t*)&msg, sizeof(msg)); cl_assert_equal_i(s_launcher_deprecated_messages, 1); }
MAX_SUPPORTED_PALETTE_ENTRIES 4 // stores transparent masks + color patterns for even+odd scanlines typedef struct { // true, if color entry will be visible on 1bit, false otherwise bool transparent_mask[MAX_SUPPORTED_PALETTE_ENTRIES]; // a 32bit value you can OR into the 1bit destination for each color entry ...
{ src_y = src_begin_y; }
uint8_t dest_shift = dest_shift_at_line_begin; RowLookUp look_up = look_ups[dest_y % 2]; int16_t src_x = src_begin_x + src_origin_offset.x; uint8_t row_bits_left = dest_rect.size.w; uint32_t *dest_block = (uint32_t *)dest_block_x_begin + (dest_y * dest_row_length_words); const uint32_t *dest...
x.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_prompt.h" #include "stubs_rand_ptr.h" #include "stubs_sleep.h" #include "stubs_task_watchdog.h" #define CONTACT_1_UUID 0x0a, 0x04, 0x98, 0x00, 0x39, 0x18, 0x47, 0xaa, 0x9c, 0x16, 0x8e, 0xa0, 0xa8, 0x2a, 0x2e, 0xb8 #define ADDRESS_1_UUID 0xd...
contacts_db_get_len((uint8_t *)&contact, UUID_SIZE)
, sizeof(contact)); SerializedContact *serialized_contact; contacts_db_get_serialized_contact((Uuid *)&contact, &serialized_contact); cl_assert_equal_i(serialized_contact->flags, 0); cl_assert_equal_i(serialized_contact->num_attributes, 1); cl_assert_equal_i(serialized_contact->num_addresses, 2); contacts_...
s_gc_block = (GCBlock) { .block_valid = true, .block_writes = 0, .gc_start_page = free_region_start }; PBL_LOG(LOG_LEVEL_DEBUG, "New Erase Region: %d", s_gc_block.gc_start_page); return (true); } return (false); } return (true); // gc block must be valid to ge...
prv_invoke_watch_file_callbacks(f->name, FILE_CHANGED_EVENT_CLOSED)
; } res = S_SUCCESS; cleanup: mutex_unlock_recursive(s_pfs_mutex); return (res); } status_t pfs_close_and_remove(int fd) { mutex_lock_recursive(s_pfs_mutex); status_t res = E_UNKNOWN; if (!FD_VALID(fd)) { res = E_INVALID_ARGUMENT; } else { File *f = &PFS_FD(fd).file; char file_name[f->nam...
TY_REWARD_DEFAULT }, { .key = ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY, .default_val = ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SUMMARY_DEFAULT }, { .key = ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SESSION, .default_val = ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_SESSION_DEFAULT }, }; // Return true if we ...
prv_close_settings_and_unlock(&file)
; } return rv; } PFSCallbackHandle activity_insights_settings_watch(PFSFileChangedCallback callback) { return pfs_watch_file(ACTIVITY_INSIGHTS_SETTINGS_FILENAME, callback, FILE_CHANGED_EVENT_CLOSED, NULL); } void activity_insights_settings_unwatch(PFSCallbackHandle cb_handle) { pfs_unw...
te resource. const uint32_t update_length = resource_size( SYSTEM_APP, RESOURCE_ID_AS7000_FW_IMAGE); if (update_length == 0) { // We don't have a firmware to write so there's no point in booting // the HRM. PBL_LOG(LOG_LEVEL_DEBUG, "No HRM FW update available"); return; } AS7000FWUpdateHe...
mutex_unlock(dev->state->lock)
; } bool hrm_is_enabled(HRMDevice *dev) { return (dev->state->enabled_state == HRMEnabledState_Enabled || dev->state->enabled_state == HRMEnabledState_PoweringOn); } void as7000_get_version_info(HRMDevice *dev, AS7000InfoRecord *info_out) { if (!dev->state->lock) { PBL_LOG(LOG_LEVEL_DEBUG, "Not an HR...
/* * 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...
memcpy(&info->caller_name, msg, MIN(caller_name_size, sizeof(info->caller_name)))
; msg_length += caller_name_size + 1; // Ensure that we haven't run off the end of our buffer if (msg_length > length) { return false; } info->caller_number[CALLER_BUFFER_LENGTH - 1] = '\0'; info->caller_name[CALLER_BUFFER_LENGTH - 1] = '\0'; return true; } // MJZ: This has been left here for futur...
o_ptr = heap->begin; do { /* Check to see if the current fragment is marked as free. */ if(heap_info_ptr->is_allocated) { alloc_segments++; *used += heap_info_ptr->Size * ALIGNMENT_SIZE; } else { free_segments++; /* Accumulate the total number of free Bytes. ...
if (allocated_block) { return &allocated_block->Data; }
return NULL; } void heap_free(Heap* const heap, void *ptr, uintptr_t client_pc) { UTIL_ASSERT(heap->begin); if (!ptr) { // free(0) is a no-op, just bail return; } UTIL_ASSERT(heap_contains_address(heap, ptr)); // <ptr> not in range (heap->begin, heap->end) heap_lock(heap); { /* Get a poin...
most recent alarm since it modifies the alarm config AlarmConfig *config = s_most_recent_alarm_id != ALARM_INVALID_ID ? &s_most_recent_alarm_config : NULL; bool trigger = true; const bool is_smart = (config && config->is_smart); if (is_smart)...
if (size <= 0) { return false; }
AlarmConfig config = {}; const int load_size = MIN(size, (int)sizeof(config)); if (settings_file_get(file, &key, sizeof(key), &config, load_size) == S_SUCCESS) { if (config.hour > 23 || config.minute > 59) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalid config for id %u! Blowing it out! " "Hours %u ...
t_equal_i(s_alarm_timer_timeout_ms, */ /* (SECONDS_PER_DAY * 2 + prv_hours_and_minutes_to_seconds(1, 30)) * 1000); */ s_current_day = s_sunday; s_current_hour = 12; s_current_minute = 15; cron_service_wakeup(); bool schedule_2[7] = {false, true, false, false, false, false, false}; id2 =...
alarm_get_time_until(id1, &time_until_alarm)
; cl_assert_equal_b(alarm_is_scheduled, true); cl_assert_equal_i(next_alarm, rtc_get_time() + time_until_alarm); // Schedule another alarm before the previous alarm, it becomes the next alarm id2 = alarm_create(&(AlarmInfo) { .hour = 9, .minute = 30, .kind = ALARM_KIND_WEEKDAYS }); at_least_one_alarm_enabled...
ribute__((naked)) NMI_Handler(void) { // Save the processor state at the moment the NMI exception was entered to a // struct of type CoreDumpSavedRegisters. // // Save the processor state which is not automatically stacked during // exception entry before any C code can clobber it. __asm volatile ( " l...
{ CoreDumpFlashRegionHeader region_hdr; CoreDumpImageHeader image_hdr; prv_debug_str_int("CD: Checking: ", flash_base); prv_flash_read_bytes(&region_hdr, flash_base, sizeof(region_hdr)); prv_flash_read_bytes(&image_hdr, flash_base + sizeof(region_hdr), sizeof(image_hdr)); if ((image_hdr.magic =...
// Get flash address to save new image to. This method also pre-erases the region for us. flash_base = prv_flash_start_address(true /*new*/); prv_debug_str_int("CD: Saving to: ", flash_base); // --------------------------------------------------------------------------------------- // Dump RAM and thread i...
bool has_short_title, bool has_short_subtitle) { const time_t now = rtc_get_time(); AttributeList list = {}; prv_set_timeline_icon(&list, TIMELINE_RESOURCE_TIMELINE_WEATHER, 0); attribute_list_add_cstring(&list, AttributeIdTitle, "SUNRISE"); attribute_list_add_cstring(&list, AttributeIdSubtitle, "11°/6°"...
(&list, AttributeIdTitle, "Weekly All Hands design stuff")
; attribute_list_add_cstring(&list, AttributeIdLocationName, "ConfRM-HIGH_Video Room"); static StringList headings = StringListLiteral("Description\0Attendees\0Organizer"); static StringList paragraphs = StringListLiteral( "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incid...
/* * 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...
_write(0, str, strlen(str))
RCA_IC_STEP_E)) //! Defined in sdk/interfaces/ble_stack/(Debug|Release)/libble_stack.a //! Also see https://github.com/pebble/bt-dialog-source/blob/master/ble_stack/src/rom_patch/rom_patch.c#L2687 extern ble_error_t __real_patch_rom_functions(void); static bool s_should_log_about_mic_error = false; static uint32_t s_...
llc_pdu_send_func(conhdl, LL_UNKN_RSP_LEN)
; } #endif #endif static const uint32_t s_orig_functions[] = { #if IS_AE_CHIP (uint32_t) llm_util_get_supp_features, #if !SUPPORTS_PACKET_LENGTH_EXTENSION (uint32_t) llc_length_rsp_pdu_send, #endif #endif (uint32_t) lld_data_rx_check, }; static const uint32_t s_patched_functions[] = { #if IS_AE_CHIP (uint32_...
, duration_total - 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 2); cl_assert_equal_i(prv_count_ha...
(&s_started_handler_calls, a)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, ...
t_get_buffer_size(const AttributeList *list) { return (sizeof(Attribute) * list->num_attributes) + attribute_list_get_string_buffer_size(list); } size_t attribute_list_get_string_buffer_size(const AttributeList *list) { size_t size = 0; for (int i = 0; i < list->num_attributes; i++) { size += prv_get_attribu...
for (int i = 0; i < attr_list->num_attributes; i++) { if (attr_list->attributes[i].id == id) { return &attr_list->attributes[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...
DFSDM_FilterCmd(this->filter, DISABLE)
; DFSDM_TransceiverInitTypeDef DFSDM_InitStruct; DFSDM_TransceiverStructInit(&DFSDM_InitStruct); DFSDM_InitStruct.DFSDM_Interface = DFSDM_Interface_SPI_RisingEdge; DFSDM_InitStruct.DFSDM_Clock = DFSDM_Clock_Internal; DFSDM_InitStruct.DFSDM_Input = DFSDM_Input_External; DFSDM_InitStruct.DFSDM_Redirection =...
turn ctx.copied_size; } // ----------------------------------------------------------------------------- // Creating BLEAdData: // ----------------------------------------------------------------------------- //! Magic high bit used as scan_resp_data_length to indicate that the ad_data //! has been finalized and the ...
(max_ad_data_size)
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, software * distributed under the L...
analytics_stopwatch_start(ANALYTICS_DEVICE_METRIC_BT_OFF_TIME, AnalyticsClient_System)
; s_comm_is_running = false; // This is a legacy event used to update the Settings app. prv_put_disconnection_event(); } static void prv_send_state_change_event(void) { PBL_LOG(LOG_LEVEL_DEBUG, "----> Sending a BT state event"); PebbleEvent event = { .type = PEBBLE_BT_STATE_EVENT, .bluetooth = { ...
ssions) { s_num_captured_sleep_sessions++; } } // -------------------------------------------------------------------------------------------- // Collect summary sleep information from a collection of sessions static void prv_get_sleep_summary(SleepTestResults *results, time_t test_start_utc, ...
printf("\n %-4d 0x%-4x %-4d", (int)minute_data[i].steps, (int)minute_data[i].orientation, (int)minute_data[i].vmc)
; } printf("\n"); // Verify that we got the expected minute data cl_assert_equal_i(minute_data_len, exp_num_minutes); for (int j = 0; j < minute_data_len; j++) { cl_assert_equal_i(minute_data[j].steps, exp_minutes[j].steps); cl_assert_equal_i(minute_data[j].orientation, exp_minutes[j].orientation); ...
on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/ui/content_indicator.h" #include "applib/ui/content_indicator_private.h" #inc...
for (size_t i = 0; i < CONTENT_INDICATOR_BUFFER_SIZE; i++) { content_indicator_deinit(&content_indicator); bytes_written -= sizeof(ContentIndicator *); cl_assert_equal_i(buffer->bytes_written, bytes_written); }
} void test_content_indicator__configuring_should_configure(void) { ContentIndicator content_indicator; content_indicator_init(&content_indicator); ContentIndicatorDirectionData *direction_data = content_indicator.direction_data; // Test setting a dummy configuration for a direction const ContentIndicatorC...
_ds_notifications_received++; } else if (uid == s_invalid_param_uid) { ancs_handle_write_response(0, 0xA2); s_num_ds_notifications_received++; } else if (uid == multiple_complete_dict_uid) { prv_fake_receiving_ds_notification(ARRAY_LENGTH(s_multiple_complete_dicts), (uint8_t*) s_multiple_complete_dicts...
{ // Get 4 complete notifications prv_send_notification((uint8_t *)&s_complete_dict); prv_send_notification((uint8_t *)&s_complete_dict); prv_send_notification((uint8_t *)&s_complete_dict); prv_send_notification((uint8_t *)&s_complete_dict); cl_assert_equal_i(s_num_requested_notif_attributes, 4); cl_asser...
cl_assert_equal_i(s_num_requested_notif_attributes, 12 + 1); cl_assert_equal_i(s_num_ds_notifications_received, 18 + 1); // No increment: cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 4 + 4 + 4); } void test_ancs__should_handle_message_size_attribtue(void) { prv_send_notif...
age_flags, PAGE_FLAG_START_PAGE) || IS_PAGE_TYPE(hdr.page_flags, PAGE_FLAG_CONT_PAGE) || page_is_deleted(hdr.page_flags)) { return (true); } } // pfs filesystem is not active return (false); } // migration utility // Returns true if valid PFS file found, false otherwise bool pfs_active(...
mutex_lock_recursive(s_pfs_mutex)
; PFSFileChangedCallbackNode *callback_node = (PFSFileChangedCallbackNode *)cb_handle; PBL_ASSERTN(callback_node->list_node.next != NULL || callback_node->list_node.prev != NULL || s_head_callback_node_list == &callback_node->list_node); PBL_ASSERTN(list_contains(s_head_callback_node_list, &callba...
m.h" #include "services/normal/timeline/timeline.h" // Fixture //////////////////////////////////////////////////////////////// // Fakes //////////////////////////////////////////////////////////////// #include "fake_rtc.h" // Stubs //////////////////////////////////////////////////////////////// #include "stubs_ana...
(attribute_get_string(&item->attr_list, AttributeIdSubtitle, "none"), "subtitle")
; timeline_item_destroy(item); } void test_timeline_api__item_pin_to_timeline(void) { TimelineItem *item = timeline_item_create_with_attributes(0, 0, TimelineItemTypePin, LayoutIdTest, NULL, NULL); Uuid id = item->header.id; cl_assert(!timeline_exists(&id)); cl_assert(timeline_add(item)); timeline_ite...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ i2c_use(I2C_MAX14690); bool rv = i2c_write_register(I2C_MAX14690, register_address, value); i2c_release(I2C_MAX14690); return (rv); }
/* Public Functions */ bool pmic_init(void) { prv_set_pin_config(); if (!prv_is_alive()) { return false; } // Power up 3.2V rail prv_update_rail_state(PmicRail_LDO2, true); return true; } static bool prv_update_rail_state(PmicRail rail, bool enable) { static int8_t s_ldo2_ref_count = 0; static...
d int radius_of_path = 37; const unsigned int radius_of_spinner_circles = 9; const GPoint circle_center_point = GPoint(layer->bounds.size.w / 2, center_of_circle_y_val); const unsigned int angle = (TRIG_MAX_ANGLE * data->cur_distance_normalized * LOOPS_PER_ANIMATION) / ANIMATION_NORM...
property_animation_get_animation(data->spinner_animation)
; animation_set_duration(animation, animation_duration_ms); animation_set_delay(animation, animation_delay_ms); animation_set_curve(animation, AnimationCurveLinear); animation_set_auto_destroy(animation, false); AnimationHandlers anim_handler = { .stopped = prv_anim_stopped, }; animat...
0, 0, 4 * SECONDS_PER_HOUR }, /* Syria (Syria) [Asia/Damascus] Rule Syria 2012 max - Mar lastFri 0:00 1:00 S Rule Syria 2009 max - Oct lastFri 0:00 0 - Mar 26th 2015 22:00 UTC ~ Oct 29th 2015 21:00 UTC, GMT+2 */ [29]={ 1427407200, 1...
mktime(&jan_6)
); } void test_clock__clock_to_timestamp(void) { s_prefs_24h_style = false; fake_rtc_init(0, 0); rtc_timezone_clear(); static const time_t jan1st_noon_2005 = 1104580800; static const int32_t min_gmtoff = -12 * SECONDS_PER_HOUR; static const int32_t max_gmtoff = 12 * SECONDS_PER_HOUR; static const int32...
TART_FAIL_STRIKE_TWO); } else { dbgserial_putstr("Boot failed, strike 1"); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); } return false; } static bool prv_check_force_boot_recovery(void) { if (boot_bit_test(BOOT_BIT_FORCE_PRF)) { boot_bit_clear(BOOT_BIT_FORCE_PRF); return true; } if (b...
if (boot_bit_test(BOOT_BIT_FW_STABLE)) { dbgserial_putstr("Last firmware boot was stable; clear strikes"); boot_bit_clear(BOOT_BIT_FW_STABLE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); boot_bit_clear(BOOT_BIT_FW_START_FAIL_STRIKE_TWO); boot_bit_clear(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_ONE...
display_init(); display_boot_splash(); #ifdef DISPLAY_DEMO_LOOP while (1) { display_boot_splash(); delay_us(1000000); for (int i=0; i <= 91; ++i) { display_firmware_update_progress(i, 91); delay_us(80000); } for (uint32_t i=0; i <= 0xf; ++i) { display_error_code(i * 0x11...
function call below. app_notification_window_add_new_notification_by_id(id); } static void prv_handle_notification(PebbleEvent *e, void *context) { if (e->type == PEBBLE_SYS_NOTIFICATION_EVENT) { Uuid *id = e->sys_notification.notification_id; switch(e->sys_notification.type) { case NotificationAdded...
app_zalloc_check(sizeof(NotificationsData))
; app_state_set_user_data(data); data->notification_event_info = (EventServiceInfo) { .type = PEBBLE_SYS_NOTIFICATION_EVENT, .handler = prv_handle_notification, }; event_service_client_subscribe(&data->notification_event_info); prv_load_notification_storage(data); prv_push_window(data); } static...
ense. */ #include "health_util.h" #include "services/common/i18n/i18n.h" #include "services/normal/activity/activity.h" #include "shell/prefs.h" #include "util/time/time.h" #include "util/units.h" #include "util/string.h" #include <limits.h> #include <stdio.h> #include <string.h> static void prv_convert_duration_t...
( i18n_get("H", i18n_owner), units_font, color, container)
upervisory_response(enum SupervisoryKind kind, bool final) { ReliablePacket *packet = pulse_link_send_begin( PULSE2_RELIABLE_TRANSPORT_RESPONSE); packet->s = (struct ReliableSupervisoryPacket) { .is_supervisory = true, .kind = kind, .poll_or_final = final,...
(&bad_port, &packet->i.protocol, sizeof(packet->i.protocol))
ss = true; } unlock: prv_unlock(); return success; } //! @note Executes on app task, therefore we need to go through syscalls to access AppInbox! static void prv_callback_event_handler(void *ctx) { AppInboxServiceTag tag = (AppInboxServiceTag)(uintptr_t)ctx; AppInboxConsumerInfo info = {}; size_t num_messa...
kernel_free(node)
; node = next; } s_app_inbox_head = NULL; } prv_unlock(); } static bool prv_is_inbox_being_written(AppInboxNode *inbox) { return (inbox->writer != NULL); } static size_t prv_get_space_remaining(AppInboxNode *inbox) { return (inbox->buffer.size - inbox->buffer.write_index - inbox->buffer.current_...
n writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "flash_translation.h" #include "dri...
ftl_add_region(s_region_list[i].start, s_region_list[i].end, false)
; } // at this point we have found all the regions that already exist on the flash // so run our cleanup logic in case we rebooted during a filesystem operation pfs_reboot_cleanup(); for (unsigned int i = s_next_region_idx; i < TOTAL_NUM_FLASH_REGIONS; i++) { ftl_add_region(s_region_list[i].start, s_reg...
/* * 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...
gdraw_command_sequence_create_with_resource(resource_id)
_x = interpolate_int16(distance_normalized, flip_boundary_from_x, flip_boundary_to_x); const GPoint circle_center = GPoint(current_flip_boundary_x - circle_radius + 1, ...
{ return NULL; }
if (flip_to_the_right) { static const CompositorTransition s_impl = { .init = prv_round_flip_transition_to_launcher_animation_init, .update = prv_round_flip_transition_animation_update, }; return &s_impl; } else { static const CompositorTransition s_impl = { .init = prv_round_fli...
/* * 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...
(buf, i18n_get_locale(), ISO_LOCALE_LENGTH)
; } DEFINE_SYSCALL(void, sys_i18n_get_with_buffer, const char *string, char *buffer, size_t length) { if (PRIVILEGE_WAS_ELEVATED) { if (pebble_task_get_current() == PebbleTask_Worker) { // not allowed from workers syscall_failed(); } if (!memory_layout_is_cstring_in_region(memo...
, 192}, { 936, 24, 144}, { 864, 32, 128}, { 752, 0, 104}, { 704, -32, 16}, { 824, 48, -184}, { 896, 56, -184}, { 1392, -232, 80}, { 1520, -32, 160}, { 1200, 328, -56}, { 1248, 288, -120}, { 1336, 296, 96}, { 1216, 408, 272}, { 1168, 560, 168}, { 1040, 360, 256}, ...
{ 936, -104, -96}, { 1336, -184, 96}, { 1400, 96, 200}, // 94 seconds { 1336, 368, 72}, { 1608, 344, 40}, { 1656, 424, 296}, { 1480, 536, 344}, { 1192, 544, 328}, { 936, 280, 200}, { 912, 272, 112}, { 904, 416, -40}, { 880, 528, -32}, { 912, 584, -80}, { 1160,...
{ 1224, 432, -56}, { 1400, 304, 96}, { 1808, 344, 152}, { 1536, 408, 104}, { 984, 248, 72}, { 1232, 200, 104}, { 1344, 0, 232}, { 1248, 40, 224}, { 1040, 48, 216}, // 97 seconds { 936, 16, 168}, { 840, 16, 136}, { 776, 8, 128}, { 720, -24, 104}, { 680, -24, 4...
/* * 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 (((uint8_t *) frame >= end) || !gdraw_command_frame_validate(frame, (size_t)(end - (uint8_t *)frame))) { return false; } frame = prv_next_frame(frame); }
return (end == (uint8_t *) frame); } static uint32_t prv_get_single_play_duration(GDrawCommandSequence *sequence) { uint32_t total = 0; GDrawCommandFrame *frame = sequence->frames; for (uint32_t i = 0; i < sequence->num_frames; i++) { total += gdraw_command_frame_get_duration(frame); frame = prv_next...
r *swap_layer = (SwapLayer *)context; prv_finish_animation(swap_layer); prv_announce_interaction(swap_layer); // If our first click caused a swap, then just scroll to the top of the current notification int16_t offset = prv_get_current_notification_offset(swap_layer); const GRect *layer_frame = &swap_layer->...
(next, &next_frame)
; layer_add_child(&swap_layer->layer, (Layer *)next); layer_insert_below_sibling((Layer *)next, &swap_layer->arrow_layer.layer); swap_layer->next = next; } } bool swap_layer_attempt_layer_swap(SwapLayer *swap_layer, ScrollDirection direction) { return prv_attempt_swap(swap_layer, direction, true /* to_...
nalytics_app_sleep_cpu_cycles = 0; static RtcTicks s_analytics_app_stop_ticks = 0; // We need different timings for our different platforms since we use different mechanisms to keep // time and to wake us up out of stop mode. On stm32f2 we don't have a millisecond register so we // use the "retina rtc" and a RTC Alarm...
(ticks_elapsed)
; // Update the task watchdog every time we come out of STOP mode (which is // at least once/second) since the timer peripheral will not have been // incremented task_watchdog_step_elapsed_time_ms((ticks_elapsed * 1000) / RTC_TICKS_HZ); s_analytics_device_stop_ticks += ticks_elapsed; ...
/* * 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(mfg_info_get_watch_color(), WATCH_INFO_COLOR_GREEN)
; } void test_spalding_mfg_info__rtc_freq(void) { cl_assert_equal_i(mfg_info_get_rtc_freq(), 0); mfg_info_set_rtc_freq(0xfefefefe); cl_assert_equal_i(mfg_info_get_rtc_freq(), 0xfefefefe); mfg_info_set_rtc_freq(1337); cl_assert_equal_i(mfg_info_get_rtc_freq(), 1337); } void test_spalding_mfg_info__mode...
save the time state to the backup registers in ticks. #define SAVE_TIME_FREQUENCY (30 * RTC_TICKS_HZ) static void check_and_handle_rollover(RtcIntervalTicks rtc_ticks) { bool save_needed = false; const RtcIntervalTicks last_ticks = s_last_ticks; s_last_ticks = rtc_ticks; if (rtc_ticks < last_ticks) { // ...
RTC_ClearITPendingBit(RTC_IT_ALRA)
; EXTI_ClearITPendingBit(EXTI_Line17); } }
ty("clear_over_black", ctx.parent_framebuffer, GColorWhite)); } #define ORIGIN_RECT_NO_CLIP GRect(0, 0, 144, 168) #define ORIGIN_RECT_CLIP_XY GRect(0, 0, 20, 20) #define ORIGIN_RECT_CLIP_NXNY GRect(0, 0, 144, 168) #define ORIGIN_DRAW_RECT_NO_CLIP GRect(6, 6, 30, 40) #define ORIGIN_DRAW_RECT_CLIP_X...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_clip_xy.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_NXNY, ORIGIN_RECT_CLIP_NXNY, true, 5); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_NXNY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_aa_sw5_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if...
fb); layer_set_update_proc(&layer, &across_ny_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_across_ny_offset_layer.${BIT_DEPTH_NAME}.pbi")); } void test_graphics_draw_rect_${BIT_DEPTH_NAME}__color(void) { GContext ctx; Layer layer; test_graph...
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 4)
/* * 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...
(0x01234567)
; delay_ms(200); display_error_code(0x89abcdef); delay_ms(200); display_error_code(0xcafebabe); delay_ms(200); display_error_code(0xfeedface); delay_ms(200); display_error_code(0x8badf00d); delay_ms(200); display_error_code(0xbad1ce40); delay_ms(200); display_error_code(0...
n.h> #define NUM_SYSTEM_FONTS (ARRAY_LENGTH(s_font_resource_keys)) void *task_malloc(size_t bytes) { return malloc(bytes); } void *task_zalloc(size_t bytes) { void *ptr = malloc(bytes); if (ptr) { memset(ptr, 0, bytes); } return ptr; } void *task_zalloc_check(size_t bytes) { void *ptr = task_zalloc(...
if (num_bytes == 0) { return NULL; }
uint8_t *result = malloc(num_bytes + (used_aligned ? 7 :0)); if (!result || sys_resource_load_range(app_num, resource_id, offset, result, num_bytes) != num_bytes) { free(result); return NULL; } return result; } void wtf(void) { printf(">>>> WTF\n"); EM_ASM_INT_V({ abort(); }); while (1) ;...
-1504, 208, -408}, { -1320, 536, -824}, { -1080, 552, -840}, { -1224, 424, -736}, { -1000, 328, -616}, { -1272, 368, -568}, { -1600, 192, -464}, { -1856, 112, -424}, { -1768, 72, -360}, { -1496, 40, -296}, { -1400, 16, -280}, { -1400, 112, -200}, { -1224, 128, -168}, ...
{ -1128, 376, -32}, { -1304, 792, 192}, // 10 seconds { -1384, 600, -128}, { -1112, 752, -360}, { -1136, 760, -376}, { -1448, 816, 40}, { -1704, 392, 208}, { -1560, 288, 160}, { -1320, 168, 144}, { -1184, 192, 184}, { -1088, 160, 192}, { -1056, 184, 168}, { -1008,...
{ -1296, 272, 320}, { -1128, 328, 352}, { -1128, 384, 280}, { -992, 104, 280}, { -728, -528, -408}, { -920, -592, 48}, { -1384, 384, -280}, { -1664, 304, -272}, { -1680, 384, -232}, { -1840, 480, -8}, { -1672, 472, 176}, { -1528, 600, 248}, { -1448, 728, 80}, // ...
const char *localized_text) { if (data->warning_dialog) { return; // only show one dialog at a time } if (exit_on_pop) { bool animated = false; app_window_stack_pop_all(animated); } data->warning_dialog = weather_app_warning_dialog_push(localized_text, ...
window_init(window, WINDOW_NAME("Weather"))
; const WindowHandlers window_handlers = { .appear = prv_main_window_appear, .load = prv_main_window_load, .disappear = prv_main_window_disappear, .unload = prv_main_window_unload, }; window_set_window_handlers(window, &window_handlers); window_set_click_config_provider(window, prv_main_window_...
.stopped = prv_move_timeline_layer_stopped, }, data); animation_set_duration(animation, TIMELINE_CARD_TRANSITION_MS / 2); animation_set_custom_interpolation(animation, interpolate_moook); animation_schedule(animation); return animation; } static void prv_push_pin_window(TimelineAppData *data, TimelineIterSt...
(move_animation)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_test_get_miss(1)
; prv_test_get_miss(2); prv_test_get_miss(3); prv_push(1); prv_test_get_hit(0, 0); prv_test_get_hit(1, 1); prv_test_get_miss(2); prv_test_get_miss(3); prv_push(2); prv_test_get_hit(0, 0); prv_test_get_hit(1, 1); prv_test_get_hit(2, 2); prv_test_get_miss(3); prv_push(3); prv_test_get_miss(...
return (!empty && !filtered_out); } static bool prv_has_transition_window(ModalContext *context) { Window *window = window_stack_get_top_window(&context->window_stack); return (window && (context > &s_modal_window_stacks[ModalPriorityDiscreet])); } static bool prv_has_opaque_window(ModalContext *context) { Wi...
(modal_is_destination)
; } static void prv_handle_app_to_modal_transition_visible(void) { // The last event resulted in a modal window being pushed where we didn't have any before. // Start the animation! compositor_transition(prv_get_compositor_transition(true /* modal_is_destination */)); } static void prv_handle_modal_to_app_trans...
tCANONICAL_REG_INDEX_LR])) { // The core dump handler got invoked from another exception, therefore the // running task was interrupted by an exception. // Get R0-R3, R12, R14, PC, xpsr for the task off the process stack used // by the task. // The information for this task is going to be ...
for (unsigned int i = 0; i < count; i++) { chunk_hdr.size = regions[i].length + sizeof(CoreDumpMemoryHeader); CD_ASSERTN(s_flash_addr + chunk_hdr.size - flash_base < CORE_DUMP_MAX_SIZE); s_flash_addr += prv_flash_write_bytes(&chunk_hdr, s_flash_addr, sizeof(chunk_hd...
} // Write the Core Dump Image Header // Returns number of bytes written @ flash_addr static uint32_t prv_write_image_header(uint32_t flash_addr, uint8_t core_number, const ElfExternalNote *build_id, uint32_t timestamp) { CoreDumpImageHeader hdr = { .magic = CORE_DUMP_MAGI...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
text_layer_set_font(status, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD))
; text_layer_set_text_alignment(status, GTextAlignmentCenter); layer_add_child(&window->layer, &status->layer); app_window_stack_push(window, true /* Animated */); s_timer = evented_timer_register(100, true /* repeating */, prv_update_display, data); } static void s_main(void) { prv_handle_init(); app_e...
e.page_start_addr = FLASH_REGION_DEBUG_DB_BEGIN; } s_curr_state.page_start_addr = prv_get_unit_base_address(s_curr_state.page_start_addr); prv_erase_unit(s_curr_state.page_start_addr); s_curr_state.log_file_id = prv_get_next_log_file_id(prev_log_id); } done: // we have allocated a region to be used...
if (!state->sent_build_id) { // dump header data first // use the read buffer to also hold build id str. Each byte of the build ID requires 2 // characters. const int off = MEMBER_SIZE(DumpLogState, msg_buf) - 2 * MEMBER_SIZE(FlashLoggingHeader, build_id) - 1; uint8_t build_id[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...
{ *reg = (((sets << SCB_DCISW_SET_Pos) & SCB_DCISW_SET_Msk) | ((ways << SCB_DCISW_WAY_Pos) & SCB_DCISW_WAY_Msk)); #if defined(__CC_ARM) __schedule_barrier(); #endif }
while (ways--); } while (sets--); __DSB(); __ISB(); } #endif MOCKABLE void icache_enable(void) { #if __ICACHE_PRESENT SCB->CSSELR = CSSELR_L1_ICACHE; __DMB(); s_icache_cssidr = SCB->CCSIDR; icache_invalidate_all(); __DSB(); __ISB(); SCB->CCR |= SCB_CCR_IC_Msk; // enable I-Cache __DSB(); __I...
rs.h" #include "stm32f2xx_rcc.h" #include "stm32f2xx_rtc.h" //! LSE startup time, about 4 seconds empirically, //! but we give it 30 seconds since it it fails we sadwatch static const int LSE_READY_TIMEOUT_MS = 30000; static const unsigned int LSE_FREQUENCY_HZ = 32768; static const int RTC_ASYNC_PRESCALER = 7; static...
RTC_SetTime(RTC_Format_BIN, &rtc_time)
; } void rtc_speed_up(void) { if (!prv_slow_mode()) { // If we're not in slow mode there's nothing to do return; } // On standby the RTC is reset to date 0, so the RTC's time is really // the number of seconds we've been in standby int32_t elapsed_since_standby = prv_seconds_since_standby(); int32...
Record* r = registry->records + i; if (r->active == false) { return i; } } return -1; } int registry_private_add(const char* key, const uint8_t key_length, const uint8_t* uuid, uint8_t description, const uint8_t* value, uint8_t value_length, Registry* registry) { if (value_length >= MAX_VALUE_S...
{ const int idx = record_get_index(key, key_length, uuid, registry); PBL_ASSERTN(idx < registry->num_records); if (idx >= 0) { Record* r = registry->records + idx; r->active = false; registry->is_different_from_flash = true; return 0; } return -1; }
//////////////////////////////////////////////////////////// // Read and write from flash //////////////////////////////////////////////////////////// static void registry_set_header(uint32_t cursor, bool active) { const uint8_t* header = s_inactive_header; if (active) { header = s_active_header; } flash_...
rollover in order to update our stats for the sleep // and activity metrics to include the previous day's history void activity_insights_recalculate_stats(void) { prv_calculate_metric_history_stats(ActivityMetricSleepTotalSeconds, &s_sleep_stats); prv_calculate_metric_history_stats(ActivityMetricStepCount, &s_acti...
i18n_get("%l:%M%p", i18n_owner)
; char time_str_buf[TIME_BUFFER_LENGTH]; strftime(time_str_buf, TIME_BUFFER_LENGTH, format, &time); safe_strcat(out_buf, string_strip_leading_whitespace(time_str_buf), buf_length); } // ----------------------------------------------------------------------------------------- // Generates the sleep enter/exit ti...
graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(ctx, false); graphics_draw_line(ctx, GPoint(50, 40), GPoint(70, 35)); } void across_nx_layer_update_callback(Layer* me, GContext* ctx) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_context_set_antialiased(...
(&layer, &ctx)
cable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "applib/ui/s...
GRect(0,0,180,180)
; ScrollLayer *scroll_layer = scroll_layer_create(scroll_bounds); GSize content_size = GSize(180, 2000); scroll_layer_set_content_size(scroll_layer, content_size); int32_t scroll_height = DEFAULT_SCROLL_HEIGHT; int32_t offset = 0; for (offset = 0; offset < content_size.h - scroll_bounds.size.h; offset...
rovider, data); data->timeline_layer.animating_intro_or_exit = false; if (!finished || (!prv_set_state(s_app_data, TimelineAppStateStationary) && !prv_set_state(s_app_data, TimelineAppStateDaySeparator))) { return; } data->current_animati...
prv_play_peek_in(data)
; return; } #endif peek_layer_set_duration(peek_layer, duration); peek_layer_play(peek_layer); } static void prv_intro_timer_callback(void *context) { TimelineAppData *data = context; data->intro_timer_id = EVENTED_TIMER_INVALID_ID; // if we are already hiding the peek, we were in a mini peek const...
[WithinUpperBounds].u64 + margin, .s8 = cases[WithinUpperBounds].s8 + margin, .s16 = cases[WithinUpperBounds].s16 + margin, .s32 = cases[WithinUpperBounds].s32 + margin, .s64 = cases[WithinUpperBounds].s64 + margin, .d = cases[WithinUpperBounds].d - margin, .expected_error_msg = "TypeErr...
jerry_create_boolean(true)
, .expected_output = true, }, { .input = jerry_create_number(1.0), .expected_output = true, }, { .input = jerry_create_string((const jerry_char_t *)" "), .expected_output = true, }, { .input = jerry_create_array(0), .expected_output = true, }, { ...
FIGURE; // fallthrough case LinkState_Opened: prv_send_configure_request(this); // fallthrough case LinkState_RequestSent: case LinkState_AckSent: if (prv_handle_configure_request(this, packet)) { prv_transition_to(this, LinkState_AckSent); } else { prv_transiti...
{ prv_transition_to(this, LinkState_Closed); }
else if (this->state->link_state == LinkState_Stopping) { prv_transition_to(this, LinkState_Stopped); } else if (this->state->link_state == LinkState_AckReceived) { prv_transition_to(this, LinkState_RequestSent); } else if (this->state->link_state == LinkState_Opened) { PBL_LOG(LOG_LEVEL_WARNING, "Term...
f (glyph_block_bits_left <= 0) { src = *(++glyph_block); glyph_block_bits_left += 32; // Need to account for the dest_shift when loading up the new glyph block rotl32(src, glyph_block_bits_left + dest_shift); src_rotated = glyph_block_bits_left + dest_shift; } dest_b...
rotl32(src, dest_shift % 32)
, 296, -88}, { 864, 312, -80}, { 760, 296, -120}, { 736, 240, -112}, { 760, 224, -120}, { 792, 184, -88}, { 848, 200, -144}, { 944, 200, -200}, { 1032, 168, -192}, { 1200, 144, -120}, { 960, 232, -336}, { 1216, 272, -416}, { 1312, 160, -200}, { 1064, 216, -312}, {...
{ 1352, 608, -256}, { 1536, 472, -16}, { 1552, 512, -104}, { 1280, 424, -112}, { 1048, 560, -168}, { 896, 296, -64}, { 712, 200, -256}, { 704, 256, -432}, { 712, 200, -528}, { 704, 216, -656}, { 656, 160, -752}, { 832, 256, -928}, // 96 seconds { 704, 208, -808}, ...
{ 792, 104, -152}, { 1112, 152, -208}, { 1368, 168, -136}, { 1256, 192, -304}, { 1440, 280, -384}, { 1440, 240, -272}, { 1120, 240, -272}, { 888, 320, -336}, { 720, 392, -280}, { 672, 440, -280}, { 760, 520, -360}, { 864, 544, -376}, { 896, 560, -368}, { 928, 632...
/* * 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 (!window) { return NULL; } return &((Window *)window)->layer; }
// Override find layer function so we don't have to muck around with points and layer bounds (also // this process can change and this test will keep on working) Layer *layer_find_layer_containing_point(const Layer *node, const GPoint *point) { return s_active_layer; } typedef struct RecognizerHandled { ListNode...
{ 472, 392, -768}, { 472, 376, -768}, { 472, 392, -784}, { 464, 384, -768}, { 480, 368, -768}, { 480, 400, -768}, { 472, 384, -760}, { 480, 392, -760}, { 480, 384, -768}, { 472, 376, -768}, // 102 seconds { 496, 384, -760}, { 472, 376, -776}, { 456, 432, -744}, { ...
{ 472, 384, -760}, { 464, 416, -760}, { 472, 376, -768}, { 488, 392, -760}, { 472, 408, -760}, { 464, 376, -752}, { 480, 392, -768}, { 480, 392, -760}, { 472, 400, -760}, { 488, 392, -776}, { 472, 384, -760}, { 488, 376, -768}, { 464, 408, -760}, { 472, 368, -784}...
{ 472, 392, -792}, { 464, 360, -752}, { 464, 392, -768}, { 488, 400, -760}, // 110 seconds { 448, 408, -768}, { 464, 408, -760}, { 464, 376, -760}, { 464, 384, -768}, { 488, 400, -760}, { 456, 400, -752}, { 464, 400, -760}, { 480, 392, -760}, { 464, 392, -760}, ...
{ 1584, -408, 152}, { 1168, -168, -24}, { 1232, 160, -424}, { 2320, 2400, -2168}, { 1752, 3512, -3168}, // 33 seconds { 168, 2280, -2184}, { -432, 1176, -1136}, { -752, 752, -552}, { -952, 72, 56}, { -1480, 48, 280}, { -1176, 168, 8}, { -1056, 320, 144}, { -848, 1...
{ 1232, 3576, -3152}, { -168, 1920, -1976}, { -720, 984, -856}, { -856, 208, -312}, { -1248, -120, -32}, { -1648, -152, -144}, { -1184, -16, 0}, { -920, 704, -216}, { -1216, 3752, -2448}, { 184, 4000, -3224}, { 1136, 2536, -1224}, { 744, 1064, -16}, { 960, 488, -40},...
ter_to = grect_center_point(&icon_to); GPoint target = gpoint_add(gpoint_sub(center_to, center_from), GPoint(size.w / 2, size.h / 2)); const bool take_ownership = true; KinoReel *kino_reel = kino_reel_scale_segmented_create(from_reel, take_ownership, layer_frame); kino_reel_transform_set_from_frame(kino_reel, ...
{ peek_layer_set_fields(peek_layer, number, NULL, NULL); }
tActiveWindow *active_window) { ActionBarLayer *action_bar = &active_window->action_bar; bool is_paused = false; bool can_stop = false; if (active_window->workout_controller) { is_paused = active_window->workout_controller->is_paused(); can_stop = active_window->workout_controller->stop != NULL; } ...
prv_draw_heart_icon(ctx, active_window->hr_measuring_icon, &bounds, render, size_out)
; } static void prv_render_separator(GContext *ctx, Layer *layer) { graphics_context_set_stroke_color(ctx, GColorBlack); graphics_draw_horizontal_line_dotted(ctx, GPoint(0, layer->bounds.size.h - 1), layer->bounds.size.w); } static void prv_render_bg_color(GContext *ctx, GRe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ if (clock_is_24h_style()) { buffer[0] = '\0'; return 0; } else { return prv_format_time(buffer, buffer_size, i18n_noop("%p"), timestamp); } }
size_t clock_format_time(char *buffer, uint8_t size, int16_t hours, int16_t minutes, bool add_space) { if (size == 0 || buffer == NULL) { return 0; } bool is24h = clock_is_24h_style(); const char *format; // [INTL] you want to have layout resources that specify time formatting...
rcpy(data->debug_card.dialog_text, "HR stats"); // Get various stats time_t end_time = time(NULL); // List of time ranges typedef struct { uint32_t seconds; char *desc; } TimeRange; TimeRange ranges[] = { {1 * SECONDS_PER_HOUR, "1 hour"}, {30 * SECONDS_PER_MINUTE, "30 min"}, }; unsig...
window_set_user_data(data->steps_window, data)
; window_set_click_config_provider_with_context(data->steps_window, steps_click_config_provider, data); window_set_window_handlers(data->steps_window, (WindowHandlers) { .load = steps_window_load, .unload = steps_window_unload, .appear = steps_window_appea...
by Jumboji //! @return the GTextNode view node of the notification static NOINLINE GTextNode *prv_create_view(NotificationLayout *layout, bool use_body_icon) { const NotificationStyle *style = &s_notification_styles[system_theme_get_content_size()]; const bool is_reminder = prv_is_reminder(layout); const Layout...
style->body_line_delta, .text.extent.offset.y = style->body_padding, .text.extent.margin.h = style->body_padding, }; const LayoutNodeHeadingsParagraphsConfig headings_paragraphs_node = { .extent.node.type = LayoutNodeType_HeadingsParagraphs, .extent.offse...
/* * 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 (prv_clocksource_is_lse_started()) { // LSE remains on through standby and resets so often don't need to do anything return true; }
dbgserial_putstr("Starting LSE oscillator"); RCC_LSEConfig(RCC_LSE_ON); for (int i = 0; i < LSE_READY_TIMEOUT_MS; i++) { if (prv_clocksource_is_lse_started()) { return true; } delay_us(1000); } dbgserial_putstr("LSE oscillator did not start"); return false; } //! This routine relies on...
------------------------------------------- // The same menu layer is reused for TX / RX, we just handle it differentely // based on whether we are currently executing a TX or RX test. #define TX_MENU_NUM_PAYLOAD_ROWS (2) enum { TXMenuIdx_Channel = 0, TXMenuIdx_UnmodulatedContinuousWave, TXMenuIdx_PayloadLength...
(index, data)
; if (prv_test_is_running(data) && row != TXMenuIdx_RunStop) { // Can't change params while running return; } switch (row) { case TXMenuIdx_Channel: prv_txrx_number_window(39, &data->channel, "Channel", data); break; case TXMenuIdx_UnmodulatedContinuousWave: ...
int8_t chunk[chunk_size] // data for the above chunk // // uint32_t chunk_key // uint32_t chunk_size // uint8_t chunk[chunk_size] // ... // uint32_t 0xFFFFFFFF // terminates list // // For threads, we store a CoreDumpThreadInfo structure as t...
{ return E_INTERNAL; }
} *size = current_offset; return S_SUCCESS; } void core_dump_mark_read(uint32_t flash_base) { CoreDumpFlashRegionHeader region_hdr; flash_read_bytes((uint8_t *)&region_hdr, flash_base, sizeof(region_hdr)); region_hdr.unread = 0; flash_write_bytes((uint8_t *)&region_hdr, flash_base, sizeof(region_hdr));...
v; } PPoGATTWorkAroundState *connection_get_ppogatt_wa_state(Connection *connection) { PPoGATTWorkAroundState *state; prv_lock(); { state = connection->ppogatt_wa_state; } prv_unlock(); return state; } bool connection_is_gateway(Connection *connection) { bool val; prv_lock(); { val = connect...
prv_set_flag(connection, is_reversed_ppogatt_enabled, ConnectionFlag_IsReversedPPoGATTEnabled)
; } void connection_set_last_pairing_result(uint16_t conn_idx, uint8_t result) { prv_lock(); { Connection *connection = connection_by_idx(conn_idx); if (connection) { connection->last_pairing_result = result; } } prv_unlock(); } void connection_set_ppogatt_wa_state(Connection *connection, PP...
_all(&ACTIVITY_SUMMARY_PIN_CONFIG); return prv_push_summary_pin(pin_time_utc, now_utc, uuid, steps, total_steps_avg, &ACTIVITY_SUMMARY_PIN_CONFIG); } // ------------------------------------------------------------------------------------------------ // Checks to see if we should add/up...
i18n_noop("You're a machine!")
, i18n_noop("Hey speedster, we can barely keep up!"), i18n_noop("Way to show us what you're made of 👊"), }, }; return prv_get_variant(&s_running_intros, VARIANT_RANDOM); } case ActivitySessionType_Open: { static const InsightCopyVariants s_open_intros = { ...
ter_focus_animation( MenuLayer *menu_layer) { // it's critical to cancel the animation for center focus here so that any potential in-between // selection state will be cleaned up const bool was_animating = menu_layer->center_focused ? prv_cancel_selection_animation(menu_layer) : ...
{ ++it->count; }
} void menu_layer_set_selected_next(MenuLayer *menu_layer, bool up, MenuRowAlign scroll_align, bool animated) { const MenuLayerBeforeSelectionChangeState before_state = prv_capture_state_and_cancel_center_focus_animation(menu_layer); MenuSelectNextIterator it = { .it =...
/* * 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...
check_atan2(-1508, 299)
; check_atan2(1020, 1002); } void test_math__ceil_log_two(void) { check_ceil_log_two(4); check_ceil_log_two(5); check_ceil_log_two(100); check_ceil_log_two(256); check_ceil_log_two(123456); } void test_math__sign_extend(void) { cl_assert_equal_i(sign_extend(0, 32), 0); cl_assert_equal_i(sign_extend(0,...
(Animation *animation, bool finished, void *context) { TimelineAppData *data = context; if (finished) { prv_set_state(data, TimelineAppStateStationary); } } static void prv_hide_day_sep_stopped(Animation *animation, bool finished, void *context) { TimelineAppData *data = context; if (!finished || !prv_se...
timeline_model_iter_prev(&new_idx, &has_new)
) { prv_exit(data); goto done; } if (has_new) { timeline_layer_set_prev_item(&data->timeline_layer, new_idx); } timeline_layer_move_data(&data->timeline_layer, -1); } // If we interrupted a previous scroll, hasten this scroll const bool is_hasted = !was_stationary; const uint3...
ow. void test_window_stack__push_during_window_unload(void) { Window *window = window_create(); window_set_window_handlers(window, &(WindowHandlers){ .load = prv_window_load, .unload = prv_push_window_unload }); WindowStack *stack = app_state_get_window_stack(); // Switch to the app state to push a...
{ Window *window1 = window_create(); Window *window2 = window_create(); WindowStack *stack = app_state_get_window_stack(); window_stack_push(stack, window1, true); Animation *first = fake_animation_get_first_animation(); cl_assert(animation_is_scheduled(first)); window_stack_push(stack, window2, true)...
c void prv_mute_notification_weekends(ActionMenu *action_menu, const ActionMenuItem *action_menu_item, void *context) { prv_mute_notification(action_menu_item, MuteBitfield_Weekends); } static bool prv_has_mute_action(TimelineItem ...
(&notif_prefs->attr_list, AttributeIdAppName, "")
; } const char *mute_label = i18n_noop("Mute %s"); static char mute_label_buf[32]; snprintf(mute_label_buf, sizeof(mute_label_buf), i18n_get(mute_label, root_level), display_name); const uint8_t mute_option = ancs_filtering_get_mute_type(notif_prefs); const bool is_mute_weekdays = ...
", .res_key = FONT_KEY_GOTHIC_24_BOLD}, {.js_name = "28px Gothic", .res_key = FONT_KEY_GOTHIC_28}, {.js_name = "28px bold Gothic", .res_key = FONT_KEY_GOTHIC_28_BOLD}, {.js_name = "30px bolder Bitham", .res_key = FONT_KEY_BITHAM_30_BLACK}, {.js_name = "42px bold Bitham", .res_key = FONT_KEY_BITHAM_42_BOLD}, {...
graphics_text_attributes_destroy(s_rocky_text_state.text_attributes)
; s_rocky_text_state.text_attributes = NULL; } } void rocky_api_graphics_text_reset_state(void) { prv_text_state_deinit(); s_rocky_text_state = (RockyAPITextState) { .font = s_default_font, .font_name = DEFAULT_FONT_DEFINITION.js_name, .overflow_mode = GTextOverflowModeWordWrap, .alignment ...
e_unregister, uint8_t *storage) { // No check is needed on the value of `storage `, we're not going to derefence it. return app_inbox_service_unregister_by_storage(storage); } static bool prv_get_consumer_info(AppInboxServiceTag tag, AppInboxConsumerInfo *info_in_out); DEFINE_SYSCALL(bool, sys_app_inbox_service_g...
if (!info_out) { return false; }
bool success = false; prv_lock(); { AppInboxNode *inbox = prv_find_inbox_by_tag_and_log_if_not_found(tag); if (!inbox) { goto unlock; } *info_out = (const AppInboxConsumerInfo) { .tag = tag, .message_handler = inbox->message_handler, .dropped_handler = inbox->dropped_hand...
e_is_accepting_outbound(), true); } static void prv_out_failed_callback(DictionaryIterator *failed, AppMessageResult reason, void *context) { s_out_failed_call_count++; cl_assert_equal_p(context, &s_context); prv_assert_dict_equal(failed, &s_expected_iter); s_failure_result = reason; // When the out...
{ if (s_app_receiver_oom) { return false; } s_is_app_message_receiver_open = true; return true; }
void app_message_receiver_close(void) { s_is_app_message_receiver_open = false; } size_t sys_app_pp_app_message_inbox_size_maximum(void) { return 600; } void sys_app_pp_app_message_analytics_count_drop(void) { } bool sys_get_current_app_is_js_allowed(void) { return false; } Version sys_get_current_app_sdk_v...
imu/units.h" #include "system/logging.h" #include "os/mutex.h" #include "system/passert.h" #include "util/size.h" #include "kernel/util/sleep.h" #define STM32F2_COMPATIBLE #define STM32F4_COMPATIBLE #include <mcu.h> #include <inttypes.h> #include <stdio.h> #include <string.h> #define ACCEL_MAX_IDLE_DELTA 100 // Sta...
if (!accel_start()) { // couldn't start the accel return (false); }
} if (!i2c_read_register_block(I2C_LIS3DH, register_address, read_size, buffer)) { prv_reset(); return (false); } if (!running) { accel_stop(); } return (true); } bool lis3dh_write(uint8_t address, uint8_t write_size, const uint8_t *buffer) { bool running = accel_running(); if (!runnin...
ilename_path, int src_line_number, const char* fmt, ...) { va_list fmt_args; va_start(fmt_args, fmt); int len = vsnprintf(buffer, buffer_len, fmt, fmt_args); va_end(fmt_args); return (len); } static char *get_expected_msg(void) { cl_assert(s_msg.msg_arr != NULL); cl_assert(s_msg.curr_msg_idx < s_msg.num_...
test_flash_logging__initialize()
; flash_logging_init(); int num_logs; char **logs = generate_unique_logs(space_avail, log_len, &num_logs); setup_and_test_expected_msg(logs, 0, 0, num_logs); free_logs(logs, num_logs); } } //! void test_flash_logging__wrap(void) { flash_logging_init(); uint32_t tot_size, erase_size, page_siz...
pringGreenARGB8}, {"cyan", GColorCyanARGB8}, {"bulgarianrose", GColorBulgarianRoseARGB8}, {"imperialpurple", GColorImperialPurpleARGB8}, {"indigo", GColorIndigoARGB8}, {"electricultramarine", GColorElectricUltramarineARGB8}, {"armygreen", GColorArmyGreenARGB8}, {"darkgray", GColorDarkGrayARGB8}, {"liber...
if (parsed_color->a == 0) { *parsed_color = GColorClear; }
return true; } } case 7: { // #RRGGBB if (prv_parse_hex_comps(color_value + 1, 2, &r, &g, &b, NULL)) { *parsed_color = GColorFromRGB(r, g, b); return true; } } case 9: { // #RRGGBBAA if (prv_parse_hex_comps(color_value + 1, 2, &r, &g, &b, &a)) { *...
lude "process_state/app_state/app_state.h" #include "services/common/comm_session/session.h" #include "syscall/syscall.h" #include "system/logging.h" #include "system/passert.h" #include "util/math.h" static void prv_outbox_prepare(AppMessageCtxOutbox *outbox); static uint16_t prv_get_next_transaction_id(AppMessageCt...
(outbox->app_outbox_message)
; outbox->app_outbox_message = NULL; // Finish by moving to the next phase. outbox->phase = OUT_CLOSED; } static void prv_throttle(AppMessageCtxOutbox *outbox) { if (outbox->not_ready_throttle_ms == 0) { outbox->not_ready_throttle_ms = 1; } else { outbox->not_ready_throttle_ms = MIN(outbox->not_read...
/* * 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...
{ switch (hr_util_get_hr_zone(bpm)) { case HRZone_Zone1: /// Zone 1 HR Label return i18n_noop("FAT BURN"); case HRZone_Zone2: /// Zone 2 HR Label return i18n_noop("ENDURANCE"); case HRZone_Zone3: /// Zone 3 HR Label return i18n_noop("PERFORMANCE"); default: //...
static const char* prv_get_label_for_metric(WorkoutMetricType metric_type, WorkoutActiveWindow *active_window) { switch (metric_type) { case WorkoutMetricType_Hr: { int bpm = active_window->workout_controller->get_metric_value(WorkoutMetricType_Hr, ...
l_node->horizontal_alignment = GTextAlignmentLeft; // This vertical node is just a container to vertically center the icon node const size_t max_vertical_icon_container_nodes = 1; GTextNodeVertical *vertical_icon_container_node = graphics_text_node_create_vertical(max_vertical_icon_container_nodes); vertic...
kino_reel_custom_get_data(reel)
racking_start(PowerSystemMcuDma1); SPI_I2S_DMACmd(BOARD_CONFIG_DISPLAY.spi, SPI_I2S_DMAReq_Tx, ENABLE); prv_display_context_init(&s_display_context); s_display_context.get_next_row = nrcb; s_display_context.complete = uccb; prv_do_dma_update(); // Block while we wait for the update to finish. TickType_...
if (is_end_of_buffer) { prv_display_write_byte(0x00); // Disable display slave select prv_disable_chip_select(); prv_display_enter_static(); s_display_context.complete(); signed portBASE_TYPE was_higher_priority_task_woken = pdFALSE; xSemaphoreGiveFromISR(s_dma_update_in_pr...
#if DISPLAY_ORIENTATION_ROTATED_180 prv_memcpy_reverse_bytes((uint8_t*)s_dma_line_buffer, r.data, DISP_LINE_BYTES); s_dma_line_buffer[0] &= ~(0xffff); s_dma_line_buffer[0] |= (DISP_MODE_WRITE | reverse_byte(r.address + 1) << 8); #else prv_memcpy_backwards(s_dma_line_buffer, (uint32_t*)r.data, DISP_LIN...
tributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "clar.h" #include "applib/app_glance.h" #include "drivers/rtc...
rtc_get_time()
+ 20, .type = AppGlanceSliceType_IconAndSubtitle, .icon_and_subtitle.icon_resource_id = APP_GLANCE_SLICE_DEFAULT_ICON, } }, }; cl_assert_equal_m(&glance, &expected_glance, sizeof(AppGlance)); } void prv_reload_with_validation_cb(AppGlanceReloadSession *session, size_t limit, void *contex...
ys_hrm_manager_get_subscription_info, HRMSessionRef session, AppInstallId *app_id, uint32_t *update_interval_s, uint16_t *expire_s, HRMFeature *features) { mutex_lock_recursive(s_manager_state.lock); HRMSubscriberState *state = prv_get_subscriber_state_from_ref(session); if (state) {...
sys_hrm_manager_set_update_interval(state->session_ref, state->update_interval_s, HRM_MANAGER_APP_EXIT_EXPIRATION_SEC)
; }
.h" #include "util/uuid.h" #include <string.h> // These headers auto-generated from the measurements.proto #include "nanopb/common.pb.h" #include "nanopb/event.pb.h" #include "nanopb/measurements.pb.h" #include "nanopb/payload.pb.h" #define PROTOBUF_LOG_DEBUG(fmt, args...) \ PBL_LOG_D(LOG_DOMAIN_PROTOBU...
rtc_get_time()
, }; // NOTE: A Payload is the master protobuf struct that we send to the phone. // Events have already been encoded for Payloads (in `protobuf_log_session_add_event`) // MeasurementSets have not. They are currently only written to the stream as a self standing // object, not for a payload. // This results...
under the License. */ #include "scroll_layer.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/gtypes.h" #include "applib/graphics/graphics.h" #include "applib/ui/content_indicator_private.h" #include "applib/ui/shadows.h" #include "applib/ui/window.h" #include "process_management/app_manager.h" #...
prv_setup_shadow_layer(scroll_layer)
; } ScrollLayer* scroll_layer_create(GRect frame) { ScrollLayer *layer = applib_type_malloc(ScrollLayer); if (layer) { scroll_layer_init(layer, &frame); } return layer; } bool scroll_layer_is_instance(const Layer *layer) { return layer && layer->property_changed_proc == scroll_layer_property_changed_pro...
erase_optimal_range(region.begin, region.begin, region.end, region.end); PBL_LOG(LOG_LEVEL_INFO, ">>>> Checking '%s' is erased", region.name); check_region_erased(region); PBL_LOG(LOG_LEVEL_INFO, ">>>> Checking '%s' can write", region.name); check_region_write(region, false, true); PBL_LOG(LOG_LEVEL_INFO, ">>...
simple_menu_layer_get_layer(&data->menu_layer)
); } static void push_window(FlashDiagAppData *data) { Window *window = &data->window; window_init(window, WINDOW_NAME("Flash Diagnostic")); window_set_user_data(window, data); window_set_window_handlers(window, &(WindowHandlers) { .load = prv_window_load, }); const bool animated = true; app_window_s...
n_kernel_main(prv_stop_hrm_kernel_main); } } // Emit for every subscription, so Settings/Bluetooth menu can update accordingly. prv_put_sharing_state_updated_event(s_ble_hrm_subscription_count); } static void prv_update_permission(GAPLEConnection *connection, HrmSharingPermission permission) { bt_lock_ass...
if (gap_le_connection_is_valid(connection)) { const HrmSharingPermission permission = (is_granted ? HrmSharingPermission_Granted : HrmSharingPermission_Declined); prv_update_permission(connection, permission); }
bt_unlock(); kernel_free(sharing_request); analytics_event_ble_hrm(is_granted ? BleHrmEventSubtype_SharingAccepted : BleHrmEventSubtype_SharingDeclined); } void bt_driver_cb_hrm_service_update_subscription(const BTDeviceInternal *device, ...