prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
i18n_ctx_noop("TmplStringSing", " year")
, /// Plural suffix for years with full units i18n_ctx_noop("TmplStringPlur", " years")}, }; #endif static void prv_do_conversion(TemplateStringState *state, intmax_t value, int divide, int mod, const char * const suffix_strings[3][2], FormatUnits add_units, ...
vert_term.max_interval_slots = 160; job = gap_le_advert_schedule(ad_scannable, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job); // Max < Min: advert_term.min_interval...
(gap_le_is_advertising_enabled(), true)
{ // Invalid, closed or out of range FD prv_respond_internal_error(cmd, length, E_INVALID_ARGUMENT); return NULL; } } static PulseBulkIODomainHandler* prv_get_domain_handler(uint8_t domain_id) { for (uint8_t i = 0; i < NUM_DOMAIN_HANDLERS; i++) { PulseBulkIODomainHandler *domain_handler = s_domain_...
(cmd->write.data, cmd->write.address, payload_length, pulse_fd->domain_state)
; if (FAILED(ret)) { prv_respond_internal_error(cmd, length, ret); return; } WriteResponse *resp = pulse_reliable_send_begin(PULSE2_BULKIO_PROTOCOL); *resp = (WriteResponse) { .opcode = BULKIO_RESP_DOMAIN_WRITE, .fd = cmd->write.fd, .address = cmd->write.address, .length = payload_leng...
d 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 ...
ambient_light_get_light_level()
> s_sensor_light_dark_threshold; } AmbientLightLevel ambient_light_level_to_enum(uint32_t light_level) { if (!s_initialized) { // if the sensor is not enabled, always return that it is very dark return AmbientLightLevelUnknown; } const uint32_t k_delta_threshold = BOARD_CONFIG.ambient_k_delta_threshold...
size_t size; }; static struct file_description descriptions[] = { // this first set of files match some I found on my snowy bb2 {"gap_bonding_db", 8102}, {"pmap", 5632}, {"pindb", 57095}, {"appdb", 32603}, {"reminderdb", 57090}, {"appcache", 8108}, {"alarms", 8110}, {"notifpref", 8107}, {"activi...
for (uint32_t i = 0; i < ARRAY_LENGTH(descriptions); ++i) { prv_check_file_exists(descriptions[i].name); }
}
er(); } static void clear_stuck_button(ButtonId button_id) { __disable_irq(); const uint32_t button_counter_register = RTC_ReadBackupRegister(STUCK_BUTTON_REGISTER); if (button_counter_register != 0) { // Create bitmask with all 1s, except on the counter byte for this button_id in button_counter_register. A...
if ((s_debounced_button_state & RESET_BUTTONS) == RESET_BUTTONS) { s_hard_reset_timer += 1; can_power_down_tim4 = false; if (s_hard_reset_timer > RESET_THRESHOLD_SAMPLES) { __disable_irq(); // If the UP button is held at the moment the timeout is hit, set the force-PRF bootbit: const boo...
} else { // past time_t difference = now - timestamp; if (now < timestamp || difference < SECONDS_PER_MINUTE) { i18n_get_with_buffer("Now", word_buffer, word_buffer_size); strncpy(number_buffer, "", number_buffer_size); } else { prv_copy_time_string_timestamp(number_buffer, number_buffer_s...
(gmt_offset_m)
% MINUTES_PER_HOUR) * 100) / MINUTES_PER_HOUR; if (min_offset_percent) { snprintf(min_buf, sizeof(min_buf), ".%d", min_offset_percent); } snprintf(region_name, buffer_size, "UTC%+d%s", hour_offset, min_buf); } } else { strncpy(region_name, "---", buffer_size); } } int16_t clock_g...
ick_handler(ClickRecognizerRef recognizer, void *context) { TimelineAppData *data = context; prv_inactive_timer_refresh(data); ButtonId button = click_recognizer_get_button_id(recognizer); const bool next = (button == BUTTON_ID_UP) ^ (data->timeline_model.direction == TimelineIterDirectionFuture); // W...
timeline_model_get_iter_state(i)
->pin.header.id, id)) { prv_refresh_pin(data, i); } } prv_update_timeline_layer(data); } } ///////////////////////////////////// // Intro Animation ///////////////////////////////////// static void prv_intro_anim_stopped(Animation *anim, bool finished, void *context) { TimelineAppData *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...
fake_rtc_increment_time_ms(1000)
; interval_timer_take_sample(&timer); num_intervals = interval_timer_get(&timer, &average_ms); cl_assert_equal_i(num_intervals, 2); cl_assert_equal_i(average_ms, 1000); fake_rtc_increment_time_ms(1030); interval_timer_take_sample(&timer); // = 1000 + (0.5 * (1030 - 1000)) // = 1000 + (0.5 * 30) // ...
as 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) { v...
memcpy(&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) ...
/* * 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_timer_register(500, timer_callback, NULL)
; } static void handle_init(void) { AmbientLightAppData *data = task_malloc_check(sizeof(AmbientLightAppData)); data->window = window_create(); Layer *window_layer = window_get_root_layer(data->window); GRect bounds = window_layer->bounds; data->text_layer = text_layer_create((GRect) { .origin = { 0...
hrm_service_update_subscription(s_device_b, true); cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_b)); prv_assert_permissions_ui_and_respond(true /* is_granted */); cl_assert_equal_b(true, ble_hrm_is_sharing_to_connection(&s_conn_b)); prv_assert_event_service_subscribed(true); cl_assert_equ...
prv_assert_permissions_ui_and_respond(true /* is_granted */)
; cl_assert_equal_b(false, ble_hrm_is_sharing_to_connection(&s_conn_a)); } void test_ble_hrm__decline_permission_dont_ask_again_even_after_reconnecting(void) { bt_driver_cb_hrm_service_update_subscription(s_device_a, true); // Decline: prv_assert_permissions_ui_and_respond(false /* is_granted */); // Unsu...
W_FW_UPDATE_IN_PROGRESS); FirmwareDescription firmware_description = firmware_storage_read_firmware_description(flash_new_fw_addr); if (!firmware_storage_check_valid_firmware_description(&firmware_description)) { dbgserial_print("Desclen "); dbgserial_print_hex(firmware_description.description_lengt...
system_reset()
; } else if (!boot_bit_test(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO)) { dbgserial_putstr("Failed to load recovery firmware, strike two. Try again."); boot_bit_set(BOOT_BIT_RECOVERY_LOAD_FAIL_STRIKE_TWO); boot_bit_set(BOOT_BIT_SOFTWARE_FAILURE_OCCURRED); system_reset(); } else { dbgs...
// History with low median static const int32_t step_history[ACTIVITY_HISTORY_DAYS] = { AVERAGE_STEPS, // This is 'today' AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS, AVERAGE_STEPS }...
(ACTIVITY_INSIGHTS_SETTINGS_ACTIVITY_REWARD)
, &disabled_activity, sizeof(disabled_activity)); pfs_watch_cb(NULL); // Update the settings cache prv_minute_update(ACTIVE_MINUTES); cl_assert_equal_i(fake_kernel_services_notifications_ancs_notifications_count(), 0); } // ---------------------------------------------------------------------...
nks. Every time //! the system boots up a different file is used. This leaves the file from the previous boot intact in case we previously //! crashed. //! //! Files are referred to in multiple ways. The "file generation" is how recent the file is. 0 is the generation of the current //! boot, 1 is the generation of the...
serial_distance(file_id[i - 1], file_id[i], FILE_ID_BIT_WIDTH)
; if (distance < 0 || distance > 2) { *current_file_id = get_next_file_id(file_id[i - 1]); *current_file_index = i; return; } } } // Everything was increasing which means everything was in order from oldest to newest // and we need to wrap around. *current_file_index = 0...
return RESOURCE_ID_BT_PAIR_FAILURE; default: WTF; } } static void prv_adjust_background_frame_for_state(BTPairingUIData *data) { GAlign alignment; const int16_t width_of_sidebar = data->action_bar_layer.layer.frame.size.w; const int16_t window_width = data->window.layer.bounds.size.w; const int1...
window_set_background_color(&data->window, PBL_IF_COLOR_ELSE(GColorLightGray, GColorWhite))
; const int32_t width_of_action_bar_with_padding = ACTION_BAR_WIDTH + PBL_IF_RECT_ELSE(2, -4); const int32_t width = window->layer.bounds.size.w - width_of_action_bar_with_padding; const int32_t x_offset = PBL_IF_RECT_ELSE(0, 22); #if PLATFORM_ROBERT || PLATFORM_CALCULUS const int32_t info_text_y_offset = 36; ...
392}, { -792, 448, 384}, { -800, 416, 432}, { -792, 392, 448}, { -808, 504, 336}, { -816, 496, 312}, { -816, 456, 328}, { -792, 424, 328}, { -760, 400, 376}, { -760, 344, 432}, { -776, 280, 416}, { -872, 144, 512}, { -816, 104, 544}, { -840, 232, 464}, { -856, 304...
{ -528, 144, 808}, { -536, 136, 808}, // 407 seconds { -528, 112, 792}, { -528, 104, 784}, { -520, 96, 784}, { -520, 88, 776}, { -544, 96, 808}, { -544, 112, 776}, { -544, 104, 784}, { -536, 136, 760}, { -528, 104, 792}, { -528, 112, 816}, { -544, 120, 776}, {...
{ 368, 712, -696}, { 360, 688, -696}, { 352, 712, -688}, { 344, 728, -688}, { 352, 736, -688}, { 360, 728, -672}, { 360, 712, -688}, { 368, 720, -712}, { 384, 704, -712}, { 376, 704, -704}, // 410 seconds { 360, 696, -704}, { 416, 696, -840}, { 536, 624, -1072}, ...
D { uint32_t data; uint32_t padding; } raw; struct PACKED { uint8_t packet_id; uint8_t finger_data[MAX_NUM_TOUCHES][DATA_LEN_FINGER]; uint8_t active_fingers; } touch; } EventMessage; _Static_assert(sizeof(EventMessage) == 8, "eWD1000 event messages should be 8 bytes."); #if 0 // TODO: used by...
htons(address)
; MemoryPacket packet = { .packet_id = PACKET_ID_RAM_READ, .address = address, .value = 0x00, .footer = RAM_FLASH_FOOTER }; prv_write_data((uint8_t *)&packet, sizeof(packet)); prv_wait_for_interrupt(); prv_read_data((uint8_t *)&packet, sizeof(packet)); PBL_ASSERTN(packet.packet_id == PACKET_...
/* * 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(0, -5)
); // -360 degrees (-> 0 degrees) should be (0, -5) result = gpoint_from_polar_internal(&center, radius, -TRIG_MAX_ANGLE); cl_assert_equal_gpoint(result, GPoint(0, -5)); } void test_graphics_circle__gpoint_from_polar_correct_scale(void) { // edge cases are covered above, this test only verifies that // the ...
eally really really really " "really really really really really really really really " "really long subtitle."; slice = (AppGlanceSlice) { .expiration_time = APP_GLANCE_SLICE_NO_EXPIRATION, .layout.icon = APP_GLANCE_SLICE_DEFAULT_ICON,...
(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, &glance_read), S_SUCCESS)
; cl_assert_equal_i(glance_read.num_slices, 0); for (unsigned int i = 0; i < sizeof(glance_read.slices); i++) { const uint8_t byte = ((uint8_t *)glance_read.slices)[i]; cl_assert_equal_i(byte, 0); } // Request the current slice for this glance again; this should return false since there aren't // any...
/* * 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...
(sessions, s_sessions, s_num_sessions * sizeof(ActivitySession))
; *session_entries = s_num_sessions; return true; } // --------------------------------------------------------------------------------------- void test_workout_utils__initialize(void) { s_num_sessions = 0; } void test_workout_utils__cleanup(void) { } // --------------------------------------------------------...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
memcpy(buffer, s_resource_buffer + start_bytes, num_bytes)
; return num_bytes; } size_t sys_resource_size(ResAppNum app_num, uint32_t id) { return s_resource_buffer_size; } //helpers //unit test code void test_vibe_score__initialize(void) { s_vibe_queue_index = 0; } void test_vibe_score__cleanup(void) { } void test_vibe_score__double_pulse(void) { uint8_t buffer[]...
EE); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_NONE); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r0_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // SCREEN_COLOR_DEPTH_BITS == 8 } #define OFFSET_RECT_NO_CLIP GRect(10, 10, 40, 50) #define OFFSET_RECT_CLIP_XY GR...
gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_offset_r8_quad_top_right.${BIT_DEPTH_NAME}.pbi")
super aggressively with the // bma255, I'm concerned about changing the timing of how fast we drain things. Thus, just use a // static buffer for now. This should be safe because only one thread should be draining the data. static AccelDriverSample data[BMA255_FIFO_MAX_FRAMES]; const uint64_t timestamp_us = prv...
accel_offload_work_from_isr(prv_handle_data, should_context_switch)
; } } static void prv_update_accel_interrupts(bool enable, AccelOperatingMode mode) { s_operating_states[mode].using_interrupts = enable; bool enable_interrupts = false; for (uint32_t i = 0; i < ARRAY_LENGTH(s_operating_states); i++) { if (s_operating_states[i].using_interrupts) { enable_interrupts ...
rty.call_count++; s_layer_mark_dirty.last_call = (MockCallRecording){.layer = layer}; } static MockCallRecordings s_graphics_context_set_fill_color; void graphics_context_set_fill_color(GContext* ctx, GColor color) { s_graphics_context_set_fill_color.call_count++; s_graphics_context_set_fill_color.last_call = (M...
rocky_runtime_context_deinit()
/* * 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...
do_stuff(h)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
ble_ad_copy_service_uuids(s_ad_data, copied_uuids, count)
; cl_assert_equal_i(found, 1); // Test ble_ad_copy_service_uuids, destination array too small: found = ble_ad_copy_service_uuids(s_ad_data, copied_uuids, 0); cl_assert_equal_i(found, 1); // Test ble_ad_get_tx_power_level returns false, when no TX Power Level: int8_t tx_power_level_out; cl_assert(!ble_ad...
)->next); } mutex_unlock_recursive(s_list_mutex); } void dls_list_remove_all(void) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *cur = s_logging_sessions; DataLoggingSession *next; while (cur != NULL) { next = cur->next; if (cur->data) { mutex_destroy(cur->data->mutex); ker...
{ // Read the next pointer first, just in case the callback ends up removing the session. DataLoggingSession *next_logging_session = logging_session->next; if (!callback(logging_session, data)) { mutex_unlock_recursive(s_list_mutex); return false; } logging_session = next_logging_sessi...
mutex_unlock_recursive(s_list_mutex); return true; } void dls_list_init(void) { s_list_mutex = mutex_create_recursive(); s_logging_sessions = NULL; } bool dls_list_is_session_valid(DataLoggingSession *logging_session) { mutex_lock_recursive(s_list_mutex); DataLoggingSession *iter = s_logging_sessions; ...
ero_bytes(void) { cl_assert(system_flash_erase(FLASH_BASE, 0, NULL, NULL)); cl_assert_equal_i(0, erased_sector); cl_assert(flash_locked); } void test_system_flash__erase_one_byte(void) { cl_assert(system_flash_erase(FLASH_BASE, 1, NULL, NULL)); cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector); cl_asser...
IS_FLASH_SECTOR(sector)
, "Sector number out of range"); cl_assert(IS_VOLTAGERANGE(voltage_range)); cl_check_(flash_flags_set == false, "Forgot to clear flags before erasing"); cl_check_((erased_sector & (1 << sector/8)) == 0, "Re-erasing an already erased sector"); flash_flags_set = true; if (return_status == FLASH_COMP...
test_graphics_context_init(&s_ctx, fb); framebuffer_clear(fb); } void test_emoji_fonts__cleanup(void) { free(fb); fb = NULL; gbitmap_destroy(s_dest_bitmap); s_dest_bitmap = NULL; } // Helpers ////////////////////// static char s_emoji_string[] = "😄😃😀😊☺😉😍😘😚😗😙😜😝😛😳😁😔😌😒😞😣😢😂😭😥😪😰😅😓...
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE))
; } void test_emoji_fonts__gothic_28_emoji(void) { prv_prepare_canvas_and_render_emoji(RESOURCE_ID_GOTHIC_28_EMOJI); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); }
/* * 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_forget_ble_remote(remote->dual.ble.bonding)
; break; default: WTF; } PBL_LOG(LOG_LEVEL_INFO, "User Forgot BT Pairing (%u)", remote->type); PBL_LOG(LOG_LEVEL_DEBUG, "Name: %s", remote->name); settings_bluetooth_update_remotes(remote_data->bt_data); prv_show_dialog(context); } #if CAPABILITY_HAS_BUILTIN_HRM static GAPLEConnection *prv_le...
ATE); // Verify the collected data AccelRawData captured_data[k_raw_samples]; prv_uncompress_captured_data(captured_data, k_raw_samples); cl_assert_equal_m(raw_data, captured_data, k_raw_samples * sizeof(AccelRawData)); } // ------------------------------------------------------------------------...
cl_assert_equal_i(num_records, exp_num_records)
; cl_assert_equal_i(utc_start, exp_utc_start); cl_assert_equal_i(minutes[0].steps, exp_utc_start % 255); // --------------------------------------------------------------------------------------- // Once a minute, retrieve the last ALG_MINUTES_PER_RECORD minutes of data. We should // get 1 fewer record each...
circular_buffer_write(&s_log_buffer.circular_buffer, buffer, length)
) { // Out of memory! Attempt to print an overrun message circular_buffer_write(&s_log_buffer.circular_buffer, (uint8_t *)&OVERRUN.header, sizeof(OVERRUN) - sizeof(HcProtocolMessage)); } prv_start_tx(); prv_unlock(); } #ifdef PBL_LOGS_HASHED void pbl_log_hashed(const uint32_t p...
static void prv_set_connection_responsiveness( Transport *transport, BtConsumer consumer, ResponseTimeState state, uint16_t max_period_secs, ResponsivenessGrantedHandler granted_handler) { if (granted_handler) { launcher_task_add_callback(prv_granted_kernel_main_cb, granted_handler); } } static CommSe...
{ size_t packet_length = sizeof(PulsePPCallbackPacket) + data_length; PulsePPCallbackPacket *cb_data = kernel_malloc_check(packet_length); cb_data->packet_length = sizeof(PulsePPPacket) + data_length; cb_data->packet.opcode = opcode; if (data) { memcpy(&cb_data->packet.data[0], data, data_length); } ...
axes_inverts[axis]; int16_t raw = (((int16_t)raw_data[offset + 1]) << 8) | raw_data[offset]; int16_t converted = (invert ? -1 : 1) * raw_to_mgs(raw, s_accel_scale); return (converted); } // Simple read register command with no error handling static bool prv_read_register(uint8_t register_address, uint8_t *result...
(LOG_LEVEL_ERROR, "Failed to exit low power mode")
; } void lis3dh_power_down(void) { if (accel_start()) { uint8_t ctrl_reg1; if (prv_read_register(LIS3DH_CTRL_REG1, &ctrl_reg1)) { ctrl_reg1 |= LPen; if (prv_write_register(LIS3DH_CTRL_REG1, ctrl_reg1)) { // Write successful, low power mode enabled accel_stop(); return; ...
ck), &current_stack, true); cl_assert_equal_p(b, actual); cl_assert_equal_i(0, current_stack); cl_assert_equal_p(b, stack[0]); // no more siblings on root level actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(NULL, actual); cl_assert...
layer_add_child(&parent, &child_b)
; layer_add_child(&parent, &child_c); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(9, 9)), &child_a); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(6, 6)), &child_b); cl_assert_equal_p(layer_find_layer_containing_point(&parent, &GPoint(15, 15)), &child_c); layer...
rv_clear_handler_histories(); uint64_t start_ms = prv_now_ms(); animation_schedule(a); // Seek to just after the end of the second A prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS); #endif } // ---------------------------------------------------------------------------------...
prv_last_handler_entry(&s_stopped_handler_calls, a)
->fire_order < prv_last_handler_entry(&s_started_handler_calls, b)->fire_order); // Finish the sequence prv_advance_to_ms_with_timers(prv_now_ms() + leftover_seq + 2 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1); cl_assert_equal_i(prv_last_up...
/* * 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...
(&ctx, buf)
; uint8_t byte; uint32_t count = 0; while (sle_decode(&ctx, &byte)) { cl_assert_equal_i(byte, 0x0); ++count; } cl_assert_equal_i(count, 5); } void test_sle__long_zeros(void) { SLEDecodeContext ctx; uint8_t buf[] = { 0xfd, // escape code 0xfd, 0xff, 0xaa, // 32810 zeroes 0xfd, 0x00 //...
/* * 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...
(&data->menu_layer, GColorJaegerGreen, GColorWhite)
; menu_layer_set_click_config_onto_window(menu_layer, window); layer_add_child(&window->layer, menu_layer_get_layer(menu_layer)); } static void push_window(AppData *data) { PBL_LOG(LOG_LEVEL_INFO, "PUSHING WINDOW"); Window *window = &data->window; window_init(window, WINDOW_NAME("Demo Menu")); window_set_u...
/* * 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(abs(a.d.integer - b.d.integer) < 10)
; cl_assert(abs(a.tx.integer - b.tx.integer) < 10); cl_assert(abs(a.ty.integer - b.ty.integer) < 10); } // -------------------------------------------------------------------------------------- static void cl_assert_equal_fixed_s32_16(const Fixed_S32_16 a, const Fixed_S32_16 b) { cl_assert_equal_i(a.raw_value, ...
(&ctx, GPoint(0, 13), 4)
; graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 15), 20); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 17), 21); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 19), 22); graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, 21), MAX_NUM_COLS - 1); graphics_draw_horizontal_line_dotted(&ctx,...
text gcontext = (GContext) { }; GFont font = (GFont) { 0 }; GRect box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 4 * HORIZ_ADVANCE_PX + 1, 2 * FONT_HEIGHT + 1 } }; TextLayoutExtended layout = (TextLayoutExtended) { .hash = 0, .box = (GRect) { (GPoint) { 0, 0 }, (GSize) { 7 * HORIZ_ADVANCE_PX + 1, FONT_HEIGH...
cl_assert_equal_i(layout.max_used_size.h, 2 * FONT_HEIGHT)
; // Nothing - save for the first line - will be rendered below the box graphics_text_layout_get_max_used_size(&gcontext, "JR\n\nWhop", font, box, GTextOverflowModeWordWrap, GTextAlignmentLeft, (void*)&layout); cl_assert_equal_i(layout.box.size.w, box.size.w); cl_assert_equal_i(layout.max_used_size.w, 4 * HORIZ...
/* * 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...
(unmodified_data_patch_start, patch, size)
!= 0) { // There is new data present, so perform a write! memcpy(unmodified_data_patch_start, patch, size); prv_perform_write(&data, should_erase); } prv_cleanup_struct(&data); } typedef struct { size_t size; size_t offset; uint8_t patch[]; } WriteEraseCBData; static void prv_perform_flash_era...
(scroll_layer)
) { prv_setup_shadow_layer(scroll_layer); // still require explicit un-hiding of shadow scroll_layer_set_shadow_hidden(scroll_layer, true); } } } bool scroll_layer_get_paging(ScrollLayer* scroll_layer) { return scroll_layer && prv_scroll_layer_is_paging_enabled(scroll_layer); } ContentIndica...
ype = "legacy3"; break; case ProcessAppSDKType_4x: app_type = "4.x"; break; } char *const sdk_platform = platform_type_get_name(process_metadata_get_app_sdk_platform(app_md)); PBL_LOG(LOG_LEVEL_DEBUG, "Starting %s app <%s>", app_type, process_metadata_get_name(app_md)); // new logging on...
((char *)app_ram.start + stack_guard_size, 0, memory_segment_get_size(&app_ram) - stack_guard_size)
; MemorySegment app_segment; PBL_ASSERTN(memory_segment_split(&app_ram, &app_segment, app_segment_size)); PBL_ASSERTN(memory_segment_split(&app_segment, NULL, stack_guard_size)); // No (accessible) memory segments can be placed between the top of APP_RAM // and the end of stack. Stacks always grow towards lo...
/* * 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...
{ AppSync *s = data; Tuple *tuple = dict_read_first(&s->current_iter); while (tuple) { update_key_callback(tuple->key, tuple, NULL, s); tuple = dict_read_next(&s->current_iter); } }
static void update_callback(DictionaryIterator *updated_iter, void *context) { AppSync *s = context; uint32_t size = s->buffer_size; const bool update_existing_keys_only = true; DictionaryResult result = dict_merge(&s->current_iter, &size, updated_iter, ...
ECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_bw, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_bw_set_corner_45.Xbit.pbi")); // Top-left center rotatio...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rotated_bitmap_origin_color_set_0.Xbit.pbi"))
; // Top-left corner rotation point, Angle 45 setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpSet); graphics_draw_rotated_bitmap(&ctx, test_image_color, GPointZero, DEG_TO_TRIGANGLE(45), GPointZero); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, ...
omplete; } // ------------------------------------------------------------------------------------------- // @param state our context // @param now the time we are running to. When called from animation_set_elapsed, this will // be in the future, otherwise it will be the current time // @param top_level_animatio...
{ void *arg = va_arg(args, void *); if (arg == NULL) { break; } animation_array[array_len++] = arg; }
} // Create from an array return func(animation_array, array_len); } // ------------------------------------------------------------------------------------------- // Complex animations don't perform any logic in their update callback static void prv_complex_animation_update(Animation * animation, uint32_t di...
ctx, (is_card ? layout_get_colors((LayoutLayer *)layout)->primary_color : GColorBlack)); static const GRect page_frame_on_screen = { { 0, STATUS_BAR_LAYER_HEIGHT }, { DISP_COLS, DISP_ROWS - STATUS_BAR_LAYER_HEIGHT } }; const GTextNodeDrawConfig config = { .page_frame = is_peek ? &GRectZero : &page_frame_...
layout_create_text_node_from_config(&layout->layout_layer, &s_body_config.text.extent.node)
); return vertical_node; } static void prv_page_break_node_callback(GContext *ctx, const GRect *box, const GTextNodeDrawConfig *config, bool render, GSize *size_out, void *user_data) { TimelineLayout *layout = user_data; const GRec...
408, -264}, { 1328, 552, -320}, // 30 seconds { 1296, 728, -416}, { 1144, 800, -576}, { 1008, 936, -616}, { 1120, 880, -584}, { 848, 616, -440}, { 1024, 600, -392}, { 1296, 512, -312}, { 1272, 248, -168}, { 1080, 248, -184}, { 1056, 184, -184}, { 1136, 224, -136}, ...
{ 1064, 568, -216}, { 1184, 368, -136}, { 984, 256, -112}, { 1040, 256, -136}, { 1232, 528, -8}, { 1480, 192, 0}, { 1440, 224, -64}, { 1280, 168, -88}, { 1008, 120, -88}, { 832, -88, -256}, { 720, -56, -336}, { 464, -48, -528}, { 648, -120, -568}, { 824, -64, -488...
{ 1080, 392, -368}, // 38 seconds { 1112, 496, -336}, { 1128, 672, -408}, { 904, 864, -488}, { 760, 1128, -552}, { 1040, 864, -424}, { 1320, 928, -432}, { 1064, 576, -240}, { 1144, 520, -256}, { 1288, 416, -152}, { 1376, 328, -144}, { 1088, 176, -136}, { 896, 184...
/////////////////////////////////////////////// // Receive Tests //////////////////////////////////////////////////////////////////////////////// void test_rocky_api_app_message__receive_message_multi_chunk(void) { prv_init_and_goto_session_open_with_tiny_buffers(); EXECUTE_SCRIPT("var event = null;\n" ...
for (int i = 0; i < 2; ++i) { ASSERT_JS_GLOBAL_EQUALS_B("didError", false); AppTimer *t = rocky_api_app_message_get_session_closed_object_queue_timer(); cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_assert_equal_b(fake_app_timer_is_scheduled(t), true); EXPECT_OUTBOX_NO_MESSAGE_PENDING(); cl_as...
// Timer for the 3rd should be set: AppTimer *t = rocky_api_app_message_get_session_closed_object_queue_timer(); cl_assert(t != EVENTED_TIMER_INVALID_ID); cl_assert_equal_b(fake_app_timer_is_scheduled(t), true); // Connect: prv_simulate_transport_connection_event(true /* is_connected */); prv_postmessa...
/* * 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...
fake_transport_create(TransportDestinationSystem, NULL, NULL)
; s_session = fake_transport_set_connected(s_transport, true); s_session_id = audio_endpoint_setup_transfer(prv_test_setup_complete_callback, prv_test_stop_transfer_callback); cl_assert(s_session_id != AUDIO_ENDPOINT_SESSION_INVALID_ID); } void test_audio_endpoint_...
enuLayer); if (layer) { menu_layer_init(layer, &frame); } return layer; } void menu_layer_pad_bottom_enable(MenuLayer *menu_layer, bool enable) { menu_layer->pad_bottom = enable; } void menu_layer_deinit(MenuLayer *menu_layer) { prv_cancel_selection_animation(menu_layer); layer_deinit(&menu_layer->inv...
(menu_layer, callback_context, &callbacks)
"%d", &state->test_entry.start_at.value); } else if (strcmp(token, "TEST_START_AT_MIN") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at.min); } else if (strcmp(token, "TEST_START_AT_MAX") == 0) { sscanf(token + strlen(token) + 1, "%d", &state->test_entry.start_at....
if (!state->file) { printf("\nFile %s could not be opened", file_path); continue; }
} return true; } // --------------------------------------------------------------------------------------- // Return info on the next set of samples static bool prv_accel_sample_discovery_next(StepFileTestEntry *entry) { AccelSampleDiscoveryState *state = &s_accel_sample_discovery_state; while (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...
if (syscall_internal_elevate_privilege()) { syscall_assert_userspace_buffer(buffer, size); }
do_stuff(buffer, size); } void wrapper() { void * buffer = NULL; int size = 0; good_syscall(buffer, size); // This tests to make sure analysis continues through good_syscall hidden_bad_syscall(buffer, size); } bool cond(const char *font_key) { return &cond == font_key; } void conditional_syscall(cons...
if (recurring) { attribute_list_add_uint8(&list, AttributeIdDisplayRecurring, CalendarRecurringTypeRecurring); }
attribute_list_add_cstring(&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( ...
{ -960, 304, -56}, { -688, 208, 200}, { -336, 496, 16}, { -384, 616, -104}, { -560, 528, 8}, { -704, 360, 104}, { -816, 288, 136}, { -824, 248, 184}, // 55 seconds { -960, 232, 168}, { -1080, 208, 112}, { -1136, 224, 48}, { -1272, 216, 32}, { -952, 344, -168}, ...
{ -424, 328, -208}, { -456, 336, -224}, { -488, 280, -136}, { -616, 304, -152}, { -640, 328, -104}, { -648, 344, -72}, { -912, 456, -168}, { -1016, 464, -24}, { -1528, 536, -112}, { -1472, 648, -120}, { -896, 512, -72}, { -1000, 616, -224}, { -952, 480, -88}, { -8...
i].uint8, attribute->length); break; case AttributeTypeStringList: attribute->length = attr_list->attributes[i].string_list->serialized_byte_length; memcpy(buffer, attr_list->attributes[i].string_list->data, attribute->length); break; case AttributeTypeUint32List...
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_attribute_length(&list->attributes[i]); } return size; } void attribute_list_add_cstring(AttributeList *list, AttributeId id, const char *cstring)...
*)&data->pinned_address, sizeof(data->pinned_address)) && prv_field_valid((uint8_t *)&data->local_name, sizeof(data->local_name)) && prv_field_valid((uint8_t *)&data->getting_started, sizeof(data->getting_started)))) { return true; } return false; } // Stored struct setters static void prv_wri...
(data, true)
ther transitions are invalid WTF; } } bool smartstrap_fsm_state_test_and_set(SmartstrapState expected_state, SmartstrapState next_state) { const bool did_set = __atomic_compare_exchange_n(&s_fsm_state, &expected_state, next_state, false, __ATOMIC_RELAXED, __AT...
{ mutex_assert_held_by_curr_task(s_state_lock, true); }
wday = ((EPOCH_WDAY + days) % DAYS_PER_WEEK)) < 0) { res->tm_wday += DAYS_PER_WEEK; } /* compute year & day of year */ int y = EPOCH_YEAR; int yleap; if (days >= 0) { for (;;) { yleap = YEAR_IS_LEAP(y); if (days < s_year_lengths[yleap]) { break; } y++; days -= s_...
(&utc_sec, &local_tm)
; return (local_tm.tm_hour * MINUTES_PER_HOUR) + local_tm.tm_min; } // --------------------------------------------------------------------------------------- int time_util_minute_of_day_adjust(int minute, int delta) { minute += delta; if (minute < 0) { minute += MINUTES_PER_DAY; } else if (minute >= MINU...
/* * 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(europe_minsk_region != -1)
; // Make sure they're unique cl_assert(america_new_york_region != europe_minsk_region); // Look up one that doesn't exist const int america_waterloo_region = FIND_REGION("America/Waterloo"); cl_assert(america_waterloo_region == -1); } void test_timezone_database__find_region_by_name_links(void) { // Loo...
/* * 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_state_get_framebuffer()
) }; grect_clip(area_out, &display_frame); } //! Currently, the unobstructed area is derived from the origin of the obstruction. //! This is equivalent to the height of the unobstructed area. static void prv_origin_y_to_area(int16_t origin_y, GRect *area_out) { PBL_ASSERTN(area_out); *area_out = (GRect) { .s...
NVALID_ARGUMENT); rv = pfs_close(1000000); cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("file", OP_FLAG_WRITE, FILE_TYPE_STATIC, 10); cl_assert(fd >= 0); rv = pfs_close(fd); cl_assert(rv == S_SUCCESS); rv = pfs_close(fd); // should not be able to double close an fd cl_assert(rv == E_INVALID_A...
cl_assert(fd >= 0)
; cl_assert(pfs_close(fd) == S_SUCCESS); cl_assert(pfs_remove(name) == S_SUCCESS); } void test_pfs__active_regions(void) { pfs_format(false); cl_assert(!pfs_active_in_region(0, pfs_get_size())); // erase every page and make sure pfs is active pfs_format(true); cl_assert(pfs_active_in_region(0, pfs_get_s...
/* * 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...
(data->lookup.userdata)
; } applib_free(context); } static void prv_apply_transform(GDrawCommandList *list, GSize size, const GRect *from, const GRect *to, AnimationProgress normalized, void *context) { if (!list || !context) { return; } ScaleSegmentedData *data = context; GDelayCreatorContext...
ralDataSize_Byte; dma_config.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; dma_config.DMA_Mode = DMA_Mode_Normal; dma_config.DMA_PeripheralBaseAddr = FLASH_DATA_REGISTER_ADDR; dma_config.DMA_PeripheralInc = DMA_PeripheralInc_Disable; dma_config.DMA_MemoryInc = DMA_MemoryInc_Enable; dma_config.DMA_Priority =...
prv_flash_get_register(FLASH_CMD_READ_FLAG_STATUS_REG)
; // assert if we found the flag to be enabled PBL_ASSERTN(!(flag_status_register & N25QFlagStatusBit_SectorLockStatus)); } // This will clear the protection flag error from a previous error. // We call this because the error bits persist across reboots static void prv_clear_flag_status_register(void) { flash_st...
*/ #include "clar.h" #include "services/normal/timezone_database.h" #include "services/common/clock.h" #include "../timezone_fixture.auto.h" #include "stubs_logging.h" #include "stubs_passert.h" #include <string.h> //! Find a region ID for the given region name. //! @return a valid, matching region ID, or -1 if...
(tz_info.dst_id, 0)
L) { return; } menu_layer_deinit(menu_layer); applib_free(menu_layer); } Layer* menu_layer_get_layer(const MenuLayer *menu_layer) { return &((MenuLayer *)menu_layer)->scroll_layer.layer; } ScrollLayer* menu_layer_get_scroll_layer(const MenuLayer *menu_layer) { return &((MenuLayer *)menu_layer)->scroll_l...
(a->row, b->row)
eduled_days, weekdays, sizeof(weekdays)); break; case ALARM_KIND_JUST_ONCE: config->kind = ALARM_KIND_JUST_ONCE; const bool no_day[DAYS_PER_WEEK] = { false, false, false, false, false, false, false }; memcpy(&config->scheduled_days, no_day, sizeof(no_day)); prv_set_day_for_just_once_al...
mutex_lock_with_timeout(s_mutex, portMAX_DELAY)
; const bool alarm_is_scheduled = s_next_alarm_time != 0; if (alarm_is_scheduled && next_alarm_time_out) { *next_alarm_time_out = prv_get_alarm_time(&s_next_alarm, s_next_alarm_time); } mutex_unlock(s_mutex); return alarm_is_scheduled; } // ------------------------------------------------------------...
EBUG, "No more windows, killing current app"); PebbleEvent event = { .type = PEBBLE_PROCESS_KILL_EVENT, .kill = { .gracefully = true, .task=PebbleTask_App } }; sys_send_pebble_event_to_kernel(&event); return; } // Check to see if handling the previous event requires us to rerender ourselves. if (prv...
event_service_client_unsubscribe( &events_info->legacy2_status_bar_change_event)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, center, (outer_size / 2))
I_GetFlagStatus(QSPI_FLAG_BUSY) != RESET) { } } static void prv_quad_enable() { QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Write; qspi_com_config.QSPI_ComConfig_IMode = QSPI_ComConfig_IMode_1Line;...
{ prv_enable_qspi_clock(); prv_set_num_data_bytes(buffer_size); QSPI_ComConfig_InitTypeDef qspi_com_config; QSPI_ComConfig_StructInit(&qspi_com_config); qspi_com_config.QSPI_ComConfig_FMode = QSPI_ComConfig_FMode_Indirect_Read; qspi_com_config.QSPI_ComConfig_DMode = QSPI_ComConfig_DMode_4Line; qspi_com_...
s32_16_getter(Fixed_S32_16 *p) { return *p; } // -------------------------------------------------------------------------------------- static void prv_uint32_setter(int32_t *p, uint32_t value) { *p = value; } static uint32_t prv_uint32_getter(uint32_t *p) { return *p; } // ----------------------------------...
(s_stopped_handler_calls.num_calls, 1)
ld_c); layer_add_child(&child_a, &grand_child_a); cl_assert(grand_child_a.parent == &child_a); // Remove non-first-child (child_b): // // +-parent // | // '->child_a->child_c // | // '->grand_child_a // // +-child_b // layer_remove_from_parent(&child_b); cl_asser...
layer_create(GRectZero)
; layer_add_child(a, aa); layer_add_child(aa, aaa); layer_add_child(aaa, aaaa); layer_add_child(a, ab); a->next_sibling = b; stack[0] = a; // go to child if possible Layer *actual = __layer_tree_traverse_next__test_accessor(stack, ARRAY_LENGTH(stack), &current_stack, true); cl_assert_equal_p(...
auto.h" //! This symbol and its contents are provided by the linker script, see the //! .note.gnu.build-id section in src/fw/stm32f2xx_flash_fw.ld extern const ElfExternalNote TINTIN_BUILD_ID; const FirmwareMetadata TINTIN_METADATA SECTION(".pbl_fw_version") = { .version_timestamp = GIT_TIMESTAMP, .version_tag = ...
{ *major = GIT_MAJOR_VERSION; *minor = GIT_MINOR_VERSION; *patch_ptr = GIT_PATCH_VERBOSE_STRING; }
REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_SUS_INST, 0x0)
; REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_WEN_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDA_REG, QSPIC_ERS_INST, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDB_REG, QSPIC_RESSUS_DLY, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDB_REG, QSPIC_ERSRES_HLD, 0x0); REG_SETF(QSPIC, QSPIC_ERASECMDB_REG, QSPIC_ERS_CS_HI, 0x0); REG_S...
cs_notif(TimelineItem *notification) { uuid_generate(&notification->header.id); notifications_add_notification(notification); timeline_item_destroy(notification); } static void prv_handle_ancs_update(TimelineItem *notification, CommonTimelineItemHeader *existing_header) { if ...
{ // PBL-9509: iOS' Calendar app uses the timestamp of the ANCS notification for the time of the // event, not the time the notification was sent. If a calendar event has multiple notifications, // for example, 15 mins before and 5 minutes before, ANCS will send 2x ANCS notifications. // Because our dupe detect...
static bool prv_should_ignore_because_duplicate(TimelineItem *notification, CommonTimelineItemHeader *existing_header) { return (notification->header.ancs_uid == existing_header->ancs_uid); } static bool prv_should_ignore_because_apple_mail_dot_app_bug(const ANCSAttr...
20 77 ing late .On my w //! 61 79 00 42 75 73 79 20 72 69 67 68 74 20 6e 6f ay.Busy right no //! 77 20 2d 20 67 69 76 65 20 6d 65 20 61 20 73 65 w - give me a se //! 63 6f 6e 64 3f 21 01 00 00 cond?!.. . static const uint8_t s_ios_pref_db_insert_dict[] = { 0x00, 0x00, 0x00, 0x00, 0...
attribute_find(&notif_prefs->attr_list, AttributeIdShortTitle)
/* * 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_handle_fault()
; } void NMI_HandlerC(uint32_t *fault_args) { // Save the fault_args pointer for later g_stacked_regs = fault_args; uint32_t extra_reboot_info = 0; RebootReason reason; bool reboot_already_set = reboot_reason_get(&reason); RebootReasonCode code = RebootReasonCode_NMI; // Are we here because the hw watc...
andle(PebbleEvent *e, void *context) { PebbleTask task = pebble_task_get_current(); AccelServiceState *state = (AccelServiceState *)accel_service_private_get_session(task); PBL_ASSERTN(state->double_tap_handler != NULL); // only kernel clients can subscribe to double tap right now, so just increment double tap ...
accel_session_set_samples_per_update(session, samples_per_update)
; } // ---------------------------------------------------------------------------------------------- static void prv_shared_subscribe(AccelServiceState *state, AccelSamplingRate sampling_rate, uint32_t samples_per_update, PebbleTask handler_task) { state->manager_state = sys_accel_...
/* * 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_reel)
, 20); } void test_kino_player__create_finite_animation_finite_reel_foward(void) { // Choose duration and elapsed to have clean division for // ANIMATION_NORMALIZED_MAX * elapsed / duration = whole_number test_reel_data->duration_ms = 300; Animation *animation = (Animation *)kino_player_create_play_animation(t...
rdWrap, GTextAlignmentCenter, NULL); } void draw_text_single_line_wordwrap_clip_outside_x(Layer* me, GContext* ctx) { graphics_context_set_text_color(ctx, GColorBlack); graphics_draw_text(ctx, s_text_buffer, &s_font_info, GRect(80, 4, 72, 32), GTextOverflowModeWordWrap, GTextAlignmentCenter, N...
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_ny.${BIT_DEPTH_NAME}.pbi"))
; test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &draw_text_single_line_wordwrap_clip_across_ny_second_line); layer_render_tree(&canvas, &ctx); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_text_single_line_wordwrap_clip_across_ny_second_line.${BIT_DEPTH_NAME}.pbi")); test_graphics_c...
false /*quiet*/); if (!prv_is_mutable(state, animation)) { return false; } animation->delay_ms = delay_ms; return true; } // ------------------------------------------------------------------------------------------- uint32_t animation_get_delay(Animation *animation_h) { if (animation_private_using_le...
{ // We need to enable other applib modules like scroll_layer, menu_layer, etc. which are // compiled to use the 3.0 animation API to work with 2.0 apps. return ((AnimationLegacy2 *)animation_h)->curve; }
h out a new time on each // API function call s_workout_data.second_timer = (RegularTimerInfo) { .cb = prv_workout_timer_cb, }; // Initialize all of our initial values for keeping track of metrics activity_get_metric(ActivityMetricStepCount, 1, &s_workout_data.current_...
(s_workout_data.current_workout)
; s_workout_data.current_workout = NULL; } unlock: prv_unlock(); return rv; } // --------------------------------------------------------------------------------------- bool workout_service_is_workout_ongoing(void) { prv_lock(); bool rv = (s_workout_data.current_workout != NULL); prv_unlock(); return...
-56}, { -1080, 504, 144}, { -1232, -40, 40}, { -1368, 72, 24}, { -1616, 264, 104}, { -1048, 240, -96}, { -1120, 200, -40}, { -936, 176, -16}, { -592, 184, -128}, { -376, 320, -128}, { -392, 328, -88}, // 92 seconds { -488, 400, -80}, { -640, 440, 32}, { -736, 472,...
{ -584, 224, 240}, { -592, 248, 216}, { -744, 312, 296}, { -944, 272, 88}, { -1256, 104, 168}, { -1464, 264, -56}, { -1336, 240, -16}, { -1048, 264, -120}, { -1088, 104, -136}, { -904, 200, -80}, { -552, 120, -24}, { -432, 248, 0}, { -496, 312, 24}, { -536, 216, 1...
{ -440, 272, -112}, { -456, 208, -8}, { -592, 384, 16}, { -768, 440, 8}, { -824, 496, -24}, { -920, 504, 64}, { -1168, 744, -216}, // 100 seconds { -1344, 552, -184}, { -1488, 800, -240}, { -1120, 344, -128}, { -1032, 432, -320}, { -1224, 600, -56}, { -984, 312, ...
(&container->node)
; } else { char buffer[16]; const GFont font = data->em_dash_font; snprintf(buffer, sizeof(buffer), EM_DASH); graphics_context_set_text_color(ctx, CURRENT_TEXT_COLOR); graphics_draw_text(ctx, buffer, font, rect, GTextOverflowModeFill, GTextAlignmentCenter, NULL); } } static void prv_render_typi...
nfig_disable(bus->hal->i2c, bus->hal->clock_ctrl); prv_i2c_deinit(bus); } bool i2c_hal_is_busy(I2CBus *bus) { return ((bus->hal->i2c->ISR & I2C_ISR_BUSY) != 0); } static void prv_disable_all_interrupts(I2CBus *bus) { bus->hal->i2c->CR1 &= ~(I2C_CR1_TXIE | I2C_CR1_RXIE | ...
if ((transfer->direction == I2CTransferDirection_Write) && (i2c->ISR & I2C_ISR_TCR)) { // done writing the register address for a write request - "reload" the write payload transfer->state = I2CTransferState_WriteData; prv_resume_transfer(bus, false /* !generate_start */); }
return 0; } return s_live_capabilities; } static CommSession *s_app_session_ptr; CommSession *comm_session_get_current_app_session(void) { return s_app_session_ptr; } static bool s_close_called; void settings_file_close(SettingsFile *file) { s_close_called = true; } static status_t s_open_status; status_t...
(s_set_value, s_live_capabilities)
ts = 32; job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job); // Minimum interval boundary (with scan resp): char scan_resp_data[] = "scan resp data"; BLEAdData *ad_s...
{ gap_le_advert_deinit(); BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 10, }; GAPLEAdvertisingJobRef job; job = gap_le_advert_schedule(ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvert...
void test_gap_le_advert__continue_after_slave_connection(void) { BLEAdData *ad = create_ad(NULL, NULL); GAPLEAdvertisingJobTerm advert_term = { .min_interval_slots = 160, .max_interval_slots = 320, .duration_secs = 10, }; GAPLEAdvertisingJobRef job; job = gap_le_advert_schedule(ad, &advert_term,...
_idx, rv); return rv; } ble_error_t gatt_wrapper_write_no_resp(uint16_t conn_idx, uint16_t handle, uint16_t length, const uint8_t *value) { GATT_LOG_DEBUG("gatt_wrapper_write_no_resp: handle: %d", handle); const GattRespDest resp_dest = GattRespDestNone; if (!prv_enqueue...
(&addr, evt->handle, evt->length, evt->value)
; // GATT Indications are already automatically confirmed by the Dialog SDK. // See comments with ble_gattc_indication_cfm(). }
95603200,"47","07"},{1195689600,"47","07"},{1195776000,"47","07"}, {1195862400,"47","07"},{1195948800,"47","07"},{1196035200,"48","07"},{1196121600,"48","07"},{1196208000,"48","07"},{1196294400,"48","07"},{1196380800,"48","07"}, {1196467200,"48","07"},{1196553600,"48","07"},{1196640000,"49","07"},{1196726400,"49","...
(tmbuf, sizeof(tmbuf), "%z", &jan_2_2015__13_00_00)
; cl_assert_equal_s(tmbuf, "-1100"); } #endif void test_strftime__full_percent_U(void) { char tmbuf[512]; struct tm dec_30_2014__13_00_00 = { .tm_hour = 13, .tm_min = 0, .tm_sec = 0, // 13:00:00 .tm_year = 2014 - 1900, .tm_mon = 11, .tm_mday = 30, // 2014/12/30 .tm_wday = 2, .tm_yday = 363, // Tuesd...
/* * 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(OFFSET_X, OFFSET_Y + i, STRIPE_WIDTH, STRIPE_HEIGHT)
, (GColor){.argb = color | alpha}); color++; } // Compare the results cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "blendtest_0_100.pbi")); // Reset canvas setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_bitmap_in_rect(&ctx, ...
ession) { concat_str_int(DLS_FILE_NAME_PREFIX, session->comm.session_id, name, DLS_FILE_NAME_MAX_LEN); } // ---------------------------------------------------------------------------------------- // Logs if an error occurs, returns true on success static bool prv_pfs_read(int fd, void *buf, size_t size) { int by...
{ // The write offset is 0 if we've never created storage for this session. return true; }
if (!prv_get_session_file(session, 0)) { // We couldn't open up this storage file. Since we are just compacting where we can, // just return true so that we go on to the next session in the list. return true; } size_t cur_size = prv_pfs_get_file_size(session->storage.fd); uint32_t target_free_byt...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ mutex_lock(s_pending_data_mutex); }
static void prv_unlock_pending_bonding(void) { mutex_unlock(s_pending_data_mutex); } static void prv_shared_prf_reschedule_writeback_timer(void) { if (regular_timer_is_scheduled(&s_shared_prf_writeback_timer)) { regular_timer_remove_callback(&s_shared_prf_writeback_timer); } regular_timer_add_multiminute...
int32_t prv_num_packets_in_flight(const PPoGATTClient *client) { return prv_sn_distance(client->out.next_expected_ack_sn, client->out.next_data_sn); } static uint32_t prv_next_sn(uint32_t current_sn) { return (current_sn + 1) % PPOGATT_SN_MOD_DIV; } static uint32_t prv_prev_sn(uint32_t sn) { return ((PPOGATT_SN...
{ // We've timed out waiting for a reset to be completed, start over: // iAP and PPoGATT are connecting concurrently at the moment. To avoid having two system // sessions, the iOS app will deliberately hold the PPoGATT client in the reset state, by not // sending the Reset Complete, if there is...
return; } uint8_t sn = client->out.next_expected_ack_sn; if (prv_has_timeout(client)) { prv_roll_back(client, sn); // Return, because all packets after the timed-out one have been "rolled back" now, // no point in continuing. return; } // No timeouts s_ppogatt_timeout_count = 0; } st...
/* * 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...
(sizeof(LowPowerAppData))
os, end_hours, end_minutes, false); } static void prv_set_deep_sleep(char *buffer, size_t buffer_size, int32_t sleep_duration, void *i18n_owner) { if (sleep_duration <= 0) { strncpy(buffer, EN_DASH, buffer_size); return; } health_util_format_hour...
{ app_free(card_data->headings[i].primary_value); app_free(card_data->headings[i].secondary_value); }
/* * 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...
{ option_menu_init(&s_data.option_menu); const OptionMenuConfig option_menu_config = { .title = config->title ?: "Option Menu", .content_type = config->content_type, .status_colors = { GColorWhite, GColorBlack }, .highlight_colors = { PBL_IF_COLOR_ELSE(GColorCobaltBlue, GColorBlack), GColorWhite },...
// Tests ////////////////////// // These tests test all permutations on all platforms even if the combination on the particular // platform was not designed and thus does not appear pleasant. Make sure you are looking at the // combination relevant to your use case when examining the unit test output of Option Menu....
1, .minor = 0, }, .sdk_version = { .major = 5, .minor = 13, }, .app_face_bg_color = {0}, .template_id = 0, .icon_resource_id = 0, }; // menu layer static const uint32_t menu_layer_size = (1140 + 7852); static const AppDBEntry menu_layer = { .name = MENU_LAYER_APP_NAME, .uuid = {0xb8, 0x26,...
(INSTALL_ID_INVALID, app_install_get_id_for_uuid(&(const Uuid)UUID_SYSTEM))
; } void test_app_install_manager__compare_app_entry_retrieve_methods(void) { AppInstallEntry id_entry; AppInstallEntry uuid_entry; cl_assert_equal_b(true, app_install_get_entry_for_install_id(tictoc_id, &id_entry)); cl_assert_equal_b(true, app_install_get_entry_for_uuid(&tictoc_uuid, &uuid_entry)); cl_asse...
/* * 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...
(evt->conn_idx)
; if (!connection) { PBL_LOG(LOG_LEVEL_WARNING, "Read_device_name: Failed to find connection"); return; } typedef struct PACKED HcProtocol_GapDeviceNameResponse { HcProtocol_GapDeviceNameResponseHeader header; uint8_t name[evt->length]; } HcProtocol_GapDeviceNameResponse; HcProtocol_GapDevice...