prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * 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 (progress_callback) { progress_callback(sector - first_sector + 1, count, progress_context); }
} FLASH_Lock(); return true; } bool system_flash_write( uint32_t address, const void *data, size_t length, SystemFlashProgressCb progress_callback, void *progress_context) { dbgserial_print("system_flash_write("); dbgserial_print_hex(address); dbgserial_print(", "); dbgserial_print_hex(length); ...
yer, Layer *cell_layer, MenuCellSpan *cursor, GContext* ctx) { if (cursor->h == 0) { // cell has height 0, no need to draw anything. return; } cell_layer->bounds.size.h = cursor->h; cell_layer->frame.size.h = cursor->h; cell_layer->frame.origin.y = cursor->y; // Save current drawing state: G...
prv_menu_layer_draw_row(it->it.menu_layer, &it->cell_layer, &it->it.cursor, it->ctx)
, int minute_of_day, ActivityScalarStore steps, ActivityScalarStore total_steps_avg, Uuid *uuid) { sniprintf(ACTIVITY_SUMMARY_PIN_CONFIG.short_subtitle, SUBTITLE_BUFFER_LENGTH, i18...
("Gettin' your step on?")
, }, }; return prv_get_variant(&s_walking_intros, VARIANT_RANDOM); } case ActivitySessionType_Run: { static const InsightCopyVariants s_running_intros = { .num_variants = 5, .variants = { i18n_noop("Feelin' hot? Cause you're on 🔥"), i18n_noop("Hey ...
nses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitation...
{ close_sessions(); }
/* * 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...
(content_indicators[index], content_indicator)
; } void helper_check_configs_for_equality(ContentIndicatorConfig a, ContentIndicatorConfig b) { cl_assert_equal_p(a.layer, b.layer); cl_assert_equal_b(a.times_out, b.times_out); cl_assert(a.alignment == b.alignment); cl_assert(a.colors.foreground.argb == b.colors.foreground.argb); cl_assert(a.colors.backgro...
* 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 "drivers/display.h" #include <stdbool.h> #include "bo...
prv_end_command()
ignmentCenter: align_str = "center"; break; } return jerry_create_string((const jerry_char_t *)align_str); } // we speed this up, e.g. by sorting and doing binary search if this ever becomes an issue T_STATIC const RockyAPISystemFontDefinition s_font_definitions[] = { {.js_name = "18px bold Gothic",...
jerry_set_object_field(result, "width", result_width)
; jerry_set_object_field(result, "height", result_height); return jerry_acquire_value(result); } void rocky_api_graphics_text_add_canvas_methods(jerry_value_t obj) { rocky_add_function(obj, ROCKY_CONTEXT2D_FILLTEXT, prv_fill_text); rocky_add_function(obj, ROCKY_CONTEXT2D_MEASURETEXT, prv_measure_text); rocky...
vailable) { return NULL; } s_kernel_receiver_is_receiving = true; cl_assert_equal_p(endpoint->handler, app_message_app_protocol_system_nack_callback); cl_assert(total_payload_size <= MAX_HEADER_SIZE); return s_kernel_receiver; } static void prv_default_kernel_receiver_write(Receiver *receiver, ...
cl_assert_equal_b(true, s_kernel_receiver_finish_called)
topped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // Complete B prv_advance_to_ms_with_timers(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1); cl_assert_equal_i(prv_c...
(start_ms + duration_total + 5 * MIN_FRAME_INTERVAL_MS + 1)
; 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), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 1)...
l_assert(!alerts_should_vibrate_for_type(AlertMobile)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(!alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(!alerts...
rtc_get_ticks()
+ NOTIFICATION_VIBE_HOLDOFF_TICKS); cl_assert(alerts_should_enable_backlight_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alerts_should_vibrate_for_type(AlertReminder)); alerts_set_notification_vibe_timestamp(); fake_rtc_set_ticks(rtc_get_ticks() + NOTIFICATION_...
onitor_handle_state_change_event(event->battery_state.new_state); } else if (event->type == PEBBLE_BATTERY_CONNECTION_EVENT) { battery_state_handle_connection_event(event->battery_connection.is_connected); periodic_timer_trigger(1); } } // Setup //////////////////////////////////// void test_battery_monito...
fake_battery_set_millivolts(discharge_mv)
; fake_battery_set_connected(false); cl_assert_equal_i(battery_get_charge_state().charge_percent, percent); } void test_battery_monitor__curve_adjustment_when_charge_complete(void) { int charge_mv = battery_curve_lookup_voltage_by_percent(0, true); int full_mv = battery_curve_lookup_voltage_by_percent(100, fal...
ap_pbi_eq(bitmap, GET_PBI_NAME(88))); #endif } // Tests APNG file with 8-bit color, 5 frames and loop = 1 // Tests gbitmap_sequence_update_bitmap_by_elapsed with 0 delay frames for 1, 4 and 5 // and 2 & 3 have delay 1000ms // Result: // - gbitmaps matches platform decoded APNG void test_gbitmap_sequence__color_8bit...
(orig_bounds.size, GBitmapFormat8BitCircular)
; cl_assert(bitmap); // Shift the bounds when updating gbitmap_set_bounds(bitmap, shift_bounds); gbitmap_sequence_update_bitmap_next_frame(bitmap_sequence, bitmap, NULL); // set the original bounds to do whole-image comparison gbitmap_set_bounds(bitmap, orig_bounds); cl_check(gbitmap_pbi_eq(bitmap, GET_P...
s function doesn't get called for 49 days we'll miss a rollover but that's // extremely unlikely. TickType_t rollover_amount = -1; s_coarse_ticks += rollover_amount; } s_last_freertos_tick_count = freertos_tick_count; RtcTicks ret_value = freertos_tick_count + s_coarse_ticks; if (ints_enabled) { ...
rtc_get_time_ms(&seconds, &ms)
[s_message_idx].length = length; memcpy(s_messages[s_message_idx].data, data, length); ++s_message_idx; if (s_num_messages_to_consume_from_handler--) { app_inbox_consume(consumer_info); } } #define assert_message(idx, dd, ll) \ { \ cl_assert(idx <= s_message_idx); \ cl_assert_equal_i(ll, s_messages[idx...
app_inbox_service_has_inbox_for_tag(AppInboxServiceTagUnitTest)
); } void test_app_inbox__app_inbox_create_and_register_kernel_oom(void) { fake_kernel_malloc_set_largest_free_block(0); void *result = app_inbox_create_and_register(BUFFER_SIZE, 1, test_message_handler, test_dropped_h...
, PmicRegisters_GPIO4_CNTL = 0x0c, PmicRegisters_GPIO5_CNTL = 0x0d, PmicRegisters_GPIO_SIG_OUT = 0x20, PmicRegisters_GPIO_SIG_IN = 0x21, PmicRegisters_REG1_VOLTAGE = 0x22, PmicRegisters_REG2_VOLTAGE = 0x23, PmicRegisters_REG_CNTL = 0x24, PmicRegisters_GPIO_CNTL1 = 0x25, PmicRegisters_GPIO_CNTL2 = 0x...
{ s_pmic_gpio_output_state = new_output_state; return true; }
return false; } static void prv_init_pmic_gpio_outputs(void) { // Sync the state of the PMIC GPIO output register with the value that we // think it has. if (!prv_set_pmic_gpio_outputs(0, 0)) { PBL_LOG(LOG_LEVEL_ERROR, "Could not initialize PMIC GPIO outputs"); } } static void prv_handle_charge_state_c...
_switch); } static void prv_configure_interrupts(void) { // Clear pending interrupts in case we were woken from standby prv_clear_pending_interrupts(); exti_configure_pin( BOARD_CONFIG_POWER.pmic_int, ExtiTrigger_Falling, prv_as3701b_interrupt_handler); exti_enable(BOARD_CONFIG_POWER.pmic_int); const...
prv_read_register(PmicRegisters_RESET_CNTL, &reset_cntl)
) { PBL_LOG(LOG_LEVEL_ERROR, "Failed to read the RESET_CNTL register"); return; } s_last_reset_reason = reset_cntl >> 4; } uint32_t pmic_get_last_reset_reason(void) { return s_last_reset_reason; } bool pmic_init(void) { s_debounce_charger_timer = new_timer_create(); prv_init_gpio(); if (!prv_is_...
t32_t size = dls_test_get_num_bytes(logging_sessions[i]); PBL_LOG(LOG_LEVEL_INFO, "Size of session %d: %d", i, size); total_bytes += size; } PBL_LOG(LOG_LEVEL_INFO, "total bytes: %d", total_bytes); cl_assert(total_bytes < DLS_TOTAL_STORAGE_BYTES); // We should still be able to create more sessions up ...
dls_list_get_next(logging_session)
/* * 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...
property_animation_get_animation(prop_animation)
; } static void prv_window_transition_move_render(WindowTransitioningContext *context, GContext *ctx) { Window *window_from = context->window_from; if (window_from) { window_render(window_from, ctx); graphics_patch_trace_of_moving_rect(ctx, &context->window_from_last_x, ...
g the new record. Compacting the file will copy over the // previous record while clearing the overwrite bits for us, so that we // can still find the previous record. We could be smarter here, but // this should happen pretty rarely. return settings_file_compact(file); } // The overwri...
(&file->iter)
; } // Create and write out a new record. Writing the header transitions us into // the write-in-progress state, since at least once of the bits must be // flipped from a 1 to a 0 in order for the header to be valid. SettingsRecordHeader new_hdr; memset(&new_hdr, 0xff, sizeof(new_hdr)); new_hdr.last_modi...
le LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * di...
("Demo Menu")
OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "swap_layer.h" #include "applib/applib_malloc.auto.h" #include "applib/graphics/graphics.h" #include "applib/graphics/gtypes.h" #include "applib/...
if (swap_layer->callbacks.get_layout_handler) { LayoutLayer *layout = swap_layer->callbacks.get_layout_handler(swap_layer, rel_change, swap_layer->context); // if there is no layout, we return NULL if (!layout) { return NULL; } ...
return NULL; } static void prv_announce_layout_will_appear(SwapLayer *swap_layer, LayoutLayer *layout) { swap_layer->swap_in_progress = true; if (swap_layer->callbacks.layout_will_appear_handler) { return swap_layer->callbacks.layout_will_appear_handler(swap_layer, layout, ...
( &s_circular_buffer, (uint8_t *)report_buffer, length)
; if (!written) { ++s_dropped_reports; } else { // notify clients there's a new event available PebbleEvent e = { .type = PEBBLE_BLE_SCAN_EVENT, }; event_put(&e); } } // ----------------------------------------------------------------------------- bool gap_le_consume_scan_results(uint8_t *...
box_params->box.origin.x; line_iter_state->current->origin.y += prv_get_line_height(text_box_params); line_iter_state->current->width_px = 0; // needs to be reset per line line_iter_state->current->max_width_px = text_box_params->box.size.w; line_iter_state->current->suffix_codepoint = 0; line_iter_state->cu...
(ctx, word, SPACE_CODEPOINT, text_box_params)
); } //////////////////////////////////////////////////////////// // Walk Line typedef void (*CharVisitorCallback)(GContext* ctx, const TextBoxParams* const text_box_params, Line* line, GRect cursor, const Codepoint codepoint); void render_chars_char_visitor_cb(GContext* ctx, cons...
/* * 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...
command_hwver_write(written_hw_version5)
; hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version5, hw_version); #endif // BOARD_SILK || BOARD_CALCULUS } void test_mfg_serials__serial_number_console(void) { const char* serial; // Initially, bunch of XXs: serial = mfg_get_serial_number(); cl_assert_equal_s(serial, "XXXXXXXXXXXX")...
cb(HealthActivity activity, time_t time_start, time_t time_end, void *context) { uint32_t *num_activities_found = (uint32_t *)context; *num_activities_found += 1; char *activity_name = "unknown"; switch (activity) { case HealthActivityNone: activity_name = "none"; ...
(APP_LOG_LEVEL_DEBUG, "No more data")
e) : implementation->accessors.getter.gcolor8(subject); property_animation->values.from.gcolor8 = from_value ? *((GColor8*)from_value) : implementation->accessors.getter.gcolor8(subject); } else if (property_animation->anim...
((Animation *)animation_h)
); prv_init(property_animation, implementation, subject, from_value, to_value); return true; } // ----------------------------------------------------------------------------------------- PropertyAnimation* property_animation_create_layer_frame(struct Layer *layer, GRect *from_frame, ...
h_context( Window *window, ClickConfigProvider click_config_provider, void *context) { PBL_ASSERTN(window); window->click_config_provider = click_config_provider; window->click_config_context = context; if (window->on_screen && !window->is_unfocusable) { // We're already on screen, make the config prov...
prv_get_current_click_manager()
; ClickConfig *cfg = &mgr->recognizers[button_id].config; cfg->raw.up_handler = up_handler; cfg->raw.down_handler = down_handler; cfg->raw.context = context; } ClickConfigProvider window_get_click_config_provider(const Window *window) { return window->click_config_provider; } void *window_get_click_config_...
const bool is_text_remaining) { // Only set a trailing ellipsis if there is text remaining if (!is_text_remaining) { return; } // Check if outputting two lines extend beyond the text box height - then display the ellipsis // on the current line bool is_last_line = ((lin...
(ctx, &ctx->dest_bitmap, &ctx->dest_bitmap.bounds, line->origin.y + TEXT_LINE_BASE_LINE(line), fixed_x1, fixed_x2, GColorRed)
; #endif } } typedef struct { int16_t origin_x; int16_t width_px; } OrphanLineState; static OrphanLineState prv_capture_orphan_state(Line const* line) { return (OrphanLineState) { .origin_x = line->origin.x, .width_px = line->width_px, }; } static void prv_apply_orphan_state(const OrphanLineState *...
/* * 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...
{ state->will_focus_info.type = PEBBLE_APP_WILL_CHANGE_FOCUS_EVENT; state->will_focus_info.handler = prv_focus_event_handler; event_service_client_subscribe(&state->will_focus_info); }
state->handlers = handlers; } void app_focus_service_subscribe(AppFocusHandler handler) { AppFocusHandlers handlers = (AppFocusHandlers) { .will_focus = handler }; app_focus_service_subscribe_handlers(handlers); } void app_focus_service_unsubscribe(void) { AppFocusState *state = app_state_get_app_focus_state...
* Math.PI);\n" "var c1 = 100 + 50 * Math.cos(0);\n" "var c2 = 100 + 50 * Math.cos(2 * Math.PI);\n" ); cl_assert_equal_i(100, (int32_t)jerry_get_number_value(prv_js_global_get_value("s1"))); cl_assert_equal_i(99, (int32_t)jerry_get_number_value(prv_js_global_get_value("s2"))); cl_assert_equal_i(150, (in...
rocky_event_loop_with_string_or_snapshot(snapshot, snapshot_size)
; cl_assert(result); } static int s_cleanup_calls; static void prv_cleanup_cb(const uintptr_t native_p) { ++s_cleanup_calls; } void test_js__js_value_cleanup(void) { s_cleanup_calls = 0; { // Sanity check: // we don't clean up when a bare jerry_value_t goes out of scope. jerry_value_t value = jer...
file, (uint8_t *)&i, sizeof(uint32_t), (uint8_t *)&value, sizeof(uint32_t)); } for (uint32_t i = 0; i < LOOPS; i++) { // increment value of all NUMBER_ENTRIES entries for (uint32_t j = 0; j < NUMBER_ENTRIES; j++) { if (manual && (j % 10 == 0)) { cl_must_pass(settings_file_compact(&file)); ...
settings_file_open(&file, "test_file_max_storage", 4096)
); uint8_t key[5]; int key_len = 4; uint8_t val[5]; int val_len = 4; // 255 * (8 + 4 + 4) = 4080 + 8 + 8 = 4096 for (int j = 0; j < 255 * 2; j++) { prv_print_stats(&file); int i = j % 255; snprintf((char *)key, sizeof(key), "k%03d", i); snprintf((char *)val, sizeof(val), "v%03d", i); pri...
, NULL }; const char *script = "var "FUNC_NAME" = function() { throw new Error('"ERROR_STRING"'); };"; prv_do_call_user_function(script); cl_assert(*s_log_internal__expected == NULL); } void test_rocky_api_util__eval_no_error(void) { s_log_internal__expected = (const char *[]){ NULL }; prv_do_eval("1+1...
jerry_value_is_object(now)
); jerry_value_t getSeconds = jerry_get_object_field(now, "getSeconds"); jerry_value_t getMinutes = jerry_get_object_field(now, "getMinutes"); jerry_value_t getHours = jerry_get_object_field(now, "getHours"); jerry_value_t getDate = jerry_get_object_field(now, "getDate"); jerry_value_t getMonth = jerry_get_ob...
DRAW_RECT_NO_CLIP, 0); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r0_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bit...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) + 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax2_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif } void ...
; static bool s_pattern_in_progress = false; // s_vibe_strength is the current vibration strength setting of the motor static int32_t s_vibe_strength = VIBE_STRENGTH_OFF; // s_vibe_strength_default is the vibrations trength of the motor used when one is not specified // explicitly, and can be changed in the notificatio...
{ return prv_vibe_pattern_enqueue_step_raw(duration_ms, strength); }
DEFINE_SYSCALL(bool, sys_vibe_pattern_enqueue_step, uint32_t duration_ms, bool on) { return prv_vibe_pattern_enqueue_step_raw(duration_ms, on ? s_vibe_strength_default : VIBE_STRENGTH_OFF); } DEFINE_SYSCALL(void, sys_vibe_pattern_trigger_start, void) { 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...
cl_assert_equal_i(atoi("21474836481"), 1)
; // ((2147483647 * 10) + 1) & 0xFFFFFFFF cl_assert_equal_i(atoi("21474836471"), (int)4294967287); // -1 * (((2147483647 * 10) + 1) & 0xFFFFFFFF) cl_assert_equal_i(atoi("-21474836471"), -(int)4294967287); } // atol will actually behave _exactly_ the same as atoi, so these tests are just copy-pasted // Would pr...
heck(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 4); graphics_draw_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_origin_sw4_clip_xy.${BIT_DEPTH_NA...
(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw2_clip_nxny.${BIT_DEPTH_NAME}.pbi"))
; // AA = true, SW = 3 setup_test_aa_sw(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, 3); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw3_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFS...
qual_i(s_num_timeline_adds, 2); alarm_set_kind(id, ALARM_KIND_WEEKENDS); // Alarm should not go off on Thursday anymore s_current_hour = 10; s_current_minute = 30; cron_service_wakeup(); cl_assert_equal_i(s_num_alarms_fired, 0); // Alarm should go off on the weekend s_current_day = s_saturday; s_cu...
cl_assert_equal_i(s_num_alarms_fired, 1)
; } // TODO: // - Test disable while snoozing // - Test delete while snoozing
/* * 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...
("R3=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R3])
; printf("R12=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_R12]); printf("LR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_LR]); printf("PC=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_PC]); printf("xPSR=0x%08" PRIx32 "\n", g_stacked_regs[Stacked_Register_xPSR]); printf("SP=0x%08" PRIx32 "...
nce; } static bool prv_should_use_glance_cache_for_app_with_uuid(const Uuid *uuid) { // Use the glance cache only if the app does not have the system UUID (all zeros) return !uuid_is_system(uuid); } ///////////////////// // Glance events static void prv_handle_glance_event(PebbleEvent *event, void *context) { ...
(service->generic_glance_icon)
; service->generic_glance_icon_resource_id = generic_glance_icon_resource_id; const KinoPlayerCallbacks glance_reel_player_callbacks = (KinoPlayerCallbacks) { .frame_did_change = prv_glance_reel_player_frame_did_change_cb, }; kino_player_set_callbacks(&service->glance_reel_player, glance_reel_player_callba...
/* * 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_num, id, start_bytes, buffer, num_bytes)
; } size_t sys_resource_size(ResAppNum app_num, uint32_t handle) { return emx_resources_get_size(app_num, handle); } GFont sys_font_get_system_font(const char *font_key) { static FontInfo s_system_fonts_info_table[NUM_SYSTEM_FONTS + 1] = {}; for (int i = 0; i < (int) NUM_SYSTEM_FONTS; ++i) { if (0 == strcm...
/* * 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_data)
; ANCSAppData app_data_out = { 0 }; ancs_app_storage_load(app_data.bundle_id, &app_data_out); cl_assert_equal_s(app_data.bundle_id, app_data_out.bundle_id); cl_assert_equal_i(app_data.flags, app_data_out.flags); cl_assert_equal_s(app_data.display_name, app_data_out.display_name); ancs_app_destroy_buffer(...
data being available // FIXME: optimize this equation // current linear equation has slope of 1 cycle/SETUP_STEP, with initial value 1 // setupTime based on h_clock frequency // equation derived from existing working values; 5 at 64Mhz, 8 at 128 Mhz // the data was then interpolated into a line, wi...
{ // Set bits according to value needed - see Table 7.11 in data sheet // [15] Device Read Mode 0b1 Asynchronous Read Mode // [14:11] Programmable Read Wait States 0b1011 13 wait cycles (default) // [10] RDY Polarity 0b1 RDY signal is active high (defau...
prv_write_configuration_register(configuration_register); prv_switch_flash_mode(&nor_init); prv_poll_for_ready(0); flash_impl_release(); return S_SUCCESS; } status_t flash_impl_blank_check_sector(FlashAddress addr) { // FIXME: Blank check operation is only allowed in asynchronous mode. Fall // back ...
ion) { bool rv; prv_lock(); { rv = list_contains((ListNode *)s_connections, (const ListNode *)connection); } prv_unlock(); return rv; } static bool prv_connection_by_idx_list_filter_cb(ListNode *found_node, void *data) { uint16_t conn_idx = (uintptr_t)data; return (((Connection *)found_node)->conn_...
{ state = connection->ppogatt_wa_state; }
haringRequest *)ctx); } static void prv_request_sharing_permission(GAPLEConnection *const connection) { PBL_LOG(LOG_LEVEL_INFO, "Requesting BLE HRM sharing permission"); BLEHRMSharingRequest *const sharing_request = kernel_zalloc_check(sizeof(*sharing_request)); sharing_request->connection = connection; launch...
(connection)
) { prv_update_permission(connection, HrmSharingPermission_Declined); prv_disconnect_to_kill_subscription(connection); } bt_unlock(); analytics_event_ble_hrm(BleHrmEventSubtype_SharingRevoked); } static void prv_revoke_gap_le_connection_for_each_cb(GAPLEConnection *connection, void *unused) { prv_upda...
eneric_glance || !res_info) { return; } const bool is_requested_resource_the_default_icon = ((res_info->res_app_num == generic_glance->default_icon_resource_info.res_app_num) && ((res_info->res_id == APP_GLANCE_SLICE_DEFAULT_ICON) || (res_info->res_id == generic_glance->default_icon_reso...
(structured_glance)
; const time_t existing_reeval_time = generic_glance->next_slice_subtitle_template_string_reeval_time; // Bail out if the new re-evaluation time is not earlier than the existing one we have if ((new_reeval_time == 0) || ((existing_reeval_time != 0) && (new_reeval_time >= existing_reeval_time))) { ...
t read data to %p of length %d at pos %d: %"PRId32, data, data_len, pos, status); fatal_logic_error(iter); } static int sfs_write(SettingsRawIter *iter, const uint8_t *data, int data_len) { status_t status = pfs_write(iter->fd, data, data_len); if (status >= 0) { return status; } int pos = pfs...
{ sfs_seek(iter, iter->hdr_pos + sizeof(SettingsRecordHeader) + iter->hdr.key_len + offset, FSeekSet); sfs_write(iter, &byte, 1); }
void settings_raw_iter_deinit(SettingsRawIter *iter) { int status = pfs_close(iter->fd); if (status < 0) { PBL_LOG(LOG_LEVEL_WARNING, "Could not close settings file"); } } #if UNITTEST uint32_t settings_raw_iter_prv_get_num_record_searches(void) { return s_num_record_changes; } #endif
} static GTextNode *prv_create_pin_view_node(TimelineLayout *layout) { const AttributeList *attributes = layout->layout_layer.attributes; const size_t num_vertical_nodes = 3; GTextNodeVertical *vertical_node = graphics_text_node_create_vertical(num_vertical_nodes); const bool is_future = (layout->info->scrol...
( &layout->layout_layer, &secondary_config.text.extent.node)
; if (is_peek) { secondary_node->node.offset = peek_text_offset; secondary_node->max_size.w = peek_text_width; } else { secondary_node->text = secondary_text; } secondary_node->overflow = overflow; graphics_text_node_container_add_child(&vertical_node->container, &secondary_node->n...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(strtol("2147483648", NULL, 10), INT_MAX)
/* * 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...
(DISP_GPIO, &gpio_cfg)
; gpio_cfg.GPIO_Mode = GPIO_Mode_OUT; gpio_cfg.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Pin = DISP_PIN_SCS; GPIO_Init(DISP_GPIO, &gpio_cfg); gpio_cfg.GPIO_OType = GPIO_OType_OD; gpio_cfg.GPIO_PuPd = GPIO_PuPd_NOPULL; gpio_cfg.GPIO_Pin = DISP_PIN_CRESET; GPIO_Init(DISP_GPIO, &gpio_cfg); RCC_APB2P...
/* * 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...
FAILED(read_result)
) { RETURN_STATUS_UP(read_result); } return restricted_size; } // Legacy version to prevent previous app breakage, __deprecated preserves order int persist_read_data__deprecated(const uint32_t key, const size_t buffer_size, void *buffer) { return persist_read_data(key, buffe...
/* * 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->line_spacing_delta += 5; text_layer_set_line_spacing_delta(&data->text_layer, data->line_spacing_delta); }
else if (button == BUTTON_ID_SELECT) { data->overflow_mode = (data->overflow_mode + 1) % 3; text_layer_set_overflow_mode(&data->text_layer, data->overflow_mode); } else if (button == BUTTON_ID_DOWN) { if (data->line_spacing_delta < 5) { data->line_spacing_delta -= 1; } else { data->line_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...
(scroll_layer, data)
; scroll_layer_set_content_size(scroll_layer, GSize(window->layer.bounds.size.w, 500)); const GRect max_text_bounds = GRect(0, 0, window->layer.bounds.size.w, 500); TextLayer *text = &data->text; text_layer_init(text, &max_text_bounds); text_layer_set_text(text, "Lorem ipsum dolor sit amet, consectetur adipi...
rt_equal_p(touch_event, NULL); } void test_touch__handle_update_merge_position(void) { touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(10, 10), 5, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 0); prv_test_touch...
{ touch_set_touch_state(0, TouchState_FingerDown, GPointZero, 3686380, 0); touch_handle_update(0, TouchState_FingerDown, &GPoint(13, 13), 6, 3686420); touch_handle_update(0, TouchState_FingerUp, &GPoint(15, 100), 0, 3686400); TouchEvent *touch_event = touch_event_queue_get_event(0, 1); prv_test_touch_event(to...
void test_touch__handle_update_pressure(void) { //TODO: We're not passing pressure updates to the UI yet (not so useful?) } typedef struct TouchEventContext { TouchEvent touch_events[4]; uint32_t idx; } TouchEventContext; static void prv_touch_event_dispatch_cb(const TouchEvent *event, void *context) { Touc...
enuLayer txrx_menu_layer; NumberWindow txrx_number_window; // Payload Selection Window payload_window; SimpleMenuLayer *payload_menu_layer; SimpleMenuSection payload_menu_section; SimpleMenuItem *payload_menu_items; // Status Window Window status_window; TextLayer status_text; char status_string[S...
if (wait_for_result) { xSemaphoreTake(data->btle_test_semaphore, portMAX_DELAY); return data->last_test_step_result; }
return true; } static void prv_stop_mic_and_cleanup(AppData *data) { mic_stop(MIC); app_free(data->mic_buffer); data->mic_buffer = NULL; } static void prv_run_test(AppData *data) { PBL_ASSERTN(data->current_test_step == BTLETestStep_None); bool failed = false; bt_driver_register_response_callback(prv...
7427 }, // priority rank 31 { .id = 17, .priority = 1, .size = 22644 }, // priority rank 2 { .id = 18, .priority = 30, .size = 33202 }, // priority rank 22 { .id = 19, .priority = 25, .size = 151434 }, // priority rank 18 { .id = 20, .priority = 33, .size = 102321 }, // priority rank 24 { .id = 21, .priori...
fake_system_task_callbacks_invoke_pending()
ta, item, action) && action != dismiss_action) { timeline_actions_add_action_to_root_level(action, root_level); } } if (has_ancs_mute_action) { const char *app_id = attribute_get_string(&item->attr_list, AttributeIdiOSAppIdentifier, ""); iOSNotifPrefs *notif_prefs = ios_notif_pref_db_get_p...
{ PBL_LOG(LOG_LEVEL_ERROR, "Couldn't create notification action menu"); return; }
window_data->action_menu = timeline_actions_push_action_menu( &config, window_manager_get_window_stack(NOTIFICATION_PRIORITY)); } static void prv_select_long_click_handler(ClickRecognizerRef recognizer, void *data) { prv_dismiss_all(data, NULL); } static void prv_back_button_single_click_handler(ClickReco...
atic void draw_dotted_line(GContext *ctx, GPoint p0, uint16_t length, bool is_vertical) { bool even = (p0.x + p0.y) % 2 == 0; const GPoint delta = is_vertical ? GPoint(0, 1) : GPoint(1, 0); while (length >= 1) { if (even) { graphics_draw_pixel(ctx, p0); } even = !even; p0.x += delta.x; p...
(data->action_bar, data->window)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
cl_assert(r != NULL)
id_draw` after the final child is drawn. This is necessary to setup the draw box that // will be passed down to its children as well as to finalize the calculation of the container's // size. Similarly, containers also have extra calculation before and after they draw a child in // order to shrink the draw box th...
if (ctx->node->sibling) { // Continue this level to the next sibling contexts[level].node = ctx->node->sibling; break; }
/ to zero). It can be calculated using the formula: // Effective Connection Interval = (Connection Interval) * (1+(Slave Latency)) //! This module contains a work-around for parameter update requests not being applied by //! iOS / Apple's BT controller, even though they get "accepted" by the host. //! @see gap_le_conn...
{ return; }
// We need to wait at least REQUIRED_INIT_PAUSE_TICKS after a connection before // requesting new parameters. uint32_t retry_ms = REQUEST_TIMEOUT_MS; if ((rtc_get_ticks() - connection->ticks_since_connection) < REQUIRED_INIT_PAUSE_TICKS) { retry_ms = (REQUIRED_INIT_PAUSE_S * MS_PER_SECOND); goto retry...
/* * 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 (nf->callbacks.decremented != NULL) { nf->callbacks.decremented(nf, nf->callback_context); } update_output_value(nf); }
} static void select_click_handler(ClickRecognizerRef recognizer, NumberWindow *nf) { if (nf->callbacks.selected != NULL) { nf->callbacks.selected(nf, nf->callback_context); } } static void click_config_provider(NumberWindow *nf) { window_single_repeating_click_subscribe(BUTTON_ID_UP, 50, (ClickHandler) up...
t uint8_t *payload, uint32_t payload_size) { uint8_t buffer[sizeof(PutRequest) + payload_size]; PutRequest *put_msg = (PutRequest *)buffer; *put_msg = (PutRequest) { .cmd = CmdPut, .cookie = htonl(cookie), .payload_size = htonl(payload_size), }; memcpy(&put_msg->payload[0], payload, payload_size)...
fake_pb_storage_mem_reset()
; fake_pb_storage_mem_set_crc(EXPECTED_CRC); fake_comm_session_init(); fake_event_reset_count(); Transport *transport = fake_transport_create(TransportDestinationSystem, NULL, prv_system_msg_sent_callback); s_session = fake_transport_set_connected(transport, tru...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(AlertMaskAllOn)
; cl_assert(alerts_get_mask() == AlertMaskAllOn); // Should allow all notifications to go through cl_assert(alerts_should_notify_for_type(AlertMobile)); cl_assert(alerts_should_notify_for_type(AlertReminder)); cl_assert(alerts_should_notify_for_type(AlertPhoneCall)); // Should not allow invalid Notificati...
(fd, (uint8_t *)s_test_file_a, sizeof(s_test_file_a))
; pfs_close(fd); memset(s_test_file_b, 0, sizeof(s_test_file_b)); fd = pfs_open(TEST_FILE_B_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(s_test_file_b)); pfs_close(fd); fd = pfs_open(TEST_FILE_C_NAME, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof (s_test_file_c)); for (unsigned int i = 0; i < ARRAY...
{ *menu_layer = (MenuLayer) { .pad_bottom = true, }; ScrollLayer *scroll_layer = &menu_layer->scroll_layer; scroll_layer_init(scroll_layer, frame); menu_layer_init_scroll_layer_callbacks(menu_layer); scroll_layer_set_shadow_hidden(scroll_layer, true); scroll_layer_set_context(scroll_layer, menu_layer...
MenuLayer* menu_layer_create(GRect frame) { MenuLayer *layer = applib_type_malloc(MenuLayer); 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...
_reset(void); // Stubs /////////////////////////////////////////////////////////// static ActivitySession s_saved_session; void activity_sessions_prv_add_activity_session(ActivitySession *session) { s_saved_session = *session; } void activity_sessions_prv_delete_activity_session(ActivitySession *session) {} void ac...
cl_assert(workout_service_start_workout(ActivitySessionType_Run))
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distribute...
memcpy(command->points, points2, sizeof(points2))
; frame = (GDrawCommandFrame *)(command->points + command->num_points); *frame = (GDrawCommandFrame) { .duration = 30, }; frame->command_list = (GDrawCommandList) { .num_commands = 1 }; command = gdraw_command_list_get_command(&frame->command_list, 0); points2[0].x++; // increment x value to dist...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(APP_LOG_LEVEL_DEBUG, "Error with \"j\": %s", buf)
ow.com/users/56349/eddie-parker> static int wrap(int num, int const lower_bound, int const upper_bound) { int range_size = upper_bound - lower_bound + 1; if (num < lower_bound) num += range_size * ((lower_bound - num) / range_size + 1); return lower_bound + (num - lower_bound) % range_size; } static void up_...
{ nw->label = label; layer_mark_dirty(&nw->window.layer); }
.transaction_id = state->transaction_id, .error_code = htonl(GET_BYTES_OK), .num_bytes = htonl(state->num_bytes), }; comm_session_send_buffer_write(sb, (const uint8_t *) &rsp, sizeof(rsp)); state->sent_header = true; } comm_session_send_buffer_end_write(sb); if (state->storage.current_of...
if (s_get_bytes_in_progress == true) { PBL_LOG(LOG_LEVEL_ERROR, "already in progress."); prv_protocol_send_err_response(session, hdr->transaction_id, GET_BYTES_ALREADY_IN_PROGRESS); return; }
GetBytesState* state = kernel_zalloc_check(sizeof(*state)); *state = (GetBytesState) { .session = session, .transaction_id = hdr->transaction_id, }; // let the other types of pushes setup the state. if (!prv_setup_state_for_command(hdr->cmd_id, state, msg_data, msg_len)) { kernel_free(state); ...
hone_call.h" #include "ancs_notifications_util.h" #include "nexmo.h" #include "comm/ble/kernel_le_client/ancs/ancs_types.h" #include "drivers/rtc.h" #include "kernel/pbl_malloc.h" #include "services/common/analytics/analytics.h" #include "services/common/i18n/i18n.h" #include "services/normal/blob_db/ios_notif_pref_db...
(&title->pstr, reminder_title_buffer)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(this->pdm_frequency > 0)
; PBL_ASSERTN(this->pdm_frequency % MIC_SAMPLE_RATE == 0); uint32_t oversampling_ratio = this->pdm_frequency / MIC_SAMPLE_RATE; uint32_t sinc_order = (oversampling_ratio <= k_max_sinc4_osr) ? DFSDM_SincOrder_Sinc4 : DFSDM_SincOrder_Sinc3; // Calculate the right shift needed to contain the final value wit...
rs = { .stopped = prv_info_text_animation_stopped, }; animation_set_handlers(animation, handlers, NULL); } static void prv_initialize_info_text(BTPairingUIData *data) { prv_animate_info_text(data); } static void prv_deinitialize_info_text(BTPairingUIData *data) { } #else // Normal FW -- use i18n text for ...
PBL_ASSERTN(data->ui_state == BTPairingUIStateAwaitingUserConfirmation)
opped_handler_calls, a), 1); cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX); // ------------------------------------------------------------------------------------- // Build up a sequence out of a + b Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b...
prv_count_handler_entries(&s_started_handler_calls, b)
= 4, }; const Fixed_S16_3 y2_fixed = (Fixed_S16_3) { .integer = y2, .fraction = 4, }; prv_assign_vertical_line_raw(ctx, x, y1_fixed, y2_fixed, color); } void test_graphics_context_mask__apply_assign_vertical_line_raw(void) { prv_mask_apply_vline_test_pattern(prv_vline_pattern_apply_assign_vertical_li...
cl_assert(!graphics_context_mask_use(NULL, NULL))
; // Should start with default draw implementation cl_assert_equal_p(ctx->draw_state.draw_implementation, &g_default_draw_implementation); GDrawMask *mask1 = graphics_context_mask_create(ctx, true /* transparent */); cl_assert(mask1); cl_assert(graphics_context_mask_use(ctx, mask1)); // Should still be on...
m would go off every day. Respect /// capitalization! i18n_noop("EVERY DAY") : /// A frequency option for alarms, i.e. the alarm would go off every day. Respect /// capitalization! i18n_noop("Every Day"); break; case ALARM_KIND_WEEKDAYS: ...
(alarm_day_text, full_day_string)
ap, GRect dest_rect, GPoint src_origin_offset, GCompOp compositing_mode, GColor tint_color) { bitblt_into_1bit_setup_compositing_mode(&compositing_mode, tint_color); ...
{ ++src_block; if (src_block == src_block_end) { // Wrap-around source bitmap horizontally: src_block = src_block_begin; src_bits_left = src_bits_left_at_line_begin; src_dest_shift = (src_dest_shift + src_bitmap->bounds.size.w) % 32; } else { src...
// Proceed to next dest_block: ++dest_block; } } } void bitblt_bitmap_into_bitmap(GBitmap* dest_bitmap, const GBitmap* src_bitmap, GPoint dest_offset, GCompOp compositing_mode, GColor8 tint_color) { GRect dest_rect = { dest_offset, src_bitmap->bounds.size }; grect...
_schedule_thursday[7] = {false, false, false, false, true, false, false}; id = alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_JUST_ONCE }); prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_JUST_ONCE, just_once_schedule_thursday); id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 1...
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_WEEKENDS, s_weekend_schedule)
jerry_get_number_value(value)
; } else if (jerry_value_is_string(value)) { uint32_t sz = jerry_get_utf8_string_size(value); char buf[sz + 1]; memset(buf, 0, sz + 1); jerry_string_to_utf8_char_buffer(value, (jerry_char_t *)buf, sz); rv = strtoul(buf, NULL, 0); } return rv; } int32_t jerry_get_int32_value(jerry_value_t val...
/* * 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...
(RTC_BKP_BOOTBIT_DR, current_value)
; } void boot_bit_clear(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); current_value &= ~bit; RTC_WriteBackupRegister(RTC_BKP_BOOTBIT_DR, current_value); } bool boot_bit_test(BootBitValue bit) { uint32_t current_value = RTC_ReadBackupRegister(RTC_BKP_BOOTBIT_DR); re...
/////////////////////////////////////////////////////// void test_app_message_sender__outbox_data_too_short(void) { // This is one byte too small, because the PP payload has to be at least one in length: AppMessageAppOutboxData data = {}; prv_send_outbox_raw_data((const uint8_t *)&data, sizeof(data)); assert_c...
app_free(outbox_data)
; } void test_app_message_sender__byte_by_byte_consume(void) { AppMessageAppOutboxData *outbox_data = prv_create_and_send_outbox_message(NULL /* auto-select */, ALLOWED_ENDPOINT_ID, TEST_PAYLOAD, sizeof(TEST_PAYLOAD)); size_t length = comm_session_send_queue_get_lengt...
open but for now we will just let external callers use this // routine before allocating large files uint32_t tot_capacity = (pfs_get_size() * 8) / 10; return ((allocated_space >= tot_capacity) ? 0 : (tot_capacity - allocated_space)); } uint32_t pfs_crc_calculate_file(int fd, uint32_t offset, uint32_t...
(buf, sizeof(buf), "rd err: %d", num_bytes)
; goto cleanup; } PBL_HEXDUMP_D_SERIAL(LOG_LEVEL_DEBUG, bytes, num_bytes); prompt_send_response("DONE"); cleanup: kernel_free(bytes); } void pfs_command_cat(const char *filename, const char *num_chars) { int fd = pfs_open(filename, OP_FLAG_READ, 0, 0); char buf[16]; if (fd < 0) { prompt_send_re...
h your app or press up / down to browse the timeline"; color = GColorPictonBlue; } window_set_background_color(&data->window, PBL_IF_COLOR_ELSE(color, GColorWhite)); #endif text_layer_set_text(&data->info_text_layer, text); } static void prv_update_ui(SdkAppData *data) { prv_update_time(data); prv_update...
prv_init()
; app_event_loop(); } const PebbleProcessMd* sdk_app_get_info(void) { static const PebbleProcessMdSystem s_app_md = { .common = { .main_func = s_main, // UUID: 1197fc39-47e7-439b-82be-f56d9ba1dbd8 .uuid = { 0x11, 0x97, 0xfc, 0x39, 0x47, 0xe7, 0x43, 0x9b, 0x82, 0xbe, 0xf5, 0x6...
/* * 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(memcmp(buffer, data, sizeof(data)), 0)
; // Test ble_ad_copy_local_name, destination buffer large enough: char local_name[64]; size = ble_ad_copy_local_name(s_ad_data, local_name, 64); cl_assert_equal_s(local_name, "LightBlue"); cl_assert_equal_i(size, strlen("LightBlue") + 1); // Test ble_ad_copy_local_name, destination buffer too small: si...
bi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette); } // Tests 8-bit palettized 64-color PNG loading into gbitmap // Result: // - gbitmap matches platform loaded PNG void test_png__color_8_bit(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_F...
gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(4bitpalette))
); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat4BitPalette); } // Tests 8-bit transparent color PNG with 4-bit number of colors (<= 16 colors) // loading into gbitmap // Checks for bug fixed for PBL-15809, where GBitmap depth was based off // number of colors and not index value bits-per-pixel (bpp). ...
/* * 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...
(contents->message, message, sizeof(contents->message))
; size_t payload_length = MIN(sizeof(MessageContents), offsetof(MessageContents, message) + strlen(message)); return payload_length; } static void prv_send_pulse_packet(uint8_t log_level, const char *src_filename, uint16_t src_line_number, const cha...
static void prv_invalidate_current_page(void) { PBL_LOG(LOG_LEVEL_DEBUG, "Invalidating current page: #%"PRIu32, s_valid_page_idx); // First, check if the page is Unpopulated SprfMagic magic = prv_get_magic_for_page(s_valid_page_idx); if (magic == SprfMagic_UnpopulatedEntry) { // This page is already Unpopu...
(field_ptr, 0xFF, field_size)
; prv_persist_field(field_ptr, offset, field_size, false); prv_dealloc_struct(data); } static bool prv_fetch_field(uint8_t *field_out, size_t offset, size_t field_size) { flash_read_bytes(field_out, prv_current_page_flash_addr() + offset, field_size); if (!prv_field_valid(field_out, field_size)) { // If co...
d_a, advert_terms_a, sizeof(advert_terms_a)/sizeof(GAPLEAdvertisingJobTerm), unscheduled_callback, s_unscheduled_cb_data, 0); cl_assert(job_a); assert_ad_data("A"); // Schedule job "B": BLEAdData *ad_b = create_ad("B", NULL); GAPLEAdvertisingJ...
cl_assert_equal_i(s_unscheduled_cb_count, 0)
; regular_timer_fire_seconds(1); assert_ad_data("B"); cl_assert_equal_i(s_unscheduled_cb_count, 0); } // Unschedule job "B", air job "A" regular_timer_fire_seconds(1); assert_ad_data("A"); cl_assert_equal_i(s_unscheduled_cb_count, 1); cl_assert_equal_p(s_unscheduled_job, job_b); cl_assert_equ...
_list_lock static void prv_queue_deferred_delete(SmartstrapAttributeInternal *attr, bool do_free) { mutex_assert_held_by_curr_task(s_attr_list_lock, true); if (attr->state != SmartstrapAttributeStateRequestInProgress) { // stop the in-progress request smartstrap_cancel_send(); } void *buffer = mbuf_ge...
(s_attr_list_lock)
; SmartstrapAttributeInternal *attr = prv_find_by_buffer((uint8_t *)app_attr); mutex_unlock(s_attr_list_lock); if (!attr) { // the app might have destroyed the attribute return; } // clear the write_blocked flag after the event has been processed for an attribute attr->write_blocked = false; }
.num_success = inbox->num_success, .it = inbox->buffer.storage, .end = inbox->buffer.storage + inbox->buffer.write_index, }; // Also mark that there is no event pending any more: inbox->has_pending_event = false; // Reset counters because the info is communicated to app and it's about to ...
((ListNode *)node, (ListNode **)&s_app_inbox_head, NULL)
; num_messages_lost = node->num_failed + node->num_success + (node->writer ? 1 : 0); kernel_free(node); } } prv_unlock(); return num_messages_lost; } void app_inbox_service_unregister_all(void) { prv_lock(); { AppInboxNode *node = s_app_inbox_head; while (node) { AppInboxNode *n...
tric(ActivityMetric metric, uint32_t history_len, int32_t *history) { cl_assert_equal_i(history_len, 1); if (metric == ActivityMetricSleepState) { *history = s_sleep_state; return true; } else if (metric == ActivityMetricSleepStateSeconds) { *history = s_sleep_state_seconds; return true; } else ...
cl_assert_equal_i(s_num_timeline_removes, 0)
56, 640, -32}, { -192, 680, 16}, { -128, 840, 56}, { -32, 1048, 16}, { -24, 976, 24}, { -88, 1040, -8}, { -144, 1152, 64}, { -160, 1208, 64}, { -168, 1280, -24}, { -88, 1072, -144}, { -104, 808, -88}, { -176, 664, -72}, { -224, 520, -48}, { -320, 504, 0}, { -432, ...
{ -40, -424, -1032}, { 16, -304, -1000}, { -32, -304, -960}, { -96, -280, -912}, { -128, -344, -888}, // 377 seconds { -112, -224, -944}, { -80, -272, -976}, { -56, -192, -1008}, { -48, -168, -1048}, { -56, -176, -1104}, { -24, -248, -1072}, { -24, -264, -992}, { ...
{ 160, 840, 408}, { 168, 784, 424}, { 184, 776, 448}, { 184, 776, 488}, { 176, 784, 464}, { 184, 784, 464}, { 192, 776, 456}, { 200, 768, 472}, { 208, 776, 464}, { 208, 768, 440}, { 216, 768, 408}, { 216, 776, 432}, // 380 seconds { 200, 792, 480}, { 192, 784...
{ make_space_for_log(msg_length); LogHeader log_header = { .log_length = msg_length }; flash_write_bytes((const uint8_t*) &log_header, get_current_address(s_current_chunk, s_current_offset), sizeof(log_header)); s_current_offset += sizeof(log_header); uint32_t addr = get_current_address(s_current_chunk, s_c...
bool flash_logging_write(const uint8_t *data_to_write, uint32_t flash_addr, uint32_t data_length) { flash_write_bytes(data_to_write, flash_addr, data_length); return (true); } void flash_logging_init(void) { debug_db_init(); s_current_chunk = 0; s_current_chunk_id = 0; // Formatting the file we're g...
e->part->status_bit_masks.busy, false /* !set */, QSPI_NO_TIMEOUT); } qspi_release(dev->qspi); return (already_enabled) ? S_NO_ACTION_REQUIRED : S_SUCCESS; } status_t qspi_flash_lock_sector(QSPIFlash *dev, uint32_t addr) { #if TARGET_QEMU return S_SUCCESS; #endif qspi_use(dev->qspi); prv_write_enable(de...
profiler_init()
; prompt_send_response("Check whoami"); if (!qspi_flash_check_whoami(dev)) { ++failures; prompt_send_response("ERROR: Who am I failed"); } else { ++passes; } prompt_send_response("Enter low power mode"); flash_impl_enter_low_power_mode(); // WHOAMI should fail in low-power mode prompt_sen...
icense for the specific language governing permissions and * limitations under the License. */ #include "do_not_disturb.h" #include "do_not_disturb_toggle.h" #include "applib/ui/action_toggle.h" #include "applib/ui/app_window_stack.h" #include "applib/ui/dialogs/actionable_dialog.h" #include "applib/ui/dialogs/dial...
("Press and hold the Back button from a notification to turn " \ "Quiet Time on or off.", &s_data)
; if (source == ManualDNDFirstUseSourceActionMenu) { prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_action_menu); } else { prv_push_first_use_dialog(msg, prv_toggle_manual_dnd_from_settings_menu); } } static void prv_try_update_schedule_mode(void *data) { const bool clear_override = (bool) (...
DataNode *data_node = kernel_malloc(sizeof(DataNode) + pp_header.length); list_init(&data_node->node); data_node->endpoint_id = pp_header.endpoint_id; data_node->length = pp_header.length; memcpy(data_node->data, buffer, pp_header.length); fake_transport->sent_data = (DataNode *) li...
fake_transport_set_connected((Transport *)fake_transport, false /* connected */)
; } list_remove((ListNode *) fake_transport, (ListNode **) &s_fake_transport_head, NULL); DataNode *data_node = fake_transport->sent_data; while (data_node) { DataNode *next_data_node = (DataNode *)data_node->node.next; kernel_free(data_node); data_node = next_data_node; } kernel_free(fake_trans...
ENT, .battery_state.new_state.is_plugged = is_plugged_in, }; event_put(&e); } // ----------------------------------------------------------------------------- // Tests // ----------------------------------------------------------------------------- void test_hrm_manager__initialize(void) { // Init time fa...
cl_assert_equal_i(s_events_received[0].type, PEBBLE_HRM_EVENT)
; cl_assert_equal_i(s_events_received[0].hrm.event_type, HRMEvent_BPM); // Subscribe again before we expire, should get the same session ref back HRMSessionRef new_session_ref = sys_hrm_manager_app_subscribe(app_id, 1, expire_s, HRMFeature_BPM); c...
///////////////////////// status_t reminder_db_delete_with_parent(const TimelineItemId *parent_id) { return (timeline_item_storage_delete_with_parent(&s_storage, parent_id, reminders_handle_reminder_removed)); } status_t reminder_db_read_item(TimelineItem *item_ou...
{ if (has_reminded) { reminders_handle_reminder_updated(&hdr->common.id); } else { rv = reminders_update_timer(); } }
return rv; } status_t reminder_db_insert_item(TimelineItem *item) { if (item->header.type != TimelineItemTypeReminder) { return E_INVALID_ARGUMENT; } size_t payload_size = timeline_item_get_serialized_payload_size(item); uint8_t *buffer = kernel_malloc_check(sizeof(SerializedTimelineItemHeader) + paylo...
estroy((LayoutLayer *)timeline_layout); layer->layouts[index] = NULL; app_free(layer->layouts_info[index]); layer->layouts_info[index] = NULL; } static void prv_destroy_nonvisible_items(TimelineLayer *layer) { for (int i = 0; i < (int)ARRAY_LENGTH(s_nonvisible_items); i++) { TimelineLayout *timeline_layou...
((Layer *)&timeline_layer->day_separator, &frame)
; const TimelineLayerStyle *style = prv_get_style(); const int16_t expanded_layer_height = frame.size.h + 2 * (style->left_margin + style->right_margin); // move way off screen: 2x height * (1/2 - move_delta) in integer logic const int16_t TARGET_Y = (2 * expanded_layer_height * (1 - 2 * timeline_layer->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...
{ if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_graphics_context(); } else { return kernel_ui_get_graphics_context(); } }
ContentIndicatorsBuffer *kernel_ui_get_content_indicators_buffer(void) { PBL_ASSERT_TASK(PebbleTask_KernelMain); return &s_kernel_content_indicators_buffer; } ContentIndicatorsBuffer *content_indicator_get_current_buffer(void) { if (pebble_task_get_current() == PebbleTask_App) { return app_state_get_conte...