prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r4_sw5_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, false, 5); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, RADIUS_DEFAULT); cl_check(gbitmap_pbi_eq(&ctx.des...
(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11)
; graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 1); // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_r1_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif setup_test_aa_sw(&ctx, fb, ORIGIN...
imation_set_duration(a, duration_a); Animation *b = prv_create_test_animation(); animation_set_duration(b, duration_b); // Create a sequence Animation *seq = animation_sequence_create(a, b, NULL); cl_assert(seq != NULL); animation_set_play_count(seq, play_count_seq); // Check the duration cl_assert_e...
(&s_teardown_handler_calls, a)
, 0); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, a), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a),...
frame of the right "round flip" compositor // transition animation and then clips a full-screen red rectangle to the resulting mask static void prv_right_flip_first_frame_clipping(GContext *ctx) { // The first frame is ANIMATION_NORMALIZED_MAX because the right flip animation is actually // played backwards com...
(sizeof(GContext))
; test_graphics_context_init(ctx, fb); framebuffer_clear(fb); GBitmap *const bitmap = &ctx->dest_bitmap; // vertical test pattern for (int16_t y = 0; y < DISP_ROWS; y++) { GBitmapDataRowInfo row_info = prv_gbitmap_get_data_row_info(bitmap, y); for (int x = 0; x < DISP_COLS; x++) { GColor8 colo...
---------------------------------------------------------- void app_manager_close_current_app(bool gracefully) { // This method can be called as a result of receiving a PEBBLE_PROCESS_KILL_EVENT notification // from an app, telling us that it just finished it's deinit. Don't replace s_next_app.md if // perhaps it...
(DISP_COLS, DISP_ROWS)
; return; } WTF; } bool app_manager_is_app_supported(const PebbleProcessMd *md) { // Get the app ram size depending on the SDK type. // Unsupported SDK types will have a size of 0. return prv_get_app_segment_size(md) > 0; } // Commands /////////////////////////////////////////////////////////// void...
in the send buffer, until they are Ack'd in case we need to retransmit them. uint16_t offset = prv_total_num_bytes_awaiting_ack(client); // If retransmitting, we need to use the same fragmentation as the previous transmission. // The payload_sizes field will still contain the previously used size, unless it was...
{ prv_send_next_packets(client); client = (PPoGATTClient *) client->node.next; }
IP, ORIGIN_RECT_NO_CLIP, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, 3, GCornersAll); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_no_clip.${BIT_DEPTH_NAME}.pbi")); // TODO: Fix left corners PBL-15915 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CL...
(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, 3, GCornersAll)
; cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "fill_rect_origin_r3_aa_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_CLIP_XY, ORIGIN_RECT_CLIP_XY, true, 1); graphics_fill_round_rect(&ctx, &ORIGIN_DRAW_RECT_CLIP_XY, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1, GCornersAll); cl_check(gbitmap...
ges[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[...
(true, 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_ha...
// will add it for us. it->cursor.y -= it->cursor.h; } else { it->cursor.y -= total_height; } it->cell_bottom_y = it->cursor.y + it->cursor.h; // SECTION it->section_callback(it); } } if (it->should_continue == false) { return; } ...
layer_remove_from_parent(&render_iter->cell_layer)
; // Assign the new cache: menu_layer->cache.cursor = render_iter->new_cache; task_free(render_iter); } void menu_layer_init_scroll_layer_callbacks(MenuLayer *menu_layer) { ScrollLayer *scroll_layer = &menu_layer->scroll_layer; scroll_layer_set_callbacks(scroll_layer, (ScrollLayerCallbacks) { .click_co...
-304, 424, -944}, { -432, 584, -856}, { -432, 432, -816}, // 2 seconds { -440, 512, -824}, { -456, 480, -800}, { -440, 448, -720}, { -480, 584, -464}, { -504, 768, -448}, { -536, 816, -296}, { -568, 960, -216}, { -528, 816, -88}, { -480, 880, 184}, { -528, 888, 288},...
{ 1192, 856, -176}, { 1296, 712, -144}, { 1432, 600, -152}, { 1168, 408, -120}, { 1104, 328, -104}, { 1208, 304, -104}, { 1376, 336, -64}, { 1544, 240, -32}, { 1360, 144, -32}, { 1120, -192, -48}, { 608, -224, -176}, { 1112, -368, -32}, { 1160, -96, -352}, { 1312,...
d) { cron_service_deinit(); } //////////////////////////////////////////////////////////////////////////////////////////////////// //! Smart alarms #define SMART_ALARM_UPDATE_MIN (SMART_ALARM_SNOOZE_DELAY_S / SECONDS_PER_MINUTE) void test_alarm_smart__trigger_30_min_early_awake(void) { AlarmId id; id = alarm_c...
cl_assert_equal_i(s_num_alarm_events_put, 0)
; } } // Smart alarm trigger checks cl_assert_equal_i(s_num_alarms_fired, 1); cl_assert_equal_i(s_num_alarm_events_put, 1); cl_assert_equal_i(s_num_timeline_adds, 6); cl_assert_equal_i(s_num_timeline_removes, 3); cl_assert_equal_i(s_last_timeline_item_added->header.timestamp, rtc_get_time()); } 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...
xQueueCreate(MAX_TO_APP_EVENTS, sizeof(PebbleEvent))
216, -136, -224}, { -1256, 88, -88}, { -1192, 304, 200}, { -1784, 832, 216}, { -1112, -80, 752}, { -1032, 160, 472}, { -792, 112, 440}, { -480, -104, 328}, { -456, 96, 88}, { -600, -256, 32}, { -832, 312, -136}, { -904, 520, -128}, // 18 seconds { -1104, 400, 48}, ...
{ -1408, 264, -248}, // 23 seconds { -1280, 0, -136}, { -792, 392, -424}, { -1056, 192, -280}, { -736, 64, -160}, { -320, 64, -144}, { -448, 136, -336}, { -696, 136, -312}, { -888, -128, -64}, { -1032, 40, -152}, { -976, 272, -408}, { -1072, 312, -376}, { -944, -5...
/* * 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...
prefs_private_write_backing(key, key_len, val, val_len)
TransportDestinationSystem); cl_assert_equal_b(comm_session_is_valid(session), true); fake_session_send_queue_set_length(1234); cl_assert_equal_i(fake_system_task_count_callbacks(), 0); comm_session_send_next(session); cl_assert_equal_i(fake_system_task_count_callbacks(), 1); c...
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection)
; } void test_session__reset_invalid_session(void) { CommSession *invalid_session = (CommSession *) TransportID1; cl_assert_equal_b(comm_session_is_valid(invalid_session), false); cl_assert_equal_i(s_reset_count, 0); comm_session_reset(invalid_session); cl_assert_equal_i(s_reset_count, 0); } extern bool com...
EachCallback cb; void *data; } ForEachCbData; static Connection *s_connections; // We expect several threads to call this module (i.e ble_task, host_transport) so // make it threadsafe static PebbleRecursiveMutex *s_connection_lock = NULL; void connection_module_init(void) { s_connection_lock = mutex_create_recu...
prv_unlock()
; } // // Getters // // Note: Using a lock on the getters doesn't really accomplish anything since // the fields we read are either set on creation or atomic operations. We do // run the risk that the connection handle is no longer valid and could add // some extra checks in the future to protect against that I suppos...
/* * 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_set_callbacks(&s_data.option_menu, &callbacks, config)
; window_set_on_screen(&s_data.option_menu.window, true, true); window_render(&s_data.option_menu.window, fake_graphics_context_get_context()); } // Tests ////////////////////// // These tests test all permutations on all platforms even if the combination on the particular // platform was not designed and thus d...
nected(void) { return (s_transport.session != NULL); } // ----------------------------------------------------------------------------------------- void pulse_transport_set_connected(bool is_connected) { if (pulse_transport_is_connected() == is_connected) { return; } static const TransportImplementation s...
(PULSE_PP_OPCODE_UNKNOWN, &packet->opcode, sizeof(packet->opcode))
34"), true); // Expect no advertisement data: cl_assert_equal_i(ad->ad_data_length, 0); // Expect scan response data: cl_assert_equal_i(ad->scan_resp_data_length, sizeof(expected_scan_resp_data)); // Compare scan response data: cl_assert_equal_i(memcmp(expected_scan_resp_data, ad-...
{ BLEAdData *ad; ad = ble_ad_create(); uint8_t expected_ad_data[] = { 1 /* +1 for Type byte */ + strlen("Pebble 1234"), 0x09, // Local Name, Complete 'P', 'e', 'b', 'b', 'l', 'e', ' ', '1', '2', '3', '4' }; // Should fit fine, expect true: cl_assert_equal_b(ble_ad_set_local_name(ad, "Pebble 12...
void test_ble_ad_parse__set_tx_power_level(void) { BLEAdData *ad; ad = ble_ad_create(); uint8_t expected_ad_data[] = { 1 /* +1 for Type byte */ + 1 /* int8_t with value */, 0x0a, // TX Power Level -55, }; // Should fit fine, expect true: cl_assert_equal_b(ble_ad_set_tx_power_level(ad), true)...
ssion_send_buffer_begin_write(session, ENDPOINT_ID_DATA_LOGGING, total_length, timeout_ms); if (!sb) { mutex_unlock(s_endpoint_data.mutex); return false; } analytics_inc(ANALYTICS_DEVICE_METRIC_DATA_LOGGING_ENDPOINT_SENDS, AnalyticsC...
update_session_state(logging_session, DataLoggingSessionCommStateIdle, true /*reschedule*/)
; mutex_unlock(s_endpoint_data.mutex); // reopen the session that was NACK'ed dls_endpoint_open_session(logging_session); } //! System task callback executed which reopens the next session in the list built up by report_cmd_system_task_cb static void prv_reopen_next_session_system_task_cb(void* data) { DataL...
ession %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 to the max for (int i = num_sessions; i < DLS_MAX_NUM_SESSIONS; i++) { logging_sessions[i]...
dls_test_get_tag(logging_session)
; prv_check_session_data(logging_session, crcs[tag], num_bytes[tag]); } logging_session = dls_list_get_next(logging_session); cl_assert(logging_session == NULL); } void test_data_logging__recover_one(void) { prv_do_recovery_test(1); } void test_data_logging__recover_five(void) { prv_do_recovery_test(5);...
ics typedef enum { StationaryAnalyticsEnterNormally, StationaryAnalyticsEnterFromPeek, StationaryAnalyticsExitNormally, StationaryAnalyticsExitToPeek, StationaryAnalyticsEnterCharging, StationaryAnalyticsExitCharging, StationaryAnalyticsEnableStationaryMode, StationaryAnalyticsDisableStationaryMode } St...
if (prv_update_and_check_accel_is_stationary()) { prv_watch_is_motionless(); } else { prv_watch_is_in_motion(); }
te *notes_attribute) { return notes_attribute->length / sizeof(VibeNote); } static unsigned int prv_vibe_score_get_pattern_length(GenericAttribute *pattern_attribute) { return pattern_attribute->length / sizeof(VibeNoteIndex); } static bool prv_vibe_score_resource_is_valid(ResAppNum app_num, uint32_t resource_id,...
{ applib_free(vibe_score); return NULL; }
// Validate the loaded command sequence if (!vibe_score_validate(vibe_score, data_size)) { applib_free(vibe_score); return NULL; } return vibe_score; } unsigned int vibe_score_get_duration_ms(VibeScore *score) { if (!score) { return 0; } GenericAttribute *notes_attribute = generic_attribut...
80}, { -216, 1072, 232}, { -352, 1568, 112}, { -776, 1520, 328}, { -592, 1088, 360}, { -488, 1000, 400}, { -152, 608, 112}, { -8, 536, 48}, { -16, 448, 96}, { -48, 672, 24}, { -144, 896, 120}, { -232, 1048, 40}, { -464, 1056, 120}, { -576, 992, -192}, { -328, 1056...
{ -248, 520, -192}, { -112, 808, -176}, { -288, 1120, -232}, { -288, 1264, -280}, // 78 seconds { -424, 1360, -56}, { -320, 1096, -88}, { -432, 920, -88}, { -352, 848, -192}, { -240, 816, -208}, { -56, 624, -192}, { 32, 576, -216}, { 128, 608, -216}, { 144, 744, -...
{ 168, 1040, -152}, { 64, 1024, 72}, { 136, 1312, -312}, { -144, 1328, -16}, { -184, 1144, 392}, { -152, 1184, 160}, { -56, 1112, 144}, { 48, 760, 64}, { 104, 632, -16}, { 136, 584, 64}, { 176, 864, 72}, { 72, 936, 16}, // 81 seconds { 40, 1032, 0}, { -96, 12...
out->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->scroll_direction == TimelineScrollDirectionDown); const bool is_peek = (layout->layout_layer.mode == LayoutLayerMod...
{ 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->node); // TODO: PBL-30522 Enable timeline list view text flow // Remove when text flow is enabled if (PBL_IF_ROUND_ELSE(...
GAP_LE_Connectability_Parameters_t *GAP_LE_Connectability_Parameters, GAP_LE_Event_Callback_t GAP_LE_Event_Callback, unsigned long CallbackParameter) { s_is_le_advertising_enabled = true; s_le_adv_connection_event_callback = GAP_LE_Event_Callback;...
{ GAP_LE_Connection_Complete_Event_Data_t event_data = (GAP_LE_Connection_Complete_Event_Data_t) { .Status = status, .Master = is_master, .Peer_Address_Type = device->is_random_address ? latRandom : latPublic, .Peer_Address = BTDeviceAddressToBDADDR(device->address...
void fake_gap_put_disconnection_event(uint8_t status, uint8_t reason, bool is_master, const BTDeviceInternal *device) { GAP_LE_Disconnection_Complete_Event_Data_t event_data = (GAP_LE_Disconnection_Complete_Event_Data_t) { .Status = ...
nst uint32_t key, const uint32_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) &value, sizeof(value), TUPLE_UINT); } DictionaryResult dict_write_int8(DictionaryIterator *iter, const uint32_t key, const int8_t value) { return dict_write_data_internal(iter, key, (const uint8_t * const) ...
(iter, tuple->key, (uint8_t*)tuple->value, tuple->length, tuple->type)
; } DictionaryResult dict_write_tuplet(DictionaryIterator *iter, const Tuplet * const tuplet) { if (iter == NULL || iter->dictionary == NULL || iter->cursor == NULL) { return DICT_INVALID_ARGS; } switch (tuplet->type) { case TUPLE_BYTE_ARRAY: return dict_write_data_internal(iter, tuplet...
1144, 336, -136}, { 1280, 360, -24}, { 1360, 400, 16}, { 1216, 440, -8}, { 1432, 480, 16}, { 1544, 560, 88}, { 1040, 616, 184}, { 1424, 840, 8}, { 864, 704, -96}, { 904, 560, -48}, { 976, 616, 24}, { 1280, 640, 48}, { 1400, 456, 104}, { 1376, 264, 152}, { 1424, 1...
{ 1576, 416, -320}, { 1872, 512, -544}, { 1616, 216, 144}, // 100 seconds { 1264, 112, 16}, { 1120, -56, -336}, { 1008, 792, -336}, { 1136, 200, -80}, { 1184, 376, 0}, { 1248, 392, 40}, { 1600, 480, 144}, { 1312, 576, 328}, { 1264, 800, 168}, { 936, 1088, -64}, ...
{ 1696, 448, 120}, { 1328, 608, 208}, { 1320, 936, 56}, { 976, 1416, 120}, { 864, 912, -200}, { 688, 552, -120}, { 912, 624, -8}, { 1392, 560, 96}, { 1432, 392, 72}, { 1400, 328, 16}, { 1528, 304, 40}, { 1608, 344, 64}, // 103 seconds { 1544, 320, 88}, { 1312...
pin_attr_list)); const int num_actions = 2 + num_responses; TimelineItemActionGroup action_group = { .num_actions = num_actions, // Malloc the actions in order to save stack space .actions = kernel_zalloc_check(sizeof(TimelineItemAction) * num_actions), };...
("Below avg")
), .bg_color = GColorOrangeARGB8, .card_icon = TIMELINE_RESOURCE_ARROW_DOWN, }, [PercentTier_BelowAverage] = { .avg_relation = PBL_IF_RECT_ELSE(i18n_noop("BELOW AVG"), i18n_noop("Below avg")), .bg_color = GColorOrangeARGB8, .card_icon = TIMELINE_RESOURCE_ARROW_DOWN, }, [Per...
/* * 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...
kernel_malloc(sizeof(ReadResponseData) + val_len)
; if (!read_response) { *gatt_value_length = 0; return BLEGATTErrorLocalInsufficientResources; } *read_response = (const ReadResponseData) { .object_ref = data->obj_ref, .length = val_len, }; memcpy(read_response->value, resp->value, val_len); if (s_read_responses[data->c...
rry_char_t *) field); const bool has_property = jerry_has_property(object, prop_name); JS_VAR value = (has_property) ? jerry_get_property(object, prop_name) : jerry_create_undefined(); return jerry_acquire_value(value); } bool rocky_str_equal(jerry_value_t str_js, const char *str) { char buffer[40] = {0}; PB...
jerry_get_global_object()
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pulse_link_max_send_size()
- sizeof(ReliablePacket); } static void prv_send_supervisory_response(enum SupervisoryKind kind, bool final) { ReliablePacket *packet = pulse_link_send_begin( PULSE2_RELIABLE_TRANSPORT_RESPONSE); packet->s = (struct ReliableSupervisoryPacket) { .is_supervisory =...
ultricies sagittis, " "nisi orci viverra felis, vitae luctus massa dolor sit amet dolor. Cras " "mattis velit vitae pretium pulvinar. Pellentesque auctor, turpis at cras " "amet."; _Static_assert(sizeof(lipsum) > PERSIST_STRING_MAX_LENGTH, "lipsum string is not long enough for persist tests"); voi...
cl_assert_equal_i(persist_exists(0), S_TRUE)
; } void test_persist__delete(void) { cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST); cl_assert(PASSED(persist_write_int(0, 0))); cl_assert_equal_i(persist_delete(0), S_TRUE); cl_assert_equal_i(persist_delete(0), E_DOES_NOT_EXIST); } /* * Confirm that fields can be reassigned values. */ void test_pe...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ return; }
layer_set_frame(&text_layer->layer, &(GRect) { text_layer->layer.frame.origin, max_size }); layer_mark_dirty(&text_layer->layer); } GSize text_layer_legacy2_get_size(TextLayerLegacy2* text_layer) { if (text_layer == NULL) { return GSizeZero; } return text_layer->layer.frame.size; } void text_layer_leg...
s_max_subsequent_error_count_since_last_log = s_subsequent_mic_errors; } if (s_subsequent_mic_errors <= MAX_SUBSEQUENT_MIC_ERRORS) { // Pretend the MIC error was a CRC so the upper layers will ignore the packet: rxdesc->rxstatus &= ~BLE_MIC_ERR_BIT; rxdesc->rxstatus |= BLE_CRC_ERR_BIT; ...
ARRAY_LENGTH(s_patched_functions)
te__((noreturn)) prv_jump_to_fw(void) { void *initial_stack_pointer, *reset_handler; prv_get_fw_reset_vector(&reset_handler, &initial_stack_pointer); dbgserial_print("Booting firmware @ "); dbgserial_print_hex((uintptr_t)reset_handler); dbgserial_print("...\r\n\r\n"); prv_hw_reset(); // The Cortex-M us...
boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_TWO)
; } else { dbgserial_putstr("Failed to start firmware, strike one."); boot_bit_set(BOOT_BIT_FW_START_FAIL_STRIKE_ONE); } return false; } static bool prv_prf_button_combination_is_pressed(void) { return (button_is_pressed(BUTTON_ID_UP) && button_is_pressed(BUTTON_ID_BACK) && button_is_pressed(BUT...
unt_handler_entries(&s_stopped_handler_calls, a), 0); cl_assert(prv_count_handler_entries(&s_update_handler_calls, a) >= test_duration/MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, a), 0); // The distance should always be at 0 cl_assert_equal_i(prv_l...
(prv_count_handler_entries(&s_started_handler_calls, seq), 1)
; cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0); // Complete B prv_advance_to_ms_with_timers(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(...
CT_NO_CLIP, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_NO_CLIP); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw1_no_clip.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 1); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); c...
gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_XY, OFFSET_RECT_CLIP_XY, true, 11); graphics_draw_rect(&ctx, &OFFSET_DRAW_RECT_CLIP_XY); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_rect_offset_aa_sw11_clip_xy.${BIT_DEPTH_NAME}.pbi")); setup_test_aa_sw(&ctx, fb, OFFSET_RECT_CLIP_NXNY, OFFSET_RECT_CLIP_NXNY,...
&item->attr_list.attributes[attr_idx], AttributeIdSender); attr_idx++; } // The sender is in the title for iMessage const ANCSAttribute *sender = title; if (has_multimedia) { // Move the title (sender) to the body for MMS if (ancs_notifications_u...
(buffer, action, ActionIDPositive, positive_action, app_id, properties)
; action++; } if (negative_action) { *buffer = prv_fill_native_ancs_action(buffer, action, ActionIDNegative, negative_action, app_id, properties); action++; } if (pebble_actions) { for (int i = 0; i < pebble_actions->num_actions; i++) { TimelineIte...
ontext *ctx, const Layer *cell_layer, uint16_t device_index, SettingsBluetoothData *data) { const uint32_t num_remotes = list_count(data->remote_list_head); PBL_ASSERT(device_index < num_remotes, "Got index %" PRId16 " only have %" PRId32, device_index, num_remotes);...
i18n_get("Disabling...", data)
: i18n_get("Enabling...", data); icon = &data->icon_heap_bitmap[BluetoothAltIconIdx]; } menu_cell_basic_draw(ctx, cell_layer, title, subtitle, icon); // TODO PBL-23111: Decide how we should show these strings on round displays #if PBL_RECT // Hack: the pairing instruction is drawn in th...
e_localtime(&now)); health_util_create_text_node_with_text( string_strip_leading_whitespace(time_buffer), time_font, GColorWhite, container); if (!clock_is_24h_style()) { /// AM/PM for the current time strftime(am_pm_buffer, sizeof(am_pm_buffer), "%p", pbl_override_localtime(&now)); health_...
prv_draw_goal_line(ctx, data->typical_steps, MAX(data->daily_steps_avg, data->typical_steps), goal_line_length, goal_line_width, bounds, GColorYellow)
; const bool has_bpm = (data->current_bpm > 0); // draw time prv_draw_time(ctx, data->time_font, PBL_IF_COLOR_ELSE(data->am_pm_font, data->time_font), bounds, screen_is_obstructed, has_bpm); #if ROBERT_SCREEN_RES bounds = grect_inset(bounds, GEdgeInsets(0, 25)); // draw deperator if (!sc...
uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)
); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_sta...
->size.h), TEXT_VISIBLE_UPPER_THRESHOLD)); #else const bool text_visible = render; #endif static const GRect box = { .origin = { CARD_MARGIN, LAYOUT_TOP_BANNER_HEIGHT }, .size = { DISP_COLS - 2 * CARD_MARGIN, LAYOUT_MAX_HEIGHT }, }; static const GRect page_frame_on_screen = { ...
prv_card_render(layout, graphics_context_get_current_context(), false)
; } return layout->view_size; } static void prv_layout_destroy(LayoutLayer *layout) { NotificationLayout *notification_layout = (NotificationLayout *)layout; prv_destroy_view(notification_layout); kino_layer_deinit(&notification_layout->icon_layer); task_free(notification_layout); } static void prv_layout...
= animation_spawn_create_from_array(animations, num_animations); return animation; } void timeline_layer_set_layouts_hidden(TimelineLayer *layer, bool hidden) { for (int i = 0; i < TIMELINE_NUM_ITEMS_IN_TIMELINE_LAYER; i++) { TimelineLayout *layout = layer->layouts[i]; if (layout) { prv_set_layout_h...
prv_destroy_layout(layer, i)
; } } peek_layer_deinit(&layer->day_separator); kino_layer_deinit(&layer->end_of_timeline); // TODO: PBL-21982: Only support rectangular screen for now #if PBL_RECT timeline_relbar_layer_deinit(layer); #endif }
title; TimelineItemActionGroup *action_group; ActionChainingMenuSelectCb select_cb; ActionChainingMenuClosedCb closed_cb; void *select_cb_context; void *closed_cb_context; } ChainingWindowData; #if PBL_ROUND static int16_t prv_get_header_height(struct MenuLayer *menu_layer, ...
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack)
, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite)); status_bar_layer_set_title(&data->status_layer, data->title, false /* revert */, false /* animated */); status_bar_layer_set_separator_mode(&data->status_layer, StatusBarLayerSeparatorModeDotted); layer_add_...
* plane_eq[2]); return ((distance / r) > thresh); } static int min_max_diff(int16_t *vals, int n_vals) { int min = vals[0]; int max = vals[0]; for (int i = 0; i < n_vals; i++) { if (vals[i] > max) { max = vals[i]; } else if (vals[i] < min) { min = vals[i]; } } return (max - min);...
sphere_fit(&solution[0])
) { return (MagCalStatusNoSolution); } return (check_correction_value(solution, saved_corr)); }
/* * 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...
(timep, result)
; } //! System call to exit an application gracefully. DEFINE_SYSCALL(NORETURN, sys_exit, void) { process_manager_task_exit(); } DEFINE_SYSCALL(void, sys_psleep, int millis) { vTaskDelay(milliseconds_to_ticks(millis)); }
}, { 704, 120, 320}, { 776, 1360, 776}, { 480, 2704, 360}, { 232, 2056, 112}, { -192, 1504, -8}, { -328, 824, 72}, { -352, 208, 24}, { -352, 136, -304}, { -192, -24, -176}, { -232, 240, 48}, // 24 seconds { -448, 1920, 432}, { -112, 2624, 1032}, { 296, 1896, 608},...
{ 408, 1056, 152}, { 376, 416, 80}, { 456, -64, 144}, { 536, -288, 152}, { 352, -480, 392}, { 816, 320, 312}, { 384, 2552, 1024}, { 496, 2272, 496}, { 56, 1960, 344}, { -200, 1240, 32}, { -384, 648, -48}, { -688, 200, -128}, { -504, 0, -216}, { -336, -176, -88}, ...
{ -272, 1088, 168}, { -432, 2944, 840}, // 32 seconds { 0, 2176, 776}, { 368, 1688, 536}, { 360, 896, 264}, { 432, 320, 128}, { 536, -152, 136}, { 544, -400, 216}, { 440, -424, 312}, { 832, 640, 592}, { 560, 2768, 696}, { 512, 2352, 312}, { 72, 1680, 224}, { ...
/* * 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...
{ uint16_t buffer; flash_read_bytes((uint8_t*) &buffer, BASE_ADDRESS, sizeof(buffer)); PBL_LOG(LOG_LEVEL_DEBUG, ">> Addr 0x%x is 0x%"PRIx16, BASE_ADDRESS, buffer); buffer = 0x0505; flash_write_bytes((uint8_t*) &buffer, BASE_ADDRESS, sizeof(buffer)); PBL_LOG(LOG_LEVEL_DEBUG, ">> Addr 0x%x Written to 0x%x", ...
static void test_write_bytes(void) { for (int i = 1; i < 127; ++i) { uint8_t data = i; flash_write_bytes((uint8_t*) &data, BASE_ADDRESS + i, sizeof(data)); PBL_LOG(LOG_LEVEL_DEBUG, ">> Wrote Addr 0x%x is 0x%"PRIx8, i, data); } for (int i = 0; i < 128; ++i) { uint8_t data = 0; flash_read_byt...
manager_get_framebuffer_size(&app_framebuffer_size); const FrameBuffer *app_framebuffer = app_state_get_framebuffer(); if (gsize_equal(&app_framebuffer_size, &s_framebuffer.size)) { #if CAPABILITY_COMPOSITOR_USES_DMA && !TARGET_QEMU && !UNITTEST compositor_dma_run(s_framebuffer.buffer, app_framebuffer->buffer,...
modal_manager_render(ctx)
16_t) 0xffff) static BTDeviceInternal s_device; static GAPLEConnection *s_connection; static uint16_t s_handle; static BTDeviceInternal prv_dummy_device(uint8_t octet) { BTDeviceAddress address = { .octets = { [0] = octet, [1] = octet, [2] = octet, [3] = octet, [4] = octet, [...
memcmp(buffer, value, value_length)
, 0); cl_assert_equal_i(characteristic_out, characteristic); } } free(buffer); } static void prv_assert_notification_event(BLECharacteristic characteristic, const uint8_t *value, uint16_t assert_value_length, bool kernel,...
X const int duration_a = 300; const int duration_b = 500; const int play_count_b = 2; int duration_total = duration_a + play_count_b * duration_b; // Create 2 animations Animation *a = prv_create_test_animation(); animation_set_duration(a, duration_a); // Setup stopped handler for the first child that...
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0)
; cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, c), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, c), 0); // ------------------------------------------------------------------------...
/* * 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...
{ // Special case: the final encoded block is 254 bytes long with no // zero after it. While it's technically a valid encoding if a // trailing zero is appended, it causes the output to be one byte // longer than it needs to be. This violates consistent overhead // cont...
dst[code_idx] = code; code_idx = dst_idx++; code = 0x01; } } } dst[code_idx] = code; return dst_idx; }
ocky = rocky_get_rocky_singleton(); JS_VAR all_listeners = jerry_get_object_field(rocky, "_listeners"); JS_VAR event_listeners = jerry_get_object_field(all_listeners, event_name); // printf("event_listeners.refcount: %d", jerry_port_) const uint32_t len = jerry_get_array_length(event_listeners); for (uint32_t...
if (!jerry_value_is_function(argv[1])) { return rocky_error_argument_invalid("Not a valid handler"); }
*func = argv[1]; return jerry_create_undefined(); } JERRY_FUNCTION(prv_add_event_listener) { char event_name[32]; jerry_value_t func; // out parameter &func will not be acquired JS_VAR arg_result = prv_event_listener_extract_args(argc, argv, event_name,...
n 0.001Hz increments, this can be used to scale #define AS7000_ACCEL_FREQUENCY_SCALE (1000) //! Thresholds for quality conversion. These are upper bounds on readings. enum AS7000SQIThreshold { AS7000SQIThreshold_Excellent = 2, AS7000SQIThreshold_Good = 5, AS7000SQIThreshold_Acceptable = 8, AS7000SQIThreshold_P...
i2c_release(dev->i2c_slave)
; return rv; } static bool prv_set_host_one_second_time_register(HRMDevice *dev, uint32_t average_ms) { PPG_DBG("host one second time: %"PRIu32" ms", average_ms); // Register takes a reading in 0.1ms increments uint16_t value = average_ms * 10; const uint8_t msb = (value >> 8) & 0xff; const uint8_t lsb =...
struct PulseTransferFD { // impl == NULL means that the FD is free PulseBulkIODomainHandler *impl; void *domain_state; ReadTransferState transfer_state; } PulseTransferFD; typedef struct BulkIOPacketCallbackData { size_t length; uint8_t packet[0]; } BulkIOPacketCallbackData; static PulseTransferFD s_trans...
FAILED(fd)
) { prv_respond_internal_error(cmd, length, E_OUT_OF_RESOURCES); return; } size_t payload_length = length - sizeof(cmd->opcode) - sizeof(cmd->open); status_t ret = state->impl->open_proc(cmd->open.data, payload_length, &state->domain_state); if (FAILED(ret)) { prv_free_fd(fd); if (ret == E_IN...
/* * 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...
graphics_context_mask_record(ctx, mask)
ionResultMsg) + sizeof(GenericAttributeList); const bool app_initiated = (msg->flags.app_initiated == 1); Uuid *app_uuid = NULL; if (!prv_handle_result_common(msg->result, app_initiated, msg->session_id, &msg->attr_list, attr_list_size, &app_uuid)) { return; } GenericAttr...
PBL_LOG(LOG_LEVEL_WARNING, "Invalid size for dictation result message %zu", size)
; } break; } default: // Ignore invalid message ID PBL_LOG(LOG_LEVEL_WARNING, "Invalid message ID"); break; } } #else void voice_endpoint_protocol_msg_callback(CommSession *session, const uint8_t* data, size_t size) { } #endif void voice_endpoint_setup_session(VoiceEndpointSess...
--------------------------------------------------------------------------- static bool prv_set_alarm_kind_op(AlarmId id, AlarmConfig *config, void *context) { AlarmKind type = (uintptr_t)context; switch (type) { case ALARM_KIND_EVERYDAY: config->kind = ALARM_KIND_EVERYDAY; const bool everyday[DAYS_...
prv_alarm_get_config(&file, id, &config)
; if (!rv) { goto cleanup; } is_enabled = !config.is_disabled; cleanup: prv_file_close_and_unlock(&file); return is_enabled; } // ---------------------------------------------------------------------------------------------- bool alarm_get_hours_minutes(AlarmId id, int *hour_out, int *minute_out) { 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...
(window_layer, simple_menu_layer_get_layer(s_main_window_data.menu_layer))
; } static void window_unload(Window *window) { simple_menu_layer_destroy(s_main_window_data.menu_layer); } static void init(void) { Window *window = s_main_window_data.window; window = window_create(); window_set_window_handlers(window, (WindowHandlers) { .load = window_load, .unload = window_unload,...
/* * 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...
( s_sectors[sector], VoltageRange_1)
height(title_text_font)); const GFont info_text_font = fonts_get_system_font(FONT_KEY_GOTHIC_14); const GSize info_text_size = GSize(window_bounds.size.w, fonts_get_font_height(info_text_font)); const int16_t vertical_spacing = 3; GRect certification_rect = (GRect) { .size = GSize(window_bounds.size.w, ...
(a_dialog)
; actionable_dialog_push(a_dialog, modal_manager_get_window_stack(ModalPriorityGeneric)); } static void prv_deinit_cb(SettingsCallbacks *context) { SettingsSystemData *data = (SettingsSystemData *) context; i18n_free_all(data); } static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, ...
alogCallbacks callbacks = { .unload = dialog_close_cb }; ExpandableDialog *first_use_dialog = expandable_dialog_create_with_params( "DNDFirstUse", RESOURCE_ID_QUIET_TIME, msg, GColorBlack, GColorMediumAquamarine, &callbacks, RESOURCE_ID_ACTION_BAR_ICON_CHECK, expandable_dialog_close_cb); i18n_free(msg, ...
MIN(seconds_until_update, seconds_until_midnight)
; } } if (s_data.is_in_schedule_period == is_enable_next) { // Coming out of scheduled DND with manual DND on, turning it off if (is_enable_next && do_not_disturb_is_manually_enabled()) { do_not_disturb_set_manually_enabled(false); } s_data.is_in_schedule_period = !is_enable_next; } ...
)&s_app_glance_with_invalid_slice_total_sizes, sizeof(s_app_glance_with_invalid_slice_total_sizes)), E_INVALID_ARGUMENT); } status_t app_glance_db_insert_stale(const uint8_t *key, int key_len, const uint8_t *val, int val_l...
{ AppGlance glance = {}; cl_assert_equal_i(app_glance_db_read_glance(&UUID_INVALID, &glance), E_DOES_NOT_EXIST); }
void test_app_glance_db__reading_glance_with_invalid_arguments_fails(void) { // NULL UUID fails AppGlance glance_out = {}; cl_assert_equal_i(app_glance_db_read_glance(NULL, &glance_out), E_INVALID_ARGUMENT); // NULL glance_out fails cl_assert_equal_i(app_glance_db_read_glance(&APP_GLANCE_TEST_UUID, NULL), ...
/* * 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_byte_stream_write(&out_stream, byte)
; continue; } // read the escape code const uint8_t code = prv_byte_stream_read(&in_stream); if (code == 0) { // end of stream break; } else if (code == 1) { // literal escape byte prv_byte_stream_write(&out_stream, escape); } else { // a sequence of zeros ...
); } void test_rocky_api_global__can_unsubsribe_event_handlers(void) { static const RockyGlobalAPI api = { .add_handler = prv_api_add, .remove_handler = prv_api_remove, }; static const RockyGlobalAPI *apis[] = { &api, NULL, }; rocky_global_init(apis); s_prv_api_add__result = true; EXECUT...
jerry_release_value(a_event)
; } void test_rocky_api_global__event_constructor(void) { static const RockyGlobalAPI *apis[] = {NULL}; rocky_global_init(apis); EXECUTE_SCRIPT( "_rocky.Event.prototype.myCustomThing = 'xyz';\n" "var e = new _rocky.Event('myevent');\n" "var t = e.type;\n" "var c = e.myCustomThing;\n" ); ...
--------------------------------------- // Kernel BG callback called by the Heart Rate Manager when new data arrives T_STATIC void prv_hrm_subscription_cb(PebbleHRMEvent *hrm_event, void *context) { #if CAPABILITY_HAS_BUILTIN_HRM if (!s_hrm_present) { return; } ACTIVITY_LOG_DEBUG("Got HR event: %d", (int) hr...
kernel_malloc_check(sizeof(SettingsFile))
; if (settings_file_open(file, ACTIVITY_SETTINGS_FILE_NAME, ACTIVITY_SETTINGS_FILE_LEN) != S_SUCCESS) { kernel_free(file); PBL_LOG(LOG_LEVEL_ERROR, "No settings file"); return NULL; } return file; } // -------------------------------------------------------------------------...
T) // Overrides same function in graphics.c; we need to do this so we can pass in the GBitmapFormat // we need to use for the unit test output canvas instead of relying on GBITMAP_NATIVE_FORMAT, which // wouldn't work for Spalding since it uses GBitmapFormat8BitCircular GBitmap* graphics_capture_frame_buffer(GContext ...
settings_content_size_to_preferred_size((SettingsContentSize)settings_content_size)
; system_theme_set_content_size(content_size); const int16_t x_offset = (int16_t)(GRID_CELL_PADDING + (settings_content_size * (GRID_CELL_PADDING + DISP_COLS))); for (int down_scrolls = 0; down_scrolls <= num_down_scrolls; down_scrolls++) { const int16_t y_offset = (int16_t)((num_r...
ntensity() - BACKLIGHT_BRIGHTNESS_OFF) / 2; // update the debug stats if (new_brightness > HALF_BRIGHTNESS && s_current_brightness <= HALF_BRIGHTNESS) { // getting brighter and have now transitioned past half brightness analytics_stopwatch_start(ANALYTICS_APP_METRIC_BACKLIGHT_ON_TIME, AnalyticsClient_App);...
if (s_num_buttons_down == 0 && s_light_state == LIGHT_STATE_ON && !s_user_controlled_state) { // no more buttons pressed: wait for a bit and then start the fade-out timer prv_change_state(LIGHT_STATE_ON_TIMED); }
mutex_unlock(s_mutex); } void light_enable_interaction(void) { mutex_lock(s_mutex); //if some buttons are held or light_enable is asserted, do nothing if (s_num_buttons_down > 0 || s_light_state == LIGHT_STATE_ON) { mutex_unlock(s_mutex); return; } if (prv_light_allowed()) { prv_change_stat...
-------------------------------------------------------------------------------------- static void prv_display_scalar_history_alert(HealthAPITestAppData *data, const char *title, HealthMetric metric) { strcpy(data->debug_card.dialog_text, title); // Get History time_t...
(wake_time_str, sizeof(wake_time_str), "%H:%M", local_tm)
; char total_sleep_str[8]; char deep_sleep_str[8]; prv_convert_seconds_to_time(sleep_total_sec, total_sleep_str, sizeof(total_sleep_str)); prv_convert_seconds_to_time(sleep_deep_sec, deep_sleep_str, sizeof(deep_sleep_str)); snprintf(data->sleep_card.text, sizeof(data->sleep_card.text), "Zzz..\nt...
n for the given 15-minute time slot int prv_expected_steps_per_min(int slot, int multiplier) { if (multiplier == 1) { // The slot % 50 was chosen so that the total # of steps per day does not exceeed 2^16 return ((slot % 50) + 1); } else if (multiplier == 2) { // The slot % 30 was chosen so that the tot...
strlen(ACTIVITY_FIXTURE_PATH)
+ strlen(filename) + 3]; sprintf(out_path, "%s/%s/%s", CLAR_FIXTURE_PATH, ACTIVITY_FIXTURE_PATH, filename); // Open and read the settings file from PFS int fd = pfs_open(ACTIVITY_SETTINGS_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC, ACTIVITY_SETTINGS_FILE_LEN); cl_assert(fd >= S_SUCCESS); ...
/* * 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 (rv != S_SUCCESS) { return NULL; }
const int len = settings_file_get_len(&s_watch_app_prefs_db.settings_file, pref_key, strlen(pref_key)); void *prefs = task_zalloc(len); if (prefs) { rv = settings_file_get(&s_watch_app_prefs_db.settings_file, pref_key, strlen(pref_key), pre...
///////////////////////////// #include "stubs_app_state.h" #include "stubs_applib_resource.h" #include "stubs_compiled_with_legacy2_sdk.h" #include "stubs_heap.h" #include "stubs_logging.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_tasks.h" #include "stubs_print.h" #include "stubs_...
cl_assert(gtransform_is_equal(&t, &t_c))
uint16_t device_index, SettingsBluetoothData *data) { const uint32_t num_remotes = list_count(data->remote_list_head); PBL_ASSERT(device_index < num_remotes, "Got index %" PRId16 " only have %" PRId32, device_index, num_remotes); StoredRemote* remote = (StoredRemo...
("Enabling...", data)
; icon = &data->icon_heap_bitmap[BluetoothAltIconIdx]; } menu_cell_basic_draw(ctx, cell_layer, title, subtitle, icon); // TODO PBL-23111: Decide how we should show these strings on round displays #if PBL_RECT // Hack: the pairing instruction is drawn in the cell callback, but outside of ...
error = (errors & USART_FLAG_FE) != 0, .noise_detected = (errors & USART_FLAG_NE) != 0, }; return flags; } bool uart_is_rx_ready(UARTDevice *dev) { return dev->periph->SR & USART_SR_RXNE; } bool uart_has_rx_overrun(UARTDevice *dev) { return dev->periph->SR & USART_SR_ORE; } bool uart_has_rx_framing_erro...
portEND_SWITCHING_ISR(should_context_switch)
; } void uart_clear_all_interrupt_flags(UARTDevice *dev) { dev->periph->SR &= ~(USART_SR_TXE | USART_SR_RXNE | USART_SR_ORE); } // DMA //////////////////////////////////////////////////////////////////////////////// void uart_start_rx_dma(UARTDevice *dev, void *buffer, uint32_t length) { dev->periph->CR3 |= USA...
the mutex we are logging so no // additional locking is needed #define LOG_LOCKED(logged_lr, new_lr) \ if (logged_lr == 0) { \ logged_lr = new_lr; \ } #define LOG_UNLOCKED(logged_lr, nest_count) \ if (nest_count == 1) { \ logged_lr = 0; \ ...
if (xLightMutexLockRecursive(mutex, timeout_ticks) == pdTRUE) { LOG_LOCKED(handle->common.lr, myLR); return (true); }
return (false); } bool mutex_is_owned_recursive(PebbleRecursiveMutex * handle) { LightMutexHandle_t mutex = handle->common.freertos_mutex; void* holder = xLightMutexGetHolder(mutex); void* current = xTaskGetCurrentTaskHandle(); return (holder == current); } void mutex_unlock_recursive(PebbleRecursiveMutex...
/* * 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...
(bus->hal->ev_irq_channel, I2C_IRQ_PRIORITY)
.attributes = NULL, }, .action_group = { .num_actions = 0, .actions = NULL, }, .allocated_buffer = NULL, } }; // items with long duration static TimelineItem s_long_items[] = { { .header = { .id = {0xaa}, .timestamp = 10000, .duration = 30, .type = T...
(pin_db_insert_item(&s_items[i]), 0)
; } cl_assert_equal_i(fake_pbl_malloc_num_net_allocs(), num_net_allocs); } void test_timeline__cleanup(void) { fake_settings_file_reset(); fake_pbl_malloc_clear_tracking(); } // Tests /////////////////////////// void test_timeline__all_forwards(void) { Iterator iterator = {0}; TimelineIterState state = {0...
l = context; const ActionMenuItem *item = prv_get_item_for_index(aml, aml->selected_index); if (item && aml->cb) { aml->cb(item, aml->context); } } static bool prv_aml_is_short(ActionMenuLayer *aml) { return (aml->num_short_items != 0 || aml->num_items == 0); } static int16_t prv_get_cell_padding(ActionMe...
{ // First point from bottom will be +0, second +1, third +0, etc. separator_start_point.y--; separator_start_point.x += i & 1; graphics_draw_horizontal_line_dotted(ctx, separator_start_point, separator_width); separator_start_point.x -= i & 1; }
} } static int16_t prv_get_header_height_cb(struct MenuLayer *menu_layer, uint16_t second_index, void *callback_context) { ActionMenuLayer *aml = callback_context; if (!prv_should_center(aml) || prv_aml_is_short(aml) || aml->num_items == 0) { return 0; } const in...
d_prf_storage_get_valid_page_number(void); extern void shared_prf_storage_set_valid_page_number(uint32_t page_num); // Defines ////////////////////////////////////////////////////////// #define SPRF_REGION_SIZE (FLASH_REGION_SHARED_PRF_STORAGE_END - \ FLASH_REGION_SHARED_PRF_STORAGE_BEGIN) #d...
flash_write_bytes((uint8_t *) &inv_magic, SPRF_PAGE_FLASH_OFFSET(j), sizeof(inv_magic))
; } // Write the valid page flash_read_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_OFFSET(page_idx[i]), sizeof(data)); data.magic = SprfMagic_ValidEntry; flash_write_bytes((uint8_t *) &data, SPRF_PAGE_FLASH_OFFSET(page_idx[i]), sizeof(data)); // Call init and see if it found the valid page sh...
graphics_context_set_fill_color(ctx, GColorDarkGray); graphics_fill_circle(ctx, pos, dot_radius); } } #endif static void prv_draw_goal_line(GContext *ctx, int32_t current_progress, int32_t total_progress, int32_t line_length, int32_t line_width, GRect frame, GColor color) { const...
health_util_create_text_node_with_text( string_strip_leading_whitespace(time_buffer), time_font, GColorWhite, container)
ect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 2, 2); cl_assert_fixedS16_3(radius, 2); r = GRect(0, 0, 6, 6); grect_polar_calc_values(&r, mode, &center, &radius); cl_assert_gpoint_precise(center, 2.5, 2.5); cl_assert_fixedS16_3(radius, 2.5); r = GRect(0, 0, 10, 10); ...
DEG_TO_TRIGANGLE(360)
, TRIG_MAX_ANGLE); cl_assert_equal_i(DEG_TO_TRIGANGLE(-360), -TRIG_MAX_ANGLE); cl_assert_equal_i(DEG_TO_TRIGANGLE(180), TRIG_PI); cl_assert_equal_i(DEG_TO_TRIGANGLE(-180), -TRIG_PI); cl_assert_equal_i(DEG_TO_TRIGANGLE(90), TRIG_PI / 2); cl_assert_equal_i(DEG_TO_TRIGANGLE(-90), -TRIG_PI / 2); cl_assert_eq...
/* * 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...
NVIC_ClearPendingIRQ(HardFault_IRQn)
; __asm("mov r0, #1"); while (true) { register uintptr_t r0 __asm("r0"); if (r0 == 0) { break; } } } #endif
/* * 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...
while (true) {}
} // All these functions are weak references to the Default_Handler, // so if we define a handler in elsewhere in the firmware, these // will be overriden ALIAS("Default_Handler") void NMI_Handler(void); ALIAS("Default_Handler") void HardFault_Handler(void); ALIAS("Default_Handler") void MemManage_Handler(void); ALIA...
imeline_item_storage_each(&s_storage, prv_timestamp_title_compare_func, &reminder_info); return reminder_info.match; } static status_t prv_insert_reminder(const uint8_t *key, int key_len, const uint8_t *val, int val_len, bool mark_synced) { const SerializedTimelineItemHeader *h...
(&s_storage, sync_util_is_dirty_cb, is_dirty_out)
; } BlobDBDirtyItem* reminder_db_get_dirty_list(void) { BlobDBDirtyItem *dirty_list = NULL; timeline_item_storage_each(&s_storage, sync_util_build_dirty_list_cb, &dirty_list); return dirty_list; } status_t reminder_db_mark_synced(const uint8_t *key, int key_len) { PBL_LOG(LOG_LEVEL_DEBUG, "reminder_db_mark_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...
if (address == -1) { prompt_send_response("Invalid address"); return; }
uint32_t word = *(uint32_t*) address; char buffer[32]; prompt_send_response_fmt(buffer, sizeof(buffer), "0x%"PRIx32" = 0x%"PRIx32, address, word); } void command_format_flash(void) { flash_erase_bulk(); } void command_erase_flash(const char *address_str, const char *length_str) { int32_t address = str_to...
// The dbgserial input support requires timer support, so it is initialized here, much later // than the core dbgserial_init(). dbgserial_input_init(); serial_console_init(); voltage_monitor_init(); battery_init(); vibe_init(); #if CAPABILITY_HAS_ACCESSORY_CONNECTOR accessory_init(); #endif flash_i...
if (mfg_info_is_hrm_present()) { hrm_init(HRM); }
#endif // The display has to be initialized before bluetooth because on Snowy the // display FPGA shares the 32 kHz clock signal with bluetooth. If the FPGA is // not programmed when we attempt to initialize bluetooth, it prevents the // clock from reaching the bluetooth module and initialization fails. dis...
/* * 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...
analytics_init()
; fake_rtc_init(0, 0); } void test_analytics__cleanup(void) { } // Make sure the stopwatches record time elapsed in ms (not ticks) void test_analytics__stopwatches_should_record_ms(void) { const AnalyticsMetric metric = ANALYTICS_DEVICE_METRIC_BATTERY_CHARGE_TIME; analytics_stopwatch_start(metric, AnalyticsCli...
&NO_MUSIC_TEXT_RECT, i18n_get("START PLAYBACK\nON YOUR PHONE", window), fonts_get_system_font(config->no_music_font_key), GColorBlack, GColorClear, GTextAlignmentCenter, GTextOverfl...
tick_timer_service_unsubscribe()
; } } static void prv_configure_music_text_layer( TextLayer *text_layer, char* text_buffer, const GRect *rect, int16_t y_offset, GTextAlignment align, GFont font) { text_layer_init_with_parameters(text_layer, rect, text_buffer, font, GColorBlack, GColorClear, align, GTextO...
troke_circle_origin_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi")); // Medium circles setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL); graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r8_no_c...
(&ctx, fb, OFFSET_RECT_NO_CLIP, OFFSET_RECT_NO_CLIP, true, STROKE_SMALL)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
gcolor_equal__deprecated(color1, color2)
); } void test_graphics_colors__inverted_readable_color(void) { GColor8 (*fun)(GColor8) = gcolor_legible_over; // transparent colors result in transparen - who has a better idea? cl_assert_equal_i(GColorClearARGB8, fun(GColorClear).argb); // // obvious cases cl_assert_equal_i(GColorWhiteARGB8, fun(GColorBla...
/* * 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(ret)
) { return ret; } } return sizeof(CoredumpStatResp); } static status_t coredump_domain_erase(uint8_t *packet_data, size_t length, uint8_t cookie) { uint32_t index = prv_get_coredump_index(packet_data); uint32_t addr = core_dump_get_slot_address(index); core_dump_mark_read(addr); return S_SUCCESS...
if (key_len != UUID_SIZE) { return E_INVALID_ARGUMENT; }
status_t rv = prv_lock_mutex_and_open_file(); if (rv != S_SUCCESS) { return rv; } if (settings_file_exists(&s_app_glance_db.settings_file, key, (size_t)key_len)) { rv = settings_file_delete(&s_app_glance_db.settings_file, key, (size_t)key_len); } else { rv = S_SUCCESS; } prv_close_file_an...
/* * 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 (!image) { return 0; }
return sizeof(GDrawCommandImage) - sizeof(GDrawCommandList) + gdraw_command_list_get_data_size(&image->command_list); } GSize gdraw_command_image_get_bounds_size(GDrawCommandImage *image) { if (!image) { return GSizeZero; } return image->size; } void gdraw_command_image_set_bounds_size(GDrawComma...
te_list_add_string_list(&list, AttributeIdHeadings, &headings); attribute_list_add_string_list(&list, AttributeIdParagraphs, &paragraphs); attribute_list_add_cstring(&list, AttributeIdBody, "Topics for the week can be found here: " "http://docs.google.com/u/...
{ app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_ID_TIMELINE }); }
static void prv_launch_notifications(void) { app_manager_put_launch_app_event(&(AppLaunchEventConfig) { .id = APP_ID_NOTIFICATIONS }); } void timeline_pins_demo_add_pins(TimelinePinsDemoSet pin_set) { const bool has_broadcaster = true; const bool has_short_subtitle = true; const bool has_short_title = true; ...
s_INT_MASK_2, 0xff); // Clear interrupt status so we're not woken immediately (read the regs) prv_clear_pending_interrupts(); // Set Reg_Standby_mod1 to specify which rails to turn off / keep on // - SD1, LDO1 off // - LDO2 on // - Disable regulator pulldowns prv_write_register(PmicRegisters_REG_S...
(LOG_LEVEL_DEBUG, "USB Status: %s", (connected) ? "Connected" : "Disconnected")
; bool charging = pmic_is_charging(); PBL_LOG(LOG_LEVEL_DEBUG, "Charging? %s", (charging) ? "true" : "false"); } void command_pmic_rails(void) { // TODO: Implement. }
/* * 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, shadow_bottom, &GRect(0, layer_h + shadow_bottom_y_offset, layer_w, shadow_bottom_bitmap_h))
; } } static void prv_setup_shadow_layer(ScrollLayer *scroll_layer) { layer_init(&scroll_layer->shadow_sublayer, &scroll_layer->layer.bounds); layer_set_clips(&scroll_layer->shadow_sublayer, true); scroll_layer->shadow_sublayer.update_proc = scroll_layer_draw_shadow_sublayer; layer_add_child(&scroll_layer->l...
/* * 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...
{ const int data_len = sizeof(s_send_text_prefs); cl_assert_equal_i( watch_app_prefs_db_insert(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN, s_send_text_prefs, data_len), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(SEND_TEXT_KEY, SEND_TEXT_KEY_LEN), data_len); // Make sure we get back the correct...
void test_watch_app_prefs_db__insert_weather(void) { const int data_len = sizeof(s_weather_prefs); cl_assert_equal_i( watch_app_prefs_db_insert(WEATHER_KEY, WEATHER_KEY_LEN, s_weather_prefs, data_len), S_SUCCESS); cl_assert_equal_i(watch_app_prefs_db_get_len(WEATHER_KEY, WEATHER_KEY_LEN), data_len)...
{ -160, -144, -992}, { -160, -144, -1000}, { -168, -144, -984}, { -168, -144, -984}, { -160, -144, -984}, { -168, -144, -992}, { -160, -152, -992}, { -160, -136, -1000}, { -160, -152, -992}, { -160, -152, -992}, { -160, -144, -992}, { -160, -144, -984}, { -160, -128, -1...
{ -168, -128, -992}, { -168, -136, -992}, { -168, -120, -984}, { -168, -144, -984}, { -160, -128, -1000}, { -160, -144, -984}, { -168, -128, -1000}, { -168, -128, -992}, { -168, -144, -992}, { -160, -152, -984}, { -160, -152, -1008}, { -168, -152, -992}, // 161 second...
{ -160, -152, -992}, // 163 seconds { -168, -120, -976}, { -176, -144, -1008}, { -168, -152, -992}, { -152, -128, -1000}, { -168, -152, -968}, { -168, -176, -992}, { -160, -112, -984}, { -168, -144, -992}, { -168, -112, -984}, { -168, -112, -1016}, { -168, -136, -992...
/* * 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...
(s_plog_state.mutex)
result; } response = { .cmd = cmd | RESPONSE_MASK, .token = *(BlobDBToken *)data, .result = response_code, }; prv_send_response(session, (uint8_t *)&response, sizeof(response)); } static void prv_blob_db_msg_decode_and_handle( CommSession *session, BlobDBCommand cmd, const uint8_t *data, size_t...
prv_send_write_writeback(BLOB_DB_COMMAND_WRITEBACK, db_id, last_updated, key, key_len, val, val_len)
; return token; } void blob_db_endpoint_send_sync_done(BlobDBId db_id) { struct PACKED SyncDoneMsg { BlobDBCommand cmd; BlobDBToken token; BlobDBId db_id; } msg = { .cmd = BLOB_DB_COMMAND_SYNC_DONE, .token = prv_new_token(), .db_id = db_id, }; PBL_LOG(LOG_LEVEL_DEBUG, "Sending sync ...